fix(cli): disable js binding generation if no --platform flag

This commit is contained in:
LongYinan 2021-12-18 15:40:38 +08:00
parent 45a74856d6
commit f577512952
No known key found for this signature in database
GPG key ID: C3666B7FC82ADAD7

View file

@ -76,7 +76,7 @@ export class BuildCommand extends Command {
jsBinding = Option.String('--js', 'index.js', { jsBinding = Option.String('--js', 'index.js', {
description: `Path to the JS binding file, pass ${chalk.underline( description: `Path to the JS binding file, pass ${chalk.underline(
chalk.yellow('false'), chalk.yellow('false'),
)} to disable it`, )} to disable it. Only affect if ${chalk.green('--target')} specified.`,
}) })
cargoCwd?: string = Option.String('--cargo-cwd', { cargoCwd?: string = Option.String('--cargo-cwd', {
@ -299,7 +299,9 @@ export class BuildCommand extends Command {
} }
} }
const jsBindingFilePath = const jsBindingFilePath =
this.jsBinding && this.jsBinding !== 'false' this.jsBinding &&
this.jsBinding !== 'false' &&
this.appendPlatformToFilename
? join(process.cwd(), this.jsBinding) ? join(process.cwd(), this.jsBinding)
: null : null
await writeJsBinding(binaryName, packageName, jsBindingFilePath, idents) await writeJsBinding(binaryName, packageName, jsBindingFilePath, idents)