nsgm-cli 2.1.19 → 2.1.21

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 (99) hide show
  1. package/client/components/Button.tsx +3 -3
  2. package/client/components/ClientProviders.tsx +12 -12
  3. package/client/components/LanguageSwitcher.tsx +26 -26
  4. package/client/components/SSRSafeAntdProvider.tsx +7 -7
  5. package/client/components/SuppressHydrationWarnings.tsx +30 -30
  6. package/client/components/__tests__/Button.test.tsx +12 -12
  7. package/client/layout/index.tsx +124 -124
  8. package/client/redux/reducers.ts +2 -2
  9. package/client/redux/store.ts +24 -24
  10. package/client/redux/template/manage/actions.ts +40 -40
  11. package/client/redux/template/manage/reducers.ts +32 -32
  12. package/client/redux/template/manage/types.ts +19 -19
  13. package/client/service/template/manage.ts +29 -29
  14. package/client/styled/common.ts +6 -6
  15. package/client/styled/layout/index.ts +17 -17
  16. package/client/styled/template/manage.ts +19 -19
  17. package/client/utils/common.ts +54 -54
  18. package/client/utils/cookie.ts +30 -30
  19. package/client/utils/fetch.ts +111 -111
  20. package/client/utils/i18n.ts +41 -41
  21. package/client/utils/menu.tsx +12 -12
  22. package/client/utils/navigation.ts +22 -22
  23. package/client/utils/sso.ts +124 -124
  24. package/client/utils/suppressWarnings.ts +17 -17
  25. package/generation/prettierrc +6 -0
  26. package/lib/args.js +19 -19
  27. package/lib/cli/app.d.ts +1 -1
  28. package/lib/cli/app.js +2 -2
  29. package/lib/cli/commands/build.d.ts +1 -1
  30. package/lib/cli/commands/build.js +9 -9
  31. package/lib/cli/commands/create.d.ts +1 -1
  32. package/lib/cli/commands/create.js +36 -36
  33. package/lib/cli/commands/delete.d.ts +1 -1
  34. package/lib/cli/commands/delete.js +55 -55
  35. package/lib/cli/commands/export.d.ts +1 -1
  36. package/lib/cli/commands/export.js +12 -12
  37. package/lib/cli/commands/help.d.ts +1 -1
  38. package/lib/cli/commands/help.js +29 -29
  39. package/lib/cli/commands/init.d.ts +1 -1
  40. package/lib/cli/commands/init.js +31 -31
  41. package/lib/cli/commands/server.d.ts +1 -1
  42. package/lib/cli/commands/server.js +12 -12
  43. package/lib/cli/commands/upgrade.d.ts +1 -1
  44. package/lib/cli/commands/upgrade.js +13 -13
  45. package/lib/cli/commands/version.d.ts +1 -1
  46. package/lib/cli/commands/version.js +7 -7
  47. package/lib/cli/index.d.ts +13 -13
  48. package/lib/cli/parser.d.ts +1 -1
  49. package/lib/cli/parser.js +12 -12
  50. package/lib/cli/registry.d.ts +1 -1
  51. package/lib/cli/types.d.ts +2 -2
  52. package/lib/cli/utils/console.d.ts +2 -2
  53. package/lib/cli/utils/console.js +22 -22
  54. package/lib/cli/utils/index.d.ts +2 -2
  55. package/lib/cli/utils/prompt.d.ts +1 -1
  56. package/lib/cli/utils/prompt.js +98 -98
  57. package/lib/constants.js +28 -28
  58. package/lib/generate.d.ts +2 -2
  59. package/lib/generate.js +19 -19
  60. package/lib/generate_create.d.ts +1 -1
  61. package/lib/generate_create.js +38 -38
  62. package/lib/generate_delete.js +63 -63
  63. package/lib/generate_init.js +94 -94
  64. package/lib/generators/base-generator.d.ts +1 -1
  65. package/lib/generators/base-generator.js +23 -23
  66. package/lib/generators/file-generator.js +15 -15
  67. package/lib/generators/generator-factory.d.ts +5 -5
  68. package/lib/generators/i18n-generator.d.ts +1 -1
  69. package/lib/generators/i18n-generator.js +127 -127
  70. package/lib/generators/page-generator.d.ts +1 -1
  71. package/lib/generators/page-generator.js +25 -25
  72. package/lib/generators/resolver-generator.d.ts +1 -1
  73. package/lib/generators/resolver-generator.js +27 -27
  74. package/lib/generators/schema-generator.d.ts +1 -1
  75. package/lib/generators/schema-generator.js +4 -4
  76. package/lib/generators/service-generator.d.ts +1 -1
  77. package/lib/generators/service-generator.js +29 -29
  78. package/lib/generators/sql-generator.d.ts +1 -1
  79. package/lib/generators/sql-generator.js +10 -10
  80. package/lib/index.js +23 -23
  81. package/lib/server/csrf.d.ts +3 -3
  82. package/lib/server/csrf.js +20 -20
  83. package/lib/server/db.d.ts +1 -1
  84. package/lib/server/db.js +21 -21
  85. package/lib/server/graphql.js +26 -26
  86. package/lib/server/plugins/date.d.ts +1 -1
  87. package/lib/server/plugins/date.js +6 -6
  88. package/lib/server/utils/graphql-cache.js +5 -5
  89. package/lib/tsconfig.build.tsbuildinfo +1 -1
  90. package/lib/utils/project-config.d.ts +1 -1
  91. package/lib/utils/project-config.js +20 -20
  92. package/lib/utils.js +3 -3
  93. package/package.json +1 -1
  94. package/pages/_app.tsx +62 -62
  95. package/pages/_document.tsx +15 -15
  96. package/pages/_error.tsx +26 -26
  97. package/pages/index.tsx +48 -48
  98. package/pages/login.tsx +64 -64
  99. package/pages/template/manage.tsx +175 -175
