Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 0016cd4

Browse files
authored
chore: up to react 17 (#1096)
* chore(deps): upgrade latest react & next * chore: new import syntax * chore: point ci to real gq endpoint * chore(ci): skip backend * chore(ci): missing eslint dep * chore(config): resolve webpack 5 warning of import json file * chore(config): resolve webpack 5 warning of import json file * chore(ci): warnings & ts convert * chore(deps): upgrade main stack
1 parent 926d750 commit 0016cd4

File tree

281 files changed

+1334
-883
lines changed

Some content is hidden

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

281 files changed

+1334
-883
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
!.eslintrc.js
22
.gitignore
3+
next-env.d.ts
34
*.json
45
*.lock
56
*.hbs

.eslintrc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ module.exports = {
4141
},
4242
rules: {
4343
'@typescript-eslint/ban-ts-comment': 0,
44+
'react/jsx-uses-react': 'off',
45+
'react/react-in-jsx-scope': 'off',
4446
'react/jsx-filename-extension': [
4547
2,
4648
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },

.github/workflows/ci.yml

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,38 @@ jobs:
2222
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
2323

2424
steps:
25-
- name: (Backend) checkout codebase
26-
uses: actions/checkout@v2
27-
with:
28-
fetch-depth: 0
29-
repository: 'coderplanets/coderplanets_server'
30-
path: 'backend_server'
31-
- name: (Backend) Setup Elixir and OTP
32-
uses: erlef/setup-elixir@v1
33-
with:
34-
elixir-version: '1.10.3' # Define the elixir version [required]
35-
otp-version: '22.3' # Define the OTP version [required]
36-
- name: (Backend) Restore dependencies cache
37-
uses: actions/cache@v2
38-
with:
39-
path: deps
40-
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
41-
restore-keys: ${{ runner.os }}-mix-
42-
- name: (Backend) Install Packages
43-
working-directory: ./backend_server
44-
run: mix deps.get > /dev/null
45-
- name: (Backend) run migration
46-
working-directory: ./backend_server
47-
run: MIX_ENV=ci MIX_ENV=ci mix ecto.migrate > /dev/null
48-
- name: (Backend) set up test DB
49-
working-directory: ./backend_server
50-
run: MIX_ENV=ci mix ecto.setup > /dev/null
51-
- name: (Backend) seed data into DB
52-
working-directory: ./backend_server
53-
run: MIX_ENV=ci mix run priv/mock/cps_seeds.exs > /dev/null
54-
- name: (Backend) Run Server
55-
working-directory: ./backend_server
56-
run: MIX_ENV=ci mix phx.server &
25+
# - name: (Backend) checkout codebase
26+
# uses: actions/checkout@v2
27+
# with:
28+
# fetch-depth: 0
29+
# repository: 'coderplanets/coderplanets_server'
30+
# path: 'backend_server'
31+
# - name: (Backend) Setup Elixir and OTP
32+
# uses: erlef/setup-elixir@v1
33+
# with:
34+
# elixir-version: '1.10.3' # Define the elixir version [required]
35+
# otp-version: '22.3' # Define the OTP version [required]
36+
# - name: (Backend) Restore dependencies cache
37+
# uses: actions/cache@v2
38+
# with:
39+
# path: deps
40+
# key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
41+
# restore-keys: ${{ runner.os }}-mix-
42+
# - name: (Backend) Install Packages
43+
# working-directory: ./backend_server
44+
# run: mix deps.get > /dev/null
45+
# - name: (Backend) run migration
46+
# working-directory: ./backend_server
47+
# run: MIX_ENV=ci MIX_ENV=ci mix ecto.migrate > /dev/null
48+
# - name: (Backend) set up test DB
49+
# working-directory: ./backend_server
50+
# run: MIX_ENV=ci mix ecto.setup > /dev/null
51+
# - name: (Backend) seed data into DB
52+
# working-directory: ./backend_server
53+
# run: MIX_ENV=ci mix run priv/mock/cps_seeds.exs > /dev/null
54+
# - name: (Backend) Run Server
55+
# working-directory: ./backend_server
56+
# run: MIX_ENV=ci mix phx.server &
5757

5858
- name: (Frontend) checkout codebase
5959
uses: actions/checkout@v2

config/config.ci.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"//--- endpoint configs ---//": "",
3-
"GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql"
3+
"// GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql",
4+
"GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql"
45
}

config/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
// export * from './config.json'
2-
// import * as CONFIG from './config.json'
3-
41
import type { TThemeName } from '@/spec'
5-
import { DEFAULT_THEME as DEFAULT_THEME_CONFIG } from './config.json'
2+
3+
import CONFIG from './config.json'
64

75
export { default as LABEL_POOL } from './label_pool'
86
export { default as SEO } from './next_seo'
97

10-
export const DEFAULT_THEME = DEFAULT_THEME_CONFIG as TThemeName
8+
export const DEFAULT_THEME = CONFIG.DEFAULT_THEME as TThemeName
119

12-
// explicit export to avoid eslint warning
13-
export {
10+
export const {
1411
GRAPHQL_ENDPOINT,
1512
SENIOR_AMOUNT_THRESHOLD,
1613
SPONSOR_AMOUNT_THRESHOLD,
@@ -41,4 +38,4 @@ export {
4138
EMAIL_HELLO,
4239
EMAIL_BUSINESS,
4340
BUILD_VERSION,
44-
} from './config.json'
41+
} = CONFIG

config/label_pool.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as CONFIG from './config.json'
1+
import CONFIG from './config.json'
22

33
const { ICON_CMD } = CONFIG
44

next-env.d.ts

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/// <reference types="next" />
22
/// <reference types="next/types/global" />
3+
/// <reference types="next/image-types/global" />

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,30 @@
8585
"js-cookie": "^2.2.0",
8686
"mastani-codehighlight": "0.0.7",
8787
"mobile-device-detect": "^0.4.3",
88-
"mobx": "6.3.0",
89-
"mobx-react": "7.1.0",
88+
"mobx": "6.3.2",
89+
"mobx-react": "7.2.0",
9090
"mobx-react-lite": "3.2.0",
91-
"mobx-state-tree": "5.0.1",
91+
"mobx-state-tree": "5.0.2",
9292
"module-alias": "^2.0.1",
9393
"nanoid": "^3.1.12",
94-
"next": "^10.1.4-canary.16",
94+
"next": "11.0.1",
9595
"next-compose-plugins": "^2.2.0",
9696
"next-i18next": "4.4.1",
9797
"next-offline": "4.0.6",
9898
"next-seo": "4.4.0",
9999
"nextjs-progressbar": "^0.0.6",
100100
"overlayscrollbars": "1.13.1",
101101
"path-match": "^1.2.4",
102-
"polished": "4.1.1",
102+
"polished": "4.1.3",
103103
"promise-timeout": "^1.3.0",
104104
"prop-types": "^15.5.10",
105105
"pubsub-js": "^1.9.3",
106106
"ramda": "0.26.1",
107-
"react": "16.9.0",
107+
"react": "17.0.2",
108108
"react-animation": "^1.2.2",
109109
"react-calendar-heatmap": "1.8.1",
110110
"react-content-loader": "3.4.2",
111-
"react-dom": "16.9.0",
111+
"react-dom": "17.0.2",
112112
"react-highlight-words": "^0.16.0",
113113
"react-lazy-load-image-component": "1.5.0",
114114
"react-masonry-component": "^6.0.1",
@@ -135,7 +135,7 @@
135135
"sentry-testkit": "^2.1.0",
136136
"store": "^2.0.12",
137137
"stringz": "^2.0.0",
138-
"styled-components": "5.2.3",
138+
"styled-components": "5.3.0",
139139
"timeago-react": "3.0.2",
140140
"tinykeys": "^1.0.6"
141141
},
@@ -161,6 +161,7 @@
161161
"enzyme-adapter-react-16": "1.15.2",
162162
"enzyme-to-json": "^3.3.4",
163163
"eslint": "6.4.0",
164+
"eslint-config-next": "^11.0.1",
164165
"husky": "^3.0.0",
165166
"jest": "26.2.2",
166167
"npm-run-all": "^4.1.1",

src/components/AlertBar/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*/
66

7-
import React, { FC, ReactNode } from 'react'
7+
import { FC, ReactNode, memo } from 'react'
88

99
import { buildLog } from '@/utils'
1010

@@ -21,4 +21,4 @@ const AlertBar: FC<TProps> = ({ children }) => {
2121
return <Wrapper testid="alertBar">{children}</Wrapper>
2222
}
2323

24-
export default React.memo(AlertBar)
24+
export default memo(AlertBar)

src/components/ArticleItemPrefixLabel/ReadLabel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FC } from 'react'
1+
import { FC, memo } from 'react'
22

33
import { ReadedLabel } from './styles'
44

@@ -19,4 +19,4 @@ const ReadLabel: FC<TProps> = ({ entry, accountInfo, topOffset = '20px' }) => {
1919
return null
2020
}
2121

22-
export default React.memo(ReadLabel)
22+
export default memo(ReadLabel)

0 commit comments

Comments
 (0)