@authing/react-ui-components 3.0.2-beta.5 → 3.0.3

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.
Files changed (262) hide show
  1. package/lib/index.d.ts +749 -54
  2. package/lib/index.min.css +2 -2
  3. package/lib/index.min.js +1 -1
  4. package/lib/index.min.js.LICENSE.txt +10 -0
  5. package/package.json +35 -12
  6. package/.eslintignore +0 -6
  7. package/.eslintrc.js +0 -7
  8. package/.prettierrc +0 -5
  9. package/.vscode/settings.json +0 -31
  10. package/build/asset-manifest.json +0 -26
  11. package/build/favicon.ico +0 -0
  12. package/build/index.html +0 -1
  13. package/build/logo192.png +0 -0
  14. package/build/logo512.png +0 -0
  15. package/build/manifest.json +0 -25
  16. package/build/robots.txt +0 -3
  17. package/build/static/css/2.51c07e65.chunk.css +0 -3
  18. package/build/static/css/2.51c07e65.chunk.css.map +0 -1
  19. package/build/static/css/main.779f221a.chunk.css +0 -2
  20. package/build/static/css/main.779f221a.chunk.css.map +0 -1
  21. package/build/static/js/2.bbae9fdb.chunk.js +0 -3
  22. package/build/static/js/2.bbae9fdb.chunk.js.LICENSE.txt +0 -102
  23. package/build/static/js/2.bbae9fdb.chunk.js.map +0 -1
  24. package/build/static/js/3.fd17f196.chunk.js +0 -2
  25. package/build/static/js/3.fd17f196.chunk.js.map +0 -1
  26. package/build/static/js/main.5f341531.chunk.js +0 -2
  27. package/build/static/js/main.5f341531.chunk.js.map +0 -1
  28. package/build/static/js/runtime-main.ef138021.js +0 -2
  29. package/build/static/js/runtime-main.ef138021.js.map +0 -1
  30. package/build/static/media/loading.4a67a5f3.svg +0 -29
  31. package/components/AuthingDropdown/index.tsx +0 -52
  32. package/components/AuthingDropdown/style.less +0 -43
  33. package/components/AuthingGuard/AppMFALayout/index.tsx +0 -74
  34. package/components/AuthingGuard/AppMFALayout/style.less +0 -12
  35. package/components/AuthingGuard/CompleteUserInfoLayout/index.tsx +0 -29
  36. package/components/AuthingGuard/CompleteUserInfoLayout/style.less +0 -8
  37. package/components/AuthingGuard/Forms/ADLoginForm/index.tsx +0 -117
  38. package/components/AuthingGuard/Forms/Agreements/index.tsx +0 -81
  39. package/components/AuthingGuard/Forms/Agreements/style.less +0 -44
  40. package/components/AuthingGuard/Forms/CompleteUserInfoForm/index.tsx +0 -139
  41. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/CheckEmailForm.tsx +0 -84
  42. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/VerifyCodeForm.tsx +0 -116
  43. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/index.tsx +0 -40
  44. package/components/AuthingGuard/Forms/EmailMfaVerifyForm/style.less +0 -0
  45. package/components/AuthingGuard/Forms/EmailRegisterForm/index.tsx +0 -181
  46. package/components/AuthingGuard/Forms/EmailRegisterForm/style.less +0 -0
  47. package/components/AuthingGuard/Forms/LdapLoginForm/index.tsx +0 -166
  48. package/components/AuthingGuard/Forms/LdapLoginForm/style.less +0 -0
  49. package/components/AuthingGuard/Forms/LoginFormFooter/index.tsx +0 -76
  50. package/components/AuthingGuard/Forms/LoginFormFooter/style.less +0 -6
  51. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step1.tsx +0 -86
  52. package/components/AuthingGuard/Forms/MfaResetCodeForm/Step2.tsx +0 -53
  53. package/components/AuthingGuard/Forms/MfaResetCodeForm/index.tsx +0 -65
  54. package/components/AuthingGuard/Forms/MfaResetCodeForm/style.less +0 -20
  55. package/components/AuthingGuard/Forms/MfaVerifyForm/index.tsx +0 -105
  56. package/components/AuthingGuard/Forms/MfaVerifyForm/style.less +0 -12
  57. package/components/AuthingGuard/Forms/PasswordLoginForm/index.tsx +0 -261
  58. package/components/AuthingGuard/Forms/PhoneCodeLoginForm/index.tsx +0 -133
  59. package/components/AuthingGuard/Forms/PhoneRegisterForm/index.tsx +0 -202
  60. package/components/AuthingGuard/Forms/QrCodeLoginForm/index.tsx +0 -59
  61. package/components/AuthingGuard/Forms/QrCodeLoginForm/style.less +0 -14
  62. package/components/AuthingGuard/Forms/RegisterFormFooter/index.tsx +0 -56
  63. package/components/AuthingGuard/Forms/RegisterFormFooter/style.less +0 -0
  64. package/components/AuthingGuard/Forms/ResetPwdForm/Footer.tsx +0 -21
  65. package/components/AuthingGuard/Forms/ResetPwdForm/Step1.tsx +0 -86
  66. package/components/AuthingGuard/Forms/ResetPwdForm/Step2.tsx +0 -127
  67. package/components/AuthingGuard/Forms/ResetPwdForm/Step3.tsx +0 -141
  68. package/components/AuthingGuard/Forms/ResetPwdForm/Step4.tsx +0 -51
  69. package/components/AuthingGuard/Forms/ResetPwdForm/index.tsx +0 -96
  70. package/components/AuthingGuard/Forms/ResetPwdForm/style.less +0 -3
  71. package/components/AuthingGuard/Forms/SendPhoneCode/SendCodeBtn.tsx +0 -88
  72. package/components/AuthingGuard/Forms/SendPhoneCode/index.tsx +0 -50
  73. package/components/AuthingGuard/Forms/SendPhoneCode/style.less +0 -26
  74. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/CheckPhoneForm.tsx +0 -86
  75. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/VerifyCodeForm.tsx +0 -113
  76. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/index.tsx +0 -40
  77. package/components/AuthingGuard/Forms/SmsMfaVerifyForm/style.less +0 -3
  78. package/components/AuthingGuard/Forms/SocialAndIdpLogin/index.tsx +0 -325
  79. package/components/AuthingGuard/Forms/SocialAndIdpLogin/style.less +0 -75
  80. package/components/AuthingGuard/Forms/UploadImage/index.tsx +0 -70
  81. package/components/AuthingGuard/Forms/index.ts +0 -13
  82. package/components/AuthingGuard/GuardLayout/index.tsx +0 -474
  83. package/components/AuthingGuard/GuardLayout/style.less +0 -111
  84. package/components/AuthingGuard/Header/index.tsx +0 -25
  85. package/components/AuthingGuard/Header/style.less +0 -52
  86. package/components/AuthingGuard/IconFont/iconfont.js +0 -74
  87. package/components/AuthingGuard/IconFont/index.tsx +0 -19
  88. package/components/AuthingGuard/IconFont/style.less +0 -6
  89. package/components/AuthingGuard/IconFont/svg.js +0 -2
  90. package/components/AuthingGuard/LoginLayout/index.tsx +0 -161
  91. package/components/AuthingGuard/LoginLayout/style.less +0 -0
  92. package/components/AuthingGuard/MfaLayout/Steps.ts +0 -4
  93. package/components/AuthingGuard/MfaLayout/index.tsx +0 -49
  94. package/components/AuthingGuard/MfaLayout/style.less +0 -3
  95. package/components/AuthingGuard/RegisterLayout/index.tsx +0 -89
  96. package/components/AuthingGuard/RegisterLayout/style.less +0 -0
  97. package/components/AuthingGuard/ResetPwdLayout/index.tsx +0 -20
  98. package/components/AuthingGuard/ToggleLang/index.tsx +0 -51
  99. package/components/AuthingGuard/api/appConfig.ts +0 -146
  100. package/components/AuthingGuard/api/index.ts +0 -3
  101. package/components/AuthingGuard/api/sso.ts +0 -29
  102. package/components/AuthingGuard/api/userPoolConfig.ts +0 -111
  103. package/components/AuthingGuard/constants.ts +0 -107
  104. package/components/AuthingGuard/hooks/index.tsx +0 -70
  105. package/components/AuthingGuard/hooks/useScreenSize.tsx +0 -68
  106. package/components/AuthingGuard/index.tsx +0 -126
  107. package/components/AuthingGuard/style.less +0 -103
  108. package/components/AuthingGuard/types/Forms.ts +0 -94
  109. package/components/AuthingGuard/types/GuardConfig.ts +0 -420
  110. package/components/AuthingGuard/types/GuardState.ts +0 -7
  111. package/components/AuthingGuard/types/Locales.ts +0 -12
  112. package/components/AuthingGuard/types/index.ts +0 -4
  113. package/components/AuthingTabs/index.tsx +0 -98
  114. package/components/AuthingTabs/style.less +0 -135
  115. package/components/BindTotp/core/bindSuccess.tsx +0 -72
  116. package/components/BindTotp/core/securityCode.tsx +0 -108
  117. package/components/BindTotp/index.tsx +0 -134
  118. package/components/BindTotp/interface.ts +0 -30
  119. package/components/BindTotp/styles.less +0 -57
  120. package/components/ChangeLanguage/index.tsx +0 -35
  121. package/components/ChangePassword/core/firstLoginReset.tsx +0 -111
  122. package/components/ChangePassword/core/rotateReset.tsx +0 -114
  123. package/components/ChangePassword/index.tsx +0 -72
  124. package/components/CompleteInfo/core/completeInfo.tsx +0 -155
  125. package/components/CompleteInfo/index.tsx +0 -45
  126. package/components/CompleteInfo/interface.ts +0 -40
  127. package/components/CompleteInfo/styles.less +0 -7
  128. package/components/CopyAbleText/index.tsx +0 -54
  129. package/components/CopyAbleText/style.less +0 -13
  130. package/components/DownloadAuthenticator/index.tsx +0 -97
  131. package/components/DownloadAuthenticator/interface.ts +0 -22
  132. package/components/DownloadAuthenticator/styles.less +0 -52
  133. package/components/Error/index.tsx +0 -21
  134. package/components/Error/interface.ts +0 -9
  135. package/components/Error/styles.less +0 -12
  136. package/components/ForgetPassword/core/resetPassword.tsx +0 -162
  137. package/components/ForgetPassword/index.tsx +0 -78
  138. package/components/ForgetPassword/interface.ts +0 -32
  139. package/components/Guard/Guard.tsx +0 -295
  140. package/components/Guard/authClient.ts +0 -44
  141. package/components/Guard/config.ts +0 -19
  142. package/components/Guard/event.ts +0 -52
  143. package/components/Guard/index.tsx +0 -4
  144. package/components/Guard/module.ts +0 -20
  145. package/components/Guard/stateMachine.ts +0 -152
  146. package/components/Guard/styles.less +0 -461
  147. package/components/IconFont/iconfont.js +0 -74
  148. package/components/IconFont/index.tsx +0 -16
  149. package/components/IconFont/style.less +0 -6
  150. package/components/IconFont/svg.js +0 -2
  151. package/components/ImagePro/index.tsx +0 -53
  152. package/components/ImagePro/styles.less +0 -40
  153. package/components/InputNumber/index.tsx +0 -33
  154. package/components/Login/codemap.ts +0 -49
  155. package/components/Login/core/withAD.tsx +0 -9
  156. package/components/Login/core/withAppQrcode.tsx +0 -49
  157. package/components/Login/core/withLDAP.tsx +0 -146
  158. package/components/Login/core/withPassword/FormItemAccount.tsx +0 -42
  159. package/components/Login/core/withPassword/GraphicVerifyCode.tsx +0 -30
  160. package/components/Login/core/withPassword/InputAccount.tsx +0 -64
  161. package/components/Login/core/withPassword/index.tsx +0 -173
  162. package/components/Login/core/withPhonecode.tsx +0 -122
  163. package/components/Login/core/withWechatMiniQrcode.tsx +0 -60
  164. package/components/Login/core/withWechatmpQrcode.tsx +0 -53
  165. package/components/Login/index.tsx +0 -374
  166. package/components/Login/props.ts +0 -74
  167. package/components/Login/socialLogin/index.tsx +0 -407
  168. package/components/Login/socialLogin/style.less +0 -69
  169. package/components/Login/styles.less +0 -53
  170. package/components/MFA/VerifyCodeInput/VerifyCodeFormItem.tsx +0 -41
  171. package/components/MFA/VerifyCodeInput/index.tsx +0 -145
  172. package/components/MFA/VerifyCodeInput/style.less +0 -35
  173. package/components/MFA/codemap.ts +0 -24
  174. package/components/MFA/core/email.tsx +0 -203
  175. package/components/MFA/core/face.tsx +0 -297
  176. package/components/MFA/core/face_deps.tsx +0 -37
  177. package/components/MFA/core/sms.tsx +0 -203
  178. package/components/MFA/core/totp.tsx +0 -122
  179. package/components/MFA/index.tsx +0 -143
  180. package/components/MFA/mfaMethods/index.tsx +0 -88
  181. package/components/MFA/mfaMethods/style.less +0 -39
  182. package/components/MFA/props.ts +0 -51
  183. package/components/MFA/styles.less +0 -100
  184. package/components/NeedHelpView/core/describeQuestions.tsx +0 -245
  185. package/components/NeedHelpView/index.tsx +0 -47
  186. package/components/RecoveryCode/core/useCode.tsx +0 -71
  187. package/components/RecoveryCode/index.tsx +0 -27
  188. package/components/RecoveryCode/interface.ts +0 -31
  189. package/components/RecoveryCode/style.less +0 -13
  190. package/components/Register/codemap.ts +0 -12
  191. package/components/Register/components/Agreements/index.tsx +0 -81
  192. package/components/Register/components/Agreements/style.less +0 -44
  193. package/components/Register/core/WithEmail.tsx +0 -242
  194. package/components/Register/core/WithPhone.tsx +0 -184
  195. package/components/Register/index.tsx +0 -139
  196. package/components/Register/props.ts +0 -50
  197. package/components/SendCode/SendCodeBtn.tsx +0 -96
  198. package/components/SendCode/index.tsx +0 -94
  199. package/components/SendCode/style.less +0 -31
  200. package/components/ShieldSpin/index.tsx +0 -27
  201. package/components/ShieldSpin/loading.svg +0 -29
  202. package/components/SubmitButton/index.tsx +0 -50
  203. package/components/SubmitSuccess/index.tsx +0 -66
  204. package/components/SubmitSuccess/interface.ts +0 -17
  205. package/components/Type/index.ts +0 -52
  206. package/components/ValidatorRules/ValidatorFormItem.tsx +0 -139
  207. package/components/ValidatorRules/index.ts +0 -20
  208. package/components/VerifyCodeInput/index.tsx +0 -76
  209. package/components/VerifyCodeInput/style.less +0 -24
  210. package/components/_utils/GuardErrorCode.ts +0 -9
  211. package/components/_utils/clipboard.ts +0 -27
  212. package/components/_utils/config.ts +0 -116
  213. package/components/_utils/guradHttp.ts +0 -101
  214. package/components/_utils/hooks/index.ts +0 -64
  215. package/components/_utils/http.ts +0 -85
  216. package/components/_utils/index.ts +0 -326
  217. package/components/_utils/locales/en/common.json +0 -229
  218. package/components/_utils/locales/en/index.ts +0 -6
  219. package/components/_utils/locales/en/login.json +0 -96
  220. package/components/_utils/locales/en/map.json +0 -4
  221. package/components/_utils/locales/en/user.json +0 -82
  222. package/components/_utils/locales/index.ts +0 -45
  223. package/components/_utils/locales/zh/common.json +0 -229
  224. package/components/_utils/locales/zh/index.ts +0 -6
  225. package/components/_utils/locales/zh/login.json +0 -96
  226. package/components/_utils/locales/zh/map.json +0 -4
  227. package/components/_utils/locales/zh/user.json +0 -83
  228. package/components/_utils/popupCenter.ts +0 -48
  229. package/components/assets/images/error.png +0 -0
  230. package/components/context/base.tsx +0 -28
  231. package/components/context/global/context.tsx +0 -39
  232. package/components/context/global/reducer.tsx +0 -56
  233. package/components/context/module/context.tsx +0 -23
  234. package/components/index.ts +0 -12
  235. package/config/antdReplacer.js +0 -51
  236. package/config/env.js +0 -104
  237. package/config/getHttpsConfig.js +0 -66
  238. package/config/jest/cssTransform.js +0 -14
  239. package/config/jest/fileTransform.js +0 -40
  240. package/config/modules.js +0 -134
  241. package/config/paths.js +0 -71
  242. package/config/pnpTs.js +0 -35
  243. package/config/webpack.config.js +0 -835
  244. package/config/webpackDevServer.config.js +0 -130
  245. package/examples.tsx +0 -87
  246. package/index.js +0 -1
  247. package/logo.svg +0 -7
  248. package/public/favicon.ico +0 -0
  249. package/public/index.html +0 -43
  250. package/public/logo192.png +0 -0
  251. package/public/logo512.png +0 -0
  252. package/public/manifest.json +0 -25
  253. package/public/robots.txt +0 -3
  254. package/react-app-env.d.ts +0 -71
  255. package/reportWebVitals.ts +0 -15
  256. package/scripts/build.js +0 -208
  257. package/scripts/lib.js +0 -200
  258. package/scripts/publish.js +0 -57
  259. package/scripts/start.js +0 -162
  260. package/scripts/test.js +0 -49
  261. package/setupTests.ts +0 -5
  262. package/tsconfig.json +0 -30
