From a245697eeb290e55651aa97a913a665761bcea6d Mon Sep 17 00:00:00 2001 From: Pileks Date: Fri, 14 Oct 2022 19:42:59 +0200 Subject: [PATCH 01/11] CLI README inital version w/ basic layout --- packages/cli/README.md | 190 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 188 insertions(+), 2 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 0744b320cd..15ab1112c9 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -1,11 +1,197 @@ -# The Polywrap CLI (polywrap) +# The Polywrap CLI (`polywrap`) + + +npm + + +
A command-line interface for building and deploying Polywrap projects. -## Documentation + +## Prerequisites + +### Docker + +[Docker](https://www.docker.com/) is required to perform some tasks, including to `build` Wasm wrappers. +Linux users will also need to install [Docker Compose](https://docs.docker.com/compose/install/). +Docker is free for personal use. Once Docker is installed and enabled, you're ready to go! + +### Cue + +The `polywrap run` command can validate runs by examining `stdout` output using **Cue**. If you need to run workflow validations, you will have to install Cue. + +You can install Cue by following the instructions found [here](https://cuelang.org/docs/install/). + +## Installation + +Within one project: + +```bash +npm install --save-dev polywrap +``` + +Globally: + +```bash +npm install -g polywrap +``` + +Alternatively, `polywrap` can be run without installation: + +```bash +npx polywrap -v +``` + +## Commands + +### `help` command and `--help` option + +To list available commands, use the `help` command or the `-h, --help` option: + +```bash +polywrap help +polywrap --help +``` + +Alternatively, you can use the help command or option within any command to get a full list of available subcommands, arguments and options. + +```bash +polywrap create help +polywrap create --help +``` + +### `build | b` + +Build Polywrap projects. + +**TODO: Add documentation** + +### `codegen | g` + +Generate code bindings for Polywrap projects. + +**TODO: Add documentation** + +### `create | c` + +Create a Polywrap project. + +This command sets up a basic Polywrap-enabled project based on a pre-defined template. + +#### Subcommands: + +#### `wasm` + +Set up a Polywrap WASM Wrapper or Interface project. + +#### `app` + +Set up a NodeJS or React application which uses the Polywrap Client to invoke wrappers. + +#### `plugin` + +Set up a Polywrap Plugin project used to provide the Polywrap Cient with additional functionality. + +### `deploy | d` + +Deploy Polywrap projects. + +**TODO: Add documentation** + + +### `infra | i` + +Modular Infrastructure-As-Code Orchestrator + +**TODO: Add documentation** + +### `run | r` + +Run Workflows + +**TODO: Add documentation** + +### `docgen | o` + +Generate wrapper documentation + +**TODO: Add documentation** + +### `manifest | m` + +Inspect and migrate Polywrap manifests. + +#### Subcommands: + +#### `schema | s` + +Output the schema for any of your Project or Extension manifests. + +Usage: +```bash +# Output schema for the current project manifest (polywrap.yaml) +polywrap manifest schema +``` + +##### Arguments + +- `type` + The type of the manifest file. The default value for `type` is `project`. + +##### Options + +- `-r, --raw` + Output the full JSON Schema for the given manifest. + +- `-m, --manifest-file ` + The manifest file for which the schema will be rendered. The `type` argument determines the default manifest file used. + For example, `polywrap manifest schema build` will use `polywrap.build.yaml` as its default manifest file. + +#### `migrate | m` + +Migrate a Project or Extension manifest file to the the latest version, or a version specified. + +Usage: +```bash +# Migrate the current project manifest (polywrap.yaml) +polywrap manifest migrate +``` +##### Arguments + +- `type` + The type of the manifest file. The default value for `type` is `project`. + +##### Options +- `-f, --format ` + Migrate to a specific format instead of the latest. + + Example: + ```bash + # Migrate the current project manfiest to format 0.2.0 + polywrap manifest migrate -f 0.2.0 + # or + polywrap m m -f 0.2.0 + ``` + +- `-m, --manifest-file ` + The manifest file for which the schema will be rendered. The `type` argument determines the default manifest file used. + For example, `polywrap manifest migrate build` will use `polywrap.build.yaml` as its default manifest file. + + Example: + ```bash + # Migrate "custom-manifest.yaml" to the latest format + polywrap manifest migrate -m custom-manifest.yaml + # or + polywrap m m -m custom-manifest.yaml + ``` + + + https://docs.polywrap.io/reference/cli/polywrap-cli ## Examples + Demos: https://github.com/polywrap/demos From 0fb58e3cb23045b3c143b0215c376d9f53f9bd10 Mon Sep 17 00:00:00 2001 From: Pileks Date: Fri, 14 Oct 2022 20:24:59 +0200 Subject: [PATCH 02/11] CLI Documentation - create command, log levels --- packages/cli/README.md | 58 ++++++++++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 15ab1112c9..9a65e50f67 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -4,6 +4,7 @@ npm +

