14 lines
369 B
JavaScript
14 lines
369 B
JavaScript
|
const spawnSync = require( 'child_process' ).spawnSync;
|
||
|
const fs = require( 'fs' );
|
||
|
|
||
|
if ( ! fs.existsSync( 'node_modules' ) ) {
|
||
|
console.log( 'No "node_modules" present, installing dependencies...' );
|
||
|
const installResult = spawnSync( 'npm', [ 'install' ], {
|
||
|
shell: true,
|
||
|
stdio: 'inherit',
|
||
|
} ).status;
|
||
|
if ( installResult ) {
|
||
|
process.exit( installResult );
|
||
|
}
|
||
|
}
|