@@ -1,5 +1,5 @@
1
- import styled from 'styled-components'
2
- import { Button, Input, Table } from 'antd'
1
+ import styled from "styled-components";
2
+ import { Button, Input, Table } from "antd";
3
3
 
4
4
  export const Container = styled.div`
5
5
  margin: 20px 0 0 0;
@@ -46,7 +46,7 @@ export const Container = styled.div`
46
46
  position: relative;
47
47
 
48
48
  &:after {
49
- content: '';
49
+ content: "";
50
50
  position: absolute;
51
51
  bottom: -1px;
52
52
  left: 0;
@@ -56,7 +56,7 @@ export const Container = styled.div`
56
56
  border-radius: 3px;
57
57
  }
58
58
  }
59
- `
59
+ `;
60
60
 
61
61
  export const SearchRow = styled.div`
62
62
  margin: 10px 0 20px 0;
@@ -74,7 +74,7 @@ export const SearchRow = styled.div`
74
74
  &:hover {
75
75
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
76
76
  }
77
- `
77
+ `;
78
78
 
79
79
  export const ModalContainer = styled.div`
80
80
  .line {
@@ -99,7 +99,7 @@ export const ModalContainer = styled.div`
99
99
  position: relative;
100
100
 
101
101
  &:after {
102
- content: '';
102
+ content: "";
103
103
  position: absolute;
104
104
  left: -8px;
105
105
  top: 50%;
@@ -136,14 +136,14 @@ export const ModalContainer = styled.div`
136
136
  }
137
137
  }
138
138
  }
139
- `
139
+ `;
140
140
 
141
141
  // Button 样式组件
142
142
  export const StyledButton = styled(Button)<{
143
- $primary?: boolean
144
- $export?: boolean
145
- $import?: boolean
146
- $danger?: boolean
143
+ $primary?: boolean;
144
+ $export?: boolean;
145
+ $import?: boolean;
146
+ $danger?: boolean;
147
147
  }>`
148
148
  display: flex;
149
149
  align-items: center;
@@ -175,13 +175,13 @@ export const StyledButton = styled(Button)<{
175
175
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
176
176
  transition: all 0.3s ease;
177
177
  `}
178
- `
178
+ `;
179
179
 
180
180
  export const StyledInput = styled(Input)`
181
181
  width: 200px;
182
182
  border-radius: 6px;
183
183
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
184
- `
184
+ `;
185
185
 
186
186
  export const StyledTable = styled(Table)`
187
187
  margin-top: 16px;
@@ -192,24 +192,24 @@ export const StyledTable = styled(Table)`
192
192
  margin-top: 16px;
193
193
  margin-bottom: 16px;
194
194
  }
195
- `
195
+ `;
196
196
 
197
197
  export const ModalTitle = styled.div`
198
198
  color: #1890ff;
199
199
  font-weight: 500;
200
- `
200
+ `;
201
201
 
202
202
  export const ModalInput = styled(Input)`
203
203
  border-radius: 4px;
204
- `
204
+ `;
205
205
 
206
206
  export const IconWrapper = styled.i`
207
207
  margin-right: 5px;
208
- `
208
+ `;
209
209
 
