Create aquamarine npm package (#56)

* Create aquamarine npm package
This commit is contained in:
Pavel 2021-04-14 18:00:51 +03:00 committed by GitHub
parent 704540fcf5
commit 3f7ef9f264
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 141 additions and 0 deletions

View File

@ -57,6 +57,27 @@ jobs:
stat "$JAR" stat "$JAR"
echo "JAR=$JAR" >> $GITHUB_ENV echo "JAR=$JAR" >> $GITHUB_ENV
### Publish to NPM registry
- uses: actions/setup-node@v1
with:
node-version: "14"
registry-url: "https://registry.npmjs.org"
- name: Install jq and prepare package
run: |
sudo apt-get update && sudo apt-get --yes --force-yes install jq
PKG_NAME="$(cat package.json | jq -r .name)"
cp ${{ env.JAR }} ./npm/aqua-cli.jar
- run: npm version ${{ env.VERSION }}
working-directory: ./npm
- run: npm publish --access public
working-directory: ./npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
### create release
- uses: marvinpinto/action-automatic-releases@latest - uses: marvinpinto/action-automatic-releases@latest
with: with:
# changelog will be automatically generated from the history # changelog will be automatically generated from the history
@ -66,6 +87,8 @@ jobs:
title: "Aqua Compiler ${{ env.VERSION }}" title: "Aqua Compiler ${{ env.VERSION }}"
files: | files: |
${{ env.JAR }} ${{ env.JAR }}
body: |
[${{ env.VERSION }} @ NPM registry](https://www.npmjs.com/package/${{ env.PKG_NAME }}/v/${{ env.VERSION }})
draft: true draft: true
prerelease: false prerelease: false
repo_token: "${{ secrets.GITHUB_TOKEN }}" repo_token: "${{ secrets.GITHUB_TOKEN }}"

2
npm/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.jar
*.tgz

7
npm/LICENSE Normal file
View File

@ -0,0 +1,7 @@
Copyright 2021 Fluence Labs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

27
npm/index.js Normal file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env node
"use strict";
const { exec } = require("child_process");
const path = require("path");
const args = [
"java",
"-jar",
path.join(__dirname, "\\aqua-cli.jar"),
"-m",
"node_modules",
...process.argv.slice(2),
];
const argsString = args.join(" ");
console.log(argsString);
exec(argsString, (err, stdout, stderr) => {
console.error(stderr);
console.log(stdout);
if (err) {
process.exit(err.code);
}
});

24
npm/package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "@fluencelabs/aqua-cli",
"version": "0.0.0",
"description": "Aqua compiler",
"files": [
"aqua-cli.jar"
],
"bin": "index.js",
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://github.com/fluencelabs/aqua.git"
},
"keywords": [
"aqua",
"fluence"
],
"author": "Fluence Labs",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/fluencelabs/aqua/issues"
},
"homepage": "https://github.com/fluencelabs/aqua#readme"
}

58
npm/readme.md Normal file
View File

@ -0,0 +1,58 @@
## Aqua
Aqua is a new-gen language for distributed systems.
Aqua programs are executed on many peers, sequentially
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
The package contains a convenience `aqua-cli` 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
```
Create a directory for the source files: `.aqua` and for compiled files: `.ts`
```
mkdir aqua compiled
```
To compile files run:
```bash
npx aqua -i ./src/aqua/ -o ./src/compiled
```
Alternatively the compilation script can be put into scripts section of `package.json`
```
...
"scripts": {
...
"compile": "aqua -i ./src/aqua/ -o ./src/compiled"
},
...
```
and can be started with
```
npm run compile
```
### references
- For the list of compiler options see: https://github.com/fluencelabs/aqua
- To get started writing aqua see: https://github.com/fluencelabs/aqua-playground