File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 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 ;
You can’t perform that action at this time.
0 commit comments