nsgm-cli 1.0.26 → 2.0.0

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 (70) hide show
  1. package/.babelrc +13 -0
  2. package/LICENSE +201 -201
  3. package/README.md +161 -162
  4. package/client/layout/index.tsx +245 -0
  5. package/client/redux/reducers.ts +5 -0
  6. package/{generation/client → client}/redux/store.ts +50 -44
  7. package/{generation/client → client}/redux/template/manage/actions.ts +190 -190
  8. package/{generation/client → client}/redux/template/manage/reducers.ts +118 -118
  9. package/{generation/client → client}/redux/template/manage/types.ts +24 -24
  10. package/client/service/template/manage.ts +97 -0
  11. package/{generation/client → client}/styled/common.ts +27 -28
  12. package/client/styled/layout/index.ts +26 -0
  13. package/{generation/client → client}/styled/template/manage.ts +51 -51
  14. package/client/utils/common.ts +86 -0
  15. package/client/utils/cookie.ts +52 -0
  16. package/{generation/client → client}/utils/fetch.ts +25 -25
  17. package/client/utils/menu.tsx +27 -0
  18. package/generation/.DS_Store +0 -0
  19. package/generation/.babelrc +3 -2
  20. package/generation/README.md +19 -18
  21. package/generation/app.js +2 -2
  22. package/generation/client/redux/reducers.ts +5 -5
  23. package/generation/client/utils/menu.tsx +27 -26
  24. package/generation/gitignore +5 -4
  25. package/generation/mysql.config.js +13 -12
  26. package/generation/next.config.js +6 -6
  27. package/generation/package.json +25 -20
  28. package/generation/project.config.js +12 -12
  29. package/generation/server/rest.js +20 -20
  30. package/generation/server/utils/common.js +7 -0
  31. package/generation/tsconfig.json +30 -29
  32. package/index.js +10 -10
  33. package/lib/args.d.ts +6 -6
  34. package/lib/args.js +47 -47
  35. package/lib/generate.d.ts +3 -3
  36. package/lib/generate.js +735 -590
  37. package/lib/index.d.ts +2 -2
  38. package/lib/index.js +259 -182
  39. package/lib/server/db.d.ts +5 -5
  40. package/lib/server/db.js +110 -47
  41. package/lib/server/graphql.d.ts +7 -7
  42. package/lib/server/graphql.js +119 -119
  43. package/lib/server/plugins/date.d.ts +5 -5
  44. package/lib/server/plugins/date.js +16 -16
  45. package/lib/tsconfig.build.tsbuildinfo +1 -0
  46. package/mysql.config.js +14 -14
  47. package/next-env.d.ts +6 -0
  48. package/next.config.js +194 -174
  49. package/package.json +125 -113
  50. package/{generation/pages → pages}/_app.tsx +44 -44
  51. package/{generation/pages → pages}/_document.tsx +4 -2
  52. package/pages/index.tsx +68 -0
  53. package/{generation/pages → pages}/template/manage.tsx +278 -280
  54. package/project.config.js +14 -14
  55. package/public/slbhealthcheck.html +10 -0
  56. package/scripts/shutdown.sh +10 -0
  57. package/scripts/startup.sh +35 -0
  58. package/{generation/server → server}/apis/template.js +17 -18
  59. package/{generation/server → server}/modules/template/resolver.js +29 -35
  60. package/{generation/server → server}/modules/template/schema.js +33 -33
  61. package/server/rest.js +20 -0
  62. package/{generation/server → server}/sql/template.sql +8 -8
  63. package/server/utils/common.js +7 -0
  64. package/generation/client/layout/index.tsx +0 -223
  65. package/generation/client/service/template/manage.ts +0 -74
  66. package/generation/client/styled/layout/index.ts +0 -14
  67. package/generation/client/utils/common.ts +0 -45
  68. package/generation/next-env.d.ts +0 -2
  69. package/generation/pages/index.tsx +0 -55
  70. /package/{generation/public → public}/images/zhizuotu_1.png +0 -0
