@gravityforms/gulp-tasks
Version:
Configurable Gulp tasks for use in Gravity Forms projects.
26 lines (22 loc) • 881 B
JavaScript
const fs = require( 'fs' );
const path = require( 'path' );
const packagesDir = path.resolve( __dirname, '../../../' );
const utilsPath = path.join( packagesDir, 'utils' );
const gulpTasksPath = path.join( packagesDir, 'gulp-tasks' );
const { deleteDirectory, execShellCommand } = require( './util' );
async function init() {
await deleteDirectory( path.join( path.join( utilsPath, 'dist' ) ) );
await execShellCommand( `cd "${ gulpTasksPath }" && cross-env NODE_ENV=utilsdev npx webpack && cross-env NODE_ENV=utilsprod npx webpack --mode production`, true );
}
( async () => {
try {
if ( ! fs.existsSync( utilsPath ) ) {
console.log( 'utils package not found. Skipping dist generation for that package.' );
return;
}
await init();
} catch ( err ) {
console.error( 'An error occurred during generating utils dist files: ', err );
}
} )();