UNPKG

@gravityforms/gulp-tasks

Version:
26 lines (22 loc) 911 B
#!/usr/bin/env node const fs = require( 'fs' ); const path = require( 'path' ); const packagesDir = path.resolve( __dirname, '../../../' ); const librariesPath = path.join( packagesDir, 'libraries' ); const gulpTasksPath = path.join( packagesDir, 'gulp-tasks' ); const { deleteDirectory, execShellCommand } = require( './util' ); async function init() { await deleteDirectory( path.join( path.join( librariesPath, 'dist' ) ) ); await execShellCommand( `cd "${ gulpTasksPath }" && cross-env NODE_ENV=librariesdev npx webpack && cross-env NODE_ENV=librariesprod npx webpack --mode production`, true ); } ( async () => { try { if ( ! fs.existsSync( librariesPath ) ) { console.log( 'libraries package not found. Skipping dist generation for that package.' ); return; } await init(); } catch ( err ) { console.error( 'An error occurred during generating library dist files: ', err ); } } )();