Skip to content

Commit d3fec15

Browse files
committed
Update examples
1 parent c3d6836 commit d3fec15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+224
-111
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

examples/cache-on-front-end-nav/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
"start": "next start"
1111
},
1212
"dependencies": {
13-
"next": "^12.2.3",
13+
"next": "^12.2.5",
1414
"next-pwa": "latest",
1515
"react": "^18.2.0",
1616
"react-dom": "^18.2.0"
17+
},
18+
"devDependencies": {
19+
"eslint": "^8.22.0",
20+
"eslint-config-next": "12.2.5"
1721
}
1822
}

examples/cache-on-front-end-nav/pages/_app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState } from 'react'
22
import { useRouter } from 'next/router'
33

4-
const App = ({ Component, pageProps }) => {
4+
const _App = ({ Component, pageProps }) => {
55
const [isOnline, setIsOnline] = useState(true)
66
useEffect(() => {
77
if (typeof window !== 'undefined' && 'ononline' in window && 'onoffline' in window) {
@@ -35,4 +35,4 @@ const App = ({ Component, pageProps }) => {
3535
return <Component {...pageProps} />
3636
}
3737

38-
export default App
38+
export default _App

examples/cache-on-front-end-nav/pages/_document.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Document, { Html, Head, Main, NextScript } from 'next/document'
33
const APP_NAME = 'next-pwa example'
44
const APP_DESCRIPTION = 'This is an example of using next-pwa plugin'
55

6-
export default class extends Document {
6+
class _Document extends Document {
77
static async getInitialProps(ctx) {
88
return await Document.getInitialProps(ctx)
99
}
@@ -22,12 +22,11 @@ export default class extends Document {
2222
<meta name='theme-color' content='#FFFFFF' />
2323
{/* TIP: set viewport head meta tag in _app.js, otherwise it will show a warning */}
2424
{/* <meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover' /> */}
25-
25+
2626
<link rel='apple-touch-icon' sizes='180x180' href='/icons/apple-touch-icon.png' />
2727
<link rel='manifest' href='/manifest.json' />
2828
<link rel='shortcut icon' href='/favicon.ico' />
29-
<style>{
30-
`
29+
<style>{`
3130
html, body, #__next {
3231
height: 100%;
3332
}
@@ -37,8 +36,7 @@ export default class extends Document {
3736
h1 {
3837
text-align: center;
3938
}
40-
`
41-
}</style>
39+
`}</style>
4240
</Head>
4341
<body>
4442
<Main />
@@ -48,3 +46,5 @@ export default class extends Document {
4846
)
4947
}
5048
}
49+
50+
export default _Document

examples/cookie/.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

examples/cookie/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
},
1212
"dependencies": {
1313
"js-cookie": "^3.0.1",
14-
"next": "^12.2.3",
14+
"next": "^12.2.5",
1515
"next-cookies": "^2.0.3",
1616
"next-pwa": "latest",
1717
"react": "^18.2.0",
1818
"react-dom": "^18.2.0"
19+
},
20+
"devDependencies": {
21+
"eslint": "^8.22.0",
22+
"eslint-config-next": "12.2.5"
1923
}
2024
}

examples/cookie/pages/_document.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Document, { Html, Head, Main, NextScript } from 'next/document'
33
const APP_NAME = 'next-pwa example'
44
const APP_DESCRIPTION = 'This is an example of using next-pwa plugin'
55

6-
export default class extends Document {
6+
class _Document extends Document {
77
static async getInitialProps(ctx) {
88
return await Document.getInitialProps(ctx)
99
}
@@ -22,12 +22,11 @@ export default class extends Document {
2222
<meta name='theme-color' content='#FFFFFF' />
2323
{/* TIP: set viewport head meta tag in _app.js, otherwise it will show a warning */}
2424
{/* <meta name='viewport' content='minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no, viewport-fit=cover' /> */}
25-
25+
2626
<link rel='apple-touch-icon' sizes='180x180' href='/icons/apple-touch-icon.png' />
2727
<link rel='manifest' href='/manifest.json' />
2828
<link rel='shortcut icon' href='/favicon.ico' />
29-
<style>{
30-
`
29+
<style>{`
3130
html, body, #__next {
3231
height: 100%;
3332
}
@@ -37,8 +36,7 @@ export default class extends Document {
3736
h1 {
3837
text-align: center;
3938
}
40-
`
41-
}</style>
39+
`}</style>
4240
</Head>
4341
<body>
4442
<Main />
@@ -48,3 +46,5 @@ export default class extends Document {
4846
)
4947
}
5048
}
49+
50+
export default _Document

examples/cookie/pages/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useRouter } from 'next/router'
33
import Cookies from 'js-cookie'
44
import nextCookies from 'next-cookies'
55

6-
export default ({ user }) => {
6+
const Index = ({ user }) => {
77
const router = useRouter()
88

99
const handleLogoutClick = () => {
@@ -50,3 +50,5 @@ export const getServerSideProps = context => {
5050
}
5151
}
5252
}
53+
54+
export default Index
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

examples/custom-ts-worker/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
},
1212
"dependencies": {
1313
"babel-loader": "^8.2.5",
14-
"next": "^12.2.3",
14+
"next": "^12.2.5",
1515
"next-pwa": "latest",
1616
"react": "^18.2.0",
1717
"react-dom": "^18.2.0"
1818
},
1919
"devDependencies": {
20-
"@types/react": "^18.0.15",
20+
"@types/react": "^18.0.17",
21+
"eslint": "^8.22.0",
22+
"eslint-config-next": "12.2.5",
2123
"typescript": "^4.7.4"
2224
}
2325
}

0 commit comments

Comments
 (0)