A command-line interface for building and deploying Polywrap projects. @@ -25,7 +26,7 @@ You can install Cue by following the instructions found [here](https://cuelang.o ## Installation -Within one project: +Within a single project: ```bash npm install --save-dev polywrap @@ -40,7 +41,7 @@ npm install -g polywrap Alternatively, `polywrap` can be run without installation: ```bash -npx polywrap -v +npx polywrap ``` ## Commands @@ -81,18 +82,51 @@ This command sets up a basic Polywrap-enabled project based on a pre-defined tem #### Subcommands: -#### `wasm` +`polywrap create wasm ` Set up a Polywrap WASM Wrapper or Interface project. -#### `app` +`polywrap create app ` Set up a NodeJS or React application which uses the Polywrap Client to invoke wrappers. -#### `plugin` +`polywrap create plugin ` Set up a Polywrap Plugin project used to provide the Polywrap Cient with additional functionality. +#### Arguments + +All subcommands share the following arguments: + +- `language` (required) + The type/language of the created project + +- `name` (required) + The project name. + +#### Options + +All subcommands share the following options: + +- `-o, --output-dir ` + Specifies a custom output directory for the created project. + +#### Sample usage + +```bash +# Create a wrapper project using assemblyscript called "my-wrapper" +polywrap create wasm assemblyscript my-wrapper + +# Create an interface project using assemblyscript called "my-project" +polywrap create wasm interface my-interface + +# Create a React app project using Typescript called "my-react-app" +polywrap create app typescript-react my-react-app + +# Create a Plugin wrapper project using Typescript called "my-plugin" +polywrap create plugin typescript my-plugin +``` + ### `deploy | d` Deploy Polywrap projects. @@ -186,7 +220,21 @@ polywrap manifest migrate polywrap m m -m custom-manifest.yaml ``` +## Logging + +By default, the Polywrap CLI outputs all of its messages to the console. +Different levels of output verbosity are supported by using the following options: + +- `-v, --verbose` + Enables logging of informational messages in addition to standard output. + +- `-q, --quiet` + Disables ALL logging. Overrides the `--verbose` option. + + +### +### `-q` https://docs.polywrap.io/reference/cli/polywrap-cli From d86acf44f863979c71d7ab11a634ff92704a4047 Mon Sep 17 00:00:00 2001 From: Pileks Date: Mon, 17 Oct 2022 12:18:00 +0200 Subject: [PATCH 03/11] CLI docs - add docgen reference --- packages/cli/README.md | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 9a65e50f67..e520877ddf 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -148,9 +148,39 @@ Run Workflows ### `docgen | o` -Generate wrapper documentation +Generate wrapper documentation for your project. -**TODO: Add documentation** +```bash +polywrap docgen +``` + +#### Arguments: + +- `action` (required) + Specifies the kind of documentation generated. + Values: + - `schema` + Generates GraphQL-like schema for your project. + - `docusaurus` + Generates Docusaurus markdown for your project. + - `jsdoc` + Generates JSDoc markdown for your project. + +#### Options: +- `-m, --manifest-file ` + Specify your project's manifest file. + By default, `docgen` searches for `polywrap.yaml`. + +- `-g, --docgen-dir ` + Specify the output directory for generated docs. + By default, `./docs` is used. + +- `-c, --client-config ` + Specify a custom Polywrap Client configuration to be used. + The Polywrap Client is used to build your project's schema for which the docs will be generated. + +- `-i, --imports` + Generate docs for your project's dependencies as well. ### `manifest | m` From a4b79bb7264ffd02e4640d6b5a8bd1b5518b4418 Mon Sep 17 00:00:00 2001 From: Pileks Date: Mon, 17 Oct 2022 16:31:04 +0200 Subject: [PATCH 04/11] CLI docs - codegen command reference --- packages/cli/README.md | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index e520877ddf..c86d99ed2f 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -72,7 +72,32 @@ Build Polywrap projects. Generate code bindings for Polywrap projects. -**TODO: Add documentation** +This command generates types and bindings for your project based on your project's schema (found in `schema.graphql`). + +#### Options +- `-m, --manifest-file ` + Specify your project's manifest file. + By default, `docgen` searches for `polywrap.yaml`. + +- `-g, --codegen-dir ` + Specify an alternative directory for codegen output. + The default codegen output directory is `./wrap`. + +- `-p, --publish-dir ` + Output path for the built schema and manifest (default: `./build`) + This only applies when running `codegen` for Plugin Projects. + +- `-s, --script ` + Path to a custom generation script (JavaScript | TypeScript). + This script is run in place of the standard codegen script if provided. + **TODO: Add details about the custom codegen script** + +- `-c, --client-config ` + Use a custom Polywrap Client configuration. + +#### Special note + +When running `codegen` for Plugin Projects, the Polywrap CLI will also output an ABI schema for your plugin into the `./build` directory. You can override this output directory by specifying `-p, --publish-dir `. ### `create | c` @@ -176,8 +201,7 @@ polywrap docgen By default, `./docs` is used. - `-c, --client-config ` - Specify a custom Polywrap Client configuration to be used. - The Polywrap Client is used to build your project's schema for which the docs will be generated. + Use a custom Polywrap Client configuration. - `-i, --imports` Generate docs for your project's dependencies as well. From 461a48a4fcaceec7ee3cd59b970ac558da6a6213 Mon Sep 17 00:00:00 2001 From: Pileks Date: Mon, 17 Oct 2022 17:51:56 +0200 Subject: [PATCH 05/11] CLI docs - build command reference --- packages/cli/README.md | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index c86d99ed2f..e2aabd53af 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -64,9 +64,34 @@ polywrap create --help ### `build | b` -Build Polywrap projects. +Build Wasm and Interface Polywrap projects. +This outputs the project's ABI schema (Wasm and Interface) and binary package (Wasm) into the `./build` directory. -**TODO: Add documentation** +#### Options +- `-m, --manifest-file ` + Specify your project's manifest file. + By default, `build` searches for `polywrap.yaml`. + +- `-o, --output-dir ` + Specify an alternative directory for build output. + The default codegen output directory is `./build`. + +- `-c, --client-config ` + Use a custom Polywrap Client configuration. + +- `-n, --no-codegen` + Don't perform codegen before building. + By default, `build` performs a `codegen` step before building your Project. This option skips this step. This is especially useful when you are testing manual changes to your types/bindings. + +- `-s, --strategy ` + Specify which build strategy to use. By default, the `vm` build strategy is used. + Available strategies: + - `vm`: Uses Docker only for the source building part of the build process. At build time, it pulls a pre-built image with all necessary system dependencies, env vars and runtime; and it instantiates a Docker container with it. The Docker container instantiates bind-mounts (volumes) to copy the sources and dependencies from the host, build the sources inside the container, and copy the build artifacts back to the host machine. This approach ensures that the sources will be built in a reproducible environment but it doesn't use Docker for anything else and no image is built at runtime. + - `image`: Implies building a Docker image at runtime, where dependencies are installed and sources are copied and built as Dockerfile instructions. On subsequent builds, Docker tries to reuse cached image layers and rebuild accordingly. This approach is notably slow but the complete process happens in Docker, and can be reproduced, examined and audited layer by layer (from dependency installation to build artifacts output). + - `local` - does not use Docker at all. It simply executes a .sh file that contains the necessary instructions to install dependencies and build sources. While this is the fastest way of building, it requires you, the user, to have all prerequisite system dependencies installed. In addition, given that sources are built on the host machine and not a reproducible docker environment, reproducibility isn't guaranteed. + +- `-w, --watch` + Watch the Project's files and automatically rebuild when a file is changed. ### `codegen | g` @@ -105,7 +130,7 @@ Create a Polywrap project. This command sets up a basic Polywrap-enabled project based on a pre-defined template. -#### Subcommands: +#### Subcommands `polywrap create wasm ` @@ -179,7 +204,7 @@ Generate wrapper documentation for your project. polywrap docgen ``` -#### Arguments: +#### Arguments - `action` (required) Specifies the kind of documentation generated. @@ -191,7 +216,7 @@ polywrap docgen - `jsdoc` Generates JSDoc markdown for your project. -#### Options: +#### Options - `-m, --manifest-file ` Specify your project's manifest file. By default, `docgen` searches for `polywrap.yaml`. @@ -210,7 +235,7 @@ polywrap docgen Inspect and migrate Polywrap manifests. -#### Subcommands: +#### Subcommands #### `schema | s` From 605e32707f0de42f943104ac7c408d894fc86858 Mon Sep 17 00:00:00 2001 From: Pileks Date: Tue, 18 Oct 2022 20:13:24 +0200 Subject: [PATCH 06/11] CLI Docs - finish up reference with basic content, extend logging section --- packages/cli/README.md | 85 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index e2aabd53af..6f66da1b62 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -55,11 +55,11 @@ polywrap help polywrap --help ``` -Alternatively, you can use the help command or option within any command to get a full list of available subcommands, arguments and options. +Alternatively, you can use the `-h, --help` option within any command to get a full list of available subcommands, arguments and options. ```bash -polywrap create help polywrap create --help +polywrap codegen --help ``` ### `build | b` @@ -181,20 +181,71 @@ polywrap create plugin typescript my-plugin Deploy Polywrap projects. -**TODO: Add documentation** +#### Options +- `-m, --manifest-file ` + Specify your project's manifest file. + By default, `deploy` searches for `polywrap.yaml`. + +- `-o, --output-file ` + Output file path for the deploy result + +**TODO: Extend documentation with examples, more information** ### `infra | i` Modular Infrastructure-As-Code Orchestrator -**TODO: Add documentation** +```bash +polywrap infra [options] +``` + +#### Arguments +- `action` (required) + Infra allows you to execute the following actions: + - `up` + Start Polywrap infrastructure + - `down` + Stop Polywrap infrastructure + - `config` + Validate and display Polywrap infrastructure's bundled docker-compose manifest + - `vars` + Show Polywrap infrastructure's required .env variables + +#### Options +- `-m, --manifest-file ` + Specify the `infra` extension manifest file. + By default, `infra` searches for `polywrap.infra.yaml`. + +- `-o, --modules ` + Use only specified modules + +**TODO: Extend documentation with examples, more information** ### `run | r` Run Workflows -**TODO: Add documentation** +```bash +polywrap run [options] +``` + +#### Options +- `-m, --manifest-file ` + Specify the Workflow extension manifest file. + By default, `run` searches for `polywrap.test.yaml`. + +- `-c, --client-config ` + Use a custom Polywrap Client configuration. + +- `-o, --output-file ` + Specify the output file path for the workflow result + +- `-j, --jobs ` + Specify ids of jobs that you want to run + + +**TODO: Extend documentation with examples, more information** ### `docgen | o` @@ -302,6 +353,8 @@ polywrap manifest migrate ## Logging By default, the Polywrap CLI outputs all of its messages to the console. + +### Logging levels Different levels of output verbosity are supported by using the following options: - `-v, --verbose` @@ -310,17 +363,19 @@ Different levels of output verbosity are supported by using the following option - `-q, --quiet` Disables ALL logging. Overrides the `--verbose` option. +### Logging to a file +You can also tell the Polywrap CLI to save its output to a logfile using the `-l, --log-file [path]` option. -### - -### `-q` +Specifying the `-l` option without a `path` parameter will create a log file within the `./.polywrap/logs` directory. -https://docs.polywrap.io/reference/cli/polywrap-cli - -## Examples +```bash +# Output will be saved to the "./.polywrap/logs" directory +polywrap codegen -l +``` -Demos: -https://github.com/polywrap/demos +Alternatively, you can specify your own log file path. -Integrations: -https://github.com/polywrap/integrations +```bash +# Output will be saved to "my-log-file.log" +polywrap codegen -l my-log-file.log +``` \ No newline at end of file From b9160bf4b625ef8f7bc9778f5ebc3d6aed9859f5 Mon Sep 17 00:00:00 2001 From: Pileks Date: Fri, 21 Oct 2022 15:48:47 +0200 Subject: [PATCH 07/11] CLI docs - add test manifest details to CLI docs --- packages/cli/README.md | 125 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 3 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 6f66da1b62..8217d3fec0 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -222,9 +222,12 @@ polywrap infra [options] **TODO: Extend documentation with examples, more information** -### `run | r` +### `test | t` -Run Workflows +Run Test manifests. + +The `test` command executes a series of Wrapper invocations called **steps** organized into **jobs**. +All steps within a job are run in series, while jobs are run in parallel. ```bash polywrap run [options] @@ -244,8 +247,124 @@ polywrap run [options] - `-j, --jobs ` Specify ids of jobs that you want to run +#### The Test manifest (`polywrap.test.yaml`) +Basic structure: + +```yaml +# The basic structure of a test file +name: my-test-name #the name of the test +format: 0.1.0 +validation: "path/to/validator.cue" #(optional) path to a validator file (cuelang) +jobs: + first: + steps: #each step is a wrapper invocation that consists of a URI, the invoked method and its arguments + - uri: ens/example.eth + method: helloWorld + args: + arg1: "test" + ... + - ... + jobs: #after all job steps are executed, additional jobs can be run in parallel + ... + second: + ... +``` -**TODO: Extend documentation with examples, more information** +`jobs` is a map of ``, the key being each Job's name. + +```yaml +jobs: + helloWorld: + ... + helloPolywrap: + ... +``` + +Each Job consists of two properties: + - a `steps` collection + - This is a wrapper invocation, consisting of: + - `uri` - the WRAP URI of the wrapper + - `method` - the name of the invoked wrapper method + - `args` (optional) - a map of the invoked method's arguments + - `config` (optional) - a map of client config properties to be added/overridden + - an inner `jobs` map, making the structure of `Job` recursive. + +```yaml +jobs: + helloWorld: + steps: + - uri: ens/helloworld.polywrap.eth #ENS URI + method: helloWorld + args: + name: test + - uri: fs/./hello-polywrap/build #Filesystem URI + method: helloPolywrap + jobs: + innerJob1: + ... + innerJob2: + ... + helloPolywrap: + steps: + ... + jobs: + ... +``` + +When running a Test manifest, all top-level Jobs are run in parallel. Within those Jobs, each step is run in series. After all steps for a Job have been run, the inner `jobs` are run in parallel, with their `steps` run in series, and so on. + +You can reference the result (`data`/`error`) of any step by using the `$` symbol: + +```yaml +jobs: + helloWorld: + steps: + - uri: ens/helloworld.polywrap.eth #ENS URI + method: helloWorld + args: + name: test + - uri: fs/./hello-polywrap/build #Filesystem URI + method: helloPolywrap + jobs: + innerJob1: + steps: + - uri: ens/helloworld.polywrap.eth + method: helloWorld + args: + name: "$helloWorld.1.data" #Reference to `helloWorld`'s 2nd step return value + jobs: + innerJob11: + steps: + - uri: ens/helloworld.polywrap.eth + method: helloWorld + args: + name: "$helloWorld.innerJob1.0.error" #Reference to helloWorld's innerJob1 1st step error +``` + +#### Test validation + +By specifying a `validation` file within your Test manifest, the result of the run will be validated using `cue`. + +Example of a validation file: + +```cuelang +helloWorld: { + $0: { + data: "Hello test!", + error?: _|_, // Never fails + } + $1: { + data: "Hello Polywrap!", + error?: _|_, // Never fails + } + innerJob1: { + $0: { + data: "Hello Hello test!!", + error?: _|_, + } + } +} +``` ### `docgen | o` From 0a1e0764d9cdafc60adf8dc8eda2018b094e92f8 Mon Sep 17 00:00:00 2001 From: Pileks Date: Tue, 25 Oct 2022 12:03:41 +0200 Subject: [PATCH 08/11] CLI docs - deploy, infra commands, small fixups --- packages/cli/README.md | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 8217d3fec0..db30eec39e 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -88,7 +88,7 @@ This outputs the project's ABI schema (Wasm and Interface) and binary package (W Available strategies: - `vm`: Uses Docker only for the source building part of the build process. At build time, it pulls a pre-built image with all necessary system dependencies, env vars and runtime; and it instantiates a Docker container with it. The Docker container instantiates bind-mounts (volumes) to copy the sources and dependencies from the host, build the sources inside the container, and copy the build artifacts back to the host machine. This approach ensures that the sources will be built in a reproducible environment but it doesn't use Docker for anything else and no image is built at runtime. - `image`: Implies building a Docker image at runtime, where dependencies are installed and sources are copied and built as Dockerfile instructions. On subsequent builds, Docker tries to reuse cached image layers and rebuild accordingly. This approach is notably slow but the complete process happens in Docker, and can be reproduced, examined and audited layer by layer (from dependency installation to build artifacts output). - - `local` - does not use Docker at all. It simply executes a .sh file that contains the necessary instructions to install dependencies and build sources. While this is the fastest way of building, it requires you, the user, to have all prerequisite system dependencies installed. In addition, given that sources are built on the host machine and not a reproducible docker environment, reproducibility isn't guaranteed. + - `local` - Does not use Docker at all. It simply executes a .sh file that contains the necessary instructions to install dependencies and build sources. While this is the fastest way of building, it requires you, the user, to have all prerequisite system dependencies installed. In addition, given that sources are built on the host machine and not a reproducible docker environment, reproducibility isn't guaranteed. - `-w, --watch` Watch the Project's files and automatically rebuild when a file is changed. @@ -181,6 +181,14 @@ polywrap create plugin typescript my-plugin Deploy Polywrap projects. +```bash +polywrap deploy +``` + +`deploy` reads the Deploy manifest (`polywrap.deploy.yaml` by default) and executes the jobs and steps listed inside. + +For more information on the Deploy command and the Deploy manifest, see [Configure Polywrap deployment pipeline](https://docs.polywrap.io/quick-start/build-and-deploy-wasm-wrappers/deploy-pipeline). + #### Options - `-m, --manifest-file ` Specify your project's manifest file. @@ -188,9 +196,6 @@ Deploy Polywrap projects. - `-o, --output-file ` Output file path for the deploy result - -**TODO: Extend documentation with examples, more information** - ### `infra | i` @@ -200,6 +205,10 @@ Modular Infrastructure-As-Code Orchestrator polywrap infra [options] ``` +The `infra` command is used to set up infrastructure to test and deploy your wrappers locally. + +For more information on the `infra` command and how to create your own Infra modules, see [Configure Polywrap infrastructure pipeline](https://docs.polywrap.io/quick-start/test-wasm-wrappers/infra-pipeline) + #### Arguments - `action` (required) Infra allows you to execute the following actions: @@ -220,7 +229,21 @@ polywrap infra [options] - `-o, --modules ` Use only specified modules -**TODO: Extend documentation with examples, more information** +#### Defaults + +Polywrap comes with a default `eth-ens-ipfs` module which can be used to test your wrappers locally: + +``` +polywrap infra up --modules=eth-ens-ipfs +``` + +The default infrastructure module defines a docker container with: + +- A test server at http://localhost:4040 +- A Ganache Ethereum test network at http://localhost:8545 +- An IPFS node at http://localhost:5001 + +It also sets up ENS smart contracts at initialization, so you can build wrappers and deploy them to an ENS registry on your locally hosted testnet. The Ethereum address of the ENS registry is 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab. ### `test | t` From 2bc2e797d9a25932f692778bde1a69df5508cde7 Mon Sep 17 00:00:00 2001 From: Pileks Date: Tue, 25 Oct 2022 12:19:19 +0200 Subject: [PATCH 09/11] CLI Docs - remove TODO note --- packages/cli/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index db30eec39e..46b63c7621 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -115,7 +115,6 @@ This command generates types and bindings for your project based on your project - `-s, --script ` Path to a custom generation script (JavaScript | TypeScript). This script is run in place of the standard codegen script if provided. - **TODO: Add details about the custom codegen script** - `-c, --client-config ` Use a custom Polywrap Client configuration. From 4bc1b854681345504d637c644363f52d0b31041c Mon Sep 17 00:00:00 2001 From: Pileks Date: Sun, 30 Oct 2022 19:24:01 +0100 Subject: [PATCH 10/11] Update CLI README --- packages/cli/README.md | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index 46b63c7621..b71eace7cf 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -78,6 +78,7 @@ This outputs the project's ABI schema (Wasm and Interface) and binary package (W - `-c, --client-config ` Use a custom Polywrap Client configuration. + See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-n, --no-codegen` Don't perform codegen before building. @@ -118,6 +119,7 @@ This command generates types and bindings for your project based on your project - `-c, --client-config ` Use a custom Polywrap Client configuration. + See [The `-c, --client-config` option](#the--c,---client-config-option) for details #### Special note @@ -242,7 +244,13 @@ The default infrastructure module defines a docker container with: - A Ganache Ethereum test network at http://localhost:8545 - An IPFS node at http://localhost:5001 -It also sets up ENS smart contracts at initialization, so you can build wrappers and deploy them to an ENS registry on your locally hosted testnet. The Ethereum address of the ENS registry is 0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab. +It also sets up ENS smart contracts at initialization, so you can build wrappers and deploy them to an ENS registry on your locally hosted testnet. + +Addresses for the components of ENS: +- Registry: `0xe78A0F7E598Cc8b0Bb87894B0F60dD2a88d6a8Ab` +- Resolver: `0x5b1869D9A4C187F2EAa108f3062412ecf0526b24` +- Registrar: `0xD833215cBcc3f914bD1C9ece3EE7BF8B14f841bb` +- Reverse Registrar: `0xe982E462b094850F12AF94d21D470e21bE9D0E9C` ### `test | t` @@ -252,7 +260,7 @@ The `test` command executes a series of Wrapper invocations called **steps** org All steps within a job are run in series, while jobs are run in parallel. ```bash -polywrap run [options] +polywrap test [options] ``` #### Options @@ -262,6 +270,7 @@ polywrap run [options] - `-c, --client-config ` Use a custom Polywrap Client configuration. + See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-o, --output-file ` Specify the output file path for the workflow result @@ -419,6 +428,7 @@ polywrap docgen - `-c, --client-config ` Use a custom Polywrap Client configuration. + See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-i, --imports` Generate docs for your project's dependencies as well. @@ -491,6 +501,24 @@ polywrap manifest migrate polywrap m m -m custom-manifest.yaml ``` +### The `-c, --client-config` option + +The `build`, `codegen`, `docgen` and `test` commands allow the user to configure the Polywrap Client via the `-c, --client-config ` option. + +You can supply a path to a Javascript or Typescript module which exports a function named `getClientConfig`: + +```typescript +// asynchronous option +export async function getClientConfig( + defaultConfigs: Partial +): Promise> + +// synchronous option +export function getClientConfig( + defaultConfigs: Partial +): Partial +``` + ## Logging By default, the Polywrap CLI outputs all of its messages to the console. From 784712425d0cdad894a9991afadfb3d3a10f0c1c Mon Sep 17 00:00:00 2001 From: Pileks Date: Sun, 30 Oct 2022 19:25:34 +0100 Subject: [PATCH 11/11] CLI README - remove invalid links --- packages/cli/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/cli/README.md b/packages/cli/README.md index b71eace7cf..f30a75bf2d 100644 --- a/packages/cli/README.md +++ b/packages/cli/README.md @@ -78,7 +78,6 @@ This outputs the project's ABI schema (Wasm and Interface) and binary package (W - `-c, --client-config ` Use a custom Polywrap Client configuration. - See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-n, --no-codegen` Don't perform codegen before building. @@ -119,7 +118,6 @@ This command generates types and bindings for your project based on your project - `-c, --client-config ` Use a custom Polywrap Client configuration. - See [The `-c, --client-config` option](#the--c,---client-config-option) for details #### Special note @@ -270,7 +268,6 @@ polywrap test [options] - `-c, --client-config ` Use a custom Polywrap Client configuration. - See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-o, --output-file ` Specify the output file path for the workflow result @@ -428,7 +425,6 @@ polywrap docgen - `-c, --client-config ` Use a custom Polywrap Client configuration. - See [The `-c, --client-config` option](#the--c,---client-config-option) for details - `-i, --imports` Generate docs for your project's dependencies as well.