mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-23 03:27:08 -04:00
Update.
This commit is contained in:
parent
2a3f860473
commit
8889ac4e2e
3 changed files with 133 additions and 151 deletions
30
ghu.js
30
ghu.js
|
@ -10,13 +10,25 @@ const TEST = join(ROOT, 'test');
|
|||
const BUILD = join(ROOT, 'build');
|
||||
|
||||
const mapper = mapfn.p(SRC, BUILD).s('.less', '.css').s('.pug', '');
|
||||
const webpack_cfg = (...include) => {
|
||||
const cfg = webpack.cfg(include);
|
||||
cfg.module.rules.push({
|
||||
test: /jsdom/,
|
||||
loader: 'null-loader'
|
||||
});
|
||||
return cfg;
|
||||
const WEBPACK_CFG = {
|
||||
mode: 'none',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /.js$/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env']
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /jsdom/,
|
||||
use: 'null-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
ghu.defaults('release');
|
||||
|
@ -53,7 +65,7 @@ ghu.task('clean', 'delete build folder', () => {
|
|||
|
||||
ghu.task('build:scripts', runtime => {
|
||||
return read(`${SRC}/_h5ai/public/js/scripts.js`)
|
||||
.then(webpack(webpack_cfg(SRC)))
|
||||
.then(webpack(WEBPACK_CFG))
|
||||
.then(wrap('\n\n// @include "pre.js"\n\n'))
|
||||
.then(includeit())
|
||||
.then(ife(() => runtime.args.production, uglify()))
|
||||
|
@ -108,7 +120,7 @@ ghu.task('build:tests', ['build:styles'], 'build the test suite', () => {
|
|||
.then(write(`${BUILD}/test/index.html`, {overwrite: true})),
|
||||
|
||||
read(`${TEST}: index.js`)
|
||||
.then(webpack(webpack_cfg(SRC, TEST)))
|
||||
.then(webpack(WEBPACK_CFG))
|
||||
.then(wrap(`\n\n// @include "${SRC}/**/js/pre.js"\n\n`))
|
||||
.then(includeit())
|
||||
.then(write(mapfn.p(TEST, `${BUILD}/test`), {overwrite: true}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue