94 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-02-20 14:38:25 -08:00
const { series, watch, src, dest } = require('gulp');
2020-02-20 14:38:25 -08:00
/** */
2020-02-20 14:38:25 -08:00
var build = require('../build');
2020-02-20 14:38:25 -08:00
const devBuildTask = build.everything();
const prodBuildTask = build.everything(true);
const pagesTask = build.pages();
const twitterTask = build.twitter();
exports.pages = () => pagesTask();
2020-02-20 14:38:25 -08:00
const scss = exports.scss = build.task('scss');
const favicon = exports.favicon = build.task('favicon');
const svg = exports.svg = build.task('svg');
const scripts = exports.scripts = build.task('scripts');
2020-02-20 14:38:25 -08:00
var cleanTask = require('./clean');
exports.clean = cleanTask;
const pushToProd = require('./publish');
exports.push = pushToProd;
const cloudfront = require('./cloudfront');
exports.cloudfront = cloudfront;
exports.new = require('../build/new-post');
2020-02-29 16:28:11 -08:00
function copyProd () {
return src('dist/**/*').pipe(dest('published'));
}
/** */
2020-02-20 14:38:25 -08:00
exports.dev = series(devBuildTask);
exports.prod = series(prodBuildTask);
2020-02-20 14:38:25 -08:00
exports.publish = series(
cleanTask,
2020-02-21 20:05:52 -08:00
prodBuildTask,
2020-02-20 14:38:25 -08:00
pushToProd,
cleanTask.prodBackup,
copyProd,
cloudfront.prod
2020-02-20 14:38:25 -08:00
);
exports.testpush = pushToProd.dryrun;
/** */
2020-02-20 14:38:25 -08:00
function watcher () {
watch([
'public/**/*.{md,hbs,html,js,json}',
'posts/**/*.{md,hbs,html,js,json}',
'templates/*.{md,hbs,html,js,json}',
], pagesTask);
watch([
'twitter-i18n.json',
], series(twitterTask, pagesTask));
watch([
'scss/*.scss',
], scss);
watch([
'js/*.{js,jsx}',
], scripts);
watch([
'svg/**/*.svg',
], svg);
watch([
'favicon.png',
], favicon);
2020-02-20 14:38:25 -08:00
server();
2020-02-20 14:38:25 -08:00
}
function server () {
var forever = require('forever');
var srv = new forever.Monitor('server.js');
srv.start();
forever.startServer(srv);
}
exports.watch = series(devBuildTask, watcher);
2020-02-21 20:05:52 -08:00
exports.uat = series(cleanTask, prodBuildTask, server);
2020-02-20 14:38:25 -08:00
/** */
2020-02-20 14:38:25 -08:00
exports.default = series(cleanTask.dev, devBuildTask, watcher);