aboutsummaryrefslogtreecommitdiffstats
path: root/tasks/deploy.js
diff options
context:
space:
mode:
Diffstat (limited to 'tasks/deploy.js')
-rw-r--r--tasks/deploy.js55
1 files changed, 5 insertions, 50 deletions
diff --git a/tasks/deploy.js b/tasks/deploy.js
index 42fa14e8..5860f908 100644
--- a/tasks/deploy.js
+++ b/tasks/deploy.js
@@ -10,15 +10,13 @@ const gulp = require('gulp');
const gitbranch = require('git-branch');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
-const ansi = require('ansi-colors');
+const { green, cyan, bold } = require('colorette');
const log = require('fancy-log');
const open = require('gulp-open');
const size = require('gulp-size');
-const through = require('through2');
// Deployment
const aws = require('aws-sdk');
const publish = require('gulp-awspublish');
-const FastlyPurge = require('fastly-purge');
// Configs
const pkg = require('../package.json');
const deploy = require('../deploy.json');
@@ -53,14 +51,6 @@ const paths = {
],
};
-// Get credentials
-let credentials = {};
-try {
- credentials = require('../credentials.json'); //eslint-disable-line
-} catch (e) {
- // Do nothing
-}
-
// Get branch info
const branch = {
current: gitbranch.sync(),
@@ -128,7 +118,7 @@ gulp.task('version', (done) => {
const { domain } = deploy.cdn;
- log(`Updating version in files to ${ansi.green.bold(version)}...`);
+ log(`Updating version in files to ${green(bold(version))}...`);
// Replace versioned URLs in source
const files = ['plyr.js', 'plyr.polyfilled.js', 'config/defaults.js'];
@@ -156,7 +146,7 @@ gulp.task('cdn', (done) => {
throw new Error('No publisher instance. Check AWS configuration.');
}
- log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);
+ log(`Uploading ${green(bold(pkg.version))} to ${cyan(domain)}...`);
// Upload to CDN
return (
@@ -177,41 +167,6 @@ gulp.task('cdn', (done) => {
);
});
-// Purge the fastly cache incase any 403/404 are cached
-gulp.task('purge', () => {
- if (!Object.keys(credentials).includes('fastly')) {
- throw new Error('Fastly credentials required to purge cache.');
- }
-
- const { fastly } = credentials;
- const list = [];
-
- return gulp
- .src(paths.upload)
- .pipe(
- through.obj((file, enc, cb) => {
- const filename = file.path.split('/').pop();
- list.push(`${versionPath}${filename.replace(minSuffix, '')}`);
- cb(null);
- }),
- )
- .on('end', () => {
- const purge = new FastlyPurge(fastly.token);
-
- list.forEach((url) => {
- log(`Purging ${ansi.cyan(url)}...`);
-
- purge.url(url, (error, result) => {
- if (error) {
- log.error(error);
- } else if (result) {
- log(result);
- }
- });
- });
- });
-});
-
// Publish to demo bucket
gulp.task('demo', (done) => {
if (!canDeploy()) {
@@ -226,7 +181,7 @@ gulp.task('demo', (done) => {
throw new Error('No publisher instance. Check AWS configuration.');
}
- log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);
+ log(`Uploading ${green(bold(pkg.version))} to ${cyan(domain)}...`);
// Replace versioned files in README.md
gulp
@@ -271,4 +226,4 @@ gulp.task('open', () => {
});
// Do everything
-gulp.task('deploy', gulp.series('cdn', 'demo', 'purge', 'open'));
+gulp.task('deploy', gulp.series('cdn', 'demo', 'open'));