From a9b416f7bdd75739ea8ca93975735c0cc4db2386 Mon Sep 17 00:00:00 2001 From: "Jocelyn Badgley (Twipped)" Date: Mon, 12 Oct 2020 15:16:55 -0700 Subject: [PATCH] Copy published build into /published folder so we can do diffs on future changes --- .gitignore | 1 + gulp/clean.js | 5 +++++ gulp/index.js | 8 +++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ab9b301..586097c 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ node_modules /analytics/RAW/* /analytics/combined.log /assets.json +/published diff --git a/gulp/clean.js b/gulp/clean.js index f7581d7..28c8e33 100644 --- a/gulp/clean.js +++ b/gulp/clean.js @@ -11,3 +11,8 @@ exports.dev = function cleanDistributionForDev () { return src([ 'dist/**.{js|json|jsx}', 'rev-manifest.json', 'pages.json', 'assets.json' ], { read: false, allowEmpty: true }) .pipe(clean()); }; + +exports.prodBackup = function cleanProdCopy () { + return src([ 'published' ], { read: false, allowEmpty: true }) + .pipe(clean()); +}; diff --git a/gulp/index.js b/gulp/index.js index 0feb2dc..aabcd9f 100644 --- a/gulp/index.js +++ b/gulp/index.js @@ -1,5 +1,5 @@ -const { series, watch } = require('gulp'); +const { series, watch, src, dest } = require('gulp'); /** **************************************************************************************************************** **/ @@ -26,6 +26,10 @@ exports.cloudfront = cloudfront; exports.new = require('../build/new-post.js'); +function copyProd () { + return src('dist/**/*').pipe(dest('published')); +} + /** **************************************************************************************************************** **/ exports.dev = series(devBuildTask); @@ -34,6 +38,8 @@ exports.publish = series( cleanTask, prodBuildTask, pushToProd, + cleanTask.prodBackup, + copyProd, cloudfront.prod, ); exports.testpush = pushToProd.dryrun;