From 3a3c3659a77b21380d10a7d16e9e500c014df4d6 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Thu, 10 Jan 2019 10:59:00 +0100 Subject: [PATCH] Use Webpack for builds in scripts package --- packages/scripts/scripts/build.js | 15 ++++++--------- packages/scripts/scripts/start.js | 16 ++++++---------- webpack.config.js => webpack.configs.js | 0 3 files changed, 12 insertions(+), 19 deletions(-) rename webpack.config.js => webpack.configs.js (100%) diff --git a/packages/scripts/scripts/build.js b/packages/scripts/scripts/build.js index da6bccccd6132..025607bff0479 100644 --- a/packages/scripts/scripts/build.js +++ b/packages/scripts/scripts/build.js @@ -17,24 +17,21 @@ const args = getCliArgs(); const hasWebpackConfig = hasCliArg( '--config' ) || hasProjectFile( 'webpack.config.js' ) || - hasProjectFile( 'webpackfile.js' ); + hasProjectFile( 'webpack.config.babel.js' ); -let result; if ( hasWebpackConfig ) { // Sets environment to production. process.env.NODE_ENV = 'production'; - result = spawn( + const { status } = spawn( resolveBin( 'webpack' ), [ ...args ], { stdio: 'inherit' } ); + process.exit( status ); } else { - result = spawn( - resolveBin( 'parcel' ), - [ 'build', ...args ], - { stdio: 'inherit' } - ); + // eslint-disable-next-line no-console + console.log( 'Webpack config file is missing.' ); + process.exit( 1 ); } -process.exit( result.status ); diff --git a/packages/scripts/scripts/start.js b/packages/scripts/scripts/start.js index b20aaa3c497c6..b425f2f6e3875 100644 --- a/packages/scripts/scripts/start.js +++ b/packages/scripts/scripts/start.js @@ -17,21 +17,17 @@ const args = getCliArgs(); const hasWebpackConfig = hasCliArg( '--config' ) || hasProjectFile( 'webpack.config.js' ) || - hasProjectFile( 'webpackfile.js' ); + hasProjectFile( 'webpack.config.babel.js' ); -let result; if ( hasWebpackConfig ) { - result = spawn( + const { status } = spawn( resolveBin( 'webpack' ), [ '--watch', ...args ], { stdio: 'inherit' } ); + process.exit( status ); } else { - result = spawn( - resolveBin( 'parcel' ), - [ 'watch', ...args ], - { stdio: 'inherit' } - ); + // eslint-disable-next-line no-console + console.log( 'Webpack config file is missing.' ); + process.exit( 1 ); } - -process.exit( result.status ); diff --git a/webpack.config.js b/webpack.configs.js similarity index 100% rename from webpack.config.js rename to webpack.configs.js