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
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitf92f503

Browse files
authored
Next 9 new feature (#756)
* chore(clean-up): replace installed fetch with next9's build-in fetchhttps://nextjs.org/blog/next-9-4#new-environment-variables-support* chore(eslint): upgrade for arrow-parens rule* feat(core): use next9's build-in env support* chore(deps): remove unused pkgs
1 parentc7c7b29 commitf92f503

File tree

16 files changed

+65
-184
lines changed

16 files changed

+65
-184
lines changed

‎.babelrc‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"presets": [["next/babel"]],
33
"env": {
4-
"development": {
5-
"plugins": ["inline-dotenv"]
6-
},
74
"production": {
85
"presets": [
96
[
@@ -18,25 +15,16 @@
1815
}
1916
]
2017
]
21-
},
22-
"test": {
23-
"plugins": ["inline-dotenv"]
2418
}
2519
},
2620
"plugins": [
2721
"add-react-displayname",
28-
[
29-
"@babel/plugin-proposal-decorators",
30-
{
31-
"legacy":true
32-
}
33-
],
34-
"transform-inline-environment-variables",
3522
[
3623
"babel-plugin-styled-components",
3724
{
3825
"ssr":true,
3926
"displayName":true,
27+
"pure":true,
4028
"preprocess":false
4129
}
4230
]

‎.prettierrc‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"bracketSpacing": true,
3-
"trailingComma": "es5",
3+
"trailingComma": "all",
44
"singleQuote": true,
55
"tabWidth": 2,
66
"semi": false
7-
}
7+
}

‎docs/general/develop.md‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,7 @@ you can edit it to match your own needs.
3434

3535
##env
3636

37-
frontend code can not use NODE_ENV directly, this project use[webpack-env](https://github.com/mrsteele/dotenv-webpack)(`systemvars:true`) to pass the`NODE_ENV` env to frontend code, so frontend code can use it like 'process.env.NODE_ENV'.
38-
39-
see next.config.js[details](https://github.com/mydearxym/mastani_web/blob/dev/next.config.js#L56-L60)
40-
41-
```js
42-
config.plugins.push(
43-
newDotenv({
44-
path:'./.env',
45-
systemvars:true,
46-
})
47-
)
48-
```
37+
see:https://nextjs.org/docs/basic-features/environment-variables
4938

5039
##valid cmd
5140

‎next.config.docker.js‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
constwebpack=require('webpack')
22

3-
constpath=require('path')
4-
constfs=require('fs')
5-
constDotenv=require('dotenv-webpack')
6-
require('dotenv').config()
7-
83
// next-plugins
94
constwithPlugins=require('next-compose-plugins')
105
constwithSourceMaps=require('@zeit/next-source-maps')
@@ -20,33 +15,24 @@ const nextConfig = {
2015
config.plugins.push(newwebpack.IgnorePlugin(/(?:\/tests|__mocks)/))
2116
// moment locale size is too big
2217
config.plugins.push(
23-
newwebpack.ContextReplacementPlugin(/moment[/\\]locale$/,/(en)/)
18+
newwebpack.ContextReplacementPlugin(/moment[/\\]locale$/,/(en)/),
2419
)
2520

2621
// for sentry
2722
config.plugins.push(
2823
newwebpack.DefinePlugin({
2924
'process.env.SENTRY_RELEASE':JSON.stringify(buildId),
30-
})
25+
}),
3126
)
3227
if(!isServer){
3328
config.resolve.alias['@sentry/node']='@sentry/browser'
3429
}
3530

36-
if(fs.existsSync('./.env')){
37-
config.plugins.push(
38-
newDotenv({
39-
path:path.join(__dirname,'.env'),
40-
systemvars:true,
41-
})
42-
)
43-
}
44-
4531
returnconfig
4632
},
4733
}
4834

4935
module.exports=withPlugins(
5036
[withSourceMaps,[withOffline,offlineConfig]],
51-
nextConfig
37+
nextConfig,
5238
)

