From 6531a9d83419232e23c10a9a84e1d228bdccfdeb Mon Sep 17 00:00:00 2001 From: SHUANG SU Date: Tue, 19 Nov 2019 01:44:26 +0800 Subject: [PATCH] fix: fix dev script. --- gulpfile.js | 26 ++++++++++++++++++-------- package.json | 3 +++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 98c38683..9744db9a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -15,9 +15,9 @@ var argv = require('yargs').argv; * Usage: * * ```shell - * ./nodule_modules/.bin/gulp release --env asf - * ./nodule_modules/.bin/gulp release --env echartsjs - * ./nodule_modules/.bin/gulp release --env dev # the same as "debug" + * ./node_modules/.bin/gulp release --env asf + * ./node_modules/.bin/gulp release --env echartsjs + * ./node_modules/.bin/gulp release --env dev # the same as "debug" * # Check `./config` to see the available env * ``` * ------------------------------------------------------------------------ @@ -25,12 +25,13 @@ var argv = require('yargs').argv; function initEnv() { var envType = argv.env; - var isDev = argv.dev != null || argv.debug != null || envType === 'debug'; + var isDev = argv.dev != null || argv.debug != null || envType === 'debug' || envType === 'dev'; if (isDev) { - console.warn('============================='); - console.warn('!!! THIS IS IN DEV MODE !!!'); - console.warn('============================='); + console.warn('===================================================================='); + console.warn('THIS IS IN DEV MODE'); + console.warn('!!! Please input your local host in `config/env.dev.js` firstly !!!'); + console.warn('===================================================================='); envType = 'dev'; } @@ -38,7 +39,16 @@ function initEnv() { throw new Error('--env MUST be specified'); } - return require('./config/env.' + envType); + var config = require('./config/env.' + envType); + + if (isDev) { + console.warn('===================================================================='); + console.warn('Please visit the website: '); + console.warn(config.host); + console.warn('===================================================================='); + } + + return config; } var config = initEnv(); diff --git a/package.json b/package.json index 91a83ed0..c606b5ed 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "echarts-examples", "version": "0.0.0", "private": true, + "scripts": { + "dev": "./node_modules/.bin/gulp release --env dev" + }, "devDependencies": { "app-module-path": "^2.2.0", "argparse": "^1.0.9",