210
210
  export const RoundedButton = styled(Button)`
211
211
  border-radius: 4px;
212
- `
212
+ `;
213
213
 
214
214
  export const GlobalStyle = styled.div`
215
215
  .rounded-button {
@@ -221,4 +221,4 @@ export const GlobalStyle = styled.div`
221
221
  overflow: auto !important;
222
222
  padding-right: 0 !important;
223
223
  }
224
- `
224
+ `;
@@ -1,91 +1,91 @@
1
- import getConfig from 'next/config'
2
- import _ from 'lodash'
1
+ import getConfig from "next/config";
2
+ import _ from "lodash";
3
3
 
4
4
  export const getLocalEnv = () => {
5
- const nextConfig = getConfig()
6
- const { publicRuntimeConfig } = nextConfig
7
- let { env = 'uat' } = publicRuntimeConfig
8
- env = env.toLowerCase()
9
- return env
10
- }
5
+ const nextConfig = getConfig();
6
+ const { publicRuntimeConfig } = nextConfig;
7
+ let { env = "uat" } = publicRuntimeConfig;
8
+ env = env.toLowerCase();
9
+ return env;
10
+ };
11
11
 
12
12
  export const getLocalApiPrefix = () => {
13
- const nextConfig = getConfig()
14
- const { publicRuntimeConfig } = nextConfig
15
- let { protocol, host, port } = publicRuntimeConfig
16
- const { prefix, isExport } = publicRuntimeConfig
13
+ const nextConfig = getConfig();
14
+ const { publicRuntimeConfig } = nextConfig;
15
+ let { protocol, host, port } = publicRuntimeConfig;
16
+ const { prefix, isExport } = publicRuntimeConfig;
17
17
 
18
- let localApiPrefix = ''
18
+ let localApiPrefix = "";
19
19
 
20
20
  if (!isExport) {
21
- if (typeof window !== 'undefined') {
21
+ if (typeof window !== "undefined") {
22
22
  // 客户端:使用当前页面的 location
23
- const location = window.location
23
+ const location = window.location;
24
24
 
25
- protocol = location.protocol
26
- if (protocol.indexOf(':') != -1) {
27
- protocol = protocol.split(':')[0]
25
+ protocol = location.protocol;
26
+ if (protocol.indexOf(":") != -1) {
27
+ protocol = protocol.split(":")[0];
28
28
  }
29
- host = location.hostname
30
- port = location.port || (protocol.indexOf('https') !== -1 ? '443' : '80')
29
+ host = location.hostname;
30
+ port = location.port || (protocol.indexOf("https") !== -1 ? "443" : "80");
31
31
  }
32
32
  // 服务器端:直接使用配置中的值,无需额外处理
33
33
  }
34
34
 
35
- localApiPrefix = `${protocol}://${host}:${port}${prefix}`
36
- return localApiPrefix
37
- }
35
+ localApiPrefix = `${protocol}://${host}:${port}${prefix}`;
36
+ return localApiPrefix;
37
+ };
38
38
 
39
39
  export const handleXSS = (content: string) => {
40
- content = content || ''
41
- return content.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#x27;')
42
- }
40
+ content = content || "";
41
+ return content.replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;");
42
+ };
43
43
 
44
44
  export const checkModalObj = (modalObj: {}, ignoreKeys: any = []) => {
45
- let result: any = null
45
+ let result: any = null;
46
46
  _.each(modalObj, (value: any, key: string) => {
47
- if (ignoreKeys.length === 0 || (ignoreKeys.length !== 0 && ignoreKeys.join('.').indexOf(key) === -1)) {
48
- if (_.trim(value) === '') {
47
+ if (ignoreKeys.length === 0 || (ignoreKeys.length !== 0 && ignoreKeys.join(".").indexOf(key) === -1)) {
48
+ if (_.trim(value) === "") {
49
49
  result = {
50
50
  key,
51
- reason: '不能为空',
52
- }
53
- return false
51
+ reason: "不能为空",
52
+ };
53
+ return false;
54
54
  }
55
55
  }
56
- return true
57
- })
58
- return result
59
- }
56
+ return true;
57
+ });
58
+ return result;
59
+ };
60
60
 
