Commit 3a93f831 authored by wildfirecode's avatar wildfirecode

1

parent dc6246ad
// const publish = require('./publish');
const ora = require('ora'); const ora = require('ora');
const rm = require('rimraf'); const rm = require('rimraf');
const path = require('path'); const path = require('path');
...@@ -48,4 +47,39 @@ let build = opts => { ...@@ -48,4 +47,39 @@ let build = opts => {
}); });
}; };
module.exports = build; let buildTS = opts => {
if (!opts.BUILD_SKIN) {
console.error('请输入需要构建的项目名称\n');
return false;
}
const dist = path.join(process.cwd(), opts.BUILD_SKIN, 'bin-release')
rm(dist, err => {
if (err) throw err;
let webpackConfig = prodConfig(opts);
var spinner = ora('building for production...\n');
spinner.start();
// 构建
webpack(webpackConfig, function (err, stats) {
spinner.stop();
if (err) throw err;
process.stdout.write(
stats.toString({
colors: true,
modules: false,
children: false,
chunks: false,
chunkModules: false
}) + '\n\n'
);
console.log(chalk.cyan('Build complete.\n'));
shelljs.cd(opts.BUILD_SKIN);
shelljs.exec('node publish.js');
shelljs.cd('..');
});
});
};
module.exports = {
build: build,
buildTS: buildTS
};
const devServer = require('./build/dev-server'); const devServer = require('./build/dev-server');
const build = require('./build/build'); const buildObj = require('./build/build');
// const backup = require('./util/backup'); // const backup = require('./util/backup');
// const copy = require('./util/copy'); // const copy = require('./util/copy');
...@@ -38,33 +38,17 @@ class DuibaGameBuild { ...@@ -38,33 +38,17 @@ class DuibaGameBuild {
devServer.start(this.opts); devServer.start(this.opts);
} }
/**
* 构建 daily库 dui88环境
* @param {*} skin 皮肤名称
*/
build(skin) {
this.opts.sourceMap = false;
this.opts.daily = true;
this.buildBase(skin);
}
/**
* 构建 duiba库 生产环境
* @param {*} skin 皮肤名称
*/
buildProd(skin) { buildProd(skin) {
this.buildBase(skin); this.slicePath(skin);
buildObj.build(this.opts);
} }
/** buildProdTS(skin) {
* 构建 统一入口
* @param {*} skin 皮肤名称
*/
buildBase(skin) {
this.slicePath(skin); this.slicePath(skin);
build(this.opts); buildObj.buildTS(this.opts);
} }
/** /**
* 备份 把skins/下的所有文件复制到backup/下 * 备份 把skins/下的所有文件复制到backup/下
*/ */
......
...@@ -17,5 +17,5 @@ ...@@ -17,5 +17,5 @@
"co": "^4.6.0", "co": "^4.6.0",
"progress": "^2.0.0" "progress": "^2.0.0"
}, },
"version": "0.0.3" "version": "0.0.5"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment