const {resolve, join} = require('path'); const {ghu, babel, includeit, pug, less, cssmin, jszip, mapfn, read, remove, uglify, wrap, write} = require('ghu'); const NAME = 'jquery-fracs'; const ROOT = resolve(__dirname); const SRC = join(ROOT, 'src'); const BUILD = join(ROOT, 'build'); const DIST = join(ROOT, 'dist'); ghu.defaults('release'); ghu.before(runtime => { runtime.pkg = Object.assign({}, require('./package.json')); runtime.comment = `${runtime.pkg.name} v${runtime.pkg.version} - ${runtime.pkg.homepage}`; runtime.commentJs = `/*! ${runtime.comment} */\n`; console.log(runtime.comment); }); ghu.task('clean', 'delete build folder', () => { return remove(`${BUILD}, ${DIST}`); }); ghu.task('build:scripts', runtime => { return read(`${SRC}/*.js`) .then(babel({presets: ['@babel/preset-env']})) .then(wrap(runtime.commentJs)) .then(write(mapfn.p(SRC, DIST), {overwrite: true})) .then(write(mapfn.p(SRC, BUILD).s('.js', `-${runtime.pkg.version}.js`), {overwrite: true})) .then(uglify())