mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 14:40:17 +00:00
Use .js
file in aqua
command by default (#278)
* move to `aqua` and `aqua-j` * more updates * update readme * aqua-cli -> aqua * don't publish aqua as aqua-cli * update scala Co-authored-by: Dmitry Kurinskiy <dmitry@fluence.one>
This commit is contained in:
parent
3e1618c734
commit
7556db0a93
21
.github/workflows/release.yml
vendored
21
.github/workflows/release.yml
vendored
@ -55,14 +55,14 @@ jobs:
|
||||
|
||||
- name: Check .jar exists
|
||||
run: |
|
||||
JAR="cli/.jvm/target/scala-3.0.1/aqua-cli-${{ env.VERSION }}.jar"
|
||||
JAR="cli/.jvm/target/scala-3.0.2/aqua-${{ env.VERSION }}.jar"
|
||||
stat "$JAR"
|
||||
echo "JAR=$JAR" >> $GITHUB_ENV
|
||||
|
||||
- name: Check .js exists
|
||||
run: |
|
||||
JS="cli/.js/target/scala-3.0.1/cli-opt/aqua-cli-experimental-${{ env.VERSION }}.js"
|
||||
mv cli/.js/target/scala-3.0.1/cli-opt/main.js "$JS"
|
||||
JS="cli/.js/target/scala-3.0.2/cli-opt/aqua-${{ env.VERSION }}.js"
|
||||
mv cli/.js/target/scala-3.0.2/cli-opt/main.js "$JS"
|
||||
stat "$JS"
|
||||
echo "JS=$JS" >> $GITHUB_ENV
|
||||
|
||||
@ -72,23 +72,14 @@ jobs:
|
||||
node-version: "15"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- run: cp ${{ env.JAR }} ./npm/aqua-cli.jar
|
||||
- run: cp ${{ env.JS }} ./npm/aqua-cli-experimental.js
|
||||
- run: cp ${{ env.JAR }} ./npm/aqua.jar
|
||||
- run: cp ${{ env.JS }} ./npm/aqua.js
|
||||
|
||||
- run: npm version ${{ env.VERSION }}
|
||||
working-directory: ./npm
|
||||
|
||||
- name: Publish to NPM as aqua-cli
|
||||
run: npm publish --access public
|
||||
working-directory: ./npm
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
- name: Publish to NPM as aqua
|
||||
run: |
|
||||
CONTENTS="$(jq '.name = "@fluencelabs/aqua"' package.json)"
|
||||
echo "$CONTENTS" > package.json
|
||||
npm publish --access public
|
||||
run: npm publish --access public
|
||||
working-directory: ./npm
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
2
.github/workflows/test_branch.yml
vendored
2
.github/workflows/test_branch.yml
vendored
@ -60,6 +60,6 @@ jobs:
|
||||
cd ..
|
||||
sbt "cliJS/fastOptJS"
|
||||
rm -rf aqua-playground/src/compiled/examples/*
|
||||
node cli/.js/target/scala-3.0.1/cli-fastopt.js -i aqua-playground/aqua/examples -o aqua-playground/src/compiled/examples -m aqua-playground/node_modules -c "UNIQUE_CONST = 1" -c "ANOTHER_CONST = \"ab\""
|
||||
node cli/.js/target/scala-3.0.2/cli-fastopt.js -i aqua-playground/aqua/examples -o aqua-playground/src/compiled/examples -m aqua-playground/node_modules -c "UNIQUE_CONST = 1" -c "ANOTHER_CONST = \"ab\""
|
||||
cd aqua-playground
|
||||
npm run examples
|
||||
|
15
README.md
15
README.md
@ -16,13 +16,20 @@ Please refer to [Aqua Book](https://doc.fluence.dev/aqua-book/) to learn how to
|
||||
|
||||
## Compiler CLI
|
||||
|
||||
To build the Aqua compiler, clone the repo & run `sbt cli/assembly`,
|
||||
or simply download the latest JAR file from the [releases](https://github.com/fluencelabs/aqua/releases) page.
|
||||
To build the Aqua compiler, clone the repo & run `sbt cliJS/fullLinkOpt` to build JavaScript file. File location: `cli/.js/target/scala-%scala-version%/cli-opt`.
|
||||
Or `sbt cli/assembly` to build JAR file. File location: `cli/.jvm/target/scala-%scala-version%/`
|
||||
Or simply download the latest JS or JAR file from the [releases](https://github.com/fluencelabs/aqua/releases) page.
|
||||
|
||||
It requires `java` to run Aqua compiler from the command line:
|
||||
It requires `node` to run Aqua compiler in `.js` file from the command line:
|
||||
|
||||
```commandline
|
||||
java -jar aqua-cli-%version_number%.jar -i path/to/input/dir -o path/to/output/dir
|
||||
node aqua-%version_number%.js -i path/to/input/dir -o path/to/output/dir
|
||||
```
|
||||
|
||||
It requires `java` to run Aqua compiler in `.jar` file from the command line:
|
||||
|
||||
```commandline
|
||||
java -jar aqua-%version_number%.jar -i path/to/input/dir -o path/to/output/dir
|
||||
```
|
||||
|
||||
Input directory should contain files with `aqua` scripts.
|
||||
|
@ -1,4 +1,4 @@
|
||||
val dottyVersion = "3.0.1"
|
||||
val dottyVersion = "3.0.2"
|
||||
|
||||
scalaVersion := dottyVersion
|
||||
|
||||
@ -64,7 +64,7 @@ lazy val cliJVM = cli.jvm
|
||||
.settings(
|
||||
Compile / run / mainClass := Some("aqua.AquaCli"),
|
||||
assembly / mainClass := Some("aqua.AquaCli"),
|
||||
assembly / assemblyJarName := "aqua-cli-" + version.value + ".jar",
|
||||
assembly / assemblyJarName := "aqua-" + version.value + ".jar",
|
||||
libraryDependencies ++= Seq(
|
||||
)
|
||||
)
|
||||
|
5
npm/error.js
Normal file
5
npm/error.js
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict";
|
||||
|
||||
console.error("ERROR: use 'aqua' command!")
|
@ -14,18 +14,19 @@ if (fs.existsSync(nm) && fs.lstatSync(nm).isDirectory()) {
|
||||
}
|
||||
|
||||
const args = [
|
||||
"node",
|
||||
path.join(__dirname, "aqua-cli-experimental.js"),
|
||||
"java",
|
||||
"-jar",
|
||||
path.join(__dirname, "aqua.jar"),
|
||||
...importArgs,
|
||||
...process.argv.slice(2),
|
||||
];
|
||||
|
||||
const argsString = args.join(" ");
|
||||
|
||||
console.log("Aqua JS: " + argsString);
|
||||
console.log("Aqua Java " + argsString);
|
||||
exec(argsString, (err, stdout, stderr) => {
|
||||
console.error("Aqua JS: " + stderr);
|
||||
console.log("Aqua JS: " + stdout);
|
||||
console.error("Aqua Java: " + stderr);
|
||||
console.log("Aqua Java: " + stdout);
|
||||
|
||||
if (err) {
|
||||
process.exit(err.code);
|
11
npm/index.js
11
npm/index.js
@ -14,19 +14,18 @@ if (fs.existsSync(nm) && fs.lstatSync(nm).isDirectory()) {
|
||||
}
|
||||
|
||||
const args = [
|
||||
"java",
|
||||
"-jar",
|
||||
path.join(__dirname, "aqua-cli.jar"),
|
||||
"node",
|
||||
path.join(__dirname, "aqua.js"),
|
||||
...importArgs,
|
||||
...process.argv.slice(2),
|
||||
];
|
||||
|
||||
const argsString = args.join(" ");
|
||||
|
||||
console.log(argsString);
|
||||
console.log("Aqua JS: " + argsString);
|
||||
exec(argsString, (err, stdout, stderr) => {
|
||||
console.error(stderr);
|
||||
console.log(stdout);
|
||||
console.error("Aqua JS: " + stderr);
|
||||
console.log("Aqua JS: " + stdout);
|
||||
|
||||
if (err) {
|
||||
process.exit(err.code);
|
||||
|
@ -1,16 +1,18 @@
|
||||
{
|
||||
"name": "@fluencelabs/aqua-cli",
|
||||
"name": "@fluencelabs/aqua",
|
||||
"version": "0.0.0",
|
||||
"description": "Aqua compiler",
|
||||
"files": [
|
||||
"aqua-cli.jar",
|
||||
"aqua-cli-experimental.js",
|
||||
"index-experimental.js"
|
||||
"aqua.jar",
|
||||
"aqua.js",
|
||||
"index.js",
|
||||
"index-java.js",
|
||||
"error.js"
|
||||
],
|
||||
"bin": {
|
||||
"aqua": "index.js",
|
||||
"aqua-cli": "index.js",
|
||||
"aqua-js": "index-experimental.js"
|
||||
"aqua-cli": "error.js",
|
||||
"aqua-j": "index-java.js"
|
||||
},
|
||||
"scripts": {},
|
||||
"repository": {
|
||||
|
@ -8,18 +8,16 @@ or in parallel, forming a single-use coordination network.
|
||||
Aqua's runtime is heterogeneous: it includes browsers, servers, devices, all involved in solving a single task.
|
||||
Therefore, Aqua scripts are compiled into several targets at once, with AIR and Typescript as a default.
|
||||
|
||||
## aqua-cli
|
||||
## aqua
|
||||
|
||||
The package contains a convenience `aqua-cli` wrapper for usage in npm-based projects.
|
||||
The package contains a convenience `aqua` wrapper for usage in npm-based projects.
|
||||
|
||||
### usage
|
||||
|
||||
**Warning: the package requires java to be installed (it will call "java -jar ... ") **
|
||||
|
||||
Get the latest package
|
||||
|
||||
```bash
|
||||
npm i --save-dev @fluencelabs/aqua-cli
|
||||
npm i --save-dev @fluencelabs/aqua
|
||||
```
|
||||
|
||||
Create a directory for the source files: `.aqua` and for compiled files: `.ts`
|
||||
@ -31,7 +29,7 @@ mkdir aqua compiled
|
||||
To compile files run:
|
||||
|
||||
```bash
|
||||
npx aqua -i ./src/aqua/ -o ./src/compiled
|
||||
aqua -i ./src/aqua/ -o ./src/compiled
|
||||
```
|
||||
|
||||
Alternatively the compilation script can be put into scripts section of `package.json`
|
||||
|
Loading…
Reference in New Issue
Block a user