2020-02-20 14:38:25 -08:00
|
|
|
|
2020-10-12 15:16:55 -07:00
|
|
|
const { series, watch, src, dest } = require('gulp');
|
2020-02-20 14:38:25 -08:00
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
2020-02-28 10:33:39 -08:00
|
|
|
var build = require('../build');
|
2020-02-20 14:38:25 -08:00
|
|
|
|
2020-02-28 10:33:39 -08:00
|
|
|
const devBuildTask = build.everything();
|
|
|
|
const prodBuildTask = build.everything(true);
|
2020-04-07 10:35:32 -07:00
|
|
|
const pagesTask = build.pages();
|
2022-06-01 00:06:53 -03:00
|
|
|
const twitterTask = build.twitter();
|
2020-04-07 10:35:32 -07:00
|
|
|
exports.pages = () => pagesTask();
|
2020-02-20 14:38:25 -08:00
|
|
|
|
2020-03-05 19:42:14 -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;
|
|
|
|
|
2020-02-29 16:28:11 -08:00
|
|
|
exports.new = require('../build/new-post.js');
|
|
|
|
|
2020-10-12 15:16:55 -07:00
|
|
|
function copyProd () {
|
|
|
|
return src('dist/**/*').pipe(dest('published'));
|
|
|
|
}
|
|
|
|
|
2020-02-20 14:38:25 -08:00
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
2020-02-28 10:27:52 -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,
|
2020-10-12 15:16:55 -07:00
|
|
|
cleanTask.prodBackup,
|
|
|
|
copyProd,
|
2020-02-20 14:38:25 -08:00
|
|
|
cloudfront.prod,
|
|
|
|
);
|
|
|
|
exports.testpush = pushToProd.dryrun;
|
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
|
|
|
function watcher () {
|
|
|
|
|
|
|
|
watch([
|
2022-06-01 00:06:53 -03:00
|
|
|
'public/**/*.{md,hbs,html,js,json}',
|
|
|
|
'posts/**/*.{md,hbs,html,js,json}',
|
|
|
|
'templates/*.{md,hbs,html,js,json}',
|
2020-04-07 10:35:32 -07:00
|
|
|
], pagesTask);
|
2020-03-05 19:42:14 -08:00
|
|
|
|
2022-06-01 00:06:53 -03:00
|
|
|
watch([
|
|
|
|
'twitter-i18n.json',
|
|
|
|
], series(twitterTask, pagesTask));
|
|
|
|
|
2020-03-05 19:42:14 -08:00
|
|
|
watch([
|
2020-02-28 09:15:21 -08:00
|
|
|
'scss/*.scss',
|
2020-03-05 19:42:14 -08:00
|
|
|
], scss);
|
|
|
|
|
|
|
|
watch([
|
2020-03-08 14:01:00 -07:00
|
|
|
'js/*.{js,jsx}',
|
2020-03-05 19:42:14 -08:00
|
|
|
], scripts);
|
|
|
|
|
|
|
|
watch([
|
|
|
|
'svg/**/*.svg',
|
|
|
|
], svg);
|
|
|
|
|
|
|
|
watch([
|
|
|
|
'favicon.png',
|
|
|
|
], favicon);
|
2020-02-20 14:38:25 -08:00
|
|
|
|
2020-02-28 10:27:52 -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);
|
|
|
|
}
|
|
|
|
|
2020-02-28 10:27:52 -08:00
|
|
|
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
|
|
|
|
|
|
|
/** **************************************************************************************************************** **/
|
|
|
|
|
|
|
|
exports.default = series(cleanTask.dev, devBuildTask, watcher);
|