Skip to content

Commit

Permalink
The contents of v3, reconciled with master (#1357)
Browse files Browse the repository at this point in the history
* The contents of v3, reconciled with master.

* Remove a few stray files.

* Another extra file.

* Two more deletions.

* Setting up for stable release

* v3.0.0

* Updating CDN and versions

* Doc repair for wf (#1358)

* Changing doc structure to work with WF

* Changing doc structure to work with WF
  • Loading branch information
jeffposnick authored Mar 13, 2018
1 parent 5b97922 commit 07bef20
Show file tree
Hide file tree
Showing 824 changed files with 54,462 additions and 30,097 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

92 changes: 80 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,103 @@ module.exports = {
sourceType: 'module',
},
globals: {
BroadcastChannel: false,
WorkboxSW: false,
workbox: false,
goog: false,
WorkboxSW: false,
SyncEvent: false,
BroadcastChannel: false,
},
rules: {
'linebreak-style': 0,
"jsdoc/check-types": 2,
"jsdoc/newline-after-description": 2,
},
plugins: [
'jsdoc',
],
parser: 'babel-eslint',
overrides: [{
files: ['**/test/**/*.js', '**/test.js'],
files: ['test/**/*.{js,mjs}'],
env: {
mocha: true,
},
globals: {
expect: true,
sinon: true,
goog: true,
rules: {
'max-len': 0,
'require-jsdoc': 0,
'valid-jsdoc': 0,
'no-invalid-this': 0,
},
}, {
files: [
'packages/workbox-core/_private/logger.mjs',
'packages/workbox-sw/_default.mjs',
'infra/testing/cli-test-helper.js',
'infra/utils/log-helper.js',
'packages/workbox-cli/src/lib/logger.js',
],
rules: {
'no-console': 0,
},
}, {
files: [
'infra/**/*.js',
],
rules: {
'max-len': 0,
},
}, {
files: [
'gulp-tasks/**/*.js',
'infra/**/*.js'
],
rules: {
'valid-jsdoc': 0,
'require-jsdoc': 0,
},
}, {
files: [
'infra/testing/**/*',
],
env: {
'mocha': true
}
}, {
files: [
'test/workbox-build/static/**/*.js',
],
rules: {
'no-unused-vars': 0,
'no-undef': 0,
},
}, {
files: [
'packages/workbox-build/src/templates/**/*.js',
],
rules: {
'max-len': 0,
'no-invalid-this': 0,
},
}
, {
files: [
'packages/workbox-sw/**/*',
],
globals: {
'workbox': false,
},
}, {
files: ['gulp-tasks/*.js'],
files: [
'infra/testing/env-it.js',
],
rules: {
'no-console': 0,
'no-invalid-this': 0,
},
}, {
files: [
'packages/**/*.{mjs,js}',
],
plugins: [
'header',
],
rules: {
'header/header': [2, 'block', {pattern: 'Copyright \\d{4} Google Inc.'}]
}
}],
};
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.js text eol=lf
*.mjs text eol=lf
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ packages/**/LICENSE
temp
tmp-*
!packages/workbox-cli/test/static/example-project-1/node_modules
coverage/
generated-release-files/
workbox-*.json
.esm-cache/
.nyc_output/
docs
local-builds/
firebase-debug.log
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

28 changes: 8 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,18 @@ cache:
node_js:
- 'stable'

env:
- PROJECT="workbox-background-sync"
- PROJECT="workbox-broadcast-cache-update"
- PROJECT="workbox-build"
- PROJECT="workbox-webpack-plugin"
- PROJECT="workbox-cache-expiration"
- PROJECT="workbox-cli"
- PROJECT="workbox-sw"
- PROJECT="workbox-google-analytics"
- PROJECT="workbox-precaching"
- PROJECT="workbox-routing"
- PROJECT="workbox-runtime-caching"

install:
- npm install -g gulp-cli
- npm install
- gulp lerna-bootstrap-scoped --project="${PROJECT}"

# Read more here: https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-xvfb-to-Run-Tests-That-Require-a-GUI
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start || echo \"Unable to start virtual display.\""
- sleep 3 # give xvfb some time to start

install:
- npm install

script:
# Building is handled in gulp test.
- gulp test --project "${PROJECT}"
- gulp test

after_success:
- npm run coveralls
- npm run bot
5 changes: 0 additions & 5 deletions Gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Please read the [guide to contributing](CONTRIBUTING.md) prior to filing any pul

## License

Copyright 2017 Google, Inc.
Copyright 2018 Google, Inc.

Licensed under the [Apache License, Version 2.0](LICENSE) (the "License");
you may not use this file except in compliance with the License. You may
Expand Down
15 changes: 4 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
only_commits:
files:
- packages/workbox-cli/
- packages/workbox-build/
- test/
- appveyor.yml
- .travis.yml
- package.json
cache:
- node_modules

install:
- ps: Install-Product node Stable
- npm install -g gulp
- npm install
- gulp lerna-bootstrap-scoped --project="workbox-cli"
- npm install gulpjs/gulp-cli -g

test_script:
- node --version
- npm --version
- gulp test --project "workbox-cli"
- gulp test

build: off
5 changes: 5 additions & 0 deletions cdn-details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"origin": "https://storage.googleapis.com",
"bucketName": "workbox-cdn",
"releasesDir": "releases"
}
1 change: 1 addition & 0 deletions demos/functions/cdn-details.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"latestUrl":"https://storage.googleapis.com/workbox-cdn/releases/3.0.0"}
104 changes: 104 additions & 0 deletions demos/functions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
const functions = require('firebase-functions');
const express = require('express');
const exphbs = require('express-handlebars');
const path = require('path');
const fs = require('fs-extra');

