diff --git a/bin/utils.js b/bin/utils.js index fede348..dd6ab9f 100644 --- a/bin/utils.js +++ b/bin/utils.js @@ -50,17 +50,17 @@ function getArgv() { if (argv.hostname === '') { consola.fatal('Provided hostname argument has no value') - process.exit(0) + process.exit(1) } if (argv.output === '') { consola.fatal('Provided output argument has no value') - process.exit(0) + process.exit(1) } if (argv.entry === '') { consola.fatal('Provided entry argument has no value') - process.exit(0) + process.exit(1) } string.forEach(index => { @@ -86,7 +86,7 @@ function getArgv() { const configFile = resolve(rootDir, argv['config-file']) if (!fs.existsSync(configFile)) { consola.fatal('configFile is not exists', configFile) - return process.exit(0) + return process.exit(1) } let options = {} @@ -96,7 +96,7 @@ function getArgv() { options = JSON.parse(jsonString) } catch (error) { consola.fatal('clear:', error) - return process.exit(0) + return process.exit(1) } path = resolve(rootDir, options.output || './dist/build') diff --git a/src/config/webpack.base.config.ts b/src/config/webpack.base.config.ts index ced7982..e1d3f68 100644 --- a/src/config/webpack.base.config.ts +++ b/src/config/webpack.base.config.ts @@ -15,7 +15,7 @@ export function getBaseConfig(options: ConfigOptions.options) { consola.fatal( 'getBaseConfig options.babelrc or options.webpack is undefined' ) - return process.exit(0) + return process.exit(1) } const mode = options.webpack.mode || 'production' const isProd = mode === 'production' diff --git a/src/config/webpack.dll.config.ts b/src/config/webpack.dll.config.ts index 3e31604..369808c 100644 --- a/src/config/webpack.dll.config.ts +++ b/src/config/webpack.dll.config.ts @@ -14,7 +14,7 @@ export function getDllConfig( ): webpack.Configuration { if (!(options.webpack && options.webpack.dll)) { consola.fatal('getDllConfig options.webpack.dll is undefined') - return process.exit(0) + return process.exit(1) } const mode = options.webpack.mode || 'production' diff --git a/src/config/webpack.extensions.config.ts b/src/config/webpack.extensions.config.ts index 7a78de4..1b8156f 100644 --- a/src/config/webpack.extensions.config.ts +++ b/src/config/webpack.extensions.config.ts @@ -21,7 +21,7 @@ export function getExtensionsConfig( consola.fatal( 'getExtensionsConfig options.extensions.entry or options.babelrc is undefined' ) - return process.exit(0) + return process.exit(1) } const babelLoder = { diff --git a/src/extensions.ts b/src/extensions.ts index 7001170..fc13d53 100644 --- a/src/extensions.ts +++ b/src/extensions.ts @@ -18,7 +18,7 @@ export async function serverExtensions(this: any, app?: Express, opt?: BuildServ if (opt && opt.noCompiler) { if (!app) { consola.fatal('serverExtensions', 'app is undefined') - return process.exit(0) + return process.exit(1) } const outputPath = config.extensions.path const entrys = config.extensions.entry @@ -31,7 +31,7 @@ export async function serverExtensions(this: any, app?: Express, opt?: BuildServ extensions = requireFromString(souce).default } catch (error) { consola.fatal('serverExtensions', error) - return process.exit(0) + return process.exit(1) } Object.keys(extensions).forEach(extensionKey => { const extension = extensions[extensionKey] diff --git a/src/render.ts b/src/render.ts index d484150..79a8cf1 100644 --- a/src/render.ts +++ b/src/render.ts @@ -153,7 +153,7 @@ function clientManifestAddDll(clientManifest: any) { }) } catch (error) { consola.fatal('clientManifestAddDll', error) - return process.exit(0) + return process.exit(1) } } return clientManifest @@ -212,6 +212,6 @@ export function serverRender(app: Express) { } } catch (error) { consola.fatal('config.render', error) - process.exit(0) + process.exit(1) } } diff --git a/src/utils/compiler.webpack.ts b/src/utils/compiler.webpack.ts index 85a0ce3..5f82dfc 100644 --- a/src/utils/compiler.webpack.ts +++ b/src/utils/compiler.webpack.ts @@ -81,7 +81,7 @@ function devCompiler({ consola.fatal( '{clientConfig, serverConfig}.{output, plugins, entry} is undefined' ) - return process.exit(0) + return process.exit(1) } const entry: any = clientConfig.entry @@ -165,7 +165,7 @@ export function compilerConfig( if (!(entry && output)) { consola.fatal('compilerConfig: entry or output is undefined') - return process.exit(0) + return process.exit(1) } webpackConfig.mode = mode @@ -189,7 +189,7 @@ export function compilerConfig( config = requireFromString(souce) } catch (error) { consola.fatal('compilerConfig', error) - return process.exit(0) + return process.exit(1) } finally { done(config) } @@ -205,7 +205,7 @@ export function compilerConfig( config = requireFromString(souce) } catch (error) { consola.fatal('compilerConfig', error) - return process.exit(0) + return process.exit(1) } finally { done(config) } @@ -215,7 +215,7 @@ export function compilerConfig( }) } else { consola.fatal('compilerConfig: config path not find.', path) - return process.exit(0) + return process.exit(1) } }) } @@ -235,7 +235,7 @@ export function compilerDll(options: ConfigOptions.options): Promise { stats.warnings.forEach((err: any) => consola.info(err)) if (stats.errors.length) { consola.fatal('build dll fail!') - return process.exit(0) + return process.exit(1) } done() }) @@ -265,7 +265,7 @@ export async function compilerExtensions( ) { if (!(options.webpack && options.extensions && options.webpack.mode)) { consola.fatal('options.extensions or options.webpack.mode is undefined') - return process.exit(0) + return process.exit(1) } const isProd = options.webpack.mode === 'production' @@ -289,7 +289,7 @@ function prodCompilerExtensions(options: ConfigOptions.options) { stats.warnings.forEach((err: any) => consola.info(err)) if (stats.errors.length) { consola.fatal('build extensions fail!') - return process.exit(0) + return process.exit(1) } done() }) @@ -310,7 +310,7 @@ function prodCompilerExtensions(options: ConfigOptions.options) { function devCompilerExtensions(options: ConfigOptions.options, app?: Express) { if (!(app && options.extensions && options.extensions.entry)) { consola.fatal('devCompilerExtensions: app is undefined') - return process.exit(0) + return process.exit(1) } const outputPath = options.extensions.path @@ -346,7 +346,7 @@ function devCompilerExtensions(options: ConfigOptions.options, app?: Express) { extensions = requireFromString(souce).default } catch (error) { consola.fatal('devCompilerExtensions', error) - return process.exit(0) + return process.exit(1) } Object.keys(extensions).forEach(extensionKey => { const extension = extensions[extensionKey] diff --git a/src/utils/index.ts b/src/utils/index.ts index 7ca70c8..c3d2c37 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -36,7 +36,7 @@ function getConfigFileOptions( const configFile = resolve(rootDir, argv['config-file']) if (!existsSync(configFile)) { consola.fatal('entry is not exists', configFile) - return process.exit(0) + return process.exit(1) } let options: any = {} @@ -46,7 +46,7 @@ function getConfigFileOptions( options = JSON.parse(jsonString) } catch (error) { consola.fatal(error) - return process.exit(0) + return process.exit(1) } const { entry, output, injectContext } = options @@ -129,7 +129,7 @@ function setVersion(options: ConfigOptions.options) { return options } catch (error) { consola.fatal('setVersion', error) - return process.exit(0) + return process.exit(1) } } @@ -187,7 +187,7 @@ function getInjectContext(configOptions: BuildService.parsedArgs.config) { Object.assign(injectContext, JSON.parse(jsonString)) } catch (error) { consola.fatal(error) - return process.exit(0) + return process.exit(1) } } return injectContext @@ -228,7 +228,7 @@ async function getUserConfig( } } else if (argv['config-file'] !== 'buildService.config.js') { consola.fatal('Could not load config file: ' + argv['config-file']) - return process.exit(0) + return process.exit(1) } if (!options.injectContext) { @@ -299,7 +299,7 @@ async function checkDll( if (argv.dll) { if (!(options.webpack && options.webpack.dll)) { consola.fatal('options.webpack.dll is undefined') - return process.exit(0) + return process.exit(1) } await compilerDll(options) @@ -376,7 +376,7 @@ export function serverStart( start() }, WAIT_TIME) } else { - process.exit(0) + process.exit(1) } }) server.on('listening', function() {