mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-23 11:37:03 -04:00
Update ghu.js.
This commit is contained in:
parent
2153056266
commit
1fc72d8473
1 changed files with 16 additions and 33 deletions
49
ghu.js
49
ghu.js
|
@ -10,6 +10,20 @@ const TEST = join(ROOT, 'test');
|
|||
const BUILD = join(ROOT, 'build');
|
||||
|
||||
const mapper = mapfn.p(SRC, BUILD).s('.less', '.css').s('.pug', '');
|
||||
const webpackCfg = include => ({
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
include,
|
||||
loader: 'babel-loader',
|
||||
query: {
|
||||
cacheDirectory: true,
|
||||
presets: ['es2015']
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
ghu.defaults('release');
|
||||
|
||||
|
@ -49,25 +63,9 @@ ghu.task('lint', 'lint all JavaScript files with eslint', () => {
|
|||
});
|
||||
|
||||
ghu.task('build:scripts', runtime => {
|
||||
const webpackConfig = {
|
||||
output: {},
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
include: [SRC],
|
||||
loader: 'babel',
|
||||
query: {
|
||||
presets: ['es2015'],
|
||||
cacheDirectory: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
return read(`${SRC}/_h5ai/public/js/scripts.js`)
|
||||
.then(newerThan(mapper, `${SRC}/_h5ai/public/js/**`))
|
||||
.then(webpack(webpackConfig, {showStats: false}))
|
||||
.then(webpack(webpackCfg([SRC]), {showStats: false}))
|
||||
.then(wrap('\n\n// @include "pre.js"\n\n'))
|
||||
.then(includeit())
|
||||
.then(ife(() => runtime.args.production, uglify()))
|
||||
|
@ -119,21 +117,6 @@ ghu.task('build:copy', runtime => {
|
|||
});
|
||||
|
||||
ghu.task('build:tests', ['build:styles'], 'build the test suite', () => {
|
||||
const webpackConfig = {
|
||||
module: {
|
||||
loaders: [
|
||||
{
|
||||
include: [TEST],
|
||||
loader: 'babel',
|
||||
query: {
|
||||
presets: ['es2015'],
|
||||
cacheDirectory: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
return Promise.all([
|
||||
read(`${BUILD}/_h5ai/public/css/styles.css`)
|
||||
.then(newerThan(`${BUILD}/test/h5ai-styles.css`))
|
||||
|
@ -144,7 +127,7 @@ ghu.task('build:tests', ['build:styles'], 'build the test suite', () => {
|
|||
.then(write(`${BUILD}/test/tests.html`, {overwrite: true})),
|
||||
|
||||
read(`${TEST}: tests.js`)
|
||||
.then(webpack(webpackConfig, {showStats: false}))
|
||||
.then(webpack(webpackCfg([SRC, TEST]), {showStats: false}))
|
||||
.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