mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(cloudcmd) NODE_ENV: debug -> development
This commit is contained in:
parent
56882ee489
commit
efb381eb97
4 changed files with 15 additions and 15 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -20,5 +20,5 @@ server_
|
|||
*.swp
|
||||
|
||||
dist
|
||||
dist-debug
|
||||
dist-dev
|
||||
|
||||
|
|
|
|||
12
package.json
12
package.json
|
|
@ -44,8 +44,7 @@
|
|||
},
|
||||
"scripts": {
|
||||
"start": "node bin/cloudcmd.js",
|
||||
"start:debug": "NODE_ENV=debug node bin/cloudcmd.js",
|
||||
"start:dev": "nodemon bin/cloudcmd.js",
|
||||
"start:dev": "NODE_ENV=debug node bin/cloudcmd.js",
|
||||
"security": "nsp check",
|
||||
"codestyle": "redrun lint spell",
|
||||
"lint": "redrun lint:*",
|
||||
|
|
@ -60,7 +59,6 @@
|
|||
"eslint:client": "eslint --rule 'no-console:0' --env browser client",
|
||||
"fix:eslint": "redrun eslint:client -- --fix",
|
||||
"test": "tape 'test/**/*.js'",
|
||||
"watch:test": "nodemon -w server -w test -w common -x \"npm run test\"",
|
||||
"spell": "yaspeller .",
|
||||
"wisdom": "npm run build; npm run docker:rm-old; bin/release.js",
|
||||
"postpublish": "redrun docker",
|
||||
|
|
@ -84,11 +82,13 @@
|
|||
"6to5:bin": "babel bin -d legacy/bin",
|
||||
"6to5:server": "babel server -d server_",
|
||||
"6to5:client": "webpack --progress",
|
||||
"6to5:client:debug": "NODE_ENV=debug redrun 6to5:client",
|
||||
"6to5:client:dev": "NODE_ENV=development redrun 6to5:client",
|
||||
"watch:client": "redrun 6to5:client -- --watch",
|
||||
"watch:server": "nodemon bin/cloudcmd.js",
|
||||
"watch:test": "nodemon -w server -w test -w common -x \"npm run test\"",
|
||||
"w:c": "redrun watch:client",
|
||||
"watch:client:debug": "redrun 6to5:client:debug -- --watch",
|
||||
"w:c:d": "redrun watch:client:debug",
|
||||
"watch:client:dev": "redrun 6to5:client:dev -- --watch",
|
||||
"w:c:d": "redrun watch:client:dev",
|
||||
"build": "redrun rm:* 6to5:* mkdir:* legacy:*",
|
||||
"legacy:package": "echo \"module.exports = require('../package');\" > legacy/package.js",
|
||||
"mkdir:server": "mkdirp legacy/server",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ const root = () => config('root');
|
|||
const emptyFunc = (req, res, next) => next();
|
||||
emptyFunc.middle = () => emptyFunc;
|
||||
|
||||
const isDebug = process.env.NODE_ENV === 'debug';
|
||||
const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
function getPrefix(prefix) {
|
||||
if (typeof prefix === 'function')
|
||||
|
|
@ -302,8 +302,8 @@ function setUrl(pref) {
|
|||
if (/^\/cloudcmd\.js(\.map)?$/.test(req.url))
|
||||
req.url = `/dist${req.url}`;
|
||||
|
||||
if (isDebug)
|
||||
req.url = req.url.replace(/^\/dist\//, '/dist-debug/');
|
||||
if (isDev)
|
||||
req.url = req.url.replace(/^\/dist\//, '/dist-dev/');
|
||||
|
||||
next();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ const dir = './client';
|
|||
const dirExternal = './node_modules';
|
||||
|
||||
const {env} = process;
|
||||
const isDebug = env.NODE_ENV === 'debug';
|
||||
const isDev = env.NODE_ENV === 'development';
|
||||
|
||||
const dist = path.resolve(__dirname, 'dist');
|
||||
const distDebug = path.resolve(__dirname, 'dist-debug');
|
||||
const devtool = isDebug ? 'eval' : 'source-map';
|
||||
const distDev = path.resolve(__dirname, 'dist-dev');
|
||||
const devtool = isDev ? 'eval' : 'source-map';
|
||||
const notEmpty = (a) => a;
|
||||
const clean = (array) => array.filter(notEmpty);
|
||||
|
||||
const plugins = clean([
|
||||
!isDebug && new UglifyJsPlugin({
|
||||
!isDev && new UglifyJsPlugin({
|
||||
sourceMap: true
|
||||
}),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
|
|
@ -47,7 +47,7 @@ module.exports = {
|
|||
},
|
||||
output: {
|
||||
filename: '[name].js',
|
||||
path: isDebug ? distDebug : dist,
|
||||
path: isDev ? distDev : dist,
|
||||
libraryTarget: 'umd'
|
||||
},
|
||||
plugins,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue