diff --git a/cli/src/consts.ts b/cli/src/consts.ts index 66c74912..646cef3c 100644 --- a/cli/src/consts.ts +++ b/cli/src/consts.ts @@ -22,6 +22,7 @@ export function getNapiConfig( : releaseVersion const version = releaseVersionWithoutPrefix ?? packageVersion const packageName = napi?.package?.name ?? name + const npmClient: string = napi?.npmClient ?? 'npm' const binaryName: string = napi?.name ?? 'index' @@ -32,5 +33,6 @@ export function getNapiConfig( binaryName, packageJsonPath, content: pkgJson, + npmClient, } } diff --git a/cli/src/pre-publish.ts b/cli/src/pre-publish.ts index 6d8d9045..0051a975 100644 --- a/cli/src/pre-publish.ts +++ b/cli/src/pre-publish.ts @@ -38,8 +38,14 @@ export class PrePublishCommand extends Command { skipGHRelease = Option.Boolean('--skip-gh-release', false) async execute() { - const { packageJsonPath, platforms, version, packageName, binaryName } = - getNapiConfig(this.configFileName) + const { + packageJsonPath, + platforms, + version, + packageName, + binaryName, + npmClient, + } = getNapiConfig(this.configFileName) debug(`Update optionalDependencies in [${packageJsonPath}]`) if (!this.isDryRun) { await VersionCommand.updatePackageJson(this.prefix, this.configFileName) @@ -73,7 +79,7 @@ export class PrePublishCommand extends Command { console.warn(`[${chalk.yellowBright(dstPath)}] is not existed`) continue } - await spawn('npm publish', { + await spawn(`${npmClient} publish`, { cwd: pkgDir, env: process.env, })