Skip to content

Commit

Permalink
Updates to latest dependencies, and transpilation targets (#1658)
Browse files Browse the repository at this point in the history
* WIP.

* WIP.

* Linting.

* Removing browser-sync.

* Fixes workbox dependencies (#1667)

* Fixes workbox dependencies

* Fixes the depcheck

* v3.6.2

* 3.6.2 metadata (#1669)
  • Loading branch information
jeffposnick committed Oct 3, 2018
1 parent 3612461 commit 7a65759
Show file tree
Hide file tree
Showing 98 changed files with 16,428 additions and 15,894 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Expand Up @@ -20,13 +20,14 @@ module.exports = {
rules: {
"jsdoc/check-types": 2,
"jsdoc/newline-after-description": 2,
'indent': ['error', 2],
},
plugins: [
'jsdoc',
],
parser: 'babel-eslint',
overrides: [{
files: ['test/**/*.{js,mjs}'],
parser: 'babel-eslint',
env: {
mocha: true,
},
Expand Down
2 changes: 1 addition & 1 deletion demos/functions/cdn-details.json
@@ -1 +1 @@
{"latestUrl":"https://storage.googleapis.com/workbox-cdn/releases/3.6.1"}
{"latestUrl":"https://storage.googleapis.com/workbox-cdn/releases/3.6.2"}
6,110 changes: 3,480 additions & 2,630 deletions demos/functions/package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions demos/functions/package.json
Expand Up @@ -2,11 +2,11 @@
"name": "functions",
"description": "Cloud Functions for Firebase",
"dependencies": {
"express": "^4.16.2",
"express": "^4.16.3",
"express-handlebars": "^3.0.0",
"firebase-admin": "~5.4.0",
"firebase-functions": "^0.7.0",
"fs-extra": "^4.0.2"
"firebase-admin": "^6.0.0",
"firebase-functions": "^2.0.5",
"fs-extra": "^7.0.0"
},
"private": true
}
10 changes: 5 additions & 5 deletions gulp-tasks/build-packages.js
Expand Up @@ -12,11 +12,11 @@ const cleanPackage = (packagePath) => {
};

gulp.task('build-packages:clean', gulp.series(
packageRunnner(
'build-packages:clean',
'all',
cleanPackage
)
packageRunnner(
'build-packages:clean',
'all',
cleanPackage
)
));

gulp.task('build-packages:build', gulp.parallel(
Expand Down
26 changes: 8 additions & 18 deletions gulp-tasks/docs.js
Expand Up @@ -2,7 +2,6 @@ const fs = require('fs-extra');
const path = require('path');
const gulp = require('gulp');
const getNpmCmd = require('./utils/get-npm-cmd');
const browserSync = require('browser-sync').create();

const spawn = require('./utils/spawn-promise-wrapper');
const logHelper = require('../infra/utils/log-helper');
Expand Down Expand Up @@ -54,14 +53,13 @@ You can view a friendlier UI by running
return spawn(getNpmCmd(), params, {
cwd: path.join(__dirname, '..'),
})
.then(() => {
logHelper.log(`Docs built successfully`);
browserSync.reload();
})
.catch((err) => {
logHelper.error(`Docs failed to build: `, err);
throw err;
});
.then(() => {
logHelper.log(`Docs built successfully`);
})
.catch((err) => {
logHelper.error(`Docs failed to build: `, err);
throw 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([
'docs:build',
gulp.parallel(['docs:serve', 'docs:watch']),
'docs:watch',
]));
8 changes: 4 additions & 4 deletions gulp-tasks/lint.js
Expand Up @@ -6,8 +6,8 @@ const logHelper = require('../infra/utils/log-helper');
// Use npm run lint to ensure we are using local eslint
gulp.task('lint', () => {
return spawn(getNpmCmd(), ['run', 'lint'])
.catch((err) => {
logHelper.error(err);
throw new Error(`[Workbox Error Msg] 'gulp lint' discovered errors.`);
});
.catch((err) => {
logHelper.error(err);
throw new Error(`[Workbox Error Msg] 'gulp lint' discovered errors.`);
});
});
56 changes: 28 additions & 28 deletions gulp-tasks/publish-github.js
Expand Up @@ -9,36 +9,36 @@ const logHelper = require('../infra/utils/log-helper');

const publishReleaseOnGithub =
async (tagName, releaseInfo, tarPath, zipPath) => {
if (!releaseInfo) {
const releaseData = await githubHelper.createRelease({
tag_name: tagName,
draft: true,
name: `Workbox ${tagName}`,
prerelease: semver.prerelease(tagName) !== null,
});
releaseInfo = releaseData.data;
}
if (!releaseInfo) {
const releaseData = await githubHelper.createRelease({
tag_name: tagName,
draft: true,
name: `Workbox ${tagName}`,
prerelease: semver.prerelease(tagName) !== null,
});
releaseInfo = releaseData.data;
}

const tarBuffer = await fs.readFile(tarPath);
await githubHelper.uploadAsset({
url: releaseInfo.upload_url,
file: tarBuffer,
contentType: 'application/gzip',
contentLength: tarBuffer.length,
name: path.basename(tarPath),
label: path.basename(tarPath),
});
const tarBuffer = await fs.readFile(tarPath);
await githubHelper.uploadAsset({
url: releaseInfo.upload_url,
file: tarBuffer,
contentType: 'application/gzip',
contentLength: tarBuffer.length,
name: path.basename(tarPath),
label: path.basename(tarPath),
});

const zipBuffer = await fs.readFile(zipPath);
await githubHelper.uploadAsset({
url: releaseInfo.upload_url,
file: zipBuffer,
contentType: 'application/zip',
contentLength: zipBuffer.length,
name: path.basename(zipPath),
label: path.basename(zipPath),
});
};
const zipBuffer = await fs.readFile(zipPath);
await githubHelper.uploadAsset({
url: releaseInfo.upload_url,
file: zipBuffer,
contentType: 'application/zip',
contentLength: zipBuffer.length,
name: path.basename(zipPath),
label: path.basename(zipPath),
});
};

const handleGithubRelease = async (tagName, gitBranch, releaseInfo) => {
logHelper.log(`Creating GitHub release ${logHelper.highlight(tagName)}.`);
Expand Down
28 changes: 14 additions & 14 deletions gulp-tasks/test-integration.js
Expand Up @@ -36,7 +36,7 @@ const runFiles = (filePaths) => {
};

const runIntegrationTestSuite = async (testPath, nodeEnv, seleniumBrowser,
webdriver) => {
webdriver) => {
logHelper.log(oneLine`
Running Integration test on ${logHelper.highlight(testPath)}
with NODE_ENV '${nodeEnv}'
Expand Down Expand Up @@ -116,19 +116,19 @@ gulp.task('test-integration', async () => {
const localBrowsers = seleniumAssistant.getLocalBrowsers();
for (const localBrowser of localBrowsers) {
switch (localBrowser.getId()) {
case 'chrome':
case 'firefox':
if (localBrowser.getReleaseName() !== 'unstable') {
await runIntegrationForBrowser(localBrowser);
}
break;
case 'safari':
if (localBrowser.getReleaseName() === 'stable') {
await runIntegrationForBrowser(localBrowser);
}
break;
default:
logHelper.warn(oneLine`
case 'chrome':
case 'firefox':
if (localBrowser.getReleaseName() !== 'unstable') {
await runIntegrationForBrowser(localBrowser);
}
break;
case 'safari':
if (localBrowser.getReleaseName() === 'stable') {
await runIntegrationForBrowser(localBrowser);
}
break;
default:
logHelper.warn(oneLine`
Skipping integration tests for ${localBrowser.getPrettyName()}.
`);
}
Expand Down
16 changes: 8 additions & 8 deletions gulp-tasks/utils/analyse-properties.js
Expand Up @@ -73,18 +73,18 @@ class AnalyseBuildForProperties {
// either not important or it's already been minified.
return entry.propertyCount > 1 && entry.propertyName.length > 1;
})
.filter((entry) => {
switch (entry.propertyName) {
.filter((entry) => {
switch (entry.propertyName) {
case 'await':
case 'async':
return false;
default:
return true;
}
})
.sort((a, b) => {
return b.propertyCount - a.propertyCount;
});
}
})
.sort((a, b) => {
return b.propertyCount - a.propertyCount;
});
}

printDetails({filePath, analysis}) {
Expand All @@ -105,7 +105,7 @@ class AnalyseBuildForProperties {
logHelper.log(` ${entry.propertyName} ` +
`${extraSpace} ${entry.propertyCount}`);
});
logHelper.log();
logHelper.log();
}
}

Expand Down
43 changes: 19 additions & 24 deletions gulp-tasks/utils/build-browser-bundle.js
Expand Up @@ -60,7 +60,7 @@ const globals = (moduleId) => {
if (namespacePathParts[0] !== '_private' || namespacePathParts.length > 2) {
// Tried to pull in default export of module - this isn't allowed.
// A specific file must be referenced
throw new Error(oneLine`
throw new Error(oneLine`
You cannot use nested files. It must be a top level (and public) file
or a file under '_private' in a module. Please fix the import:
'${moduleId}'
Expand All @@ -77,10 +77,10 @@ const globals = (moduleId) => {
pkg.workbox.browserNamespace,
additionalNamespace,
]
.filter((value) => {
return (value && value.length > 0);
})
.join('.');
.filter((value) => {
return (value && value.length > 0);
})
.join('.');
} catch (err) {
logHelper.error(`Unable to get browserNamespace for package: ` +
`'${packageName}'`);
Expand Down Expand Up @@ -136,18 +136,13 @@ module.exports = (packagePath, buildType) => {

const plugins = rollupHelper.getDefaultPlugins(buildType);

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

return rollupStream({
input: moduleBrowserPath,
rollup,
output: {
name: namespace,
sourcemap: true,
format: 'iife',
banner,
globals,
},
external: externalAndPure,
Expand All @@ -172,24 +167,24 @@ module.exports = (packagePath, buildType) => {
}
},
})
.on('error', (err) => {
const args = [];
Object.keys(err).forEach((key) => {
args.push(`${key}: ${err[key]}`);
});
logHelper.error(err, `\n\n${args.join('\n')}`);
throw err;
})
.on('error', (err) => {
const args = [];
Object.keys(err).forEach((key) => {
args.push(`${key}: ${err[key]}`);
});
logHelper.error(err, `\n\n${args.join('\n')}`);
throw err;
})
// We must give the generated stream the same name as the entry file
// for the sourcemaps to work correctly
.pipe(source(moduleBrowserPath))
.pipe(source(moduleBrowserPath))
// gulp-sourcemaps don't work with streams so we need
.pipe(buffer())
.pipe(buffer())
// This tells gulp-sourcemaps to load the inline sourcemap
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.init({loadMaps: true}))
// This renames the output file
.pipe(rename(outputFilename))
.pipe(rename(outputFilename))
// This writes the sourcemap alongside the final build file
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(outputDirectory));
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest(outputDirectory));
};
8 changes: 4 additions & 4 deletions gulp-tasks/utils/build-node-package.js
Expand Up @@ -18,12 +18,12 @@ module.exports = (packagePath) => {
`);

return gulp.src(`${packagePath}/src/**`).pipe(babel({
only: /\.js$/,
only: [/\.js$/],
presets: [
['env', {
['@babel/preset-env', {
targets: {
// 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
// in multiple source files.
// See https://github.com/rollup/rollup-plugin-babel#helpers
'transform-runtime',
'@babel/transform-runtime',
],
})).pipe(gulp.dest(outputDirectory));
};
2 changes: 1 addition & 1 deletion gulp-tasks/utils/get-npm-cmd.js
@@ -1,2 +1,2 @@
module.exports = () => process.platform === 'win32' ?
'npm.cmd' : 'npm';
'npm.cmd' : 'npm';
3 changes: 1 addition & 2 deletions gulp-tasks/utils/lerna-wrapper.js
Expand Up @@ -5,8 +5,7 @@ const spawnPromiseWrapper = require('./spawn-promise-wrapper');
// Use require.resolve() to find the lerna module, then get the lerna
// binary from that. This allows the use of lerna with command line
// flags.
const lernaBinPath = path.join(
require.resolve('lerna'), '..', '..', 'bin', 'lerna.js');
const lernaBinPath = path.join(require.resolve('lerna'), '..', 'cli.js');

module.exports = {
bootstrap: (...args) => {
Expand Down

0 comments on commit 7a65759

Please sign in to comment.