Skip to content

Commit

Permalink
Enable prettier (#2929)
Browse files Browse the repository at this point in the history
* Deps and config

* Prettier output

* Update hardcoded file sizes

* More file size updates
  • Loading branch information
jeffposnick committed Aug 26, 2021
1 parent 70bfa09 commit 63ea2ca
Show file tree
Hide file tree
Showing 328 changed files with 11,480 additions and 7,821 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE.md
@@ -1,12 +1,12 @@
Welcome! Please use this template for reporting bugs or requesting features. For questions about using Workbox, the best place to ask is Stack Overflow, tagged with `[workbox]`: https://stackoverflow.com/questions/ask?tags=workbox

**Library Affected**:
*workbox-sw, workbox-build, etc.*
_workbox-sw, workbox-build, etc._

**Browser & Platform**:
*E.g. Google Chrome v51.0.1 for Android, or "all browsers".*
_E.g. Google Chrome v51.0.1 for Android, or "all browsers"._

**Issue or Feature Request Description**:
*Your request here.*
_Your request here._

*When reporting bugs, please include relevant JavaScript Console logs and links to public URLs at which the issue could be reproduced.*
_When reporting bugs, please include relevant JavaScript Console logs and links to public URLs at which the issue could be reproduced._
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -1,9 +1,10 @@
**Prior to filing a PR, please:**

- [open an issue](https://github.com/GoogleChrome/workbox/issues/new) to discuss your proposed change.
- ensure that `gulp build && gulp lint test` passes locally.

R: @jeffposnick @tropicadri

Fixes #*issue number*
Fixes #_issue number_

*Description of what's changed/fixed.*
_Description of what's changed/fixed._
80 changes: 40 additions & 40 deletions .github/workflows/pull-request.yml
Expand Up @@ -7,52 +7,52 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/setup-node@v1
with:
node-version: 10.x
- uses: actions/setup-node@v1
with:
node-version: 10.x

- name: Setup
run: |
npm ci
npx gulp build
- name: Setup
run: |
npm ci
npx gulp build
- run: npx gulp test_node
- run: npx gulp test_node

Full_Suite_Mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/cache@v1
with:
path: ~/.selenium-assistant
key: ${{ runner.os }}

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Setup
run: |
sudo safaridriver --enable
npm ci
npx gulp build
- run: npx gulp test
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- uses: actions/cache@v1
with:
path: ~/.selenium-assistant
key: ${{ runner.os }}

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Setup
run: |
sudo safaridriver --enable
npm ci
npx gulp build
- run: npx gulp test
4 changes: 4 additions & 0 deletions .husky/pre-commit
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run format-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run lint
13 changes: 13 additions & 0 deletions .prettierignore
@@ -0,0 +1,13 @@
.nyc_output
.vscode
*.hbs
*.log
build
coverage
docs
generated-release-files
node_modules
packages/**
!packages/*/src/**
temp
test/workbox-webpack-plugin/static/injected-manifest.json
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Expand Up @@ -5,8 +5,9 @@
We'd love to accept your patches! Before we can take them, we have to jump a couple of legal hurdles.

Please fill out either the individual or corporate Contributor License Agreement (CLA).
* If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual).
* If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate).

- If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](https://developers.google.com/open-source/cla/individual).
- If you work for a company that wants to allow you to contribute your work, then you'll need to sign a [corporate CLA](https://developers.google.com/open-source/cla/corporate).

Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll be able to
accept your pull requests.
Expand Down Expand Up @@ -42,4 +43,4 @@ To do an automated run of the full test suite for the browser-based code against

```
npm run gulp test_integration
```
```
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -7,9 +7,9 @@ Workbox is a collection of JavaScript libraries for

## Documentation

* [Overview](https://developers.google.com/web/tools/workbox/) ([site source](https://github.com/google/WebFundamentals/tree/main/src/content/en/tools/workbox))
* [Get started](https://developers.google.com/web/tools/workbox/guides/get-started)
* [Contribute](CONTRIBUTING.md)
- [Overview](https://developers.google.com/web/tools/workbox/) ([site source](https://github.com/google/WebFundamentals/tree/main/src/content/en/tools/workbox))
- [Get started](https://developers.google.com/web/tools/workbox/guides/get-started)
- [Contribute](CONTRIBUTING.md)

## Contributing

Expand Down
81 changes: 50 additions & 31 deletions demos/src/workbox-background-sync-demo/index.html
Expand Up @@ -2,68 +2,87 @@
<html lang="en">
<head>
<title>workbox-background-sync demo</title>
<meta name="workbox-background-sync demo" content="An example to demonstrate the workbox-background-sync module">
<link id="favicon" rel="icon" href="https://glitch.com/edit/favicon-app.ico" type="image/x-icon">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta
name="workbox-background-sync demo"
content="An example to demonstrate the workbox-background-sync module"
/>
<link
id="favicon"
rel="icon"
href="https://glitch.com/edit/favicon-app.ico"
type="image/x-icon"
/>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
body {
margin-left: 5%;
font-family: 'Open Sans', sans-serif
font-family: 'Open Sans', sans-serif;
}
ol {
padding-left: 20px
padding-left: 20px;
}
li {
margin-bottom: 5px
margin-bottom: 5px;
}
button {
margin: 20px 0;
font-weight: bold
font-weight: bold;
}
</style>
</head>
<body>

<header>
<div>
<h1>workbox-background-sync Demo</h1>
</div>
</header>

<ol>
<li><a href="https://developers.google.com/web/tools/chrome-devtools/#open">Open DevTools.</a></li>
<li>
<a href="https://developers.google.com/web/tools/chrome-devtools/#open"
>Open DevTools.</a
>
</li>
<li>Switch to the Network panel.</li>
<li>Toggle `Disable cache` checkbox on (it's unchecked by default).</li>
<li>Click `Make Fetch request` button below.</li>
<li>Observe that request is successfully completed with status 200.</li>
<li>Disconnect from actual network (DevTools offline doesn't work for background sync).</li>
<li>
Disconnect from actual network (DevTools offline doesn't work for
background sync).
</li>
<li>Again, click `Make Fetch request` button below.</li>
<li>Observe that request is aborted due to no network.</li>
<li>Connect to your network and observe the Network panel in DevTools.</li>
<li>Once the network is connected, you will see that the request is retried automatically upon the `sync` event.</li>
<li>
Connect to your network and observe the Network panel in DevTools.
</li>
<li>
Once the network is connected, you will see that the request is retried
automatically upon the `sync` event.
</li>
</ol>

<button class="fetch">Make fetch request</button><p>


<script>
document.querySelector('.fetch').addEventListener('click', () => {
fetch('example.txt');
});

navigator.serviceWorker.register('./sw.js');
</script>
<button class="fetch">Make fetch request</button>
<p>
<script>
document.querySelector('.fetch').addEventListener('click', () => {
fetch('example.txt');
});

navigator.serviceWorker.register('./sw.js');
</script>

<a href="https://developers.google.com/web/tools/workbox/modules">Back to Demos</a>
<a href="https://developers.google.com/web/tools/workbox/modules"
>Back to Demos</a
>
</p>

<p>

<a href="https://developers.google.com/web/tools/workbox">Docs</a> |
<a href="https://github.com/googlechrome/workbox">GitHub</a> |
<a href="https://twitter.com/workboxjs">@workboxjs</a>

<a href="https://developers.google.com/web/tools/workbox">Docs</a> |
<a href="https://github.com/googlechrome/workbox">GitHub</a> |
<a href="https://twitter.com/workboxjs">@workboxjs</a>
</p>
</body>
</html>
</html>
28 changes: 14 additions & 14 deletions demos/src/workbox-background-sync-demo/package.json
@@ -1,15 +1,15 @@
{
"name": "workbox-background-sync",
"version": "1.0.0",
"description": "Workbox Background Sync Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
"name": "workbox-background-sync",
"version": "1.0.0",
"description": "Workbox Background Sync Demo Git Listener",
"scripts": {
"start": "node updateServer.js"
},
"dependencies": {
"express": "^4.17.1"
},
"engines": {
"node": "8.x"
},
"license": "MIT"
}
15 changes: 9 additions & 6 deletions demos/src/workbox-background-sync-demo/sw.js
@@ -1,18 +1,21 @@
importScripts('https://storage.googleapis.com/workbox-cdn/releases/6.1.5/workbox-sw.js');
importScripts(
'https://storage.googleapis.com/workbox-cdn/releases/6.1.5/workbox-sw.js',
);

// Note: Ignore the error that Glitch raises about workbox being undefined.
workbox.setConfig({
debug: true,
});

const bgSyncPlugin = new workbox.backgroundSync.BackgroundSyncPlugin(
'myQueueName');
'myQueueName',
);

workbox.routing.registerRoute(
({url}) => url.pathname === '/example.txt',
new workbox.strategies.NetworkOnly({
plugins: [bgSyncPlugin],
}),
({url}) => url.pathname === '/example.txt',
new workbox.strategies.NetworkOnly({
plugins: [bgSyncPlugin],
}),
);

workbox.core.skipWaiting();
Expand Down
4 changes: 2 additions & 2 deletions demos/src/workbox-background-sync-demo/updateServer.js
Expand Up @@ -30,12 +30,12 @@ app.post('/deploy', (request, response) => {

const repoUrl = request.query.repo;
execSync(
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`git checkout -- ./ && git pull -X theirs ${repoUrl} ` +
`glitch && refresh && git branch -D glitch`,
);
response.status(200).send();
});

const listener = app.listen(process.env.PORT, function() {
const listener = app.listen(process.env.PORT, function () {
console.log('Your app is listening on port ' + listener.address().port);
});

0 comments on commit 63ea2ca

Please sign in to comment.