Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
lrsjng committed Apr 28, 2019
1 parent e36c0d0 commit ff54558
Show file tree
Hide file tree
Showing 12 changed files with 389 additions and 2,127 deletions.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
/coverage/
/dist/
/node_modules/
/**/vendor/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/build/
/coverage/
/local/
/node_modules/
/npm-debug.log
4 changes: 2 additions & 2 deletions dist/kjua.min.js

Large diffs are not rendered by default.

34 changes: 19 additions & 15 deletions ghu.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const {resolve, join} = require('path');
const {ghu, includeit, jszip, mapfn, pug, read, remove, uglify, webpack, wrap, write} = require('ghu');
const {ghu, jszip, mapfn, pug, read, remove, uglify, webpack, wrap, write} = require('ghu');

const NAME = 'kjua';

const ROOT = resolve(__dirname);
const SRC = join(ROOT, 'src');
const DEMO = join(SRC, 'demo');
const BUILD = join(ROOT, 'build');
const DIST = join(ROOT, 'dist');

Expand All @@ -24,30 +23,35 @@ ghu.task('clean', () => {

ghu.task('build:script', runtime => {
return read(`${SRC}/${NAME}.js`)
.then(webpack(webpack.cfg_umd(NAME, [SRC]), {showStats: false}))
.then(includeit())
.then(webpack(webpack.cfg_umd(NAME, [SRC])))
.then(uglify())
.then(wrap(runtime.commentJs))
.then(write(`${DIST}/${NAME}.min.js`, {overwrite: true}))
.then(write(`${BUILD}/${NAME}-${runtime.pkg.version}.min.js`, {overwrite: true}));
});

ghu.task('build:copy', () => {
return read(`${ROOT}/*.md`)
.then(write(mapfn.p(ROOT, BUILD), {overwrite: true}));
});

ghu.task('build:demo', runtime => {
ghu.task('build:other', runtime => {
const mapper = mapfn.p(SRC, BUILD).s('.pug', '');
return Promise.all([
read(`${DEMO}/*.pug`)
read(`${ROOT}/*.md`)
.then(write(mapfn.p(ROOT, BUILD), {overwrite: true})),

read(`${SRC}/demo/*.pug`)
.then(pug({pkg: runtime.pkg}))
.then(write(mapper, {overwrite: true})),
read(`${SRC}/demo: *, !*.pug`)
.then(write(mapper, {overwrite: true})),

read(`${SRC}/test/*.pug`)
.then(pug({pkg: runtime.pkg}))
.then(write(mapfn.p(SRC, BUILD).s('.pug', ''), {overwrite: true})),
read(`${DEMO}: *, !*.pug`)
.then(write(mapfn.p(SRC, BUILD), {overwrite: true}))
.then(write(mapper, {overwrite: true})),
read(`${SRC}/test/*.js`)
.then(webpack(webpack.cfg([SRC])))
.then(write(mapper, {overwrite: true}))
]);
});

ghu.task('build', ['build:script', 'build:copy', 'build:demo']);
ghu.task('build', ['build:script', 'build:other']);

ghu.task('zip', ['build'], runtime => {
return read(`${BUILD}/**`)
Expand Down
Loading

0 comments on commit ff54558

Please sign in to comment.