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.
- package/.babelrc +13 -0
- package/LICENSE +201 -201
- package/README.md +161 -162
- package/client/layout/index.tsx +245 -0
- package/client/redux/reducers.ts +5 -0
- package/{generation/client → client}/redux/store.ts +50 -44
- package/{generation/client → client}/redux/template/manage/actions.ts +190 -190
- package/{generation/client → client}/redux/template/manage/reducers.ts +118 -118
- package/{generation/client → client}/redux/template/manage/types.ts +24 -24
- package/client/service/template/manage.ts +97 -0
- package/{generation/client → client}/styled/common.ts +27 -28
- package/client/styled/layout/index.ts +26 -0
- package/{generation/client → client}/styled/template/manage.ts +51 -51
- package/client/utils/common.ts +86 -0
- package/client/utils/cookie.ts +52 -0
- package/{generation/client → client}/utils/fetch.ts +25 -25
- package/client/utils/menu.tsx +27 -0
- package/generation/.DS_Store +0 -0
- package/generation/.babelrc +3 -2
- package/generation/README.md +19 -18
- package/generation/app.js +2 -2
- package/generation/client/redux/reducers.ts +5 -5
- package/generation/client/utils/menu.tsx +27 -26
- package/generation/gitignore +5 -4
- package/generation/mysql.config.js +13 -12
- package/generation/next.config.js +6 -6
- package/generation/package.json +25 -20
- package/generation/project.config.js +12 -12
- package/generation/server/rest.js +20 -20
- package/generation/server/utils/common.js +7 -0
- package/generation/tsconfig.json +30 -29
- package/index.js +10 -10
- package/lib/args.d.ts +6 -6
- package/lib/args.js +47 -47
- package/lib/generate.d.ts +3 -3
- package/lib/generate.js +735 -590
- package/lib/index.d.ts +2 -2
- package/lib/index.js +259 -182
- package/lib/server/db.d.ts +5 -5
- package/lib/server/db.js +110 -47
- package/lib/server/graphql.d.ts +7 -7
- package/lib/server/graphql.js +119 -119
- package/lib/server/plugins/date.d.ts +5 -5
- package/lib/server/plugins/date.js +16 -16
- package/lib/tsconfig.build.tsbuildinfo +1 -0
- package/mysql.config.js +14 -14
- package/next-env.d.ts +6 -0
- package/next.config.js +194 -174
- package/package.json +125 -113
- package/{generation/pages → pages}/_app.tsx +44 -44
- package/{generation/pages → pages}/_document.tsx +4 -2
- package/pages/index.tsx +68 -0
- package/{generation/pages → pages}/template/manage.tsx +278 -280
- package/project.config.js +14 -14
- package/public/slbhealthcheck.html +10 -0
- package/scripts/shutdown.sh +10 -0
- package/scripts/startup.sh +35 -0
- package/{generation/server → server}/apis/template.js +17 -18
- package/{generation/server → server}/modules/template/resolver.js +29 -35
- package/{generation/server → server}/modules/template/schema.js +33 -33
- package/server/rest.js +20 -0
- package/{generation/server → server}/sql/template.sql +8 -8
- package/server/utils/common.js +7 -0
- package/generation/client/layout/index.tsx +0 -223
- package/generation/client/service/template/manage.ts +0 -74
- package/generation/client/styled/layout/index.ts +0 -14
- package/generation/client/utils/common.ts +0 -45
- package/generation/next-env.d.ts +0 -2
- package/generation/pages/index.tsx +0 -55
- /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, '<').replace(/>/g, '>').replace(/\"/g, '"').replace(/\'/g, ''')
|
|
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
|
-
}
|
package/generation/next-env.d.ts
DELETED
|
@@ -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
|
|
File without changes
|