nsgm-cli 2.0.12 → 2.0.15

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 (66) hide show
  1. package/.babelrc +12 -12
  2. package/LICENSE +201 -201
  3. package/README.md +163 -161
  4. package/client/layout/index.tsx +248 -248
  5. package/client/redux/reducers.ts +4 -4
  6. package/client/redux/store.ts +50 -50
  7. package/client/redux/template/manage/actions.ts +190 -190
  8. package/client/redux/template/manage/reducers.ts +118 -118
  9. package/client/redux/template/manage/types.ts +24 -24
  10. package/client/service/template/manage.ts +96 -96
  11. package/client/styled/common.ts +60 -60
  12. package/client/styled/layout/index.ts +25 -25
  13. package/client/styled/template/manage.ts +51 -51
  14. package/client/utils/common.ts +89 -89
  15. package/client/utils/cookie.ts +51 -51
  16. package/client/utils/fetch.ts +25 -25
  17. package/client/utils/menu.tsx +27 -27
  18. package/client/utils/sso.ts +205 -205
  19. package/generation/.babelrc +10 -10
  20. package/generation/README.md +19 -19
  21. package/generation/app.js +2 -2
  22. package/generation/client/redux/reducers.ts +4 -4
  23. package/generation/client/utils/menu.tsx +27 -27
  24. package/generation/gitignore +4 -4
  25. package/generation/mysql.config.js +12 -12
  26. package/generation/next.config.js +6 -6
  27. package/generation/package.json +24 -24
  28. package/generation/project.config.js +13 -13
  29. package/generation/server/rest.js +23 -23
  30. package/generation/server/utils/common.js +6 -6
  31. package/generation/tsconfig.json +30 -30
  32. package/index.js +10 -10
  33. package/lib/args.d.ts +6 -6
  34. package/lib/args.js +53 -53
  35. package/lib/generate.d.ts +3 -3
  36. package/lib/generate.js +751 -751
  37. package/lib/index.d.ts +2 -2
  38. package/lib/index.js +272 -272
  39. package/lib/server/db.d.ts +5 -5
  40. package/lib/server/db.js +110 -110
  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 -1
  46. package/mysql.config.js +14 -14
  47. package/next-env.d.ts +5 -5
  48. package/next.config.js +231 -231
  49. package/package.json +127 -126
  50. package/pages/_app.tsx +54 -54
  51. package/pages/_document.tsx +55 -55
  52. package/pages/index.tsx +68 -68
  53. package/pages/login.tsx +78 -78
  54. package/pages/template/manage.tsx +299 -278
  55. package/project.config.js +16 -16
  56. package/public/favicon.ico +0 -0
  57. package/public/slbhealthcheck.html +9 -9
  58. package/scripts/shutdown.sh +9 -9
  59. package/scripts/startup.sh +34 -34
  60. package/server/apis/sso.js +43 -43
  61. package/server/apis/template.js +37 -17
  62. package/server/modules/template/resolver.js +225 -225
  63. package/server/modules/template/schema.js +33 -33
  64. package/server/rest.js +24 -24
  65. package/server/sql/template.sql +8 -8
  66. package/server/utils/common.js +6 -6
