Shell: true for windows
This commit is contained in:
@ -34,7 +34,9 @@ async function appBuild_vite(params: {
|
|||||||
|
|
||||||
assert(buildContext.bundler.type === "vite");
|
assert(buildContext.bundler.type === "vite");
|
||||||
|
|
||||||
const dResult = new Deferred<{ isSuccess: boolean }>();
|
const dIsSuccess = new Deferred<boolean>();
|
||||||
|
|
||||||
|
console.log(chalk.blue("Running: 'npx vite build'"));
|
||||||
|
|
||||||
const child = child_process.spawn("npx", ["vite", "build"], {
|
const child = child_process.spawn("npx", ["vite", "build"], {
|
||||||
cwd: buildContext.projectDirPath,
|
cwd: buildContext.projectDirPath,
|
||||||
@ -51,9 +53,9 @@ async function appBuild_vite(params: {
|
|||||||
|
|
||||||
child.stderr.on("data", data => process.stderr.write(data));
|
child.stderr.on("data", data => process.stderr.write(data));
|
||||||
|
|
||||||
child.on("exit", code => dResult.resolve({ isSuccess: code === 0 }));
|
child.on("exit", code => dIsSuccess.resolve(code === 0));
|
||||||
|
|
||||||
const { isSuccess } = await dResult.pr;
|
const isSuccess = await dIsSuccess.pr;
|
||||||
|
|
||||||
return { isAppBuildSuccess: isSuccess };
|
return { isAppBuildSuccess: isSuccess };
|
||||||
}
|
}
|
||||||
@ -123,40 +125,35 @@ async function appBuild_webpack(params: {
|
|||||||
for (const subCommand of appBuildSubCommands) {
|
for (const subCommand of appBuildSubCommands) {
|
||||||
const dIsSuccess = new Deferred<boolean>();
|
const dIsSuccess = new Deferred<boolean>();
|
||||||
|
|
||||||
child_process.exec(
|
console.log(chalk.blue(`Running: '${subCommand}'`));
|
||||||
subCommand,
|
|
||||||
{
|
|
||||||
cwd: buildContext.bundler.packageJsonDirPath,
|
|
||||||
env: {
|
|
||||||
...process.env,
|
|
||||||
PATH: (() => {
|
|
||||||
const separator = pathSep === "/" ? ":" : ";";
|
|
||||||
|
|
||||||
return [
|
const [command, ...args] = subCommand.split(" ");
|
||||||
pathJoin(
|
|
||||||
buildContext.bundler.packageJsonDirPath,
|
const child = child_process.spawn(command, args, {
|
||||||
"node_modules",
|
cwd: buildContext.bundler.packageJsonDirPath,
|
||||||
".bin"
|
env: {
|
||||||
),
|
...process.env,
|
||||||
...(process.env.PATH ?? "").split(separator)
|
PATH: (() => {
|
||||||
].join(separator);
|
const separator = pathSep === "/" ? ":" : ";";
|
||||||
})()
|
|
||||||
}
|
return [
|
||||||
|
pathJoin(
|
||||||
|
buildContext.bundler.packageJsonDirPath,
|
||||||
|
"node_modules",
|
||||||
|
".bin"
|
||||||
|
),
|
||||||
|
...(process.env.PATH ?? "").split(separator)
|
||||||
|
].join(separator);
|
||||||
|
})()
|
||||||
},
|
},
|
||||||
(error, stdout, stderr) => {
|
shell: true
|
||||||
if (error) {
|
});
|
||||||
dIsSuccess.resolve(false);
|
|
||||||
|
|
||||||
console.log(chalk.red(`Error running: '${subCommand}'`));
|
child.stdout.on("data", data => process.stdout.write(data));
|
||||||
console.log(stdout);
|
|
||||||
console.log(stderr);
|
|
||||||
|
|
||||||
return;
|
child.stderr.on("data", data => process.stderr.write(data));
|
||||||
}
|
|
||||||
|
|
||||||
dIsSuccess.resolve(true);
|
child.on("exit", code => dIsSuccess.resolve(code === 0));
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
const isSuccess = await dIsSuccess.pr;
|
const isSuccess = await dIsSuccess.pr;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user