diff options
author | Sam Potts <sam@potts.es> | 2020-04-28 23:17:54 +1000 |
---|---|---|
committer | Sam Potts <sam@potts.es> | 2020-04-28 23:17:54 +1000 |
commit | adb3f359203e7e3e6dad06376f63630f3880fb8f (patch) | |
tree | a98619b86ac317d12c24fa5aff16e42639832d1d /tasks | |
parent | a58b8bf4bb8218f3828f9a7ae680807488324c01 (diff) | |
download | plyr-adb3f359203e7e3e6dad06376f63630f3880fb8f.tar.lz plyr-adb3f359203e7e3e6dad06376f63630f3880fb8f.tar.xz plyr-adb3f359203e7e3e6dad06376f63630f3880fb8f.zip |
v3.6.1
Diffstat (limited to 'tasks')
-rw-r--r-- | tasks/deploy.js | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/tasks/deploy.js b/tasks/deploy.js index 22fdb444..d505d188 100644 --- a/tasks/deploy.js +++ b/tasks/deploy.js @@ -42,6 +42,7 @@ Object.values(deploy).forEach(target => { // Paths const root = path.join(__dirname, '..'); const paths = { + demo: path.join(root, 'demo/'), upload: [ path.join(root, `dist/*${minSuffix}.*`), path.join(root, 'dist/*.css'), @@ -97,8 +98,8 @@ const sizeOptions = { showFiles: true, gzip: true }; const regex = '(?:0|[1-9][0-9]*)\\.(?:0|[1-9][0-9]*).(?:0|[1-9][0-9]*)(?:-[\\da-z\\-]+(?:.[\\da-z\\-]+)*)?(?:\\+[\\da-z\\-]+(?:.[\\da-z\\-]+)*)?'; const semver = new RegExp(`v${regex}`, 'gi'); -const localPath = new RegExp('(../)?dist', 'gi'); -const versionPath = `https://${deploy.cdn.domain}/${version}`; +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 => { @@ -127,14 +128,14 @@ gulp.task('version', done => { const { domain } = deploy.cdn; - log(`Uploading ${ansi.green.bold(version)} to ${ansi.cyan(domain)}...`); + log(`Updating version in files to ${ansi.green.bold(version)}...`); // Replace versioned URLs in source const files = ['plyr.js', 'plyr.polyfilled.js', 'config/defaults.js']; return gulp .src( - files.map(file => path.join(__dirname, `src/js/${file}`)), + files.map(file => path.join(root, `src/js/${file}`)), { base: '.' }, ) .pipe(replace(semver, `v${version}`)) @@ -190,7 +191,7 @@ gulp.task('purge', () => { .pipe( through.obj((file, enc, cb) => { const filename = file.path.split('/').pop(); - list.push(`${versionPath}/${filename.replace(minSuffix, '')}`); + list.push(`${versionPath}${filename.replace(minSuffix, '')}`); cb(null); }), ) @@ -229,14 +230,14 @@ gulp.task('demo', done => { // Replace versioned files in README.md gulp - .src([`${__dirname}/README.md`]) + .src([`${root}/README.md`]) .pipe(replace(cdnpath, `${domain}/${version}/`)) - .pipe(gulp.dest(__dirname)); + .pipe(gulp.dest(root)); // Replace local file paths with remote paths in demo HTML // e.g. "../dist/plyr.js" to "https://cdn.plyr.io/x.x.x/plyr.js" - const index = `${paths.demo.root}index.html`; - const error = `${paths.demo.root}error.html`; + const index = `${paths.demo}index.html`; + const error = `${paths.demo}error.html`; const pages = [index]; if (branch.current === branch.master) { |