Skip to content

Commit 1334bb3

Browse files
committed
fix: readd bootstrap.js
1 parent 3465711 commit 1334bb3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

scripts/bootstrap.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const os = require('os');
2+
const path = require('path');
3+
const child_process = require('child_process');
4+
5+
const root = path.resolve(__dirname, '..');
6+
const args = process.argv.slice(2);
7+
const options = {
8+
cwd: process.cwd(),
9+
env: process.env,
10+
stdio: 'inherit',
11+
encoding: 'utf-8',
12+
};
13+
14+
if (os.type() === 'Windows_NT') {
15+
options.shell = true;
16+
}
17+
18+
let result;
19+
20+
if (process.cwd() !== root || args.length) {
21+
// We're not in the root of the project, or additional arguments were passed
22+
// In this case, forward the command to `yarn`
23+
result = child_process.spawnSync('yarn', args, options);
24+
} else {
25+
// If `yarn` is run without arguments, perform bootstrap
26+
result = child_process.spawnSync('yarn', ['bootstrap'], options);
27+
}
28+
29+
process.exitCode = result.status;

0 commit comments

Comments
 (0)