‎next.config.js‎

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
constwebpack=require('webpack')
22

3-
constpath=require('path')
4-
constfs=require('fs')
5-
constDotenv=require('dotenv-webpack')
6-
require('dotenv').config()
7-
83
// next-plugins
94
constwithPlugins=require('next-compose-plugins')
105
constwithSourceMaps=require('@zeit/next-source-maps')()
@@ -23,33 +18,24 @@ const nextConfig = {
2318
config.plugins.push(newwebpack.IgnorePlugin(/(?:\/tests|__mocks)/))
2419
// moment locale size is too big
2520
config.plugins.push(
26-
newwebpack.ContextReplacementPlugin(/moment[/\\]locale$/,/(en)/)
21+
newwebpack.ContextReplacementPlugin(/moment[/\\]locale$/,/(en)/),
2722
)
2823

2924
// for sentry
3025
config.plugins.push(
3126
newwebpack.DefinePlugin({
3227
'process.env.SENTRY_RELEASE':JSON.stringify(buildId),
33-
})
28+
}),
3429
)
3530
if(!isServer){
3631
config.resolve.alias['@sentry/node']='@sentry/browser'
3732
}
3833

39-
if(fs.existsSync('./.env')){
40-
config.plugins.push(
41-
newDotenv({
42-
path:path.join(__dirname,'.env'),
43-
systemvars:true,
44-
})
45-
)
46-
}
47-
4834
returnconfig
4935
},
5036
}
5137

5238
module.exports=withPlugins(
5339
[withBundleAnalyzer,withSourceMaps,[withOffline,offlineConfig]],
54-
nextConfig
40+
nextConfig,
5541
)

‎package.docker.json‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"graphql-request":"^1.6.0",
4949
"graphql-tag":"^2.6.1",
5050
"graphql-voyager":"^1.0.0-rc.26",
51-
"isomorphic-fetch":"^2.2.1",
5251
"js-cookie":"^2.2.0",
5352
"keyboardjs":"^2.5.1",
5453
"mastani-codehighlight":"0.0.7",
@@ -103,11 +102,7 @@
103102
"uuid":"^3.3.2"
104103
},
105104
"devDependencies": {
106-
"@babel/core":"7.5.5",
107-
"@babel/plugin-proposal-decorators":"^7.4.4",
108-
"babel-plugin-inline-dotenv":"^1.1.2",
109-
"babel-plugin-styled-components":"1.10.7",
110-
"babel-plugin-transform-inline-environment-variables":"^0.4.3",
111-
"dotenv-webpack":"1.6.0"
105+
"@babel/core":"7.10.2",
106+
"babel-plugin-styled-components":"1.10.7"
112107
}
113108
}

