-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: migrate to es modules [fixes DXJ-252] * fix run.js path * change node version to 16 * fix type import * allow runnning with ./bin/dev.js * attempt turn on parallel tests * fix generate key command * make sure setup runs * don't show spinner for tests * fix previous task message * replace incorrect flag name, simplify addFileExtensionsInTsFiles function, update README, improve pre-commit * set testnet as default network * fix spinner * use lodash-es package * not allow any NodeJS versions except for 16 * update readme * update aqua version to the unstable
- Loading branch information
1 parent
7ea6f56
commit 5806510
Showing
88 changed files
with
4,638 additions
and
3,904 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
/.nyc_output | ||
/dist | ||
/tmp | ||
/--fix | ||
/yarn.lock | ||
oclif.manifest.json | ||
.eslintcache | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,31 +80,24 @@ USAGE | |
|
||
# Contributing | ||
|
||
- To run cli in development mode use: `./bin/dev` | ||
- To run cli in production mode run `npm run build` first, then use: `./bin/run`. If you wanna make sure you are running the actual package the users will use - do `npm run build`, `npm pack` and install this tar package (this approach is used for tests) | ||
- If you are using nvm and want to commit using VSCode - place `.huskyrc` file to your Home directory | ||
- To use cli in development mode run: `./bin/dev.js` (types are not checked in development mode because it's faster and more convenient to work with. Use typechecking provided by your IDE during development) | ||
- To use cli in production mode run `npm run build` first, then run: `./bin/run.js`. If you wanna make sure you are running the actual package the users will use - do `npm run build`, `npm pack` and install this tar package (this approach is used for tests) | ||
- Don't name arguments or flags with names that contain underscore symbols, because autogenerated links in markdown will not work | ||
- pre-commit runs each time before you commit. It includes prettier and generates this README.md file that you are reading right now. | ||
- If you want README.md file to be correctly generated please don't forget to run `npm run build` before committing | ||
- pre-commit runs each time before you commit. It attempts to build and lint your project, runs prettier and generates this README.md file that you are reading right now. | ||
- If you are using nvm and want to commit using VSCode - place `.huskyrc` file to your Home directory | ||
- Don't export anything from command files except for the command itself. If you need to share code between commands - create a separate file | ||
- Use `this.error` (or `commandObj.error`) for human readable errors. They will be reported to analytics as events. Use `throw new Error` (or `assert`) for unexpected errors. They will be reported to analytics as crashes. | ||
- Avoid using `this` in commands except for inside `initCli` function. This style is easier to understand and there will be less stuff to refactor if instead of using methods on command object you simply use separate functions which can later be moved outside into a separate module for reuse in other commands | ||
- Use `commandObj.error` for human readable errors. They will be reported to analytics as events. Use `throw new Error` (or `assert`) for unexpected errors. They will be reported to analytics as crashes. | ||
- Don't use colors inside commands descriptions. They can't be rendered to markdown and they will not be rendered to users of the packaged CLI anyway, when they run --help | ||
|
||
Pull request and release process: | ||
1. Run `npm run check` to make sure everything ok with the code | ||
1. Only after that commit your changes to trigger pre-commit hook that updates `README.md`. Read `README.md` to make sure it is correctly updated | ||
1. Push your changes | ||
1. Create pull request and merge your changes to `main` | ||
1. Switch to `main` locally and pull merged changes | ||
1. Run `git tag -a v0.0.0 -m ""` with version number that you want instead of `0.0.0` | ||
1. Run `git push origin v0.0.0` with version number that you want instead of `0.0.0` to trigger release | ||
|
||
# Commands | ||
|
||
<!-- commands --> | ||
* [`fluence aqua`](#fluence-aqua) | ||
* [`fluence autocomplete [SHELL]`](#fluence-autocomplete-shell) | ||
* [`fluence build`](#fluence-build) | ||
* [`fluence deal create`](#fluence-deal-create) | ||
* [`fluence deal faucet [AMOUNT] [TOKEN]`](#fluence-deal-faucet-amount-token) | ||
* [`fluence dep cargo i [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dep-cargo-i-package-name--package-nameversion) | ||
* [`fluence dep i`](#fluence-dep-i) | ||
* [`fluence dep npm i [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dep-npm-i-package-name--package-nameversion) | ||
|
@@ -115,7 +108,7 @@ Pull request and release process: | |
* [`fluence dependency npm i [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dependency-npm-i-package-name--package-nameversion) | ||
* [`fluence dependency npm install [PACKAGE-NAME | PACKAGE-NAME@VERSION]`](#fluence-dependency-npm-install-package-name--package-nameversion) | ||
* [`fluence deploy`](#fluence-deploy) | ||
* [`fluence help [COMMAND]`](#fluence-help-command) | ||
* [`fluence help [COMMANDS]`](#fluence-help-commands) | ||
* [`fluence init [PATH]`](#fluence-init-path) | ||
* [`fluence key default [NAME]`](#fluence-key-default-name) | ||
* [`fluence key new [NAME]`](#fluence-key-new-name) | ||
|
@@ -124,6 +117,7 @@ Pull request and release process: | |
* [`fluence module new [PATH]`](#fluence-module-new-path) | ||
* [`fluence module remove [NAME | PATH | URL]`](#fluence-module-remove-name--path--url) | ||
* [`fluence remove`](#fluence-remove) | ||
* [`fluence resource-owner pat create [DEAL-ADDRESS]`](#fluence-resource-owner-pat-create-deal-address) | ||
* [`fluence run`](#fluence-run) | ||
* [`fluence service add [PATH | URL]`](#fluence-service-add-path--url) | ||
* [`fluence service new [PATH]`](#fluence-service-new-path) | ||
|
@@ -136,14 +130,15 @@ Compile aqua file or directory that contains your .aqua files | |
|
||
``` | ||
USAGE | ||
$ fluence aqua [-i <value>] [-o <value>] [--import <value>] [--air | --js] [--log-level-compiler | ||
<value>] [--const <value>] [--no-relay] [--no-xor] [--dry] [--scheduled] [-w] [--no-input] | ||
$ fluence aqua [-i <value>] [-o <value>] [--import <value>] [--air | --js | --common-js] | ||
[--log-level-compiler <value>] [--const <value>] [--no-relay] [--no-xor] [--dry] [--scheduled] [-w] [--no-input] | ||
|
||
FLAGS | ||
-i, --input=<path> Path to an aqua file or an input directory that contains your .aqua files | ||
-o, --output=<path> Path to the output directory. Will be created if it doesn't exists | ||
-w, --watch Watch aqua file or folder for changes and recompile | ||
--air Generate .air file instead of .ts | ||
--common-js Use no extension in generated .ts file | ||
--const=<NAME=value>... Constants to be passed to the compiler | ||
--dry Checks if compilation is succeeded, without output | ||
--import=<path>... Path to a directory to import from. May be used several times | ||
|
@@ -192,7 +187,7 @@ EXAMPLES | |
$ fluence autocomplete --refresh-cache | ||
``` | ||
|
||
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.3.6/src/commands/autocomplete/index.ts)_ | ||
_See code: [@oclif/plugin-autocomplete](https://github.com/oclif/plugin-autocomplete/blob/v1.4.4/src/commands/autocomplete/index.ts)_ | ||
|
||
## `fluence build` | ||
|
||
|
@@ -214,6 +209,50 @@ EXAMPLES | |
|
||
_See code: [dist/commands/build.ts](https://github.com/fluencelabs/fluence-cli/blob/v0.2.36/dist/commands/build.ts)_ | ||
|
||
## `fluence deal create` | ||
|
||
Create your deal with the specified parameters | ||
|
||
``` | ||
USAGE | ||
$ fluence deal create --subnetId <value> --pricePerEpoch <value> --requiredStake <value> [--no-input] [-k | ||
<value>] [--network <value>] | ||
FLAGS | ||
-k, --privKey=<value> Private key with which transactions will be signed through cli | ||
--network=<network> [default: testnet] $The network in which the transactions used by the command will be carried | ||
out (local, testnet) | ||
--no-input Don't interactively ask for any input from the user | ||
--pricePerEpoch=<value> (required) The price that you will pay to resource owners per epoch | ||
--requiredStake=<value> (required) Required collateral in FLT tokens to join a deal for resource owners. | ||
--subnetId=<value> (required) Subnet ID for a deal | ||
DESCRIPTION | ||
Create your deal with the specified parameters | ||
``` | ||
|
||
## `fluence deal faucet [AMOUNT] [TOKEN]` | ||
|
||
Dev faucet for receiving FLT and FakeUSD tokens | ||
|
||
``` | ||
USAGE | ||
$ fluence deal faucet [AMOUNT] [TOKEN] [--no-input] [-k <value>] [--network <value>] | ||
ARGUMENTS | ||
AMOUNT Amount of tokens to receive | ||
TOKEN Name of the token: FakeUSD, FLT | ||
FLAGS | ||
-k, --privKey=<value> Private key with which transactions will be signed through cli | ||
--network=<network> [default: testnet] $The network in which the transactions used by the command will be carried | ||
out (local, testnet) | ||
--no-input Don't interactively ask for any input from the user | ||
DESCRIPTION | ||
Dev faucet for receiving FLT and FakeUSD tokens | ||
``` | ||
|
||
## `fluence dep cargo i [PACKAGE-NAME | PACKAGE-NAME@VERSION]` | ||
|
||
Install cargo project dependencies (all dependencies are cached inside .fluence/cargo directory of the current user) | ||
|
@@ -281,7 +320,7 @@ USAGE | |
ARGUMENTS | ||
PACKAGE-NAME | PACKAGE-NAME@VERSION Package name. Installs the latest version of the package by default. If you want | ||
to install a specific version, you can do so by appending @ and the version to | ||
the package name. For example: "@fluencelabs/aqua-lib@0.6.0" | ||
the package name. For example: @fluencelabs/[email protected] | ||
FLAGS | ||
--force Force install even if the dependency/dependencies is/are already installed | ||
|
@@ -421,7 +460,7 @@ USAGE | |
ARGUMENTS | ||
PACKAGE-NAME | PACKAGE-NAME@VERSION Package name. Installs the latest version of the package by default. If you want | ||
to install a specific version, you can do so by appending @ and the version to | ||
the package name. For example: "@fluencelabs/aqua-lib@0.6.0" | ||
the package name. For example: @fluencelabs/[email protected] | ||
FLAGS | ||
--force Force install even if the dependency/dependencies is/are already installed | ||
|
@@ -449,7 +488,7 @@ USAGE | |
ARGUMENTS | ||
PACKAGE-NAME | PACKAGE-NAME@VERSION Package name. Installs the latest version of the package by default. If you want | ||
to install a specific version, you can do so by appending @ and the version to | ||
the package name. For example: "@fluencelabs/aqua-lib@0.6.0" | ||
the package name. For example: @fluencelabs/[email protected] | ||
FLAGS | ||
--force Force install even if the dependency/dependencies is/are already installed | ||
|
@@ -490,16 +529,16 @@ EXAMPLES | |
|
||
_See code: [dist/commands/deploy.ts](https://github.com/fluencelabs/fluence-cli/blob/v0.2.36/dist/commands/deploy.ts)_ | ||
|
||
## `fluence help [COMMAND]` | ||
## `fluence help [COMMANDS]` | ||
|
||
Display help for fluence. | ||
|
||
``` | ||
USAGE | ||
$ fluence help [COMMAND] [-n] | ||
$ fluence help [COMMANDS] [-n] | ||
ARGUMENTS | ||
COMMAND Command to show help for. | ||
COMMANDS Command to show help for. | ||
FLAGS | ||
-n, --nested-commands Include all nested commands in the output. | ||
|
@@ -508,7 +547,7 @@ DESCRIPTION | |
Display help for fluence. | ||
``` | ||
|
||
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.19/src/commands/help.ts)_ | ||
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.2.2/src/commands/help.ts)_ | ||
|
||
## `fluence init [PATH]` | ||
|
||
|
@@ -562,12 +601,13 @@ Generate key-pair and store it in user-secrets.yaml or project-secrets.yaml | |
|
||
``` | ||
USAGE | ||
$ fluence key new [NAME] [--no-input] [--user] | ||
$ fluence key new [NAME] [--no-input] [--user] [--default] | ||
ARGUMENTS | ||
NAME Key-pair name | ||
FLAGS | ||
--default Set new key-pair as default for current project or user | ||
--no-input Don't interactively ask for any input from the user | ||
--user Generate key-pair for current user instead of generating key-pair for current project | ||
|
@@ -688,16 +728,37 @@ EXAMPLES | |
|
||
_See code: [dist/commands/remove.ts](https://github.com/fluencelabs/fluence-cli/blob/v0.2.36/dist/commands/remove.ts)_ | ||
|
||
## `fluence resource-owner pat create [DEAL-ADDRESS]` | ||
|
||
Create PAT (Peer auth token) in a deal for auth | ||
|
||
``` | ||
USAGE | ||
$ fluence resource-owner pat create [DEAL-ADDRESS] [--no-input] [-k <value>] [--network <value>] | ||
ARGUMENTS | ||
DEAL-ADDRESS Deal address | ||
FLAGS | ||
-k, --privKey=<value> Private key with which transactions will be signed through cli | ||
--network=<network> [default: testnet] $The network in which the transactions used by the command will be carried | ||
out (local, testnet) | ||
--no-input Don't interactively ask for any input from the user | ||
DESCRIPTION | ||
Create PAT (Peer auth token) in a deal for auth | ||
``` | ||
|
||
## `fluence run` | ||
|
||
Run aqua script | ||
|
||
``` | ||
USAGE | ||
$ fluence run [--no-input] [--relay <value>] [--data <value>] [--data-path <value>] [--import <value>] | ||
[--log-level-compiler <value>] [--log-level-avm <value>] [--quiet] [--plugin <value>] [--const <value>] | ||
[--json-service <value>] [-i <value>] [-f <value>] [--no-xor] [--no-relay] [--print-air] [--timeout <value>] [-k | ||
<value>] | ||
[--log-level-compiler <value>] [--log-level-avm <value>] [--print-particle-id] [--quiet] [--plugin <value>] [--const | ||
<value>] [--json-service <value>] [-i <value>] [-f <value>] [--no-xor] [--no-relay] [--print-air] [--timeout | ||
<value>] [-k <value>] | ||
FLAGS | ||
-f, --func=<function-call> Function call | ||
|
@@ -720,6 +781,8 @@ FLAGS | |
--plugin=<path> [experimental] Path to a directory with JS plugins (Read more: | ||
https://fluence.dev/docs/aqua-book/aqua-cli/plugins) | ||
--print-air Prints generated AIR code before function execution | ||
--print-particle-id If set, newly initiated particle ids will be printed to console. Useful to see what | ||
particle id is responsible for aqua function | ||
--quiet Print only execution result. Overrides all --log-level-* flags | ||
--relay=<multiaddr> Relay node multiaddr | ||
--timeout=<milliseconds> Timeout used for command execution | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm/transpile-only | ||
|
||
/** | ||
* Copyright 2022 Fluence Labs Limited | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/* eslint-disable node/shebang */ | ||
|
||
import path from "node:path"; | ||
import url from "node:url"; | ||
|
||
import oclif from "@oclif/core"; | ||
import { register } from "ts-node"; | ||
|
||
import { createErrorPromise } from "../src/countlyInterceptor.js"; | ||
|
||
// In dev mode -> use ts-node and dev plugins | ||
process.env.NODE_ENV = "development"; | ||
|
||
register({ | ||
project: path.join( | ||
path.dirname(url.fileURLToPath(import.meta.url)), | ||
"..", | ||
"tsconfig.json" | ||
), | ||
transpileOnly: true, | ||
swc: true, | ||
}); | ||
|
||
// In dev mode, always show stack traces | ||
oclif.settings.debug = true; | ||
|
||
// Start the CLI | ||
oclif | ||
.run(process.argv.slice(2), import.meta.url) | ||
.then(oclif.flush) | ||
.catch((error) => createErrorPromise(error, oclif.Errors.handle)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
@echo off | ||
|
||
node "%~dp0\run" %* | ||
node "%~dp0\run.js" %* |
Oops, something went wrong.