Readme updates (#295)

* NPM installation guide in the README.md

* NPM badge

Co-authored-by: Dima <dmitry.shakhtarin@fluence.ai>
This commit is contained in:
Dmitry Kurinskiy 2021-09-10 17:36:21 +03:00 committed by GitHub
parent 7362b46384
commit 5b8a253fe7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 15 deletions

View File

@ -1,6 +1,7 @@
## Aqua
[![release](https://github.com/fluencelabs/aqua/actions/workflows/release.yml/badge.svg)](https://github.com/fluencelabs/aqua/actions/workflows/release.yml)
[![npm](https://img.shields.io/npm/v/@fluencelabs/aqua)](https://www.npmjs.com/package/@fluencelabs/aqua)
Aqua is a new-gen language for distributed systems.
@ -10,30 +11,47 @@ 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.
## Using Aqua
Please refer to [Aqua Book](https://doc.fluence.dev/aqua-book/) to learn more about Aqua language.
Please refer to [Aqua Book](https://doc.fluence.dev/aqua-book/) to learn how to use Aqua.
## Install and run
## Compiler CLI
The easiest way to use Aqua is to download the latest build from npm: [@fluencelabs/aqua](https://www.npmjs.com/package/@fluencelabs/aqua).
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.
```bash
npm i -g @fluencelabs/aqua
aqua --input src/aqua --output src/generated
```
It requires `node` to run Aqua compiler in `.js` file from the command line:
Input directory should contain files with `.aqua` scripts.
```commandline
## Build from sources
If you want to build Aqua compiler from the sourcecode, you need [Scala](https://www.scala-lang.org/)'s `sbt` installed.
Aqua compiler itself can be compiled to and distributed either as JavaScript or Java file.
### Build to JS
Run `sbt cliJS/fullLinkOpt` to build JavaScript file. You can find the compiled file in: `cli/.js/target/scala-%scala-version%/cli-opt`.
Then run it with `node`:
```bash
node aqua-%version_number%.js -i path/to/input/dir -o path/to/output/dir
```
Javascript build is the default for Aqua.
### Build to JVM
Run `sbt cli/assembly` to build JAR file. It is located in `cli/.jvm/target/scala-%scala-version%/`
It requires `java` to run Aqua compiler in `.jar` file from the command line:
```commandline
```bash
java -jar aqua-%version_number%.jar -i path/to/input/dir -o path/to/output/dir
```
Input directory should contain files with `aqua` scripts.
## Repository structure
- **[types](./types)** data types, arrows, stream types definitions and variance
@ -48,3 +66,11 @@ Input directory should contain files with `aqua` scripts.
- **[backend/air](./backend/air)** generates AIR code from the middle-end model
- **[backend/ts](./backend/ts)** - generates AIR code and Typescript wrappers for use with Fluence JS SDK
- **[cli](./cli)** - CLI interface
## References
- [Aqua Book](https://doc.fluence.dev/aqua-book/)
- [Aqua Changelog](https://doc.fluence.dev/aqua-book/changelog)
- [Fluence docs](https://fluence.dev/)
- [Examples & tutorials](https://github.com/fluencelabs/examples)
- [Aqua Playground](https://github.com/fluencelabs/aqua-playground)

View File

@ -76,7 +76,7 @@ object AppOps {
def importOpts[F[_]: Monad: Files]: Opts[F[ValidatedNec[String, List[Path]]]] =
Opts
.options[String]("import", "Path to the directory to import from", "m").orEmpty
.options[String]("import", "Path to the directory to import from. May be used several times", "m").orEmpty
.map { ps =>
val checked: List[F[ValidatedNec[String, Path]]] = ps.toList.map { pStr =>
val p = Path(pStr)

View File

@ -116,8 +116,8 @@ object AquaCli extends IOApp with Logging {
override def run(args: List[String]): IO[ExitCode] = {
CommandIOApp.run[IO](
"aqua-c",
"Aquamarine compiler",
"aqua",
"Aqua Compiler",
helpFlag = false,
None
)(

View File

@ -23,7 +23,7 @@ npm i --save-dev @fluencelabs/aqua
Create a directory for the source files: `.aqua` and for compiled files: `.ts`
```
mkdir aqua compiled
mkdir src/aqua src/compiled
```
To compile files run: