Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to latest dependencies, and transpilation targets #1658

Merged
merged 8 commits into from
Oct 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ module.exports = {
rules: { rules: {
"jsdoc/check-types": 2, "jsdoc/check-types": 2,
"jsdoc/newline-after-description": 2, "jsdoc/newline-after-description": 2,
'indent': ['error', 2],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this being added for?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, now that I'm looking at the rest of the changes, I see what you're doing. But technically this isn't consistent with Google style because in some cases Google style recommends indenting 4 spaces (e.g. line continuations and stuff like that).

The google eslint package v0.10.0 adds an indentation rule more inline with what's recommended by Google JS style. It's probably worth just upgrading to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in person, there are going to be a lot of additional files that need whitespace adjustment if we don't include this.

We're already using "eslint-config-google": "^0.10.0" as part of this PR.

Let's do separate PR to remove this override and get all the whitespace consistent rather than including any more changes in this PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

}, },
plugins: [ plugins: [
'jsdoc', 'jsdoc',
], ],
parser: 'babel-eslint',
overrides: [{ overrides: [{
files: ['test/**/*.{js,mjs}'], files: ['test/**/*.{js,mjs}'],
parser: 'babel-eslint',
env: { env: {
mocha: true, mocha: true,
}, },
Expand Down
2 changes: 1 addition & 1 deletion demos/functions/cdn-details.json
Original file line number Original file line Diff line number Diff line change
@@ -1 +1 @@
{"latestUrl":"https://storage.googleapis.com/workbox-cdn/releases/3.6.1"} {"latestUrl":"https://storage.googleapis.com/workbox-cdn/releases/3.6.2"}
5,028 changes: 2,939 additions & 2,089 deletions demos/functions/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions demos/functions/package.json
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"name": "functions", "name": "functions",
"description": "Cloud Functions for Firebase", "description": "Cloud Functions for Firebase",
"dependencies": { "dependencies": {
"express": "^4.16.2", "express": "^4.16.3",
"express-handlebars": "^3.0.0", "express-handlebars": "^3.0.0",
"firebase-admin": "~5.4.0", "firebase-admin": "^6.0.0",
"firebase-functions": "^0.7.0", "firebase-functions": "^2.0.5",
"fs-extra": "^4.0.2" "fs-extra": "^7.0.0"
}, },
"private": true "private": true
} }
Empty file modified gulp-tasks/build-packages.js
Whitespace-only changes.
12 changes: 1 addition & 11 deletions gulp-tasks/docs.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs-extra');
const path = require('path'); const path = require('path');
const gulp = require('gulp'); const gulp = require('gulp');
const getNpmCmd = require('./utils/get-npm-cmd'); const getNpmCmd = require('./utils/get-npm-cmd');
const browserSync = require('browser-sync').create();


const spawn = require('./utils/spawn-promise-wrapper'); const spawn = require('./utils/spawn-promise-wrapper');
const logHelper = require('../infra/utils/log-helper'); const logHelper = require('../infra/utils/log-helper');
Expand Down Expand Up @@ -56,7 +55,6 @@ You can view a friendlier UI by running
}) })
.then(() => { .then(() => {
logHelper.log(`Docs built successfully`); logHelper.log(`Docs built successfully`);
browserSync.reload();
}) })
.catch((err) => { .catch((err) => {
logHelper.error(`Docs failed to build: `, err); logHelper.error(`Docs failed to build: `, err);
Expand All @@ -83,15 +81,7 @@ gulp.task('docs:watch', () => {
}); });
}); });


gulp.task('docs:serve', () => {
browserSync.init({
server: {
baseDir: DOCS_DIRECTORY,
},
});
});

gulp.task('docs', gulp.series([ gulp.task('docs', gulp.series([
'docs:build', 'docs:build',
gulp.parallel(['docs:serve', 'docs:watch']), 'docs:watch',
])); ]));
Empty file modified gulp-tasks/lint.js
Whitespace-only changes.
Empty file modified gulp-tasks/publish-github.js
Whitespace-only changes.
Empty file modified gulp-tasks/test-integration.js
Whitespace-only changes.
Whitespace-only changes.
5 changes: 0 additions & 5 deletions gulp-tasks/utils/build-browser-bundle.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -136,18 +136,13 @@ module.exports = (packagePath, buildType) => {


const plugins = rollupHelper.getDefaultPlugins(buildType); const plugins = rollupHelper.getDefaultPlugins(buildType);


const banner = pkgJson.workbox.includeBabelHelpers ?
fs.readFileSync(path.join(__dirname, 'external-helpers.js')) :
'';

return rollupStream({ return rollupStream({
input: moduleBrowserPath, input: moduleBrowserPath,
rollup, rollup,
output: { output: {
name: namespace, name: namespace,
sourcemap: true, sourcemap: true,
format: 'iife', format: 'iife',
banner,
globals, globals,
}, },
external: externalAndPure, external: externalAndPure,
Expand Down
8 changes: 4 additions & 4 deletions gulp-tasks/utils/build-node-package.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ module.exports = (packagePath) => {
`); `);


return gulp.src(`${packagePath}/src/**`).pipe(babel({ return gulp.src(`${packagePath}/src/**`).pipe(babel({
only: /\.js$/, only: [/\.js$/],
presets: [ presets: [
['env', { ['@babel/preset-env', {
targets: { targets: {
// Change this when our minimum required node version changes. // Change this when our minimum required node version changes.
node: '4.0', node: '6.0',
}, },
}], }],
], ],
Expand All @@ -32,7 +32,7 @@ module.exports = (packagePath) => {
// are only included in our Rollup bundles once, even if they're used // are only included in our Rollup bundles once, even if they're used
// in multiple source files. // in multiple source files.
// See https://github.com/rollup/rollup-plugin-babel#helpers // See https://github.com/rollup/rollup-plugin-babel#helpers
'transform-runtime', '@babel/transform-runtime',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, if we're getting rid of the regenerator runtime polyfill, we may not need this at all anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need it for the node libraries, since we're targeting node 6, and that doesn't support async/await.

], ],
})).pipe(gulp.dest(outputDirectory)); })).pipe(gulp.dest(outputDirectory));
}; };
Empty file modified gulp-tasks/utils/get-npm-cmd.js
Whitespace-only changes.
3 changes: 1 addition & 2 deletions gulp-tasks/utils/lerna-wrapper.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ const spawnPromiseWrapper = require('./spawn-promise-wrapper');
// Use require.resolve() to find the lerna module, then get the lerna // Use require.resolve() to find the lerna module, then get the lerna
// binary from that. This allows the use of lerna with command line // binary from that. This allows the use of lerna with command line
// flags. // flags.
const lernaBinPath = path.join( const lernaBinPath = path.join(require.resolve('lerna'), '..', 'cli.js');
require.resolve('lerna'), '..', '..', 'bin', 'lerna.js');


module.exports = { module.exports = {
bootstrap: (...args) => { bootstrap: (...args) => {
Expand Down
22 changes: 7 additions & 15 deletions gulp-tasks/utils/rollup-helper.js
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,6 @@
const babel = require('rollup-plugin-babel'); const babel = require('rollup-plugin-babel');
const minify = require('uglify-es').minify;
const replace = require('rollup-plugin-replace'); const replace = require('rollup-plugin-replace');
const uglifyPlugin = require('rollup-plugin-uglify').uglify; const terserPlugin = require('rollup-plugin-terser').terser;


const constants = require('./constants'); const constants = require('./constants');
const getVersionsCDNUrl = require('./versioned-cdn-url'); const getVersionsCDNUrl = require('./versioned-cdn-url');
Expand All @@ -14,27 +13,20 @@ module.exports = {
const plugins = []; const plugins = [];


const babelConfig = { const babelConfig = {
presets: [['env', { presets: [['@babel/preset-env', {
targets: { targets: {
// This corresponds to the version of Chroumium used by // This corresponds to the version of Chromium used by
// Samsung Internet 5.x, which is the minimum non-evergreen browser // Samsung Internet 6.x, which is the minimum non-evergreen browser
// we currently support. // we currently support.
browsers: ['chrome >= 51'], browsers: ['chrome >= 56'],
}, },
modules: false,
}]], }]],
// This will result in references to `babelHelpers.asyncToGenerators()`
// in the transpiled code. The declaration of this method lives in the
// external-helpers.js file and is injected by Rollup once into the
// workbox-core bundle.
plugins: ['external-helpers'],
externalHelpers: true,
}; };
plugins.push(babel(babelConfig)); plugins.push(babel(babelConfig));


let minifyBuild = buildType === constants.BUILD_TYPES.prod; let minifyBuild = buildType === constants.BUILD_TYPES.prod;
if (minifyBuild) { if (minifyBuild) {
const uglifyOptions = { const terserOptions = {
mangle: { mangle: {
properties: { properties: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discovered recently that we probably need to enable the option to make property mangling consistent across files (when we're outputting multiple files). I can file an issue to do that in a separate PR.

reserved: [ reserved: [
Expand All @@ -56,7 +48,7 @@ module.exports = {
}, },
}; };
plugins.push( plugins.push(
uglifyPlugin(uglifyOptions, minify), terserPlugin(terserOptions),
); );
} }


Expand Down
Empty file modified gulp-tasks/watch.js
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
{ {
"lerna": "2.11.0", "lerna": "3.4.0",
"packages": [ "packages": [
"packages/*" "packages/*"
], ],
"version": "3.6.1" "version": "3.6.2"
} }
Loading