From f577512952b0409ab76422ce539872af16a98d77 Mon Sep 17 00:00:00 2001 From: LongYinan Date: Sat, 18 Dec 2021 15:40:38 +0800 Subject: [PATCH] fix(cli): disable js binding generation if no --platform flag --- cli/src/build.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/src/build.ts b/cli/src/build.ts index 55c7b670..4dcc2360 100644 --- a/cli/src/build.ts +++ b/cli/src/build.ts @@ -76,7 +76,7 @@ export class BuildCommand extends Command { jsBinding = Option.String('--js', 'index.js', { description: `Path to the JS binding file, pass ${chalk.underline( chalk.yellow('false'), - )} to disable it`, + )} to disable it. Only affect if ${chalk.green('--target')} specified.`, }) cargoCwd?: string = Option.String('--cargo-cwd', { @@ -299,7 +299,9 @@ export class BuildCommand extends Command { } } const jsBindingFilePath = - this.jsBinding && this.jsBinding !== 'false' + this.jsBinding && + this.jsBinding !== 'false' && + this.appendPlatformToFilename ? join(process.cwd(), this.jsBinding) : null await writeJsBinding(binaryName, packageName, jsBindingFilePath, idents)