fix(docs): spawn nested npm through Node on Windows
parent
75d2c1b583
commit
0c6b30cfa7
|
|
@ -4,7 +4,10 @@ import { resolve, dirname } from 'node:path';
|
|||
import { fileURLToPath } from 'node:url';
|
||||
const root = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
function run(dir, script) {
|
||||
const result = spawnSync('npm', ['run', script], { cwd: resolve(root, dir), stdio: 'inherit' });
|
||||
const npmCLI = process.env.npm_execpath;
|
||||
if (!npmCLI) throw new Error('Run the site build through npm so npm_execpath is available.');
|
||||
const result = spawnSync(process.execPath, [npmCLI, 'run', script], { cwd: resolve(root, dir), stdio: 'inherit' });
|
||||
if (result.error) throw new Error(`Could not run npm ${script}: ${result.error.message}`);
|
||||
if (result.status !== 0) process.exit(result.status || 1);
|
||||
}
|
||||
for (const dir of ['homepage', '.']) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue