Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitda7bf5b

Browse files
committed
adapt nextjs 9.4 and fix bugs
1 parent1d090c6 commitda7bf5b

File tree

27 files changed

+1711
-897
lines changed

27 files changed

+1711
-897
lines changed

‎.env‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
NEXT_PUBLIC_TEST_PAGE_VAR=TEST_PAGE_PROP
2+
NEXT_PUBLIC_THEME_COLOR=#FFFFFF
3+
NEXT_PUBLIC_MANIEFST_PATH=/manifest.json
4+
NEXT_PUBLIC_ICON_192_PATH=/icons/icon192x192.png
5+
NEXT_PUBLIC_ICON_512_PATH=/icons/icon512x512.png
6+
NEXT_PUBLIC_FAV_ICON_PATH=/icons/favicon.ico

‎.env.production‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_LINK_PREFIX=/github_sql_pwa

‎.env.test‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NEXT_PUBLIC_TEST_PAGE_VAR=TEST_TEST_PAGE_PROP

‎.eslintrc.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ module.exports = {
7373
node:{
7474
extensions:['.js','.jsx','.ts','.tsx'],
7575
},
76+
typescript:{},
7677
},
7778
react:{
7879
version:'detect',// Tells eslint-plugin-react to automatically detect the version of React to use

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ coverage
44
.DS_Store
55
public/build/*
66
*.log
7-
.env
7+
.env*.local
88
out/
99
public/workbox-*.js
1010
public/sw.js

‎.vscode/settings.json‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"typescript.tsdk":"node_modules/typescript/lib",
3+
"deno.enable":false
4+
}

‎configs/env.mapping.js‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎jest.config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ module.exports = {
2424
'<rootDir>/__mocks__/mocks.js',
2525
'\\.(css|less|scss)$':'<rootDir>/__mocks__/mocks.js',
2626
},
27+
moduleDirectories:['node_modules','src'],
2728
};

‎jest/jest.setup.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
importEnzymefrom'enzyme';
22
importAdapterfrom'enzyme-adapter-react-16';
3-
importenvMappingfrom'../configs/env.mapping';
3+
import{join}from'path';
4+
import{loadEnvConfig}from'next/dist/lib/load-env-config';
45

5-
Object.assign(process.env,envMapping);
6+
// to load '.env' files in test
7+
loadEnvConfig(join(__dirname,'../'));
68

79
Enzyme.configure({adapter:newAdapter()});

‎next.config.js‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
constwithPWA=require('next-pwa');
33
constwithManifest=require('next-manifest');
44
constdefaultCache=require('next-pwa/cache');
5-
constenvMapping=require('./configs/env.mapping');
65

6+
/* eslint-disable prefer-destructuring */
77
constisProd=process.env.NODE_ENV==='production';
8-
const{
9-
LINK_PREFIX,
10-
FOLDER,
11-
THEME_COLOR,
12-
ICON_192_PATH,
13-
ICON_512_PATH,
14-
}=envMapping;
8+
constLINK_PREFIX=process.env.NEXT_PUBLIC_LINK_PREFIX||'';
9+
constFOLDER=LINK_PREFIX&&LINK_PREFIX.substring(1);
10+
constTHEME_COLOR=process.env.NEXT_PUBLIC_THEME_COLOR;
11+
constICON_192_PATH=process.env.NEXT_PUBLIC_ICON_192_PATH;
12+
constICON_512_PATH=process.env.NEXT_PUBLIC_ICON_512_PATH;
13+
constSHORT_NAME=process.env.SHORT_NAME||'';
14+
/* eslint-enable prefer-destructuring */
1515

1616
// tranfrom precache url for browsers that encode dynamic routes
1717
// i.e. "[id].js" => "%5Bid%5D.js"
@@ -26,7 +26,6 @@ const encodeUriTransform = async (manifestEntries) => {
2626
module.exports=()=>
2727
withManifest(
2828
withPWA({
29-
env:envMapping,
3029
target:'serverless',
3130
poweredByHeader:false,
3231
assetPrefix:LINK_PREFIX,
@@ -78,7 +77,7 @@ module.exports = () =>
7877
manifest:{
7978
/* eslint-disable @typescript-eslint/camelcase */
8079
output:'public',
81-
short_name:FOLDER,
80+
short_name:SHORT_NAME||FOLDER,
8281
name:FOLDER,
8382
start_url:`${LINK_PREFIX}/`,
8483
background_color:THEME_COLOR,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp