Skip to content

Commit

Permalink
chore: pwa setting
Browse files Browse the repository at this point in the history
  • Loading branch information
JaeMeDev committed Aug 11, 2022
1 parent b68161d commit f924561
Show file tree
Hide file tree
Showing 73 changed files with 1,660 additions and 81 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ yarn-error.log*
cypress/screenshots
cypress/videos
cypress/log

# next-pwa
**/public/workbox**
**/public/sw**
831 changes: 831 additions & 0 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
20 changes: 19 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const withPlugins = require('next-compose-plugins');
const withPWA = require('next-pwa');
const runtimeCaching = require('next-pwa/cache');

const isProd = process.env.NODE_ENV === 'production';

/** @type {import('next').NextConfig} */
Expand Down Expand Up @@ -27,4 +31,18 @@ const nextConfig = {
},
};

module.exports = nextConfig;
module.exports = withPlugins(
[
[
withPWA,
{
pwa: {
disable: !isProd,
dest: 'public',
runtimeCaching,
},
},
],
],
nextConfig,
);
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"emotion-normalize": "^11.0.1",
"facepaint": "^1.2.1",
"next": "^12.2.2",
"next-compose-plugins": "^2.2.1",
"next-pwa": "5.5.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"recoil": "^0.7.4"
Expand Down
Binary file added public/images/icon_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/icon_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/maskable_icon_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/maskable_icon_512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "2차갈래",
"short_name": "2차갈래",
"description": "2차를 빠르게 찾게 도와주는 플랫폼 2차갈래",
"icons": [
{
"src": "images/icon_192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "images/icon_512.png",
"sizes": "512x512",
"type": "image/png"
},
{
"src": "images/maskable_icon_192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "images/maskable_icon_512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"start_url": "/?source=pwa",
"background_color": "#EB4F27",
"orientation": "portrait",
"display": "standalone",
"scope": "/",
"theme_color": "#EB4F27"
}
45 changes: 45 additions & 0 deletions src/pages/_document.page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';

import Document, {
Head, Html, Main, NextScript,
} from 'next/document';

class MyDocument extends Document {
render() {
return (
<Html lang="ko">
<Head>
<meta charSet="utf-8" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta
name="apple-mobile-web-app-status-bar-style"
content="black-translucent"
/>
<meta name="apple-mobile-web-app-title" content="2차갈래" />
<meta name="application-name" content="2차갈래" />
<meta name="description" content="2차를 빠르게 찾게 도와주는 플랫폼 2차갈래" />
<meta
name="theme-color"
content="#EB4F27"
media="(prefers-color-scheme: light)"
/>
<meta
name="theme-color"
content="#EB4F27"
media="(prefers-color-scheme: dark)"
/>
<link rel="apple-touch-icon" href="/images/maskable_icon_512.png" />
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="manifest" href="/manifest.json" />
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}

export default MyDocument;
Loading

0 comments on commit f924561

Please sign in to comment.