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.
- package/.babelrc +12 -12
- package/LICENSE +201 -201
- package/README.md +163 -161
- package/client/layout/index.tsx +248 -248
- package/client/redux/reducers.ts +4 -4
- package/client/redux/store.ts +50 -50
- package/client/redux/template/manage/actions.ts +190 -190
- package/client/redux/template/manage/reducers.ts +118 -118
- package/client/redux/template/manage/types.ts +24 -24
- package/client/service/template/manage.ts +96 -96
- package/client/styled/common.ts +60 -60
- package/client/styled/layout/index.ts +25 -25
- package/client/styled/template/manage.ts +51 -51
- package/client/utils/common.ts +89 -89
- package/client/utils/cookie.ts +51 -51
- package/client/utils/fetch.ts +25 -25
- package/client/utils/menu.tsx +27 -27
- package/client/utils/sso.ts +205 -205
- package/generation/.babelrc +10 -10
- package/generation/README.md +19 -19
- package/generation/app.js +2 -2
- package/generation/client/redux/reducers.ts +4 -4
- package/generation/client/utils/menu.tsx +27 -27
- package/generation/gitignore +4 -4
- package/generation/mysql.config.js +12 -12
- package/generation/next.config.js +6 -6
- package/generation/package.json +24 -24
- package/generation/project.config.js +13 -13
- package/generation/server/rest.js +23 -23
- package/generation/server/utils/common.js +6 -6
- package/generation/tsconfig.json +30 -30
- package/index.js +10 -10
- package/lib/args.d.ts +6 -6
- package/lib/args.js +53 -53
- package/lib/generate.d.ts +3 -3
- package/lib/generate.js +751 -751
- package/lib/index.d.ts +2 -2
- package/lib/index.js +272 -272
- package/lib/server/db.d.ts +5 -5
- package/lib/server/db.js +110 -110
- 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 -1
- package/mysql.config.js +14 -14
- package/next-env.d.ts +5 -5
- package/next.config.js +231 -231
- package/package.json +127 -126
- package/pages/_app.tsx +54 -54
- package/pages/_document.tsx +55 -55
- package/pages/index.tsx +68 -68
- package/pages/login.tsx +78 -78
- package/pages/template/manage.tsx +299 -278
- package/project.config.js +16 -16
- package/public/favicon.ico +0 -0
- package/public/slbhealthcheck.html +9 -9
- package/scripts/shutdown.sh +9 -9
- package/scripts/startup.sh +34 -34
- package/server/apis/sso.js +43 -43
- package/server/apis/template.js +37 -17
- package/server/modules/template/resolver.js +225 -225
- package/server/modules/template/schema.js +33 -33
- package/server/rest.js +24 -24
- package/server/sql/template.sql +8 -8
- package/server/utils/common.js +6 -6
package/generation/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# NSGM CLI PROJECT
|
|
2
|
-
|
|
3
|
-
## 命令
|
|
4
|
-
- npm run init 初始化项目
|
|
5
|
-
- npm run upgrade 升级项目基础文件
|
|
6
|
-
- npm run create 创建模板页面
|
|
7
|
-
- npm run delete 删除模板页面
|
|
8
|
-
- npm run dev 开发模式
|
|
9
|
-
- npm run start 生产模式
|
|
10
|
-
- npm run build 编译
|
|
11
|
-
- npm run export 导出静态页面
|
|
12
|
-
|
|
13
|
-
## 参数
|
|
14
|
-
- dictionary: 在 export/init 的时候使用, 默认 webapp, 譬如: npm run init|export dictionary=webapp 或者 npm run init|export webapp
|
|
15
|
-
- controller: 在 create/delete 的时候使用, 必须有。譬如: npm run create|delete math
|
|
16
|
-
- action: 在 create/delete 的时候使用, 默认 manage, 跟在 controller 后面, 譬如 npm run create|delete math test
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 发布
|
|
1
|
+
# NSGM CLI PROJECT
|
|
2
|
+
|
|
3
|
+
## 命令
|
|
4
|
+
- npm run init 初始化项目
|
|
5
|
+
- npm run upgrade 升级项目基础文件
|
|
6
|
+
- npm run create 创建模板页面
|
|
7
|
+
- npm run delete 删除模板页面
|
|
8
|
+
- npm run dev 开发模式
|
|
9
|
+
- npm run start 生产模式
|
|
10
|
+
- npm run build 编译
|
|
11
|
+
- npm run export 导出静态页面
|
|
12
|
+
|
|
13
|
+
## 参数
|
|
14
|
+
- dictionary: 在 export/init 的时候使用, 默认 webapp, 譬如: npm run init|export dictionary=webapp 或者 npm run init|export webapp
|
|
15
|
+
- controller: 在 create/delete 的时候使用, 必须有。譬如: npm run create|delete math
|
|
16
|
+
- action: 在 create/delete 的时候使用, 默认 manage, 跟在 controller 后面, 譬如 npm run create|delete math test
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
## 发布
|
|
20
20
|
- npm version patch
|
package/generation/app.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const { startExpress } = require('nsgm-cli/lib/index')
|
|
2
|
-
|
|
1
|
+
const { startExpress } = require('nsgm-cli/lib/index')
|
|
2
|
+
|
|
3
3
|
startExpress({ dev: false })
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//import { templateManageReducer } from './template/manage/reducers'
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
//templateManage: templateManageReducer,
|
|
1
|
+
//import { templateManageReducer } from './template/manage/reducers'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
//templateManage: templateManageReducer,
|
|
5
5
|
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { BookOutlined, SolutionOutlined } from '@ant-design/icons'
|
|
2
|
-
import React from 'react'
|
|
3
|
-
|
|
4
|
-
let key = 1
|
|
5
|
-
|
|
6
|
-
export default [
|
|
7
|
-
{
|
|
8
|
-
key: key.toString(),
|
|
9
|
-
text: '介绍',
|
|
10
|
-
url: '/',
|
|
11
|
-
icon: <BookOutlined rev={undefined} />,
|
|
12
|
-
subMenus: null
|
|
13
|
-
},
|
|
14
|
-
/*{
|
|
15
|
-
key: (++key).toString(),
|
|
16
|
-
text: '模板',
|
|
17
|
-
url: '/template/manage',
|
|
18
|
-
icon: <SolutionOutlined rev={undefined} />,
|
|
19
|
-
subMenus: [
|
|
20
|
-
{
|
|
21
|
-
key: key + '_1',
|
|
22
|
-
text: '模板1',
|
|
23
|
-
url: '/template/manage'
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},*/
|
|
27
|
-
]
|
|
1
|
+
import { BookOutlined, SolutionOutlined } from '@ant-design/icons'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
|
|
4
|
+
let key = 1
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
{
|
|
8
|
+
key: key.toString(),
|
|
9
|
+
text: '介绍',
|
|
10
|
+
url: '/',
|
|
11
|
+
icon: <BookOutlined rev={undefined} />,
|
|
12
|
+
subMenus: null
|
|
13
|
+
},
|
|
14
|
+
/*{
|
|
15
|
+
key: (++key).toString(),
|
|
16
|
+
text: '模板',
|
|
17
|
+
url: '/template/manage',
|
|
18
|
+
icon: <SolutionOutlined rev={undefined} />,
|
|
19
|
+
subMenus: [
|
|
20
|
+
{
|
|
21
|
+
key: key + '_1',
|
|
22
|
+
text: '模板1',
|
|
23
|
+
url: '/template/manage'
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},*/
|
|
27
|
+
]
|
package/generation/gitignore
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
node_modules
|
|
2
|
-
.next
|
|
3
|
-
out
|
|
4
|
-
build
|
|
1
|
+
node_modules
|
|
2
|
+
.next
|
|
3
|
+
out
|
|
4
|
+
build
|
|
5
5
|
scripts/dump.*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const { mysqlConfig } = require('nsgm-cli')
|
|
2
|
-
const { mysqlOptions } = mysqlConfig
|
|
3
|
-
const { user, password, host, port, database } = mysqlOptions
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
mysqlOptions: {
|
|
7
|
-
user: 'root',
|
|
8
|
-
password: 'password',
|
|
9
|
-
host: '127.0.0.1',
|
|
10
|
-
port: 3306,
|
|
11
|
-
database: 'crm_demo'
|
|
12
|
-
}
|
|
1
|
+
const { mysqlConfig } = require('nsgm-cli')
|
|
2
|
+
const { mysqlOptions } = mysqlConfig
|
|
3
|
+
const { user, password, host, port, database } = mysqlOptions
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
mysqlOptions: {
|
|
7
|
+
user: 'root',
|
|
8
|
+
password: 'password',
|
|
9
|
+
host: '127.0.0.1',
|
|
10
|
+
port: 3306,
|
|
11
|
+
database: 'crm_demo'
|
|
12
|
+
}
|
|
13
13
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const { nextConfig } = require('nsgm-cli')
|
|
2
|
-
|
|
3
|
-
module.exports = (phase, defaultConfig) => {
|
|
4
|
-
let configObj = nextConfig(phase, defaultConfig)
|
|
5
|
-
|
|
6
|
-
return configObj
|
|
1
|
+
const { nextConfig } = require('nsgm-cli')
|
|
2
|
+
|
|
3
|
+
module.exports = (phase, defaultConfig) => {
|
|
4
|
+
let configObj = nextConfig(phase, defaultConfig)
|
|
5
|
+
|
|
6
|
+
return configObj
|
|
7
7
|
}
|
package/generation/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "nsgm-cli-project",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "nsgm dev",
|
|
8
|
-
"build": "nsgm build",
|
|
9
|
-
"start": "nsgm start",
|
|
10
|
-
"export": "nsgm export",
|
|
11
|
-
"init": "nsgm init",
|
|
12
|
-
"upgrade": "nsgm upgrade",
|
|
13
|
-
"create": "nsgm create",
|
|
14
|
-
"delete": "nsgm delete",
|
|
15
|
-
"deletedb": "nsgm deletedb",
|
|
16
|
-
"postversion": "git push && git push --tags",
|
|
17
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
-
},
|
|
19
|
-
"engines": {
|
|
20
|
-
"node": "18.18.1"
|
|
21
|
-
},
|
|
22
|
-
"author": "",
|
|
23
|
-
"license": "ISC"
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "nsgm-cli-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "nsgm dev",
|
|
8
|
+
"build": "nsgm build",
|
|
9
|
+
"start": "nsgm start",
|
|
10
|
+
"export": "nsgm export",
|
|
11
|
+
"init": "nsgm init",
|
|
12
|
+
"upgrade": "nsgm upgrade",
|
|
13
|
+
"create": "nsgm create",
|
|
14
|
+
"delete": "nsgm delete",
|
|
15
|
+
"deletedb": "nsgm deletedb",
|
|
16
|
+
"postversion": "git push && git push --tags",
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": "18.18.1"
|
|
21
|
+
},
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "ISC"
|
|
24
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const { projectConfig } = require('nsgm-cli')
|
|
2
|
-
const pkg = require('./package.json')
|
|
3
|
-
|
|
4
|
-
const { env, prefix, protocol, host, port } = projectConfig
|
|
5
|
-
const { version } = pkg
|
|
6
|
-
|
|
7
|
-
module.exports = {
|
|
8
|
-
env,
|
|
9
|
-
version,
|
|
10
|
-
prefix: '',
|
|
11
|
-
protocol: 'http',
|
|
12
|
-
host: '127.0.0.1',
|
|
13
|
-
port: 8080
|
|
1
|
+
const { projectConfig } = require('nsgm-cli')
|
|
2
|
+
const pkg = require('./package.json')
|
|
3
|
+
|
|
4
|
+
const { env, prefix, protocol, host, port } = projectConfig
|
|
5
|
+
const { version } = pkg
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
env,
|
|
9
|
+
version,
|
|
10
|
+
prefix: '',
|
|
11
|
+
protocol: 'http',
|
|
12
|
+
host: '127.0.0.1',
|
|
13
|
+
port: 8080
|
|
14
14
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const express = require('express')
|
|
2
|
-
const moment = require('moment')
|
|
3
|
-
const sso = require('./apis/sso')
|
|
4
|
-
//const template = require('./apis/template')
|
|
5
|
-
|
|
6
|
-
const router = express.Router()
|
|
7
|
-
|
|
8
|
-
router.use((req, res, next) => {
|
|
9
|
-
const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl
|
|
10
|
-
console.log(moment().format('YYYY-MM-DD HH:mm:ss') + ' ' + fullUrl)
|
|
11
|
-
next()
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
router.use('/sso', sso)
|
|
15
|
-
|
|
16
|
-
//router.use('/template', template)
|
|
17
|
-
|
|
18
|
-
router.get('/*', (req, res) => {
|
|
19
|
-
res.statusCode = 200
|
|
20
|
-
res.json({ name: 'REST' })
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
module.exports = router
|
|
1
|
+
const express = require('express')
|
|
2
|
+
const moment = require('moment')
|
|
3
|
+
const sso = require('./apis/sso')
|
|
4
|
+
//const template = require('./apis/template')
|
|
5
|
+
|
|
6
|
+
const router = express.Router()
|
|
7
|
+
|
|
8
|
+
router.use((req, res, next) => {
|
|
9
|
+
const fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl
|
|
10
|
+
console.log(moment().format('YYYY-MM-DD HH:mm:ss') + ' ' + fullUrl)
|
|
11
|
+
next()
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
router.use('/sso', sso)
|
|
15
|
+
|
|
16
|
+
//router.use('/template', template)
|
|
17
|
+
|
|
18
|
+
router.get('/*', (req, res) => {
|
|
19
|
+
res.statusCode = 200
|
|
20
|
+
res.json({ name: 'REST' })
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
module.exports = router
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const { serverDB } = require('nsgm-cli')
|
|
2
|
-
|
|
3
|
-
const { getConnection } = serverDB
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
getConnection
|
|
1
|
+
const { serverDB } = require('nsgm-cli')
|
|
2
|
+
|
|
3
|
+
const { getConnection } = serverDB
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
getConnection
|
|
7
7
|
}
|
package/generation/tsconfig.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"lib": [
|
|
5
|
-
"dom",
|
|
6
|
-
"dom.iterable",
|
|
7
|
-
"esnext"
|
|
8
|
-
],
|
|
9
|
-
"allowJs": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"strict": false,
|
|
12
|
-
"forceConsistentCasingInFileNames": true,
|
|
13
|
-
"noEmit": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"module": "esnext",
|
|
16
|
-
"moduleResolution": "node",
|
|
17
|
-
"resolveJsonModule": true,
|
|
18
|
-
"isolatedModules": true,
|
|
19
|
-
"jsx": "preserve",
|
|
20
|
-
"incremental": true
|
|
21
|
-
},
|
|
22
|
-
"include": [
|
|
23
|
-
"next-env.d.ts",
|
|
24
|
-
"**/*.ts",
|
|
25
|
-
"**/*.tsx"
|
|
26
|
-
],
|
|
27
|
-
"exclude": [
|
|
28
|
-
"node_modules"
|
|
29
|
-
]
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strict": false,
|
|
12
|
+
"forceConsistentCasingInFileNames": true,
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"module": "esnext",
|
|
16
|
+
"moduleResolution": "node",
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"isolatedModules": true,
|
|
19
|
+
"jsx": "preserve",
|
|
20
|
+
"incremental": true
|
|
21
|
+
},
|
|
22
|
+
"include": [
|
|
23
|
+
"next-env.d.ts",
|
|
24
|
+
"**/*.ts",
|
|
25
|
+
"**/*.tsx"
|
|
26
|
+
],
|
|
27
|
+
"exclude": [
|
|
28
|
+
"node_modules"
|
|
29
|
+
]
|
|
30
|
+
}
|
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const nextConfig = require('./next.config')
|
|
2
|
-
const projectConfig = require('./project.config')
|
|
3
|
-
const mysqlConfig = require('./mysql.config')
|
|
4
|
-
const serverDB = require('./lib/server/db').default
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
nextConfig,
|
|
8
|
-
projectConfig,
|
|
9
|
-
mysqlConfig,
|
|
10
|
-
serverDB
|
|
1
|
+
const nextConfig = require('./next.config')
|
|
2
|
+
const projectConfig = require('./project.config')
|
|
3
|
+
const mysqlConfig = require('./mysql.config')
|
|
4
|
+
const serverDB = require('./lib/server/db').default
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
nextConfig,
|
|
8
|
+
projectConfig,
|
|
9
|
+
mysqlConfig,
|
|
10
|
+
serverDB
|
|
11
11
|
}
|
package/lib/args.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export declare const getProcessArgvs: (removeItems?: number) => {
|
|
2
|
-
command: string;
|
|
3
|
-
dictionary: string;
|
|
4
|
-
controller: string;
|
|
5
|
-
action: string;
|
|
6
|
-
};
|
|
1
|
+
export declare const getProcessArgvs: (removeItems?: number) => {
|
|
2
|
+
command: string;
|
|
3
|
+
dictionary: string;
|
|
4
|
+
controller: string;
|
|
5
|
+
action: string;
|
|
6
|
+
};
|
package/lib/args.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getProcessArgvs = void 0;
|
|
7
|
-
var lodash_1 = __importDefault(require("lodash"));
|
|
8
|
-
var getProcessArgvs = function (removeItems) {
|
|
9
|
-
if (removeItems === void 0) { removeItems = 2; }
|
|
10
|
-
var args = process.argv.slice(removeItems);
|
|
11
|
-
var result = {
|
|
12
|
-
command: '',
|
|
13
|
-
dictionary: '',
|
|
14
|
-
controller: '',
|
|
15
|
-
action: '' // create/delete controller=${controller} action=${action}
|
|
16
|
-
};
|
|
17
|
-
lodash_1.default.each(args, function (item, index) {
|
|
18
|
-
if (item.indexOf('=') !== -1) {
|
|
19
|
-
var itemArr = item.split('=');
|
|
20
|
-
var key = itemArr[0].toLowerCase();
|
|
21
|
-
result[key] = itemArr[1];
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
var command = result.command;
|
|
25
|
-
switch (index) {
|
|
26
|
-
case 0:
|
|
27
|
-
result.command = item;
|
|
28
|
-
break;
|
|
29
|
-
case 1:
|
|
30
|
-
if (command === 'create' ||
|
|
31
|
-
command === '-c' ||
|
|
32
|
-
command.indexOf('delete') !== -1 ||
|
|
33
|
-
command.indexOf('-d') !== -1) {
|
|
34
|
-
result.controller = item;
|
|
35
|
-
}
|
|
36
|
-
if (command === 'export' || command === 'init' || command === '-i') {
|
|
37
|
-
result.dictionary = item;
|
|
38
|
-
}
|
|
39
|
-
break;
|
|
40
|
-
case 2:
|
|
41
|
-
if (command === 'create' ||
|
|
42
|
-
command === '-c' ||
|
|
43
|
-
command.indexOf('delete') !== -1 ||
|
|
44
|
-
command.indexOf('-d') !== -1) {
|
|
45
|
-
result.action = item;
|
|
46
|
-
}
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
return result;
|
|
52
|
-
};
|
|
53
|
-
exports.getProcessArgvs = getProcessArgvs;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getProcessArgvs = void 0;
|
|
7
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
8
|
+
var getProcessArgvs = function (removeItems) {
|
|
9
|
+
if (removeItems === void 0) { removeItems = 2; }
|
|
10
|
+
var args = process.argv.slice(removeItems);
|
|
11
|
+
var result = {
|
|
12
|
+
command: '',
|
|
13
|
+
dictionary: '',
|
|
14
|
+
controller: '',
|
|
15
|
+
action: '' // create/delete controller=${controller} action=${action}
|
|
16
|
+
};
|
|
17
|
+
lodash_1.default.each(args, function (item, index) {
|
|
18
|
+
if (item.indexOf('=') !== -1) {
|
|
19
|
+
var itemArr = item.split('=');
|
|
20
|
+
var key = itemArr[0].toLowerCase();
|
|
21
|
+
result[key] = itemArr[1];
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
var command = result.command;
|
|
25
|
+
switch (index) {
|
|
26
|
+
case 0:
|
|
27
|
+
result.command = item;
|
|
28
|
+
break;
|
|
29
|
+
case 1:
|
|
30
|
+
if (command === 'create' ||
|
|
31
|
+
command === '-c' ||
|
|
32
|
+
command.indexOf('delete') !== -1 ||
|
|
33
|
+
command.indexOf('-d') !== -1) {
|
|
34
|
+
result.controller = item;
|
|
35
|
+
}
|
|
36
|
+
if (command === 'export' || command === 'init' || command === '-i') {
|
|
37
|
+
result.dictionary = item;
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case 2:
|
|
41
|
+
if (command === 'create' ||
|
|
42
|
+
command === '-c' ||
|
|
43
|
+
command.indexOf('delete') !== -1 ||
|
|
44
|
+
command.indexOf('-d') !== -1) {
|
|
45
|
+
result.action = item;
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
};
|
|
53
|
+
exports.getProcessArgvs = getProcessArgvs;
|
package/lib/generate.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const initFiles: (dictionary: string, upgradeFlag?: boolean) => void;
|
|
2
|
-
export declare const createFiles: (controller: string, action: string) => void;
|
|
3
|
-
export declare const deleteFiles: (controller: string, action: string, deleteDBFlag?: boolean) => void;
|
|
1
|
+
export declare const initFiles: (dictionary: string, upgradeFlag?: boolean) => void;
|
|
2
|
+
export declare const createFiles: (controller: string, action: string) => void;
|
|
3
|
+
export declare const deleteFiles: (controller: string, action: string, deleteDBFlag?: boolean) => void;
|