‎package.json‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@
7676
"graphql-request":"^1.6.0",
7777
"graphql-tag":"^2.6.1",
7878
"graphql-voyager":"^1.0.0-rc.31",
79-
"isomorphic-fetch":"^2.2.1",
8079
"js-cookie":"^2.2.0",
8180
"keyboardjs":"^2.5.1",
8281
"mastani-codehighlight":"0.0.7",
@@ -132,21 +131,16 @@
132131
},
133132
"devDependencies": {
134133
"@babel/core":"7.10.2",
135-
"@babel/plugin-proposal-decorators":"^7.4.4",
136134
"@commitlint/cli":"^8.2.0",
137135
"@commitlint/config-conventional":"^8.2.0",
138-
"@groupher/eslint-config-web":"2.0.2",
136+
"@groupher/eslint-config-web":"2.0.4",
139137
"babel-eslint":"^10.0.2",
140138
"babel-jest":"^23.6.0",
141-
"babel-plugin-inline-dotenv":"^1.1.2",
142139
"babel-plugin-styled-components":"1.10.7",
143-
"babel-plugin-transform-inline-environment-variables":"^0.4.3",
144140
"commitizen":"3.1.2",
145141
"coveralls":"3.0.6",
146142
"cypress":"4.7.0",
147143
"cz-conventional-changelog":"^3.0.0",
148-
"dotenv":"8.1.0",
149-
"dotenv-webpack":"1.6.0",
150144
"enzyme":"3.11.0",
151145
"enzyme-adapter-react-16":"1.15.2",
152146
"enzyme-to-json":"^3.3.4",
@@ -155,7 +149,7 @@
155149
"jest":"23.4.2",
156150
"npm-run-all":"^4.1.1",
157151
"plop":"2.3.1",
158-
"prettier":"1.19.0",
152+
"prettier":"2.0.5",
159153
"pretty-quick":"^1.10.0",
160154
"react-test-renderer":"16.10.0",
161155
"shelljs":"0.8.4",

‎src/containers/DocUploader/index.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ class DocUploaderContainer extends React.Component {
110110
try{
111111
/* this.state.ossClient = new OSS.Wrapper({ */
112112
constossClient=newOSS.Wrapper({
113-
region:process.env.ALI_OSS_RESION,
114-
accessKeyId:process.env.ALI_ACCESS_KEY,
115-
accessKeySecret:process.env.ALI_ACCESS_SECRET,
116-
bucket:process.env.ALI_OSS_BUCKET,
113+
region:process.env.NEXT_PUBLIC_ALI_OSS_RESION,
114+
accessKeyId:process.env.NEXT_PUBLIC_ALI_ACCESS_KEY,
115+
accessKeySecret:process.env.NEXT_PUBLIC_ALI_ACCESS_SECRET,
116+
bucket:process.env.NEXT_PUBLIC_ALI_OSS_BUCKET,
117117
/* internal: true, */
118118
/* secure: true, */
119119
})
@@ -173,12 +173,12 @@ class DocUploaderContainer extends React.Component {
173173

174174
ossClient
175175
.multipartUpload(fullpath,file)
176-
.then(result=>{
176+
.then((result)=>{
177177
consturl=`${ASSETS_ENDPOINT}/${result.name}`
178178
sendEvent('finish')
179179
this.onUploadDone(url)
180180
})
181-
.catch(err=>{
181+
.catch((err)=>{
182182
sendEvent('finish')
183183
onUploadError(err)
184184
})

‎src/containers/Doraemon/logic/oauth/github_handler.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import oauthPopup from './oauth_window'
44
importSfrom'../../schema'
55

66
constgithubLoginHandler=(store,sr71$)=>{
7-
constclientId=process.env.GITHUB_CLIENT_ID
7+
constclientId=process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID
88
constinfo='from_github'
99
constcb='https://coderplanets.com/oauth'
1010
constgithub='https://github.com/login/oauth/authorize'
1111
consturl=`${github}?client_id=${clientId}&state=${info}&redirect_uri=${cb}`
1212

1313
oauthPopup(url)
1414

15-
Global.addEventListener('message',e=>{
15+
Global.addEventListener('message',(e)=>{
1616
if(e.origin===Global.location.origin){
1717
if(e.data.from_oauth_window){
1818
constcode=getQueryFromUrl('code',e.data.from_oauth_window)

‎src/containers/thread/UsersThread/geo_data.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
//
22
/* import { fetch } from 'whatwg-fetch' */
33
import{ASSETS_ENDPOINT}from'@/config'
4-
importfetchfrom'isomorphic-fetch'
54
import{BStore}from'@/utils'
65

76
constendpoint=`${ASSETS_ENDPOINT}/asia.geo.json`
87
constbkey='asia.geo.data'
98

10-
constfetchGeoData=()=>
11-
newPromise((resolve,reject)=>{
9+
constfetchGeoData=()=>{
10+
returnnewPromise((resolve,reject)=>{
1211
constgeoData=BStore.get(bkey)
1312

1413
if(typeofgeoData==='object')returnresolve(geoData)
@@ -23,5 +22,6 @@ const fetchGeoData = () =>
2322
})
2423
.catch(()=>reject('error'))
2524
})
25+
}
2626

2727
exportdefaultfetchGeoData

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp