Skip to content

Commit

Permalink
Merge pull request sampotts#1356 from sampotts/develop
Browse files Browse the repository at this point in the history
v3.5.1
  • Loading branch information
sampotts authored Feb 23, 2019
2 parents 80990c9 + 83eda17 commit 4d3b6b8
Show file tree
Hide file tree
Showing 8 changed files with 274 additions and 661 deletions.
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ demo
.github
.vscode
*.code-workspace
build.json
credentials.json
bundles.json
deploy.json
yarn.lock
package-lock.json
*.mp4
Expand Down
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v3.5.1

- Fixed build issues with babel and browserslist

## v3.5.0

- Preview seek/scrubbing thumbnails (thanks @jamesoflol)
Expand Down
82 changes: 39 additions & 43 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const header = require('gulp-header');
const gitbranch = require('git-branch');
const rename = require('gulp-rename');
const replace = require('gulp-replace');
const ansi = require('ansi-colors');
const log = require('fancy-log');
const open = require('gulp-open');
const plumber = require('gulp-plumber');
Expand Down Expand Up @@ -104,32 +105,14 @@ const tasks = {
css: [],
js: [],
sprite: [],
clean: ['clean'],
clean: 'clean',
};

// Size plugin
const sizeOptions = { showFiles: true, gzip: true };

// Babel config
const babelrc = (polyfill = false) => ({
presets: [
[
'@babel/preset-env',
{
targets: {
browsers,
},
useBuiltIns: polyfill ? 'usage' : false,
modules: false,
},
],
],
babelrc: false,
exclude: 'node_modules/**',
});

