UNPKG

@gravityforms/gulp-tasks

Version:
26 lines (22 loc) 881 B
#!/usr/bin/env node 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 ); } } )();