Authored by 陈峰

Merge branch 'feature/build' into 'release/6.8.5'

build change



See merge request !419
{}
\ No newline at end of file
... ...
... ... @@ -9,9 +9,10 @@
},
"scripts": {
"start": "node app.js",
"dev": "nodemon -e js,hbs -i public/ app.js",
"dev": "nodemon -e js,hbs -i public/ -i dist/ app.js",
"static": "webpack-dev-server --config ./public/build/webpack.dev.config.js",
"build": "webpack --config ./public/build/webpack.prod.config.js",
"build:node": "node ./public/build/node-build.js",
"online": "NODE_ENV=\"production\" node app.js",
"debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js",
"lint-js": "eslint -c .eslintrc --cache --fix .",
... ...
const shelljs = require('shelljs');
const path = require('path');
const distDir = path.join(__dirname, '../../dist/node');
shelljs.rm('-rf', distDir);
shelljs.mkdir('-p', distDir);
const cpPaths = [
'favicon.ico',
'.npmrc',
'process.json',
'Dockerfile',
'yarn.lock',
'package.json',
'*.js',
'config',
'apps',
'doraemon',
'mix',
'utils',
'static',
'manifest.json'
];
new Promise(resolve => { // 加载manifest.json文件
resolve();
}).then(() => { // 拷贝node代码
cpPaths.forEach(p => {
let dist = distDir;
let file = p;
if (typeof p === 'object') {
dist = path.join(dist, p[1]);
file = p[0];
if (!shelljs.test('-e', dist)) {
shelljs.mkdir('-p', dist);
}
}
shelljs.cp('-R', path.join(__dirname, '../../', file), dist);
});
}).then(() => { // 安装依赖和清理node_modules
shelljs.cd(distDir);
if (shelljs.exec('yarn --production=true').code !== 0) {
throw 'yarn install faild';
}
}).catch(error => {
console.error(`error:${error}`);
return process.exit(1); //eslint-disable-line
});
... ...
... ... @@ -18,7 +18,7 @@ const opacity = require('postcss-opacity');
const spritescore = require('postcss-sprites/lib/core');
const config = require('../../package.json');
const devInfo = require('./dev-info.js');
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);
const distDir = path.join(__dirname, `../../dist/statics/${config.name}/${config.version}`);
const dist = {
img: distDir + '/img',
font: distDir + '/font'
... ...
... ... @@ -5,7 +5,7 @@ const shelljs = require('shelljs');
const _ = require('lodash');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const config = require('../../package.json');
const distDir = path.join(__dirname, `../dist/${config.name}/${config.version}`);
const distDir = path.join(__dirname, `../../dist/statics/${config.name}/${config.version}`);
let baseConfig = require('./webpack.base.config.js');
// cope img font
... ...