package/scripts/lib.js DELETED
@@ -1,200 +0,0 @@
1
- // 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
-
5
- // Makes the script crash on unhandled rejections instead of silently
6
- // ignoring them. In the future, promise rejections that are not handled will
7
- // terminate the Node.js process with a non-zero exit code.
8
- process.on('unhandledRejection', (err) => {
9
- throw err
10
- })
11
-
12
- // Ensure environment variables are read.
13
- require('../config/env')
14
-
15
- const path = require('path')
16
- const chalk = require('react-dev-utils/chalk')
17
- const fs = require('fs-extra')
18
- const bfj = require('bfj')
19
- const webpack = require('webpack')
20
- const configFactory = require('../config/webpack.config')
21
- const paths = require('../config/paths')
22
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles')
23
- const formatWebpackMessages = require('react-dev-utils/formatWebpackMessages')
24
- const printHostingInstructions = require('react-dev-utils/printHostingInstructions')
25
- const FileSizeReporter = require('react-dev-utils/FileSizeReporter')
26
- const printBuildError = require('react-dev-utils/printBuildError')
27
-
28
- const measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild
29
- const printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild
30
- const useYarn = fs.existsSync(paths.yarnLockFile)
31
-
32
- // 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
35
-
36
- const isInteractive = process.stdout.isTTY
37
-
38
- // Warn and crash if required files are missing
39
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
40
- process.exit(1)
41
- }
42
-
43
- const argv = process.argv.slice(2)
44
- const writeStatsJson = argv.indexOf('--stats') !== -1
45
-
46
- // Generate configuration
47
- const config = configFactory('lib')
48
-
49
- // We require that you explicitly set browsers and do not fall back to
50
- // browserslist defaults.
51
- const { checkBrowsers } = require('react-dev-utils/browsersHelper')
52
- checkBrowsers(paths.appPath, isInteractive)
53
- .then(() => {
54
- // First, read the current file sizes in build directory.
55
- // This lets us display how much they changed later.
56
- return measureFileSizesBeforeBuild(paths.libBuild)
57
- })
58
- .then((previousFileSizes) => {
59
- // Remove all content but keep the directory so that
60
- // if you're in it, you don't end up in Trash
61
- fs.emptyDirSync(paths.libBuild)
62
- // Merge with the public folder
63
- // Start the webpack build
64
- return build(previousFileSizes)
65
- })
66
- .then(
67
- ({ stats, previousFileSizes, warnings }) => {
68
- if (warnings.length) {
69
- console.log(chalk.yellow('Compiled with warnings.\n'))
70
- console.log(warnings.join('\n\n'))
71
- console.log(
72
- '\nSearch for the ' +
73
- chalk.underline(chalk.yellow('keywords')) +
74
- ' to learn more about each warning.'
75
- )
76
- console.log(
77
- 'To ignore, add ' +
78
- chalk.cyan('// eslint-disable-next-line') +
79
- ' to the line before.\n'
80
- )
81
- } else {
82
- console.log(chalk.green('Compiled successfully.\n'))
83
- }
84
-
85
- console.log('File sizes after gzip:\n')
86
- printFileSizesAfterBuild(
87
- stats,
88
- previousFileSizes,
89
- paths.libBuild,
90
- WARN_AFTER_BUNDLE_GZIP_SIZE,
91
- WARN_AFTER_CHUNK_GZIP_SIZE
92
- )
93
- console.log()
94
-
95
- const appPackage = require(paths.appPackageJson)
96
- const publicUrl = paths.publicUrlOrPath
97
- const publicPath = config.output.publicPath
98
- const buildFolder = path.relative(process.cwd(), paths.libBuild)
99
- printHostingInstructions(
100
- appPackage,
101
- publicUrl,
102
- publicPath,
103
- buildFolder,
104
- useYarn
105
- )
106
- },
107
- (err) => {
108
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'
109
- if (tscCompileOnError) {
110
- console.log(
111
- chalk.yellow(
112
- 'Compiled with the following type errors (you may want to check these before deploying your app):\n'
113
- )
114
- )
115
- printBuildError(err)
116
- } else {
117
- console.log(chalk.red('Failed to compile.\n'))
118
- printBuildError(err)
119
- process.exit(1)
120
- }
121
- }
122
- )
123
- .catch((err) => {
124
- if (err && err.message) {
125
- console.log(err.message)
126
- }
127
- process.exit(1)
128
- })
129
-
130
- // Create the production build and print the deployment instructions.
131
- function build(previousFileSizes) {
132
- console.log('Creating an optimized production build...')
133
-
134
- const compiler = webpack(config)
135
- return new Promise((resolve, reject) => {
136
- compiler.run((err, stats) => {
137
- let messages
138
- if (err) {
139
- if (!err.message) {
140
- return reject(err)
141
- }
142
-
143
- let errMessage = err.message
144
-
145
- // Add additional information for postcss errors
146
- if (Object.prototype.hasOwnProperty.call(err, 'postcssNode')) {
147
- errMessage +=
148
- '\nCompileError: Begins at CSS selector ' +
149
- err['postcssNode'].selector
150
- }
151
-
152
- messages = formatWebpackMessages({
153
- errors: [errMessage],
154
- warnings: [],
155
- })
156
- } else {
157
- messages = formatWebpackMessages(
158
- stats.toJson({ all: false, warnings: true, errors: true })
159
- )
160
- }
161
- if (messages.errors.length) {
162
- // Only keep the first error. Others are often indicative
163
- // of the same problem, but confuse the reader with noise.
164
- if (messages.errors.length > 1) {
165
- messages.errors.length = 1
166
- }
167
- return reject(new Error(messages.errors.join('\n\n')))
168
- }
169
- if (
170
- process.env.CI &&
171
- (typeof process.env.CI !== 'string' ||
172
- process.env.CI.toLowerCase() !== 'false') &&
173
- messages.warnings.length
174
- ) {
175
- console.log(
176
- chalk.yellow(
177
- '\nTreating warnings as errors because process.env.CI = true.\n' +
178
- 'Most CI servers set it automatically.\n'
179
- )
180
- )
181
- return reject(new Error(messages.warnings.join('\n\n')))
182
- }
183
-
184
- const resolveArgs = {
185
- stats,
186
- previousFileSizes,
187
- warnings: messages.warnings,
188
- }
189
-
190
- if (writeStatsJson) {
191
- return bfj
192
- .write(paths.libBuild + '/bundle-stats.json', stats.toJson())
193
- .then(() => resolve(resolveArgs))
194
- .catch((error) => reject(new Error(error)))
195
- }
196
-
197
- return resolve(resolveArgs)
198
- })
199
- })
200
- }
@@ -1,57 +0,0 @@
1
- var $ = require('shelljs')
2
- var Package = require('../package.json')
3
-
4
- var version = Package.version
5
- var name = Package.name
6
-
7
- const getVersionTag = (version) => {
8
- const tagArr = ['alpha', 'beta', 'rc']
9
-
10
- const tagIndexArr = tagArr
11
- .map((type) => version.search(type))
12
- .filter((index) => index !== -1)
13
-
14
- if (tagIndexArr.length === 0) return ''
15
-
16
- const tagName = tagIndexArr[0]
17
-
18
- return tagName
19
- }
20
-
21
- var build = $.exec('yarn build:lib')
22
-
23
- if (build.code !== 0) {
24
- $.echo('build 失败了~')
25
- $.exit(1)
26
- }
27
-
28
- // $.exec(`git tab ${version}`)
29
-
30
- var tag = getVersionTag(version)
31
-
32
- let publish
33
-
34
- if (tag !== '') {
35
- publish = $.exec(`npm publish --tag ${tag}`)
36
- } else {
37
- publish = $.exec('npm publish')
38
- }
39
-
40
- if (publish.code !== 0) {
41
- $.echo(`publish 失败了~`)
42
- $.exit(1)
43
- }
44
-
45
- if ($.which('cnpm')) {
46
- $.echo(`正在同步到 淘宝源......`)
47
-
48
- $.exec(`cnpm sync name`)
49
- } else if ($.which('open')) {
50
- $.exec(`open https://npmmirror.com/sync/${name}`)
51
- } else {
52
- $.echo(`记得手动同步到淘宝源~`)
53
-
54
- $.echo(`https://npmmirror.com/sync/${name}`)
55
- }
56
-
57
- $.exit(0)
package/scripts/start.js DELETED
@@ -1,162 +0,0 @@
1
- // 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
-
5
- // Makes the script crash on unhandled rejections instead of silently
6
- // ignoring them. In the future, promise rejections that are not handled will
7
- // terminate the Node.js process with a non-zero exit code.
8
- process.on('unhandledRejection', (err) => {
9
- throw err
10
- })
11
-
12
- // Ensure environment variables are read.
13
- require('../config/env')
14
-
15
- const fs = require('fs')
16
- const chalk = require('react-dev-utils/chalk')
17
- const webpack = require('webpack')
18
- const WebpackDevServer = require('webpack-dev-server')
19
- const clearConsole = require('react-dev-utils/clearConsole')
20
- const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles')
21
- const {
22
- choosePort,
23
- createCompiler,
24
- prepareProxy,
25
- 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
38
-
39
- // Warn and crash if required files are missing
40
- if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
41
- process.exit(1)
42
- }
43
-
44
- // 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'
47
-
48
- if (process.env.HOST) {
49
- console.log(
50
- chalk.cyan(
51
- `Attempting to bind to HOST environment variable: ${chalk.yellow(
52
- chalk.bold(process.env.HOST)
53
- )}`
54
- )
55
- )
56
- console.log(
57
- `If this was unintentional, check that you haven't mistakenly set it in your shell.`
58
- )
59
- console.log(
60
- `Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
61
- )
62
- console.log()
63
- }
64
-
65
- // We require that you explicitly set browsers and do not fall back to
66
- // browserslist defaults.
67
- const { checkBrowsers } = require('react-dev-utils/browsersHelper')
68
- checkBrowsers(paths.appPath, isInteractive)
69
- .then(() => {
70
- // We attempt to use the default port but if it is busy, we offer the user to
71
- // run on a different port. `choosePort()` Promise resolves to the next free port.
72
- return choosePort(HOST, DEFAULT_PORT)
73
- })
74
- .then((port) => {
75
- if (port == null) {
76
- // We have not found a port.
77
- return
78
- }
79
-
80
- const config = configFactory('development')
81
- const protocol = process.env.HTTPS === 'true' ? 'https' : 'http'
82
- const appName = require(paths.appPackageJson).name
83
-
84
- const useTypeScript = fs.existsSync(paths.appTsConfig)
85
- const tscCompileOnError = process.env.TSC_COMPILE_ON_ERROR === 'true'
86
- const urls = prepareUrls(
87
- protocol,
88
- HOST,
89
- port,
90
- paths.publicUrlOrPath.slice(0, -1)
91
- )
92
- const devSocket = {
93
- warnings: (warnings) =>
94
- devServer.sockWrite(devServer.sockets, 'warnings', warnings),
95
- errors: (errors) =>
96
- devServer.sockWrite(devServer.sockets, 'errors', errors),
97
- }
98
- // Create a webpack compiler that is configured with custom messages.
99
- const compiler = createCompiler({
100
- appName,
101
- config,
102
- devSocket,
103
- urls,
104
- useYarn,
105
- useTypeScript,
106
- tscCompileOnError,
107
- webpack,
108
- })
109
- // Load proxy config
110
- const proxySetting = require(paths.appPackageJson).proxy
111
- const proxyConfig = prepareProxy(
112
- proxySetting,
113
- paths.appPublic,
114
- paths.publicUrlOrPath
115
- )
116
- // Serve webpack assets generated by the compiler over a web server.
117
- const serverConfig = createDevServerConfig(
118
- proxyConfig,
119
- urls.lanUrlForConfig
120
- )
121
- const devServer = new WebpackDevServer(compiler, serverConfig)
122
- // Launch WebpackDevServer.
123
- devServer.listen(port, HOST, (err) => {
124
- if (err) {
125
- return console.log(err)
126
- }
127
- if (isInteractive) {
128
- clearConsole()
129
- }
130
-
131
- if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
132
- console.log(
133
- chalk.yellow(
134
- `Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
135
- )
136
- )
137
- }
138
-
139
- console.log(chalk.cyan('Starting the development server...\n'))
140
- openBrowser(urls.localUrlForBrowser)
141
- })
142
- ;['SIGINT', 'SIGTERM'].forEach(function (sig) {
143
- process.on(sig, function () {
144
- devServer.close()
145
- process.exit()
146
- })
147
- })
148
-
149
- if (process.env.CI !== 'true') {
150
- // Gracefully exit when stdin ends
151
- process.stdin.on('end', function () {
152
- devServer.close()
153
- process.exit()
154
- })
155
- }
156
- })
157
- .catch((err) => {
158
- if (err && err.message) {
159
- console.log(err.message)
160
- }
161
- process.exit(1)
162
- })
package/scripts/test.js DELETED
@@ -1,49 +0,0 @@
1
- // Do this as the first thing so that any code reading it knows the right env.
2
- process.env.BABEL_ENV = 'test'
3
- process.env.NODE_ENV = 'test'
4
- process.env.PUBLIC_URL = ''
5
-
6
- // Makes the script crash on unhandled rejections instead of silently
7
- // ignoring them. In the future, promise rejections that are not handled will
8
- // terminate the Node.js process with a non-zero exit code.
9
- process.on('unhandledRejection', (err) => {
10
- throw err
11
- })
12
-
13
- // Ensure environment variables are read.
14
- require('../config/env')
15
-
16
- const jest = require('jest')
17
- const execSync = require('child_process').execSync
18
- let argv = process.argv.slice(2)
19
-
20
- function isInGitRepository() {
21
- try {
22
- execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' })
23
- return true
24
- } catch (e) {
25
- return false
26
- }
27
- }
28
-
29
- function isInMercurialRepository() {
30
- try {
31
- execSync('hg --cwd . root', { stdio: 'ignore' })
32
- return true
33
- } catch (e) {
34
- return false
35
- }
36
- }
37
-
38
- // Watch unless on CI or explicitly running all tests
39
- if (
40
- !process.env.CI &&
41
- argv.indexOf('--watchAll') === -1 &&
42
- argv.indexOf('--watchAll=false') === -1
43
- ) {
44
- // https://github.com/facebook/create-react-app/issues/5210
45
- const hasSourceControl = isInGitRepository() || isInMercurialRepository()
46
- argv.push(hasSourceControl ? '--watch' : '--watchAll')
47
- }
48
-
49
- jest.run(argv)
package/setupTests.ts DELETED
@@ -1,5 +0,0 @@
1
- // jest-dom adds custom jest matchers for asserting on DOM nodes.
2
- // allows you to do things like:
3
- // expect(element).toHaveTextContent(/react/i)
4
- // learn more: https://github.com/testing-library/jest-dom
5
- import '@testing-library/jest-dom'
package/tsconfig.json DELETED
@@ -1,30 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "lib/",
4
- "target": "es5",
5
- "lib": ["dom", "dom.iterable", "esnext"],
6
- "allowJs": true,
7
- "skipLibCheck": true,
8
- "esModuleInterop": true,
9
- "allowSyntheticDefaultImports": true,
10
- "strict": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "noFallthroughCasesInSwitch": true,
13
- "module": "esnext",
14
- "moduleResolution": "node",
15
- "resolveJsonModule": true,
16
- "isolatedModules": true,
17
- "declaration": true,
18
- "noEmit": false,
19
- "jsx": "react"
20
- },
21
- "include": [
22
- "components/**/*.ts",
23
- "components/**/*.tsx",
24
- "components/**/*.json",
25
- "react-app-env.d.ts",
26
- "reportWebVitals.ts",
27
- "setupTests.ts"
28
- ],
29
- "exclude": ["node_modules", "lib", "build"]
30
- }