package/package.json CHANGED
@@ -1,126 +1,127 @@
1
- {
2
- "name": "nsgm-cli",
3
- "version": "2.0.12",
4
- "description": "A CLI tool to run Next/Style-components and Graphql/Mysql fullstack project",
5
- "main": "index.js",
6
- "scripts": {
7
- "help": "node ./lib/index.js",
8
- "dev": "npm run tsbuild && node ./lib/index.js dev",
9
- "tsbuild": "rimraf lib && tsc --build tsconfig.build.json",
10
- "build": "node ./lib/index.js build",
11
- "tsv": "node ./lib/index.js version",
12
- "start": "node ./lib/index.js start",
13
- "export": "node ./lib/index.js export",
14
- "init": "node ./lib/index.js init",
15
- "upgrade": "node ./lib/index.js upgrade",
16
- "create": "node ./lib/index.js create",
17
- "delete": "node ./lib/index.js delete",
18
- "deletedb": "node ./lib/index.js deletedb",
19
- "clean": "rimraf .next && rimraf build && rimraf webapp && rimraf lib",
20
- "lint": "tslint -p tsconfig.build.json",
21
- "format": "prettier --write \"src/**/*.ts\"",
22
- "prepare": "npm run tsbuild",
23
- "prepublishOnly": "npm run lint",
24
- "preversion": "npm run lint",
25
- "version": "npm run format && git add -A src",
26
- "postversion": "git push && git push --tags",
27
- "release": "npm run clean && npm run lint && npm run format && npm run tsbuild && npm run build"
28
- },
29
- "repository": {
30
- "type": "git",
31
- "url": "git+https://github.com/erishen/nsgm.git"
32
- },
33
- "keywords": [
34
- "next",
35
- "style-components",
36
- "graphql",
37
- "mysql",
38
- "redux",
39
- "react",
40
- "hooks",
41
- "express"
42
- ],
43
- "author": {
44
- "name": "Erishen Sun",
45
- "email": "787058731@qq.com"
46
- },
47
- "license": "ISC",
48
- "bugs": {
49
- "url": "https://github.com/erishen/nsgm/issues"
50
- },
51
- "bin": {
52
- "nsgm": "lib/index.js"
53
- },
54
- "files": [
55
- "generation/*",
56
- "client/*",
57
- "server/*",
58
- "pages/*",
59
- "lib/*",
60
- "public/*",
61
- "scripts/*",
62
- "*.config.js",
63
- ".babelrc",
64
- "next-env.d.ts"
65
- ],
66
- "homepage": "https://github.com/erishen/nsgm#readme",
67
- "dependencies": {
68
- "@reduxjs/toolkit": "^1.8.5",
69
- "antd": "^5.11.0",
70
- "axios": "^1.6.0",
71
- "body-parser": "^1.19.0",
72
- "cors": "^2.8.5",
73
- "express": "^4.17.1",
74
- "express-fileupload": "^1.2.1",
75
- "express-graphql": "^0.12.0",
76
- "graphql": "^15.5.0",
77
- "lodash": "^4.17.20",
78
- "markdown-it": "^12.0.4",
79
- "moment": "^2.29.1",
80
- "mysql": "^2.18.1",
81
- "next": "^14.0.1",
82
- "react": "^18.2.0",
83
- "react-dom": "^18.2.0",
84
- "react-redux": "^7.2.2",
85
- "redux": "^4.0.5",
86
- "redux-thunk": "^2.3.0",
87
- "replace": "^1.2.0",
88
- "replace-in-file": "^6.2.0",
89
- "shelljs": "^0.8.4",
90
- "styled-components": "^5.2.1",
91
- "terser-webpack-plugin": "4.2.3",
92
- "typescript": "^4.1.3",
93
- "uglify-js": "^3.16.0",
94
- "uuid": "^8.3.2",
95
- "webpack": "^5.89.0",
96
- "webpack-simple-progress-plugin": "0.0.4",
97
- "xlsx": "^0.16.9"
98
- },
99
- "devDependencies": {
100
- "@babel/core": "^7.12.10",
101
- "@babel/plugin-proposal-optional-chaining": "^7.12.7",
102
- "@types/body-parser": "^1.19.0",
103
- "@types/express": "^4.17.11",
104
- "@types/express-fileupload": "^1.1.6",
105
- "@types/express-graphql": "^0.9.0",
106
- "@types/graphql": "^14.5.0",
107
- "@types/lodash": "^4.14.168",
108
- "@types/moment": "^2.13.0",
109
- "@types/mysql": "^2.15.17",
110
- "@types/next": "^9.0.0",
111
- "@types/node": "^20.8.10",
112
- "@types/react": "^18.2.36",
113
- "@types/react-dom": "^18.2.14",
114
- "@types/react-redux": "^7.1.25",
115
- "@types/shelljs": "^0.8.8",
116
- "@types/styled-components": "^5.1.7",
117
- "@types/uuid": "^8.3.0",
118
- "babel-plugin-react-html-attrs": "^3.0.5",
119
- "babel-plugin-styled-components": "^1.12.0",
120
- "cross-env": "^7.0.3",
121
- "prettier": "^2.2.1",
122
- "rimraf": "^3.0.2",
123
- "tslint": "^6.1.3",
124
- "tslint-config-prettier": "^1.18.0"
125
- }
126
- }
1
+ {
2
+ "name": "nsgm-cli",
3
+ "version": "2.0.15",
4
+ "description": "A CLI tool to run Next/Style-components and Graphql/Mysql fullstack project",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "help": "node ./lib/index.js",
8
+ "dev": "npm run tsbuild && node ./lib/index.js dev",
9
+ "tsbuild": "rimraf lib && tsc --build tsconfig.build.json",
10
+ "build": "node ./lib/index.js build",
11
+ "tsv": "node ./lib/index.js version",
12
+ "start": "node ./lib/index.js start",
13
+ "export": "node ./lib/index.js export",
14
+ "init": "node ./lib/index.js init",
15
+ "upgrade": "node ./lib/index.js upgrade",
16
+ "create": "node ./lib/index.js create",
17
+ "delete": "node ./lib/index.js delete",
18
+ "deletedb": "node ./lib/index.js deletedb",
19
+ "clean": "rimraf .next && rimraf build && rimraf webapp && rimraf lib",
20
+ "lint": "tslint -p tsconfig.build.json",
21
+ "format": "prettier --write \"src/**/*.ts\"",
22
+ "prepare": "npm run tsbuild",
23
+ "prepublishOnly": "npm run lint",
24
+ "preversion": "npm run lint",
25
+ "version": "npm run format && git add -A src",
26
+ "postversion": "git push && git push --tags",
27
+ "release": "npm run clean && npm run lint && npm run format && npm run tsbuild && npm run build"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/erishen/nsgm.git"
32
+ },
33
+ "keywords": [
34
+ "next",
35
+ "style-components",
36
+ "graphql",
37
+ "mysql",
38
+ "redux",
39
+ "react",
40
+ "hooks",
41
+ "express"
42
+ ],
43
+ "author": {
44
+ "name": "Erishen Sun",
45
+ "email": "leisun8309@gmail.com"
46
+ },
47
+ "license": "ISC",
48
+ "bugs": {
49
+ "url": "https://github.com/erishen/nsgm/issues"
50
+ },
51
+ "bin": {
52
+ "nsgm": "lib/index.js"
53
+ },
54
+ "files": [
55
+ "generation/*",
56
+ "client/*",
57
+ "server/*",
58
+ "pages/*",
59
+ "lib/*",
60
+ "public/*",
61
+ "scripts/*",
62
+ "*.config.js",
63
+ ".babelrc",
64
+ "next-env.d.ts"
65
+ ],
66
+ "homepage": "https://github.com/erishen/nsgm#readme",
67
+ "dependencies": {
68
+ "@reduxjs/toolkit": "^1.8.5",
69
+ "antd": "^5.11.0",
70
+ "axios": "^1.6.0",
71
+ "body-parser": "^1.19.0",
72
+ "cors": "^2.8.5",
73
+ "exceljs": "^4.4.0",
74
+ "express": "^4.17.1",
75
+ "express-fileupload": "^1.2.1",
76
+ "express-graphql": "^0.12.0",
77
+ "file-saver": "^2.0.5",
78
+ "graphql": "^15.5.0",
79
+ "lodash": "^4.17.20",
80
+ "markdown-it": "^12.0.4",
81
+ "moment": "^2.29.1",
82
+ "mysql": "^2.18.1",
83
+ "next": "^14.0.1",
84
+ "react": "^18.2.0",
85
+ "react-dom": "^18.2.0",
86
+ "react-redux": "^7.2.2",
87
+ "redux": "^4.0.5",
88
+ "redux-thunk": "^2.3.0",
89
+ "replace": "^1.2.0",
90
+ "replace-in-file": "^6.2.0",
91
+ "shelljs": "^0.8.4",
92
+ "styled-components": "^5.2.1",
93
+ "terser-webpack-plugin": "4.2.3",
94
+ "typescript": "^4.1.3",
95
+ "uglify-js": "^3.16.0",
96
+ "uuid": "^8.3.2",
97
+ "webpack": "^5.89.0",
98
+ "webpack-simple-progress-plugin": "0.0.4"
99
+ },
100
+ "devDependencies": {
101
+ "@babel/core": "^7.12.10",
102
+ "@babel/plugin-proposal-optional-chaining": "^7.12.7",
103
+ "@types/body-parser": "^1.19.0",
104
+ "@types/express": "^4.17.11",
105
+ "@types/express-fileupload": "^1.1.6",
106
+ "@types/express-graphql": "^0.9.0",
107
+ "@types/graphql": "^14.5.0",
108
+ "@types/lodash": "^4.14.168",
109
+ "@types/moment": "^2.13.0",
110
+ "@types/mysql": "^2.15.17",
111
+ "@types/next": "^9.0.0",
112
+ "@types/node": "^20.8.10",
113
+ "@types/react": "^18.2.36",
114
+ "@types/react-dom": "^18.2.14",
115
+ "@types/react-redux": "^7.1.25",
116
+ "@types/shelljs": "^0.8.8",
117
+ "@types/styled-components": "^5.1.7",
118
+ "@types/uuid": "^8.3.0",
119
+ "babel-plugin-react-html-attrs": "^3.0.5",
120
+ "babel-plugin-styled-components": "^1.12.0",
121
+ "cross-env": "^7.0.3",
122
+ "prettier": "^2.2.1",
123
+ "rimraf": "^3.0.2",
124
+ "tslint": "^6.1.3",
125
+ "tslint-config-prettier": "^1.18.0"
126
+ }
127
+ }
package/pages/_app.tsx CHANGED
@@ -1,54 +1,54 @@
1
- import React, { useEffect, useState } from 'react'
2
- import { Provider } from 'react-redux'
3
- import { ThemeProvider } from 'styled-components'
4
- import { useStore } from '../client/redux/store'
5
- import { GlobalStyle, Loading } from '../client/styled/common'
6
- import LayoutComponent from '../client/layout'
7
- import { login } from '../client/utils/sso'
8
- import { Spin } from 'antd'
9
- import 'antd/dist/reset.css'
10
-
11
- const theme = {
12
- colors: {
13
- primary: '#0070f3'
14
- }
15
- }
16
-
17
- export default function App({ Component, pageProps }) {
18
- const store = useStore(pageProps.initialReduxState)
19
- const [ssoUser, setSsoUser] = useState(null)
20
- const [pageLoad, setPageLoad] = useState(false)
21
-
22
- useEffect(() => {
23
- login((user: any) => {
24
- if (user) {
25
- // console.log('checkLogin_user', user)
26
- setSsoUser(user)
27
- }
28
- })
29
-
30
- setTimeout(() => {
31
- setPageLoad(true)
32
- }, 100)
33
- }, [])
34
-
35
- return (
36
- <>
37
- <GlobalStyle whiteColor={true} />
38
- <ThemeProvider theme={theme}>
39
- <Provider store={store}>
40
- {
41
- pageLoad ?
42
- ssoUser ? <LayoutComponent user={ssoUser}>
43
- <Component {...pageProps} />
44
- </LayoutComponent> :
45
- <Component {...pageProps} /> :
46
- <Loading>
47
- <Spin size="large" />
48
- </Loading>
49
- }
50
- </Provider>
51
- </ThemeProvider>
52
- </>
53
- )
54
- }
1
+ import React, { useEffect, useState } from 'react'
2
+ import { Provider } from 'react-redux'
3
+ import { ThemeProvider } from 'styled-components'
4
+ import { useStore } from '../client/redux/store'
5
+ import { GlobalStyle, Loading } from '../client/styled/common'
6
+ import LayoutComponent from '../client/layout'
7
+ import { login } from '../client/utils/sso'
8
+ import { Spin } from 'antd'
9
+ import 'antd/dist/reset.css'
10
+
11
+ const theme = {
12
+ colors: {
13
+ primary: '#0070f3'
14
+ }
15
+ }
16
+
17
+ export default function App({ Component, pageProps }) {
18
+ const store = useStore(pageProps.initialReduxState)
19
+ const [ssoUser, setSsoUser] = useState(null)
20
+ const [pageLoad, setPageLoad] = useState(false)
21
+
22
+ useEffect(() => {
23
+ login((user: any) => {
24
+ if (user) {
25
+ // console.log('checkLogin_user', user)
26
+ setSsoUser(user)
27
+ }
28
+ })
29
+
30
+ setTimeout(() => {
31
+ setPageLoad(true)
32
+ }, 100)
33
+ }, [])
34
+
35
+ return (
36
+ <>
37
+ <GlobalStyle whiteColor={true} />
38
+ <ThemeProvider theme={theme}>
39
+ <Provider store={store}>
40
+ {
41
+ pageLoad ?
42
+ ssoUser ? <LayoutComponent user={ssoUser}>
43
+ <Component {...pageProps} />
44
+ </LayoutComponent> :
45
+ <Component {...pageProps} /> :
46
+ <Loading>
47
+ <Spin size="large" />
48
+ </Loading>
49
+ }
50
+ </Provider>
51
+ </ThemeProvider>
52
+ </>
53
+ )
54
+ }
@@ -1,55 +1,55 @@
1
- import Document, {
2
- Html,
3
- Head,
4
- Main,
5
- NextScript,
6
- DocumentContext
7
- } from 'next/document'
8
- import React from 'react'
9
- import { ServerStyleSheet } from 'styled-components'
10
-
11
- const MyDocument = () => {
12
- return (
13
- <Html>
14
- <title>NSGM CLI</title>
15
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui"/>
16
- <meta name="apple-mobile-web-app-capable" content="yes" />
17
- <meta charSet="utf-8"/>
18
- <Head />
19
- <body>
20
- <Main />
21
- <NextScript />
22
- </body>
23
- </Html>
24
- )
25
- }
26
-
27
- // MyDocument.renderDocument = Document.renderDocument
28
-
29
- MyDocument.getInitialProps = async (ctx: DocumentContext) => {
30
- const sheet = new ServerStyleSheet()
31
- const originalRenderPage = ctx.renderPage
32
-
33
- try {
34
- ctx.renderPage = () =>
35
- originalRenderPage({
36
- enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />)
37
- })
38
-
39
- const initialProps = await Document.getInitialProps(ctx)
40
-
41
- return {
42
- ...initialProps,
43
- styles: (
44
- <>
45
- {initialProps.styles}
46
- {sheet.getStyleElement()}
47
- </>
48
- )
49
- }
50
- } finally {
51
- sheet.seal()
52
- }
53
- }
54
-
55
- export default MyDocument
1
+ import Document, {
2
+ Html,
3
+ Head,
4
+ Main,
5
+ NextScript,
6
+ DocumentContext
7
+ } from 'next/document'
8
+ import React from 'react'
9
+ import { ServerStyleSheet } from 'styled-components'
10
+
11
+ const MyDocument = () => {
12
+ return (
13
+ <Html>
14
+ <title>NSGM CLI</title>
15
+ <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui"/>
16
+ <meta name="apple-mobile-web-app-capable" content="yes" />
17
+ <meta charSet="utf-8"/>
18
+ <Head />
19
+ <body>
20
+ <Main />
21
+ <NextScript />
22
+ </body>
23
+ </Html>
24
+ )
25
+ }
26
+
27
+ // MyDocument.renderDocument = Document.renderDocument
28
+
29
+ MyDocument.getInitialProps = async (ctx: DocumentContext) => {
30
+ const sheet = new ServerStyleSheet()
31
+ const originalRenderPage = ctx.renderPage
32
+
33
+ try {
34
+ ctx.renderPage = () =>
35
+ originalRenderPage({
36
+ enhanceApp: (App) => (props) => sheet.collectStyles(<App {...props} />)
37
+ })
38
+
39
+ const initialProps = await Document.getInitialProps(ctx)
40
+
41
+ return {
42
+ ...initialProps,
43
+ styles: (
44
+ <>
45
+ {initialProps.styles}
46
+ {sheet.getStyleElement()}
47
+ </>
48
+ )
49
+ }
50
+ } finally {
51
+ sheet.seal()
52
+ }
53
+ }
54
+
55
+ export default MyDocument
package/pages/index.tsx CHANGED
@@ -1,69 +1,69 @@
1
- import MarkdownIt from 'markdown-it'
2
- import _ from 'lodash'
3
- import { Container } from '../client/styled/common'
4
- import getConfig from 'next/config'
5
- import React from 'react'
6
-
7
- const md = new MarkdownIt({
8
- html: true,
9
- linkify: true,
10
- typographer: true
11
- })
12
-
13
- const nextConfig = getConfig()
14
- const { publicRuntimeConfig } = nextConfig
15
- const { env } = publicRuntimeConfig
16
-
17
- const renderArr:any = []
18
-
19
- renderArr.push('# NSGM CLI ' + env)
20
- 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/)')
21
- renderArr.push('- 全栈架构,代码模板生成,快速开发')
22
- renderArr.push('- 数据库采用 Mysql, 配置见 mysql.config.js')
23
- renderArr.push('- 项目配置见 project.config.js')
24
- renderArr.push('- Next 框架配置见 next.config.js')
25
-
26
- renderArr.push('## 命令')
27
- renderArr.push('- nsgm init 初始化项目')
28
- renderArr.push('- nsgm upgrade 升级项目基础文件')
29
- renderArr.push('- nsgm create 创建模板页面')
30
- renderArr.push('- nsgm delete 删除模板页面')
31
- renderArr.push('- nsgm deletedb 删除模板页面及数据库表')
32
- renderArr.push('- nsgm dev 开发模式')
33
- renderArr.push('- nsgm start 生产模式')
34
- renderArr.push('- nsgm build 编译')
35
- renderArr.push('- nsgm export 导出静态页面')
36
-
37
- renderArr.push('## 参数')
38
- renderArr.push('- dictionary: 在 export/init 的时候使用, 默认 webapp, 譬如: nsgm export/init dictionary=webapp 或者 nsgm export/init webapp')
39
- renderArr.push('- controller: 在 create/delete 的时候使用, 必须有。譬如:nsgm create/delete math')
40
- renderArr.push('- action: 在 create/delete 的时候使用, 默认 manage, 跟在 controller 后面, 譬如 nsgm create/delete math test')
41
-
42
-
43
- const Page = ({ html }) => {
44
-
45
- const createMarkup = () => {
46
- return {
47
- __html: html
48
- }
49
- }
50
-
51
- return (
52
- <Container>
53
- <div dangerouslySetInnerHTML={createMarkup()} />
54
- </Container>
55
- )
56
- }
57
-
58
- Page.getInitialProps = () => {
59
- let html = ''
60
- _.each(renderArr, (item, index) => {
61
- html += md.render(item)
62
- })
63
-
64
- return {
65
- html
66
- }
67
- }
68
-
1
+ import MarkdownIt from 'markdown-it'
2
+ import _ from 'lodash'
3
+ import { Container } from '../client/styled/common'
4
+ import getConfig from 'next/config'
5
+ import React from 'react'
6
+
7
+ const md = new MarkdownIt({
8
+ html: true,
9
+ linkify: true,
10
+ typographer: true
11
+ })
12
+
13
+ const nextConfig = getConfig()
14
+ const { publicRuntimeConfig } = nextConfig
15
+ const { env } = publicRuntimeConfig
16
+
17
+ const renderArr:any = []
18
+
19
+ renderArr.push('# NSGM CLI ' + env)
20
+ 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/)')
21
+ renderArr.push('- 全栈架构,代码模板生成,快速开发')
22
+ renderArr.push('- 数据库采用 Mysql, 配置见 mysql.config.js')
23
+ renderArr.push('- 项目配置见 project.config.js')
24
+ renderArr.push('- Next 框架配置见 next.config.js')
25
+
26
+ renderArr.push('## 命令')
27
+ renderArr.push('- nsgm init 初始化项目')
28
+ renderArr.push('- nsgm upgrade 升级项目基础文件')
29
+ renderArr.push('- nsgm create 创建模板页面')
30
+ renderArr.push('- nsgm delete 删除模板页面')
31
+ renderArr.push('- nsgm deletedb 删除模板页面及数据库表')
32
+ renderArr.push('- nsgm dev 开发模式')
33
+ renderArr.push('- nsgm start 生产模式')
34
+ renderArr.push('- nsgm build 编译')
35
+ renderArr.push('- nsgm export 导出静态页面')
36
+
37
+ renderArr.push('## 参数')
38
+ renderArr.push('- dictionary: 在 export/init 的时候使用, 默认 webapp, 譬如: nsgm export/init dictionary=webapp 或者 nsgm export/init webapp')
39
+ renderArr.push('- controller: 在 create/delete 的时候使用, 必须有。譬如:nsgm create/delete math')
40
+ renderArr.push('- action: 在 create/delete 的时候使用, 默认 manage, 跟在 controller 后面, 譬如 nsgm create/delete math test')
41
+
42
+
43
+ const Page = ({ html }) => {
44
+
45
+ const createMarkup = () => {
46
+ return {
47
+ __html: html
48
+ }
49
+ }
50
+
51
+ return (
52
+ <Container>
53
+ <div dangerouslySetInnerHTML={createMarkup()} />
54
+ </Container>
55
+ )
56
+ }
57
+
58
+ Page.getInitialProps = () => {
59
+ let html = ''
60
+ _.each(renderArr, (item, index) => {
61
+ html += md.render(item)
62
+ })
63
+
64
+ return {
65
+ html
66
+ }
67
+ }
68
+
69
69
  export default Page