fix(cli): dts pipe (#1532)

This commit is contained in:
LongYinan 2023-03-21 18:47:43 +08:00 committed by GitHub
parent 3d48d4464b
commit 0f0837f5ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -646,14 +646,28 @@ export class BuildCommand extends Command {
jsBindingFilePath,
idents,
)
if (this.pipe && jsBindingFilePath) {
if (this.pipe) {
if (jsBindingFilePath) {
const pipeCommand = `${this.pipe} ${jsBindingFilePath}`
console.info(`Run ${chalk.green(pipeCommand)}`)
try {
execSync(pipeCommand, { stdio: 'inherit', env: commandEnv })
} catch (e) {
console.warn(
chalk.bgYellowBright('Pipe the js binding file to command failed'),
chalk.bgYellowBright(
'Pipe the js binding file to command failed',
),
e,
)
}
}
const pipeCommand = `${this.pipe} ${dtsFilePath}`
console.info(`Run ${chalk.green(pipeCommand)}`)
try {
execSync(pipeCommand, { stdio: 'inherit', env: commandEnv })
} catch (e) {
console.warn(
chalk.bgYellowBright('Pipe the dts file to command failed'),
e,
)
}