const cdnDetails = require('./cdn-details.json');

const workboxModules = [
'workbox-background-sync',
'workbox-broadcast-cache-update',
'workbox-cache-expiration',
'workbox-cacheable-response',
'workbox-core',
'workbox-google-analytics',
'workbox-precaching',
'workbox-range-requests',
'workbox-routing',
'workbox-strategies',
'workbox-sw',
];

const app = express();
app.engine('hbs', exphbs({defaultLayout: 'main', extname: '.hbs'}));
app.set('view engine', 'hbs');

app.get('/', function(req, res) {
let moduleData = workboxModules.map((moduleName) => {
const docPath = path.join(
__dirname, 'views', 'demo', `${moduleName}.hbs`
);

let exists = false;
try {
fs.accessSync(docPath);
exists = true;
} catch (err) {
// NOOP
}

return {
name: moduleName,
hasDemo: exists,
};
});

res.render('home', {
title: 'Workbox V3',
modules: moduleData,
});
});

app.get('/api/is-response-cacheable',
function(req, res) {
if (req.headers['x-is-cacheable']) {
const value = req.headers['x-is-cacheable'];
res.set('X-Is-Cacheable', value);
res.send(`This response has 'X-Is-Cacheable' header set to '${value}'`);
} else {
res.send(`This response has no 'X-Is-Cacheable' header`);
}
}
);

app.get('/demo/:moduleName', function(req, res) {
res.render(`demo/${req.params.moduleName}`, {
title: `${req.params.moduleName} Demo`,
});
});

app.get('/demo/:moduleName/:swfile', function(req, res, next) {
const swTemplate = path.basename(
req.params.swfile,
path.extname(req.params.swfile)
);

let cdnUrl = cdnDetails.latestUrl;
let extraConfig = '';
if (process.env.WORKBOX_DEMO_ENV === 'local') {
cdnUrl = `/local-builds`;
extraConfig = `,
modulePathPrefix: '${cdnUrl}'`;
}

const swImport = `importScripts('${cdnUrl}/workbox-sw.js');
workbox.setConfig({
debug: true${extraConfig}
});
`;

res.header('Content-Type', 'application/javascript');
res.header('Cache-Control', 'no-cache');
res.render(`demo/${req.params.moduleName}/${swTemplate}`, {
title: `${req.params.moduleName} Demo`,
CDN_URL: cdnUrl,
WORKBOX_SW_IMPORT: swImport,
layout: false,
});
});

module.exports = {
app: functions.https.onRequest(app),
};
Loading

0 comments on commit 07bef20

Please sign in to comment.