UNPKG

@gravityforms/gulp-tasks

Version:
30 lines (24 loc) 985 B
#!/usr/bin/env node import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { deleteDirectory, execShellCommand } from './util.js'; const __dirname = path.dirname( fileURLToPath( import.meta.url ) ); const packagesDir = path.resolve( __dirname, '../../../' ); const utilsPath = path.join( packagesDir, 'utils' ); const gulpTasksPath = path.join( packagesDir, 'gulp-tasks' ); 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 ); } } )();