mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-23 14:12:27 -05:00
28 lines
641 B
JavaScript
28 lines
641 B
JavaScript
|
const childProcess = require('child_process');
|
||
|
const path = require('path');
|
||
|
|
||
|
// process.argv: ['node', 'run-in-gui.js', 'foo', ...]
|
||
|
const args = process.argv.slice(2);
|
||
|
args.unshift('run');
|
||
|
// args: ['run', 'foo', ...]
|
||
|
|
||
|
// copy environment (including PATH) then add or replace BUILD_MODE and STATIC_PATH
|
||
|
const env = {
|
||
|
...process.env,
|
||
|
BUILD_MODE: 'dist',
|
||
|
STATIC_PATH: 'static'
|
||
|
};
|
||
|
|
||
|
const child = childProcess.spawnSync(
|
||
|
'npm', args,
|
||
|
{
|
||
|
cwd: path.join('node_modules', 'scratch-gui'),
|
||
|
env,
|
||
|
shell: true,
|
||
|
stdio: 'inherit'
|
||
|
}
|
||
|
);
|
||
|
|
||
|
if (child.error) throw child.error;
|
||
|
process.exit(child.status);
|