@authing/react-ui-components 3.0.2-beta.5 → 3.1.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +1 -1
- package/LICENSE +21 -0
- package/config/env.js +26 -24
- package/config/paths.js +3 -3
- package/config/webpack.config.js +29 -7
- package/lib/index.d.ts +211 -1252
- package/lib/index.min.css +1 -2
- package/lib/index.min.js +1 -1
- package/lib/index.min.js.LICENSE.txt +0 -32
- package/package.json +14 -20
- package/scripts/build.js +83 -79
- package/scripts/start.js +73 -69
- package/scripts/test.js +23 -19
- package/{components → src/common}/AuthingDropdown/index.tsx +1 -1
- package/{components → src/common}/AuthingDropdown/style.less +0 -0
- package/{components → src/common}/AuthingTabs/index.tsx +1 -1
- package/{components → src/common}/AuthingTabs/style.less +0 -0
- package/{components → src/common}/CopyAbleText/index.tsx +1 -1
- package/{components → src/common}/CopyAbleText/style.less +0 -0
- package/{components → src/common}/VerifyCodeInput/index.tsx +0 -0
- package/{components → src/common}/VerifyCodeInput/style.less +0 -0
- package/{components → src/components}/AuthingGuard/AppMFALayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/AppMFALayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/CompleteUserInfoLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ADLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/Agreements/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/Agreements/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/index.tsx +4 -9
- package/{components → src/components}/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/LoginFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/PasswordLoginForm/index.tsx +3 -3
- package/{components → src/components}/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +4 -2
- package/{components → src/components}/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/ResetPwdForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SendPhoneCode/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +2 -2
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +7 -7
- package/{components → src/components}/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Forms/UploadImage/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/Forms/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/GuardLayout/index.tsx +17 -3
- package/{components → src/components}/AuthingGuard/GuardLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/Header/index.tsx +6 -3
- package/{components → src/components}/AuthingGuard/Header/style.less +23 -11
- package/{components → src/components}/AuthingGuard/IconFont/iconfont.js +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/IconFont/style.less +0 -0
- package/{components → src/components}/AuthingGuard/IconFont/svg.js +0 -0
- package/{components → src/components}/AuthingGuard/LoginLayout/index.tsx +69 -25
- package/{components → src/components}/AuthingGuard/LoginLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/Steps.ts +0 -0
- package/{components → src/components}/AuthingGuard/MfaLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/MfaLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/RegisterLayout/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/RegisterLayout/style.less +0 -0
- package/{components → src/components}/AuthingGuard/ResetPwdLayout/index.tsx +1 -1
- package/{components → src/components}/AuthingGuard/ToggleLang/index.tsx +2 -2
- package/{components → src/components}/AuthingGuard/api/appConfig.ts +22 -14
- package/{components/_utils → src/components/AuthingGuard/api}/http.ts +33 -30
- package/{components → src/components}/AuthingGuard/api/index.ts +0 -0
- package/{components → src/components}/AuthingGuard/api/sso.ts +1 -1
- package/{components → src/components}/AuthingGuard/api/userPoolConfig.ts +3 -2
- package/{components → src/components}/AuthingGuard/constants.ts +2 -2
- package/{components → src/components}/AuthingGuard/hooks/index.tsx +0 -0
- package/{components → src/components}/AuthingGuard/hooks/useScreenSize.tsx +0 -0
- package/{components → src/components}/AuthingGuard/index.tsx +11 -3
- package/{components/_utils → src/components/AuthingGuard}/locales/en/common.json +26 -70
- package/{components/_utils → src/components/AuthingGuard}/locales/en/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/login.json +19 -21
- package/{components/_utils → src/components/AuthingGuard}/locales/en/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/en/user.json +3 -4
- package/{components/_utils → src/components/AuthingGuard}/locales/index.ts +2 -2
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/common.json +9 -53
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/index.ts +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/login.json +4 -6
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/map.json +0 -0
- package/{components/_utils → src/components/AuthingGuard}/locales/zh/user.json +1 -3
- package/{components → src/components}/AuthingGuard/style.less +5 -0
- package/{components → src/components}/AuthingGuard/types/Forms.ts +2 -1
- package/{components → src/components}/AuthingGuard/types/GuardConfig.ts +5 -1
- package/{components → src/components}/AuthingGuard/types/GuardState.ts +1 -1
- package/{components → src/components}/AuthingGuard/types/Locales.ts +0 -0
- package/{components → src/components}/AuthingGuard/types/index.ts +0 -0
- package/src/components/index.ts +7 -0
- package/{components → src}/context/base.tsx +0 -0
- package/{components → src}/context/global/context.tsx +0 -0
- package/{components → src}/context/global/reducer.tsx +2 -2
- package/src/index.tsx +142 -0
- package/{logo.svg → src/logo.svg} +0 -0
- package/{react-app-env.d.ts → src/react-app-env.d.ts} +0 -0
- package/{reportWebVitals.ts → src/reportWebVitals.ts} +0 -0
- package/{setupTests.ts → src/setupTests.ts} +0 -0
- package/{components/_utils → src/utils}/clipboard.ts +1 -1
- package/{components/_utils → src/utils}/index.ts +3 -149
- package/{components/_utils → src/utils}/popupCenter.ts +0 -0
- package/tsconfig.json +2 -8
- package/build/asset-manifest.json +0 -26
- package/build/favicon.ico +0 -0
- package/build/index.html +0 -1
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/build/static/css/2.51c07e65.chunk.css +0 -3
- package/build/static/css/2.51c07e65.chunk.css.map +0 -1
- package/build/static/css/main.779f221a.chunk.css +0 -2
- package/build/static/css/main.779f221a.chunk.css.map +0 -1
- package/build/static/js/2.bbae9fdb.chunk.js +0 -3
- package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
- package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
- package/build/static/js/3.fd17f196.chunk.js +0 -2
- package/build/static/js/3.fd17f196.chunk.js.map +0 -1
- package/build/static/js/main.5f341531.chunk.js +0 -2
- package/build/static/js/main.5f341531.chunk.js.map +0 -1
- package/build/static/js/runtime-main.ef138021.js +0 -2
- package/build/static/js/runtime-main.ef138021.js.map +0 -1
- package/build/static/media/loading.4a67a5f3.svg +0 -29
- package/components/BindTotp/core/bindSuccess.tsx +0 -72
- package/components/BindTotp/core/securityCode.tsx +0 -108
- package/components/BindTotp/index.tsx +0 -134
- package/components/BindTotp/interface.ts +0 -30
- package/components/BindTotp/styles.less +0 -57
- package/components/ChangeLanguage/index.tsx +0 -35
- package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
- package/components/ChangePassword/core/rotateReset.tsx +0 -114
- package/components/ChangePassword/index.tsx +0 -72
- package/components/CompleteInfo/core/completeInfo.tsx +0 -155
- package/components/CompleteInfo/index.tsx +0 -45
- package/components/CompleteInfo/interface.ts +0 -40
- package/components/CompleteInfo/styles.less +0 -7
- package/components/DownloadAuthenticator/index.tsx +0 -97
- package/components/DownloadAuthenticator/interface.ts +0 -22
- package/components/DownloadAuthenticator/styles.less +0 -52
- package/components/Error/index.tsx +0 -21
- package/components/Error/interface.ts +0 -9
- package/components/Error/styles.less +0 -12
- package/components/ForgetPassword/core/resetPassword.tsx +0 -162
- package/components/ForgetPassword/index.tsx +0 -78
- package/components/ForgetPassword/interface.ts +0 -32
- package/components/Guard/Guard.tsx +0 -295
- package/components/Guard/authClient.ts +0 -44
- package/components/Guard/config.ts +0 -19
- package/components/Guard/event.ts +0 -52
- package/components/Guard/index.tsx +0 -4
- package/components/Guard/module.ts +0 -20
- package/components/Guard/stateMachine.ts +0 -152
- package/components/Guard/styles.less +0 -461
- package/components/IconFont/iconfont.js +0 -74
- package/components/IconFont/index.tsx +0 -16
- package/components/IconFont/style.less +0 -6
- package/components/IconFont/svg.js +0 -2
- package/components/ImagePro/index.tsx +0 -53
- package/components/ImagePro/styles.less +0 -40
- package/components/InputNumber/index.tsx +0 -33
- package/components/Login/codemap.ts +0 -49
- package/components/Login/core/withAD.tsx +0 -9
- package/components/Login/core/withAppQrcode.tsx +0 -49
- package/components/Login/core/withLDAP.tsx +0 -146
- package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
- package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
- package/components/Login/core/withPassword/InputAccount.tsx +0 -64
- package/components/Login/core/withPassword/index.tsx +0 -173
- package/components/Login/core/withPhonecode.tsx +0 -122
- package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
- package/components/Login/core/withWechatmpQrcode.tsx +0 -53
- package/components/Login/index.tsx +0 -374
- package/components/Login/props.ts +0 -74
- package/components/Login/socialLogin/index.tsx +0 -407
- package/components/Login/socialLogin/style.less +0 -69
- package/components/Login/styles.less +0 -53
- package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
- package/components/MFA/VerifyCodeInput/index.tsx +0 -145
- package/components/MFA/VerifyCodeInput/style.less +0 -35
- package/components/MFA/codemap.ts +0 -24
- package/components/MFA/core/email.tsx +0 -203
- package/components/MFA/core/face.tsx +0 -297
- package/components/MFA/core/face_deps.tsx +0 -37
- package/components/MFA/core/sms.tsx +0 -203
- package/components/MFA/core/totp.tsx +0 -122
- package/components/MFA/index.tsx +0 -143
- package/components/MFA/mfaMethods/index.tsx +0 -88
- package/components/MFA/mfaMethods/style.less +0 -39
- package/components/MFA/props.ts +0 -51
- package/components/MFA/styles.less +0 -100
- package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
- package/components/NeedHelpView/index.tsx +0 -47
- package/components/RecoveryCode/core/useCode.tsx +0 -71
- package/components/RecoveryCode/index.tsx +0 -27
- package/components/RecoveryCode/interface.ts +0 -31
- package/components/RecoveryCode/style.less +0 -13
- package/components/Register/codemap.ts +0 -12
- package/components/Register/components/Agreements/index.tsx +0 -81
- package/components/Register/components/Agreements/style.less +0 -44
- package/components/Register/core/WithEmail.tsx +0 -242
- package/components/Register/core/WithPhone.tsx +0 -184
- package/components/Register/index.tsx +0 -139
- package/components/Register/props.ts +0 -50
- package/components/SendCode/SendCodeBtn.tsx +0 -96
- package/components/SendCode/index.tsx +0 -94
- package/components/SendCode/style.less +0 -31
- package/components/ShieldSpin/index.tsx +0 -27
- package/components/ShieldSpin/loading.svg +0 -29
- package/components/SubmitButton/index.tsx +0 -50
- package/components/SubmitSuccess/index.tsx +0 -66
- package/components/SubmitSuccess/interface.ts +0 -17
- package/components/Type/index.ts +0 -52
- package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
- package/components/ValidatorRules/index.ts +0 -20
- package/components/_utils/GuardErrorCode.ts +0 -9
- package/components/_utils/config.ts +0 -116
- package/components/_utils/guradHttp.ts +0 -101
- package/components/_utils/hooks/index.ts +0 -64
- package/components/assets/images/error.png +0 -0
- package/components/context/module/context.tsx +0 -23
- package/components/index.ts +0 -12
- package/examples.tsx +0 -87
- package/index.js +0 -1
- package/lib/static/media/loading.4a67a5f3.svg +0 -29
- package/scripts/publish.js +0 -57
|
@@ -4,38 +4,6 @@
|
|
|
4
4
|
http://jedwatson.github.io/classnames
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @license
|
|
24
|
-
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
25
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26
|
-
* you may not use this file except in compliance with the License.
|
|
27
|
-
* You may obtain a copy of the License at
|
|
28
|
-
*
|
|
29
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
-
*
|
|
31
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
32
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
33
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
34
|
-
* See the License for the specific language governing permissions and
|
|
35
|
-
* limitations under the License.
|
|
36
|
-
* =============================================================================
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
7
|
/**
|
|
40
8
|
* @license
|
|
41
9
|
* Lodash <https://lodash.com/>
|
package/package.json
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authing/react-ui-components",
|
|
3
|
-
"version": "3.
|
|
4
|
-
"framework": "React",
|
|
3
|
+
"version": "3.1.1-rc.1",
|
|
5
4
|
"private": false,
|
|
6
5
|
"main": "lib/index.min.js",
|
|
7
6
|
"typings": "lib/index.d.ts",
|
|
8
7
|
"dependencies": {
|
|
9
8
|
"antd": "^4.8.0",
|
|
10
|
-
"authing-js-sdk": "4.
|
|
11
|
-
"
|
|
12
|
-
"global": "^4.4.0",
|
|
13
|
-
"qs": "^6.9.4",
|
|
14
|
-
"react-use": "^17.3.1"
|
|
9
|
+
"authing-js-sdk": "4.23.1",
|
|
10
|
+
"qs": "^6.9.4"
|
|
15
11
|
},
|
|
16
|
-
"types": "react-app-env.d.ts",
|
|
17
12
|
"peerDependencies": {
|
|
18
|
-
"react": "16.
|
|
19
|
-
"react-dom": "16.
|
|
13
|
+
"react": "^15.0.1 || ^16.0.0 || ^17.0.0",
|
|
14
|
+
"react-dom": "^15.0.1 || ^16.0.0 || ^17.0.0"
|
|
20
15
|
},
|
|
21
16
|
"scripts": {
|
|
22
17
|
"start": "PORT=3006 node scripts/start.js",
|
|
@@ -48,21 +43,21 @@
|
|
|
48
43
|
},
|
|
49
44
|
"jest": {
|
|
50
45
|
"roots": [
|
|
51
|
-
"<rootDir>/
|
|
46
|
+
"<rootDir>/src"
|
|
52
47
|
],
|
|
53
48
|
"collectCoverageFrom": [
|
|
54
|
-
"
|
|
55
|
-
"!
|
|
49
|
+
"src/**/*.{js,jsx,ts,tsx}",
|
|
50
|
+
"!src/**/*.d.ts"
|
|
56
51
|
],
|
|
57
52
|
"setupFiles": [
|
|
58
53
|
"react-app-polyfill/jsdom"
|
|
59
54
|
],
|
|
60
55
|
"setupFilesAfterEnv": [
|
|
61
|
-
"<rootDir>/
|
|
56
|
+
"<rootDir>/src/setupTests.ts"
|
|
62
57
|
],
|
|
63
58
|
"testMatch": [
|
|
64
|
-
"<rootDir>/
|
|
65
|
-
"<rootDir>/
|
|
59
|
+
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
|
|
60
|
+
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
|
|
66
61
|
],
|
|
67
62
|
"testEnvironment": "jsdom",
|
|
68
63
|
"testRunner": "/Users/lixpng/workspace/authing/ui-components/packages/react-components/node_modules/jest-circus/runner.js",
|
|
@@ -112,7 +107,6 @@
|
|
|
112
107
|
"@testing-library/react": "^11.1.0",
|
|
113
108
|
"@testing-library/user-event": "^12.1.10",
|
|
114
109
|
"@types/jest": "^26.0.15",
|
|
115
|
-
"@types/lodash": "^4.14.175",
|
|
116
110
|
"@types/node": "^12.0.0",
|
|
117
111
|
"@types/qs": "^6.9.5",
|
|
118
112
|
"@types/react": "^16.9.53",
|
|
@@ -178,7 +172,6 @@
|
|
|
178
172
|
"resolve-url-loader": "^3.1.2",
|
|
179
173
|
"sass-loader": "8.0.2",
|
|
180
174
|
"semver": "7.3.2",
|
|
181
|
-
"shelljs": "^0.8.4",
|
|
182
175
|
"shortid": "^2.2.16",
|
|
183
176
|
"style-loader": "1.3.0",
|
|
184
177
|
"terser-webpack-plugin": "4.2.3",
|
|
@@ -191,5 +184,6 @@
|
|
|
191
184
|
"webpack-dev-server": "3.11.0",
|
|
192
185
|
"webpack-manifest-plugin": "2.2.0",
|
|
193
186
|
"workbox-webpack-plugin": "5.1.4"
|
|
194
|
-
}
|
|
195
|
-
|
|
187
|
+
},
|
|
188
|
+
"gitHead": "0c3f236e7f360ef32673df7f73de8129bf89281e"
|
|
189
|
+
}
|
package/scripts/build.js
CHANGED
|
@@ -1,171 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
// Do this as the first thing so that any code reading it knows the right env.
|
|
2
|
-
process.env.BABEL_ENV = 'production'
|
|
3
|
-
process.env.NODE_ENV = 'production'
|
|
4
|
+
process.env.BABEL_ENV = 'production';
|
|
5
|
+
process.env.NODE_ENV = 'production';
|
|
4
6
|
|
|
5
7
|
// Makes the script crash on unhandled rejections instead of silently
|
|
6
8
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
7
9
|
// terminate the Node.js process with a non-zero exit code.
|
|
8
|
-
process.on('unhandledRejection',
|
|
9
|
-
throw err
|
|
10
|
-
})
|
|
10
|
+
process.on('unhandledRejection', err => {
|
|
11
|
+
throw err;
|
|
12
|
+
});
|
|
11
13
|
|
|
12
14
|
// Ensure environment variables are read.
|
|
13
|
-
require('../config/env')
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
15
|
+
require('../config/env');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const chalk = require('react-dev-utils/chalk');
|
|
20
|
+
const fs = require('fs-extra');
|
|
21
|
+
const bfj = require('bfj');
|
|
22
|
+
const webpack = require('webpack');
|
|
23
|
+
const configFactory = require('../config/webpack.config');
|
|
24
|
+
const paths = require('../config/paths');
|
|
25
|
+
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
26
|
+
const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages');
|
|
27
|
+
const printHostingInstructions = require('react-dev-utils/printHostingInstructions');
|
|
28
|
+
const FileSizeReporter = require('react-dev-utils/FileSizeReporter');
|
|
29
|
+
const printBuildError = require('react-dev-utils/printBuildError');
|
|
30
|
+
|
|
31
|
+
const measureFileSizesBeforeBuild =
|
|
32
|
+
FileSizeReporter.measureFileSizesBeforeBuild;
|
|
33
|
+
const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
|
|
34
|
+
const useYarn = fs.existsSync(paths.yarnLockFile);
|
|
31
35
|
|
|
32
36
|
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
33
|
-
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024
|
|
34
|
-
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024
|
|
37
|
+
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
38
|
+
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
35
39
|
|
|
36
|
-
const isInteractive = process.stdout.isTTY
|
|
40
|
+
const isInteractive = process.stdout.isTTY;
|
|
37
41
|
|
|
38
42
|
// Warn and crash if required files are missing
|
|
39
43
|
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
|
|
40
|
-
process.exit(1)
|
|
44
|
+
process.exit(1);
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
const argv = process.argv.slice(2)
|
|
44
|
-
const writeStatsJson = argv.indexOf('--stats') !== -1
|
|
47
|
+
const argv = process.argv.slice(2);
|
|
48
|
+
const writeStatsJson = argv.indexOf('--stats') !== -1;
|
|
45
49
|
|
|
46
50
|
// Generate configuration
|
|
47
|
-
const config = configFactory('production')
|
|
51
|
+
const config = configFactory('production');
|
|
48
52
|
|
|
49
53
|
// We require that you explicitly set browsers and do not fall back to
|
|
50
54
|
// browserslist defaults.
|
|
51
|
-
const { checkBrowsers } = require('react-dev-utils/browsersHelper')
|
|
55
|
+
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
|
|
52
56
|
checkBrowsers(paths.appPath, isInteractive)
|
|
53
57
|
.then(() => {
|
|
54
58
|
// First, read the current file sizes in build directory.
|
|
55
59
|
// This lets us display how much they changed later.
|
|
56
|
-
return measureFileSizesBeforeBuild(paths.appBuild)
|
|
60
|
+
return measureFileSizesBeforeBuild(paths.appBuild);
|
|
57
61
|
})
|
|
58
|
-
.then(
|
|
62
|
+
.then(previousFileSizes => {
|
|
59
63
|
// Remove all content but keep the directory so that
|
|
60
64
|
// if you're in it, you don't end up in Trash
|
|
61
|
-
fs.emptyDirSync(paths.appBuild)
|
|
65
|
+
fs.emptyDirSync(paths.appBuild);
|
|
62
66
|
// Merge with the public folder
|
|
63
|
-
copyPublicFolder()
|
|
67
|
+
copyPublicFolder();
|
|
64
68
|
// Start the webpack build
|
|
65
|
-
return build(previousFileSizes)
|
|
69
|
+
return build(previousFileSizes);
|
|
66
70
|
})
|
|
67
71
|
.then(
|
|
68
72
|
({ stats, previousFileSizes, warnings }) => {
|
|
69
73
|
if (warnings.length) {
|
|
70
|
-
console.log(chalk.yellow('Compiled with warnings.\n'))
|
|
71
|
-
console.log(warnings.join('\n\n'))
|
|
74
|
+
console.log(chalk.yellow('Compiled with warnings.\n'));
|
|
75
|
+
console.log(warnings.join('\n\n'));
|
|
72
76
|
console.log(
|
|
73
77
|
'\nSearch for the ' +
|
|
74
78
|
chalk.underline(chalk.yellow('keywords')) +
|
|
75
79
|
' to learn more about each warning.'
|
|
76
|
-
)
|
|
80
|
+
);
|
|
77
81
|
console.log(
|
|
78
82
|
'To ignore, add ' +
|
|
79
83
|
chalk.cyan('// eslint-disable-next-line') +
|
|
80
84
|
' to the line before.\n'
|
|
81
|
-
)
|
|
85
|
+
);
|
|
82
86
|
} else {
|
|
83
|
-
console.log(chalk.green('Compiled successfully.\n'))
|
|
87
|
+
console.log(chalk.green('Compiled successfully.\n'));
|
|
84
88
|
}
|
|
85
89
|
|
|
86
|
-
console.log('File sizes after gzip:\n')
|
|
90
|
+
console.log('File sizes after gzip:\n');
|
|
87
91
|
printFileSizesAfterBuild(
|
|
88
92
|
stats,
|
|
89
93
|
previousFileSizes,
|
|
90
94
|
paths.appBuild,
|
|
91
95
|
WARN_AFTER_BUNDLE_GZIP_SIZE,
|
|
92
96
|
WARN_AFTER_CHUNK_GZIP_SIZE
|
|
93
|
-
)
|
|
94
|
-
console.log()
|
|
97
|
+
);
|
|
98
|
+
console.log();
|
|
95
99
|
|
|
96
|
-
const appPackage = require(paths.appPackageJson)
|
|
97
|
-
const publicUrl = paths.publicUrlOrPath
|
|
98
|
-
const publicPath = config.output.publicPath
|
|
99
|
-
const buildFolder = path.relative(process.cwd(), paths.appBuild)
|
|
100
|
+
const appPackage = require(paths.appPackageJson);
|
|
101
|
+
const publicUrl = paths.publicUrlOrPath;
|
|
102
|
+
const publicPath = config.output.publicPath;
|
|
103
|
+
const buildFolder = path.relative(process.cwd(), paths.appBuild);
|
|
100
104
|
printHostingInstructions(
|
|
101
105
|
appPackage,
|
|
102
106
|
publicUrl,
|
|
103
107
|
publicPath,
|
|
104
108
|
buildFolder,
|
|
105
109
|
useYarn
|
|
106
|
-
)
|
|
110
|
+
);
|
|
107
111
|
},
|
|
108
|
-
|
|
109
|
-
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'
|
|
112
|
+
err => {
|
|
113
|
+
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
|
|
110
114
|
if (tscCompileOnError) {
|
|
111
115
|
console.log(
|
|
112
116
|
chalk.yellow(
|
|
113
117
|
'Compiled with the following type errors (you may want to check these before deploying your app):\n'
|
|
114
118
|
)
|
|
115
|
-
)
|
|
116
|
-
printBuildError(err)
|
|
119
|
+
);
|
|
120
|
+
printBuildError(err);
|
|
117
121
|
} else {
|
|
118
|
-
console.log(chalk.red('Failed to compile.\n'))
|
|
119
|
-
printBuildError(err)
|
|
120
|
-
process.exit(1)
|
|
122
|
+
console.log(chalk.red('Failed to compile.\n'));
|
|
123
|
+
printBuildError(err);
|
|
124
|
+
process.exit(1);
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
)
|
|
124
|
-
.catch(
|
|
128
|
+
.catch(err => {
|
|
125
129
|
if (err && err.message) {
|
|
126
|
-
console.log(err.message)
|
|
130
|
+
console.log(err.message);
|
|
127
131
|
}
|
|
128
|
-
process.exit(1)
|
|
129
|
-
})
|
|
132
|
+
process.exit(1);
|
|
133
|
+
});
|
|
130
134
|
|
|
131
135
|
// Create the production build and print the deployment instructions.
|
|
132
136
|
function build(previousFileSizes) {
|
|
133
|
-
console.log('Creating an optimized production build...')
|
|
137
|
+
console.log('Creating an optimized production build...');
|
|
134
138
|
|
|
135
|
-
const compiler = webpack(config)
|
|
139
|
+
const compiler = webpack(config);
|
|
136
140
|
return new Promise((resolve, reject) => {
|
|
137
141
|
compiler.run((err, stats) => {
|
|
138
|
-
let messages
|
|
142
|
+
let messages;
|
|
139
143
|
if (err) {
|
|
140
144
|
if (!err.message) {
|
|
141
|
-
return reject(err)
|
|
145
|
+
return reject(err);
|
|
142
146
|
}
|
|
143
147
|
|
|
144
|
-
let errMessage = err.message
|
|
148
|
+
let errMessage = err.message;
|
|
145
149
|
|
|
146
150
|
// Add additional information for postcss errors
|
|
147
151
|
if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
|
|
148
152
|
errMessage +=
|
|
149
153
|
'\nCompileError: Begins at CSS selector ' +
|
|
150
|
-
err['postcssNode'].selector
|
|
154
|
+
err['postcssNode'].selector;
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
messages = formatWebpackMessages({
|
|
154
158
|
errors: [errMessage],
|
|
155
159
|
warnings: [],
|
|
156
|
-
})
|
|
160
|
+
});
|
|
157
161
|
} else {
|
|
158
162
|
messages = formatWebpackMessages(
|
|
159
163
|
stats.toJson({ all: false, warnings: true, errors: true })
|
|
160
|
-
)
|
|
164
|
+
);
|
|
161
165
|
}
|
|
162
166
|
if (messages.errors.length) {
|
|
163
167
|
// Only keep the first error. Others are often indicative
|
|
164
168
|
// of the same problem, but confuse the reader with noise.
|
|
165
169
|
if (messages.errors.length > 1) {
|
|
166
|
-
messages.errors.length = 1
|
|
170
|
+
messages.errors.length = 1;
|
|
167
171
|
}
|
|
168
|
-
return reject(new Error(messages.errors.join('\n\n')))
|
|
172
|
+
return reject(new Error(messages.errors.join('\n\n')));
|
|
169
173
|
}
|
|
170
174
|
if (
|
|
171
175
|
process.env.CI &&
|
|
@@ -178,31 +182,31 @@ function build(previousFileSizes) {
|
|
|
178
182
|
'\nTreating warnings as errors because process.env.CI = true.\n' +
|
|
179
183
|
'Most CI servers set it automatically.\n'
|
|
180
184
|
)
|
|
181
|
-
)
|
|
182
|
-
return reject(new Error(messages.warnings.join('\n\n')))
|
|
185
|
+
);
|
|
186
|
+
return reject(new Error(messages.warnings.join('\n\n')));
|
|
183
187
|
}
|
|
184
188
|
|
|
185
189
|
const resolveArgs = {
|
|
186
190
|
stats,
|
|
187
191
|
previousFileSizes,
|
|
188
192
|
warnings: messages.warnings,
|
|
189
|
-
}
|
|
193
|
+
};
|
|
190
194
|
|
|
191
195
|
if (writeStatsJson) {
|
|
192
196
|
return bfj
|
|
193
197
|
.write(paths.appBuild + '/bundle-stats.json', stats.toJson())
|
|
194
198
|
.then(() => resolve(resolveArgs))
|
|
195
|
-
.catch(
|
|
199
|
+
.catch(error => reject(new Error(error)));
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
return resolve(resolveArgs)
|
|
199
|
-
})
|
|
200
|
-
})
|
|
202
|
+
return resolve(resolveArgs);
|
|
203
|
+
});
|
|
204
|
+
});
|
|
201
205
|
}
|
|
202
206
|
|
|
203
207
|
function copyPublicFolder() {
|
|
204
208
|
fs.copySync(paths.appPublic, paths.appBuild, {
|
|
205
209
|
dereference: true,
|
|
206
|
-
filter:
|
|
207
|
-
})
|
|
210
|
+
filter: file => file !== paths.appHtml,
|
|
211
|
+
});
|
|
208
212
|
}
|
package/scripts/start.js
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
// Do this as the first thing so that any code reading it knows the right env.
|
|
2
|
-
process.env.BABEL_ENV = 'development'
|
|
3
|
-
process.env.NODE_ENV = 'development'
|
|
4
|
+
process.env.BABEL_ENV = 'development';
|
|
5
|
+
process.env.NODE_ENV = 'development';
|
|
4
6
|
|
|
5
7
|
// Makes the script crash on unhandled rejections instead of silently
|
|
6
8
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
7
9
|
// terminate the Node.js process with a non-zero exit code.
|
|
8
|
-
process.on('unhandledRejection',
|
|
9
|
-
throw err
|
|
10
|
-
})
|
|
10
|
+
process.on('unhandledRejection', err => {
|
|
11
|
+
throw err;
|
|
12
|
+
});
|
|
11
13
|
|
|
12
14
|
// Ensure environment variables are read.
|
|
13
|
-
require('../config/env')
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
15
|
+
require('../config/env');
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const fs = require('fs');
|
|
19
|
+
const chalk = require('react-dev-utils/chalk');
|
|
20
|
+
const webpack = require('webpack');
|
|
21
|
+
const WebpackDevServer = require('webpack-dev-server');
|
|
22
|
+
const clearConsole = require('react-dev-utils/clearConsole');
|
|
23
|
+
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
21
24
|
const {
|
|
22
25
|
choosePort,
|
|
23
26
|
createCompiler,
|
|
24
27
|
prepareProxy,
|
|
25
28
|
prepareUrls,
|
|
26
|
-
} = require('react-dev-utils/WebpackDevServerUtils')
|
|
27
|
-
const openBrowser = require('react-dev-utils/openBrowser')
|
|
28
|
-
const semver = require('semver')
|
|
29
|
-
const paths = require('../config/paths')
|
|
30
|
-
const configFactory = require('../config/webpack.config')
|
|
31
|
-
const createDevServerConfig = require('../config/webpackDevServer.config')
|
|
32
|
-
const getClientEnvironment = require('../config/env')
|
|
33
|
-
const react = require(require.resolve('react', { paths: [paths.appPath] }))
|
|
34
|
-
|
|
35
|
-
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1))
|
|
36
|
-
const useYarn = fs.existsSync(paths.yarnLockFile)
|
|
37
|
-
const isInteractive = process.stdout.isTTY
|
|
29
|
+
} = require('react-dev-utils/WebpackDevServerUtils');
|
|
30
|
+
const openBrowser = require('react-dev-utils/openBrowser');
|
|
31
|
+
const semver = require('semver');
|
|
32
|
+
const paths = require('../config/paths');
|
|
33
|
+
const configFactory = require('../config/webpack.config');
|
|
34
|
+
const createDevServerConfig = require('../config/webpackDevServer.config');
|
|
35
|
+
const getClientEnvironment = require('../config/env');
|
|
36
|
+
const react = require(require.resolve('react', { paths: [paths.appPath] }));
|
|
37
|
+
|
|
38
|
+
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
|
|
39
|
+
const useYarn = fs.existsSync(paths.yarnLockFile);
|
|
40
|
+
const isInteractive = process.stdout.isTTY;
|
|
38
41
|
|
|
39
42
|
// Warn and crash if required files are missing
|
|
40
43
|
if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
|
|
41
|
-
process.exit(1)
|
|
44
|
+
process.exit(1);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
// Tools like Cloud9 rely on this.
|
|
45
|
-
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000
|
|
46
|
-
const HOST = process.env.HOST || '0.0.0.0'
|
|
48
|
+
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
|
|
49
|
+
const HOST = process.env.HOST || '0.0.0.0';
|
|
47
50
|
|
|
48
51
|
if (process.env.HOST) {
|
|
49
52
|
console.log(
|
|
@@ -52,49 +55,49 @@ if (process.env.HOST) {
|
|
|
52
55
|
chalk.bold(process.env.HOST)
|
|
53
56
|
)}`
|
|
54
57
|
)
|
|
55
|
-
)
|
|
58
|
+
);
|
|
56
59
|
console.log(
|
|
57
60
|
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
|
|
58
|
-
)
|
|
61
|
+
);
|
|
59
62
|
console.log(
|
|
60
63
|
`Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
|
|
61
|
-
)
|
|
62
|
-
console.log()
|
|
64
|
+
);
|
|
65
|
+
console.log();
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
// We require that you explicitly set browsers and do not fall back to
|
|
66
69
|
// browserslist defaults.
|
|
67
|
-
const { checkBrowsers } = require('react-dev-utils/browsersHelper')
|
|
70
|
+
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
|
|
68
71
|
checkBrowsers(paths.appPath, isInteractive)
|
|
69
72
|
.then(() => {
|
|
70
73
|
// We attempt to use the default port but if it is busy, we offer the user to
|
|
71
74
|
// run on a different port. `choosePort()` Promise resolves to the next free port.
|
|
72
|
-
return choosePort(HOST, DEFAULT_PORT)
|
|
75
|
+
return choosePort(HOST, DEFAULT_PORT);
|
|
73
76
|
})
|
|
74
|
-
.then(
|
|
77
|
+
.then(port => {
|
|
75
78
|
if (port == null) {
|
|
76
79
|
// We have not found a port.
|
|
77
|
-
return
|
|
80
|
+
return;
|
|
78
81
|
}
|
|
79
82
|
|
|
80
|
-
const config = configFactory('development')
|
|
81
|
-
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'
|
|
82
|
-
const appName = require(paths.appPackageJson).name
|
|
83
|
+
const config = configFactory('development');
|
|
84
|
+
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
85
|
+
const appName = require(paths.appPackageJson).name;
|
|
83
86
|
|
|
84
|
-
const useTypeScript = fs.existsSync(paths.appTsConfig)
|
|
85
|
-
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'
|
|
87
|
+
const useTypeScript = fs.existsSync(paths.appTsConfig);
|
|
88
|
+
const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true';
|
|
86
89
|
const urls = prepareUrls(
|
|
87
90
|
protocol,
|
|
88
91
|
HOST,
|
|
89
92
|
port,
|
|
90
93
|
paths.publicUrlOrPath.slice(0, -1)
|
|
91
|
-
)
|
|
94
|
+
);
|
|
92
95
|
const devSocket = {
|
|
93
|
-
warnings:
|
|
96
|
+
warnings: warnings =>
|
|
94
97
|
devServer.sockWrite(devServer.sockets, 'warnings', warnings),
|
|
95
|
-
errors:
|
|
98
|
+
errors: errors =>
|
|
96
99
|
devServer.sockWrite(devServer.sockets, 'errors', errors),
|
|
97
|
-
}
|
|
100
|
+
};
|
|
98
101
|
// Create a webpack compiler that is configured with custom messages.
|
|
99
102
|
const compiler = createCompiler({
|
|
100
103
|
appName,
|
|
@@ -105,27 +108,27 @@ checkBrowsers(paths.appPath, isInteractive)
|
|
|
105
108
|
useTypeScript,
|
|
106
109
|
tscCompileOnError,
|
|
107
110
|
webpack,
|
|
108
|
-
})
|
|
111
|
+
});
|
|
109
112
|
// Load proxy config
|
|
110
|
-
const proxySetting = require(paths.appPackageJson).proxy
|
|
113
|
+
const proxySetting = require(paths.appPackageJson).proxy;
|
|
111
114
|
const proxyConfig = prepareProxy(
|
|
112
115
|
proxySetting,
|
|
113
116
|
paths.appPublic,
|
|
114
117
|
paths.publicUrlOrPath
|
|
115
|
-
)
|
|
118
|
+
);
|
|
116
119
|
// Serve webpack assets generated by the compiler over a web server.
|
|
117
120
|
const serverConfig = createDevServerConfig(
|
|
118
121
|
proxyConfig,
|
|
119
122
|
urls.lanUrlForConfig
|
|
120
|
-
)
|
|
121
|
-
const devServer = new WebpackDevServer(compiler, serverConfig)
|
|
123
|
+
);
|
|
124
|
+
const devServer = new WebpackDevServer(compiler, serverConfig);
|
|
122
125
|
// Launch WebpackDevServer.
|
|
123
|
-
devServer.listen(port, HOST,
|
|
126
|
+
devServer.listen(port, HOST, err => {
|
|
124
127
|
if (err) {
|
|
125
|
-
return console.log(err)
|
|
128
|
+
return console.log(err);
|
|
126
129
|
}
|
|
127
130
|
if (isInteractive) {
|
|
128
|
-
clearConsole()
|
|
131
|
+
clearConsole();
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
|
|
@@ -133,30 +136,31 @@ checkBrowsers(paths.appPath, isInteractive)
|
|
|
133
136
|
chalk.yellow(
|
|
134
137
|
`Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
|
|
135
138
|
)
|
|
136
|
-
)
|
|
139
|
+
);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
console.log(chalk.cyan('Starting the development server...\n'))
|
|
140
|
-
openBrowser(urls.localUrlForBrowser)
|
|
141
|
-
})
|
|
142
|
-
|
|
142
|
+
console.log(chalk.cyan('Starting the development server...\n'));
|
|
143
|
+
openBrowser(urls.localUrlForBrowser);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
['SIGINT', 'SIGTERM'].forEach(function (sig) {
|
|
143
147
|
process.on(sig, function () {
|
|
144
|
-
devServer.close()
|
|
145
|
-
process.exit()
|
|
146
|
-
})
|
|
147
|
-
})
|
|
148
|
+
devServer.close();
|
|
149
|
+
process.exit();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
148
152
|
|
|
149
153
|
if (process.env.CI !== 'true') {
|
|
150
154
|
// Gracefully exit when stdin ends
|
|
151
155
|
process.stdin.on('end', function () {
|
|
152
|
-
devServer.close()
|
|
153
|
-
process.exit()
|
|
154
|
-
})
|
|
156
|
+
devServer.close();
|
|
157
|
+
process.exit();
|
|
158
|
+
});
|
|
155
159
|
}
|
|
156
160
|
})
|
|
157
|
-
.catch(
|
|
161
|
+
.catch(err => {
|
|
158
162
|
if (err && err.message) {
|
|
159
|
-
console.log(err.message)
|
|
163
|
+
console.log(err.message);
|
|
160
164
|
}
|
|
161
|
-
process.exit(1)
|
|
162
|
-
})
|
|
165
|
+
process.exit(1);
|
|
166
|
+
});
|