Skip to content

Commit

Permalink
fix: added webpack to peerDeps, fast-glob to deps
Browse files Browse the repository at this point in the history
  • Loading branch information
DuCanhGH committed Nov 30, 2022
1 parent 97f59ce commit bc38707
Show file tree
Hide file tree
Showing 30 changed files with 120 additions and 103 deletions.
34 changes: 23 additions & 11 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Examples
name: Build examples

on:
push:
Expand All @@ -10,6 +10,9 @@ jobs:
build:
strategy:
matrix:
node-version: ["16.x"]
pnpm-version: ["7.x"]
os: [ubuntu-latest]
example:
[
minimal,
Expand All @@ -24,17 +27,26 @@ jobs:
offline-fallback-v2,
web-push,
]
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' && !contains(github.event.head_commit.message, '[skip ci]') }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout repo
uses: actions/checkout@v3
- name: Use pnpm
uses: pnpm/action-setup@v2
with:
node-version: 16
- run: npm ci
- run: npm link
- run: npm install
working-directory: examples/${{ matrix.example }}
- run: npm link next-pwa
version: ${{ matrix.pnpm-version }}
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Install dependencies in root
run: pnpm install
- name: Link package
run: pnpm link
- name: Install dependencies for app
run: pnpm install --frozen-lockfile=false
working-directory: examples/${{ matrix.example }}
- run: npm run build
- name: Build app
run: pnpm build
working-directory: examples/${{ matrix.example }}
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release package
name: Publish package to npm
on: [push]
jobs:
build:
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ This plugin is powered by [Workbox](https://developer.chrome.com/docs/workbox/)
> If you are new to `Next.js` or `React.js`, you may want to checkout [learn Next.js](https://nextjs.org/learn/basics/create-nextjs-app) or [Next.js documentation](https://nextjs.org/docs/getting-started) first. Then start from [a simple example](https://github.com/DuCanhGH/next-pwa/tree/master/examples/next-9) or [progressive-web-app example in Next.js's repository](https://github.com/vercel/next.js/tree/canary/examples/progressive-web-app).
```bash
yarn add next-pwa
npm i @ducanh2912/next-pwa
# or
# yarn add @ducanh2912/next-pwa
# or
# pnpm add @ducanh2912/next-pwa
```

## Basic Usage
Expand Down Expand Up @@ -269,7 +273,7 @@ You can also setup `precacheFallback.fallbackURL` in your [runtimeCaching config
There are options you can use to customize the behavior of this plugin:

```javascript
const withPWA = require("next-pwa").default({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
// disable: process.env.NODE_ENV === 'development',
// register: true,
Expand Down
2 changes: 1 addition & 1 deletion examples/cache-on-front-end-nav/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

Expand Down
12 changes: 6 additions & 6 deletions examples/cache-on-front-end-nav/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"start": "next start"
},
"dependencies": {
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@ducanh2912/next-pwa": "latest",
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/cookie/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
dynamicStartUrl: true, // this is same as default value
dynamicStartUrlRedirect: "/login", // recommend to config this for best user experience if your start-url redirects on first load
Expand Down
12 changes: 6 additions & 6 deletions examples/cookie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"start": "next start"
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"js-cookie": "^3.0.1",
"next": "^12.2.5",
"next": "13.0.5",
"next-cookies": "^2.0.3",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
4 changes: 2 additions & 2 deletions examples/custom-ts-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In this way, you get benefit of code splitting and size minimization automatical
You can customize the directory of your custom worker file by setting the `customWorkerDir` relative to the `basedir` in the `pwa` section of your `next.config.js`:

```javascript
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
customWorkerDir: "serviceworker",
// ...
});
Expand All @@ -34,7 +34,7 @@ In this example, `next-pwa` would look for `serviceworker/index.ts`.
Basically you need to create a file such as `worker.js` in `public` folder, then add an option `importScripts` to `pwa` object in `next.config.js`:

```javascript
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
importScripts: ["/worker.js"],
});
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-ts-worker/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

Expand Down
12 changes: 6 additions & 6 deletions examples/custom-ts-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"start": "next start"
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"babel-loader": "^8.2.5",
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"@types/react": "^18.0.17",
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5",
"eslint": "8.28.0",
"eslint-config-next": "13.0.5",
"typescript": "^4.7.4"
}
}
2 changes: 1 addition & 1 deletion examples/custom-worker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ In this example, `next-pwa` would look for `serviceworker/index.js`.
Basically you need to create a file such as `worker.js` in `public` folder, then add an option `importScripts` to `pwa` object in `next.config.js`:

```javascript
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
importScripts: ["/worker.js"],
});
Expand Down
2 changes: 1 addition & 1 deletion examples/custom-worker/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

Expand Down
12 changes: 6 additions & 6 deletions examples/custom-worker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"start": "next start"
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"babel-loader": "^8.2.5",
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/lifecycle/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
register: false,
skipWaiting: false,
Expand Down
12 changes: 6 additions & 6 deletions examples/lifecycle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"start": "next start"
},
"dependencies": {
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@ducanh2912/next-pwa": "latest",
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/minimal/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
// pwa output folder
// dest: '.next/pwa'
//
Expand Down
12 changes: 6 additions & 6 deletions examples/minimal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"start": "cross-env NODE_ENV=production node ./index.js"
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"cross-env": "^7.0.3",
"fastify": "^4.5.2",
"fastify-compress": "^4.1.0",
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/next-9/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

Expand Down
12 changes: 6 additions & 6 deletions examples/next-9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"start": "next start"
},
"dependencies": {
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@ducanh2912/next-pwa": "latest",
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/next-i18next/next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const withPWA = require("next-pwa")();
const withPWA = require("@ducanh2912/next-pwa").default();

module.exports = withPWA();
12 changes: 6 additions & 6 deletions examples/next-i18next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"start": "cross-env NODE_ENV=production node ./index.js"
},
"dependencies": {
"@ducanh2912/next-pwa": "latest",
"cross-env": "^7.0.3",
"express": "^4.18.1",
"fastify-compress": "^4.1.0",
"next": "^12.2.5",
"next": "13.0.5",
"next-i18next": "^12.0.0",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/next-image/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
});

Expand Down
12 changes: 6 additions & 6 deletions examples/next-image/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"start": "next start"
},
"dependencies": {
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"@ducanh2912/next-pwa": "latest",
"next": "13.0.5",
"react": "18.2.0",
"react-dom": "18.2.0"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/offline-fallback-v2/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
fallbacks: {
image: "/static/images/fallback.png",
Expand Down
12 changes: 6 additions & 6 deletions examples/offline-fallback-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
"start": "next start"
},
"dependencies": {
"next": "^12.2.5",
"next-pwa": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"next": "13.0.5",
"@ducanh2912/next-pwa": "latest",
"react": "18.2.0",
"react-dom": "18.2.0",
"sharp": "^0.30.7"
},
"devDependencies": {
"eslint": "^8.22.0",
"eslint-config-next": "12.2.5"
"eslint": "8.28.0",
"eslint-config-next": "13.0.5"
}
}
2 changes: 1 addition & 1 deletion examples/offline-fallback/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const withPWA = require("next-pwa")({
const withPWA = require("@ducanh2912/next-pwa").default({
dest: "public",
swSrc: "service-worker.js",
});
Expand Down
Loading

0 comments on commit bc38707

Please sign in to comment.