@@ -1,45 +0,0 @@
1
- import getConfig from 'next/config'
2
- import _ from 'lodash'
3
-
4
- export const getLocalApiPrefix = () => {
5
- const nextConfig = getConfig()
6
- const { publicRuntimeConfig } = nextConfig
7
- let { protocol, host, port } = publicRuntimeConfig
8
-
9
- if (typeof window !== 'undefined') {
10
- const location = window.location
11
- // console.log('location', location)
12
- protocol = location.protocol
13
- if (protocol.indexOf(':') !== -1) {
14
- protocol = protocol.split(':')[0]
15
- }
16
- host = location.hostname
17
- port = location.port
18
- }
19
-
20
- const localApiPrefix = protocol + '://' + host + ':' + port
21
- // console.log('localApiPrefix', localApiPrefix)
22
- return localApiPrefix
23
- }
24
-
25
- export const handleXSS = (content: string) => {
26
- content = content || ''
27
- return content.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\"/g, '&quot;').replace(/\'/g, '&#x27;')
28
- }
29
-
30
- export const checkModalObj = (modalObj: {}, ignoreKeys: any = []) => {
31
- let result: any = null
32
- _.each(modalObj, (value: any, key: string) => {
33
- // console.log('checkModalObj', ignoreKeys, key, ignoreKeys.join('.').indexOf(key))
34
- if (ignoreKeys.length === 0 || (ignoreKeys.length !== 0 && ignoreKeys.join('.').indexOf(key) === -1)) {
35
- if (_.trim(value) === '') {
36
- result = {
37
- key,
38
- reason: '不能为空'
39
- }
40
- return false
41
- }
42
- }
43
- })
44
- return result
45
- }
@@ -1,2 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/types/global" />
@@ -1,55 +0,0 @@
1
- import MarkdownIt from 'markdown-it'
2
- import _ from 'lodash'
3
- import { Container } from '../client/styled/common'
4
-
5
- const Page = () => {
6
- const md = new MarkdownIt({
7
- html: true,
8
- linkify: true,
9
- typographer: true
10
- })
11
-
12
- const renderArr = []
13
-
14
- renderArr.push('# NSGM CLI')
15
- renderArr.push('- 技术栈: [Next](https://github.com/vercel/next.js), [Styled-components](https://github.com/styled-components/styled-components), [Graphql](https://graphql.org/), [Mysql](https://www.mysql.com/) (命名取首字母 NSGM)')
16
- renderArr.push('- 全栈架构,代码模板生成,快速开发')
17
- renderArr.push('- 数据库采用 Mysql, 配置见 mysql.config.js')
18
- renderArr.push('- 项目配置见 project.config.js')
19
- renderArr.push('- Next 框架配置见 next.config.js')
20
- renderArr.push('- [Demo 网站](https://nsgm.erisl.top/)')
21
-
22
- renderArr.push('## 命令')
23
- renderArr.push('- nsgm init 初始化项目')
24
- renderArr.push('- nsgm upgrade 升级项目基础文件')
25
- renderArr.push('- nsgm create 创建模板页面')
26
- renderArr.push('- nsgm delete 删除模板页面')
27
- renderArr.push('- nsgm dev 开发模式')
28
- renderArr.push('- nsgm start 生产模式')
29
- renderArr.push('- nsgm build 编译')
30
- renderArr.push('- nsgm export 导出静态页面')
31
-
32
- renderArr.push('## 参数')
33
- renderArr.push('- dictionary: 在 export/init 的时候使用, 默认 webapp, 譬如: nsgm export/init dictionary=webapp 或者 nsgm export/init webapp')
34
- renderArr.push('- controller: 在 create/delete 的时候使用, 必须有。譬如:nsgm create/delete math')
35
- renderArr.push('- action: 在 create/delete 的时候使用, 默认 manage, 跟在 controller 后面, 譬如 nsgm create/delete math test')
36
-
37
- let html = ''
38
- _.each(renderArr, (item, index) => {
39
- html += md.render(item)
40
- })
41
-
42
- const createMarkup = () => {
43
- return {
44
- __html: html
45
- }
46
- }
47
-
48
- return (
49
- <Container>
50
- <div dangerouslySetInnerHTML={createMarkup()} />
51
- </Container>
52
- )
53
- }
54
-
55
- export default Page