feat(cli): support npmClient config (#1253)
This commit is contained in:
parent
e30019aa5c
commit
cb6fffd73f
2 changed files with 11 additions and 3 deletions
|
@ -22,6 +22,7 @@ export function getNapiConfig(
|
||||||
: releaseVersion
|
: releaseVersion
|
||||||
const version = releaseVersionWithoutPrefix ?? packageVersion
|
const version = releaseVersionWithoutPrefix ?? packageVersion
|
||||||
const packageName = napi?.package?.name ?? name
|
const packageName = napi?.package?.name ?? name
|
||||||
|
const npmClient: string = napi?.npmClient ?? 'npm'
|
||||||
|
|
||||||
const binaryName: string = napi?.name ?? 'index'
|
const binaryName: string = napi?.name ?? 'index'
|
||||||
|
|
||||||
|
@ -32,5 +33,6 @@ export function getNapiConfig(
|
||||||
binaryName,
|
binaryName,
|
||||||
packageJsonPath,
|
packageJsonPath,
|
||||||
content: pkgJson,
|
content: pkgJson,
|
||||||
|
npmClient,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,14 @@ export class PrePublishCommand extends Command {
|
||||||
skipGHRelease = Option.Boolean('--skip-gh-release', false)
|
skipGHRelease = Option.Boolean('--skip-gh-release', false)
|
||||||
|
|
||||||
async execute() {
|
async execute() {
|
||||||
const { packageJsonPath, platforms, version, packageName, binaryName } =
|
const {
|
||||||
getNapiConfig(this.configFileName)
|
packageJsonPath,
|
||||||
|
platforms,
|
||||||
|
version,
|
||||||
|
packageName,
|
||||||
|
binaryName,
|
||||||
|
npmClient,
|
||||||
|
} = getNapiConfig(this.configFileName)
|
||||||
debug(`Update optionalDependencies in [${packageJsonPath}]`)
|
debug(`Update optionalDependencies in [${packageJsonPath}]`)
|
||||||
if (!this.isDryRun) {
|
if (!this.isDryRun) {
|
||||||
await VersionCommand.updatePackageJson(this.prefix, this.configFileName)
|
await VersionCommand.updatePackageJson(this.prefix, this.configFileName)
|
||||||
|
@ -73,7 +79,7 @@ export class PrePublishCommand extends Command {
|
||||||
console.warn(`[${chalk.yellowBright(dstPath)}] is not existed`)
|
console.warn(`[${chalk.yellowBright(dstPath)}] is not existed`)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
await spawn('npm publish', {
|
await spawn(`${npmClient} publish`, {
|
||||||
cwd: pkgDir,
|
cwd: pkgDir,
|
||||||
env: process.env,
|
env: process.env,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue