File size: 496 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
const { spawnSync } = require( 'child_process' );
const fs = require( 'fs' );
if ( ! fs.existsSync( 'node_modules' ) ) {
console.log( 'No "node_modules" present, installing dependencies…' );
const installResult = spawnSync( 'yarn', [ 'install', '--immutable' ], {
shell: true,
stdio: 'inherit',
env: { ...process.env },
} );
if ( installResult.status ) {
console.error( 'failed to install: exited with code %d', installResult.status );
process.exit( installResult.status );
}
}
|