woocommerce/plugins/woocommerce-admin/bin/install-if-no-packages.js

14 lines
370 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( 'pnpm', [ 'install' ], {
shell: true,
stdio: 'inherit',
} ).status;
if ( installResult ) {
process.exit( installResult );
}
}