// Clean out /dist
gulp.task('clean', done => {
gulp.task(tasks.clean, done => {
const dirs = [paths.plyr.output, paths.demo.output].map(dir => path.join(dir, '**/*'));

// Don't delete the mp4
Expand All @@ -148,19 +131,34 @@ Object.entries(build.js).forEach(([filename, entry]) => {
const polyfill = filename.includes('polyfilled');
const extension = format === 'es' ? 'mjs' : 'js';

gulp.task(name, () => {
return gulp
gulp.task(name, () =>
gulp
.src(entry.src)
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(
rollup(
{
plugins: [resolve(), commonjs(), babel(babelrc(polyfill))],
plugins: [
resolve(),
commonjs(),
babel({
presets: [
[
'@babel/env',
{
// debug: true,
useBuiltIns: polyfill ? 'usage' : false,
},
],
],
babelrc: false,
exclude: [/\/core-js\//],
}),
],
},
{
name: entry.namespace,
// exports: 'named',
format,
},
),
Expand All @@ -172,13 +170,13 @@ Object.entries(build.js).forEach(([filename, entry]) => {
}),
)
.pipe(gulp.dest(entry.dist))
.pipe(filter(`**/*${extension}`))
.pipe(filter(`**/*.${extension}`))
.pipe(terser())
.pipe(rename({ suffix: minSuffix }))
.pipe(size(sizeOptions))
.pipe(sourcemaps.write(''))
.pipe(gulp.dest(entry.dist));
});
.pipe(gulp.dest(entry.dist)),
);
});
});

Expand All @@ -187,8 +185,8 @@ Object.entries(build.css).forEach(([filename, entry]) => {
const name = `css:${filename}`;
tasks.css.push(name);

gulp.task(name, () => {
return gulp
gulp.task(name, () =>
gulp
.src(entry.src)
.pipe(plumber())
.pipe(sass())
Expand All @@ -199,27 +197,25 @@ Object.entries(build.css).forEach(([filename, entry]) => {
)
.pipe(clean())
.pipe(size(sizeOptions))
.pipe(gulp.dest(entry.dist));
});
.pipe(gulp.dest(entry.dist)),
);
});

// SVG Sprites
Object.entries(build.sprite).forEach(([filename, entry]) => {
const name = `sprite:${filename}`;
tasks.sprite.push(name);

log(path.basename(filename));

gulp.task(name, () => {
return gulp
gulp.task(name, () =>
gulp
.src(entry.src)
.pipe(plumber())
.pipe(imagemin())
.pipe(svgstore())
.pipe(rename({ basename: path.parse(filename).name }))
.pipe(size(sizeOptions))
.pipe(gulp.dest(entry.dist));
});
.pipe(gulp.dest(entry.dist)),
);
});

// Build all JS
Expand Down Expand Up @@ -317,7 +313,7 @@ gulp.task('version', done => {

const { domain } = deploy.cdn;

console.log(`Updating versions to '${version}'...`);
log(`Uploading ${ansi.green.bold(version)} to ${ansi.cyan(domain)}...`);

// Replace versioned URLs in source
const files = ['plyr.js', 'plyr.polyfilled.js', 'config/defaults.js'];
Expand All @@ -342,7 +338,7 @@ gulp.task('cdn', done => {
throw new Error('No publisher instance. Check AWS configuration.');
}

console.log(`Uploading '${version}' to ${domain}...`);
log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);

// Upload to CDN
return (
Expand Down Expand Up @@ -385,13 +381,13 @@ gulp.task('purge', () => {
const purge = new FastlyPurge(fastly.token);

list.forEach(url => {
console.log(`Purging ${url}...`);
log(`Purging ${ansi.cyan(url)}...`);

purge.url(url, (error, result) => {
if (error) {
console.log(error);
log.error(error);
} else if (result) {
console.log(result);
log(result);
}
});
});
Expand All @@ -412,7 +408,7 @@ gulp.task('demo', done => {
throw new Error('No publisher instance. Check AWS configuration.');
}

console.log(`Uploading '${version}' demo to ${deploy.demo.domain}...`);
log(`Uploading ${ansi.green.bold(pkg.version)} to ${ansi.cyan(domain)}...`);

// Replace versioned files in readme.md
gulp.src([`${__dirname}/readme.md`])
Expand Down
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plyr",
"version": "3.5.0",
"version": "3.5.1",
"description": "A simple, accessible and customizable HTML5, YouTube and Vimeo media player",
"homepage": "https://plyr.io",
"author": "Sam Potts <[email protected]>",
Expand All @@ -27,24 +27,21 @@
"bugs": {
"url": "https://github.com/sampotts/plyr/issues"
},
"browserslist": [
"> 1%",
"not dead"
],
"browserslist": "> 1%",
"scripts": {
"build": "gulp build",
"lint": "eslint src/js && npm run-script remark",
"remark": "remark -f --use 'validate-links=repository:\"sampotts/plyr\"' '{,!(node_modules),.?**/}*.md'",
"deploy": "yarn lint && gulp deploy"
},
"devDependencies": {
"aws-sdk": "^2.404.0",
"ansi-colors": "^3.2.3",
"aws-sdk": "^2.409.0",
"@babel/core": "^7.3.3",
"@babel/preset-env": "^7.3.1",
"babel-eslint": "^10.0.1",
"babel-preset-minify": "^0.5.0",
"del": "^3.0.0",
"eslint": "^5.14.0",
"eslint": "^5.14.1",
"eslint-config-airbnb-base": "^13.1.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-import": "^2.16.0",
Expand All @@ -66,7 +63,7 @@
"gulp-replace": "^1.0.0",
"gulp-sass": "^4.0.2",
"gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.6.4",
"gulp-sourcemaps": "^2.6.5",
"gulp-svgstore": "^7.0.1",
"gulp-terser": "^1.1.7",
"postcss-custom-properties": "^8.0.9",
Expand All @@ -76,13 +73,13 @@
"remark-validate-links": "^8.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.0",
"rollup-plugin-node-resolve": "^4.0.0",
"rollup-plugin-node-resolve": "^4.0.1",
"stylelint": "^9.10.1",
"stylelint-config-prettier": "^4.0.0",
"stylelint-config-recommended": "^2.1.0",
"stylelint-config-sass-guidelines": "^5.3.0",
"stylelint-order": "^2.0.0",
"stylelint-scss": "^3.5.3",
"stylelint-scss": "^3.5.4",
"stylelint-selector-bem-pattern": "^2.0.0",
"through2": "^3.0.0"
},
Expand Down
16 changes: 8 additions & 8 deletions src/js/plugins/ads.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { buildUrlParams } from '../utils/urls';
class Ads {
/**
* Ads constructor.
* @param {object} player
* @param {Object} player
* @return {Ads}
*/
constructor(player) {
Expand Down Expand Up @@ -198,7 +198,7 @@ class Ads {

/**
* Update the ad countdown
* @param {boolean} start
* @param {Boolean} start
*/
pollCountdown(start = false) {
if (!start) {
Expand Down Expand Up @@ -559,7 +559,7 @@ class Ads {

/**
* Handles callbacks after an ad event was invoked
* @param {string} event - Event type
* @param {String} event - Event type
*/
trigger(event, ...args) {
const handlers = this.events[event];
Expand All @@ -575,8 +575,8 @@ class Ads {

/**
* Add event listeners
* @param {string} event - Event type
* @param {function} callback - Callback for when event occurs
* @param {String} event - Event type
* @param {Function} callback - Callback for when event occurs
* @return {Ads}
*/
on(event, callback) {
Expand All @@ -594,8 +594,8 @@ class Ads {
* The advertisement has 12 seconds to get its things together. We stop this timer when the
* advertisement is playing, or when a user action is required to start, then we clear the
* timer on ad ready
* @param {number} time
* @param {string} from
* @param {Number} time
* @param {String} from
*/
startSafetyTimer(time, from) {
this.player.debug.log(`Safety timer invoked from: ${from}`);
Expand All @@ -608,7 +608,7 @@ class Ads {

/**
* Clear our safety timer(s)
* @param {string} from
* @param {String} from
*/
clearSafetyTimer(from) {
if (!is.nullOrUndefined(this.safetyTimer)) {
Expand Down
Loading

0 comments on commit 4d3b6b8

Please sign in to comment.