fix(cli): should not throw if cargoName is provided but no package.name
This commit is contained in:
parent
a88bc57ea3
commit
8700da1776
2 changed files with 9 additions and 0 deletions
7
.github/workflows/cli-binary.yml
vendored
7
.github/workflows/cli-binary.yml
vendored
|
@ -51,6 +51,13 @@ jobs:
|
||||||
env:
|
env:
|
||||||
RUST_BACKTRACE: 1
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
|
- name: Pass -p and --cargo-name to build
|
||||||
|
run: |
|
||||||
|
node ./cli/scripts/index.js build -p napi-examples-binary --cargo-name napi-examples-binary
|
||||||
|
./napi-examples-binary
|
||||||
|
env:
|
||||||
|
RUST_BACKTRACE: 1
|
||||||
|
|
||||||
- name: Clear the cargo caches
|
- name: Clear the cargo caches
|
||||||
run: |
|
run: |
|
||||||
cargo install cargo-cache --no-default-features --features ci-autoclean
|
cargo install cargo-cache --no-default-features --features ci-autoclean
|
||||||
|
|
|
@ -204,6 +204,8 @@ export class BuildCommand extends Command {
|
||||||
let cargoPackageName: string
|
let cargoPackageName: string
|
||||||
if (tomlContent.package?.name) {
|
if (tomlContent.package?.name) {
|
||||||
cargoPackageName = tomlContent.package.name
|
cargoPackageName = tomlContent.package.name
|
||||||
|
} else if (this.cargoName) {
|
||||||
|
cargoPackageName = this.cargoName
|
||||||
} else {
|
} else {
|
||||||
throw new TypeError('No package.name field in Cargo.toml')
|
throw new TypeError('No package.name field in Cargo.toml')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue