From 27a8581d1db38cfe93d100bb146cfb73eee5a528 Mon Sep 17 00:00:00 2001 From: Jasper De Moor Date: Sun, 18 Apr 2021 17:52:28 +0200 Subject: [PATCH] add cwd docs and RUST_TARGET --- cli/README.md | 8 ++++++++ cli/src/build.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/README.md b/cli/README.md index cdac5127..618213da 100644 --- a/cli/README.md +++ b/cli/README.md @@ -66,6 +66,8 @@ If not set, cli will read the `package.name` field in `Cargo.toml` under `proces > default `undefined` +You can also define this value using the `RUST_TARGET` environment variable. + This value will be passed to `Cargo build` command directly. eg: `napi build --target x86_64-unknown-linux-musl` #### `--cargo-flags` @@ -74,6 +76,12 @@ This value will be passed to `Cargo build` command directly. eg: `napi build --t Other flags you want pass to `Cargo build`. +#### `--cargo-cwd` + +> default `undefined` + +This flag can be used to build binaries that are not in the current directory. The path that is passed to this flag should be relative to the current directory. + ### `napi artifacts` > Copy artifact files in Github actions. diff --git a/cli/src/build.ts b/cli/src/build.ts index ce250279..8dfa4c4a 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -30,7 +30,7 @@ export class BuildCommand extends Command { cargoName?: string @Command.String('--target') - targetTripleDir = '' + targetTripleDir = process.env.RUST_TARGET ?? '' @Command.String('--features') features?: string