diff options
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/build.js | 9 | ||||
-rw-r--r-- | tasks/deploy.js | 16 |
2 files changed, 13 insertions, 12 deletions
diff --git a/tasks/build.js b/tasks/build.js index 9f1efd4f..271545d9 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -30,6 +30,7 @@ const plumber = require('gulp-plumber'); const size = require('gulp-size'); const sourcemaps = require('gulp-sourcemaps'); const browserSync = require('browser-sync').create(); +const gulpIf = require('gulp-if'); // Configs const build = require('../build.json'); // Info from package @@ -74,8 +75,8 @@ const tasks = { const sizeOptions = { showFiles: true, gzip: true }; // Clean out /dist -gulp.task('clean', done => { - const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*')); +gulp.task('clean', (done) => { + const dirs = [paths.plyr.output, paths.demo.output].map((dir) => path.join(dir, '**/*')); // Don't delete the mp4 dirs.push(`!${path.join(paths.plyr.output, '**/*.mp4')}`); @@ -89,7 +90,7 @@ gulp.task('clean', done => { Object.entries(build.js).forEach(([filename, entry]) => { const { dist, formats, namespace, polyfill, src } = entry; - formats.forEach(format => { + formats.forEach((format) => { const name = `js:${filename}:${format}`; const extension = format === 'es' ? 'mjs' : 'js'; tasks.js.push(name); @@ -128,7 +129,7 @@ Object.entries(build.js).forEach(([filename, entry]) => { }, ), ) - .pipe(header('typeof navigator === "object" && ')) // "Support" SSR (#935) + .pipe(gulpIf(() => extension !== 'mjs', header('typeof navigator === "object" && '))) // "Support" SSR (#935) .pipe( rename({ extname: `.${extension}`, diff --git a/tasks/deploy.js b/tasks/deploy.js index d505d188..42fa14e8 100644 --- a/tasks/deploy.js +++ b/tasks/deploy.js @@ -27,7 +27,7 @@ const { version } = pkg; const minSuffix = '.min'; // Get AWS config -Object.values(deploy).forEach(target => { +Object.values(deploy).forEach((target) => { Object.assign(target, { publisher: publish.create({ region: target.region, @@ -102,7 +102,7 @@ const localPath = new RegExp('(../)?dist/', 'gi'); const versionPath = `https://${deploy.cdn.domain}/${version}/`; const cdnpath = new RegExp(`${deploy.cdn.domain}/${regex}/`, 'gi'); -const renameFile = rename(p => { +const renameFile = rename((p) => { p.basename = p.basename.replace(minSuffix, ''); // eslint-disable-line p.dirname = p.dirname.replace('.', version); // eslint-disable-line }); @@ -120,7 +120,7 @@ const canDeploy = () => { return true; }; -gulp.task('version', done => { +gulp.task('version', (done) => { if (!canDeploy()) { done(); return null; @@ -135,7 +135,7 @@ gulp.task('version', done => { return gulp .src( - files.map(file => path.join(root, `src/js/${file}`)), + files.map((file) => path.join(root, `src/js/${file}`)), { base: '.' }, ) .pipe(replace(semver, `v${version}`)) @@ -144,7 +144,7 @@ gulp.task('version', done => { }); // Publish version to CDN bucket -gulp.task('cdn', done => { +gulp.task('cdn', (done) => { if (!canDeploy()) { done(); return null; @@ -198,7 +198,7 @@ gulp.task('purge', () => { .on('end', () => { const purge = new FastlyPurge(fastly.token); - list.forEach(url => { + list.forEach((url) => { log(`Purging ${ansi.cyan(url)}...`); purge.url(url, (error, result) => { @@ -213,7 +213,7 @@ gulp.task('purge', () => { }); // Publish to demo bucket -gulp.task('demo', done => { +gulp.task('demo', (done) => { if (!canDeploy()) { done(); return null; @@ -248,7 +248,7 @@ gulp.task('demo', done => { .src(pages) .pipe(replace(localPath, versionPath)) .pipe( - rename(p => { + rename((p) => { if (options.demo.uploadPath) { // eslint-disable-next-line no-param-reassign p.dirname += options.demo.uploadPath; |