61
61
  export const getUrlParamByKey = (key: string) => {
62
- let result = ''
63
- if (typeof window !== 'undefined') {
64
- const locationHref = window.location.href
65
- if (locationHref.indexOf('?') !== -1) {
66
- const locationHrefArr = locationHref.split('?')
62
+ let result = "";
63
+ if (typeof window !== "undefined") {
64
+ const locationHref = window.location.href;
65
+ if (locationHref.indexOf("?") !== -1) {
66
+ const locationHrefArr = locationHref.split("?");
67
67
  if (locationHrefArr.length > 1) {
68
- const paramsStr = locationHrefArr[1]
68
+ const paramsStr = locationHrefArr[1];
69
69
 
70
- let params: any = []
71
- if (paramsStr.indexOf('&') !== -1) {
72
- params = paramsStr.split('&')
70
+ let params: any = [];
71
+ if (paramsStr.indexOf("&") !== -1) {
72
+ params = paramsStr.split("&");
73
73
  } else {
74
- params.push(paramsStr)
74
+ params.push(paramsStr);
75
75
  }
76
76
 
77
77
  _.each(params, (item) => {
78
- if (item.indexOf('=') !== -1) {
79
- const itemArr = item.split('=')
78
+ if (item.indexOf("=") !== -1) {
79
+ const itemArr = item.split("=");
80
80
  if (itemArr[0] === key) {
81
- result = itemArr[1]
82
- return false
81
+ result = itemArr[1];
82
+ return false;
83
83
  }
84
84
  }
85
- return true
86
- })
85
+ return true;
86
+ });
87
87
  }
88
88
  }
89
89
  }
90
- return result
91
- }
90
+ return result;
91
+ };
@@ -1,51 +1,51 @@
1
- import _ from 'lodash'
1
+ import _ from "lodash";
2
2
 
3
3
  export const setCookie = (name: string, value: string, cookieExpire: any) => {
4
- const currentDate = new Date()
5
- const currentTime = currentDate.getTime()
6
- const expiresTime = new Date()
7
- expiresTime.setTime(currentTime + 60 * 1000 * 60 * 24 * 30)
4
+ const currentDate = new Date();
5
+ const currentTime = currentDate.getTime();
6
+ const expiresTime = new Date();
7
+ expiresTime.setTime(currentTime + 60 * 1000 * 60 * 24 * 30);
8
8
 
9
- if (typeof document !== 'undefined') {
10
- let cookie = `${name}=${window.btoa(encodeURIComponent(value))}`
9
+ if (typeof document !== "undefined") {
10
+ let cookie = `${name}=${window.btoa(encodeURIComponent(value))}`;
11
11
  // let cookie = name + '=' + encodeURIComponent(value)
12
12
  if (cookieExpire) {
13
- cookie += `;expires=${cookieExpire}`
13
+ cookie += `;expires=${cookieExpire}`;
14
14
  } else {
15
- cookie += `;expires=${expiresTime.toUTCString()}`
15
+ cookie += `;expires=${expiresTime.toUTCString()}`;
16
16
  }
17
17
 
18
- cookie += ';path=/'
19
- document.cookie = cookie
18
+ cookie += ";path=/";
19
+ document.cookie = cookie;
20
20
  }
21
- }
21
+ };
22
22
 
23
23
  export const getCookie = (name: string) => {
24
- let result = ''
25
- if (typeof document !== 'undefined') {
26
- const cookie = document.cookie
24
+ let result = "";
25
+ if (typeof document !== "undefined") {
26
+ const cookie = document.cookie;
27
27
 
28
- const cookieArr = cookie.split('; ')
28
+ const cookieArr = cookie.split("; ");
29
29
 
30
30
  _.each(cookieArr, (item) => {
31
- const itemArr = item.split('=')
31
+ const itemArr = item.split("=");
32
32
  if (name === itemArr[0]) {
33
- result = decodeURIComponent(window.atob(itemArr[1]))
34
- return false
33
+ result = decodeURIComponent(window.atob(itemArr[1]));
34
+ return false;
35
35
  }
36
- return true
37
- })
36
+ return true;
37
+ });
38
38
  }
39
- return result
40
- }
39
+ return result;
40
+ };
41
41
 
42
42
  export const delCookie = (name: string) => {
43
- const currentDate = new Date()
44
- const currentTime = currentDate.getTime()
45
- const expiresTime = new Date()
46
- expiresTime.setTime(currentTime - 1)
43
+ const currentDate = new Date();
44
+ const currentTime = currentDate.getTime();
45
+ const expiresTime = new Date();
46
+ expiresTime.setTime(currentTime - 1);
47
47
 
48
- if (typeof document !== 'undefined') {
49
- document.cookie = `${name}=;expires=${expiresTime.toUTCString()};path=/`
48
+ if (typeof document !== "undefined") {
49
+ document.cookie = `${name}=;expires=${expiresTime.toUTCString()};path=/`;
50
50
  }
51
- }
51
+ };