nsgm-cli 2.1.12 → 2.1.14
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/README.md +369 -163
- package/client/components/Button.tsx +3 -5
- package/client/components/__tests__/Button.test.tsx +10 -10
- package/client/layout/index.tsx +149 -137
- package/client/redux/reducers.ts +1 -1
- package/client/redux/store.ts +2 -1
- package/client/redux/template/manage/actions.ts +77 -88
- package/client/redux/template/manage/reducers.ts +25 -37
- package/client/redux/template/manage/types.ts +1 -1
- package/client/service/template/manage.ts +20 -21
- package/client/styled/common.ts +12 -13
- package/client/styled/layout/index.ts +19 -19
- package/client/styled/template/manage.ts +14 -13
- package/client/utils/common.ts +23 -21
- package/client/utils/cookie.ts +18 -19
- package/client/utils/fetch.ts +64 -100
- package/client/utils/menu.tsx +16 -3
- package/client/utils/sso.ts +74 -84
- package/eslint.config.js +38 -1
- package/generation/README.md +25 -18
- package/generation/__tests__/example.test.js +41 -0
- package/generation/client/utils/menu.tsx +9 -2
- package/generation/env.example +3 -0
- package/generation/eslint.config.js +112 -0
- package/generation/gitignore +6 -1
- package/generation/jest.config.js +40 -0
- package/generation/package.json +25 -4
- package/jest.config.js +23 -6
- package/lib/args.js +9 -1
- package/lib/cli/app.d.ts +28 -0
- package/lib/cli/app.js +99 -0
- package/lib/cli/commands/build.d.ts +2 -0
- package/lib/cli/commands/build.js +29 -0
- package/lib/cli/commands/create.d.ts +2 -0
- package/lib/cli/commands/create.js +113 -0
- package/lib/cli/commands/delete.d.ts +3 -0
- package/lib/cli/commands/delete.js +151 -0
- package/lib/cli/commands/export.d.ts +2 -0
- package/lib/cli/commands/export.js +42 -0
- package/lib/cli/commands/help.d.ts +2 -0
- package/lib/cli/commands/help.js +42 -0
- package/lib/cli/commands/init.d.ts +2 -0
- package/lib/cli/commands/init.js +115 -0
- package/lib/cli/commands/server.d.ts +3 -0
- package/lib/cli/commands/server.js +26 -0
- package/lib/cli/commands/upgrade.d.ts +2 -0
- package/lib/cli/commands/upgrade.js +38 -0
- package/lib/cli/commands/version.d.ts +2 -0
- package/lib/cli/commands/version.js +24 -0
- package/lib/cli/index.d.ts +16 -0
- package/lib/cli/index.js +33 -0
- package/lib/cli/parser.d.ts +22 -0
- package/lib/cli/parser.js +115 -0
- package/lib/cli/registry.d.ts +33 -0
- package/lib/cli/registry.js +81 -0
- package/lib/cli/types/project.d.ts +10 -0
- package/lib/cli/types/project.js +2 -0
- package/lib/cli/types.d.ts +31 -0
- package/lib/cli/types.js +20 -0
- package/lib/cli/utils/console.d.ts +62 -0
- package/lib/cli/utils/console.js +148 -0
- package/lib/cli/utils/index.d.ts +2 -0
- package/lib/cli/utils/index.js +7 -0
- package/lib/cli/utils/prompt.d.ts +83 -0
- package/lib/cli/utils/prompt.js +368 -0
- package/lib/constants.d.ts +58 -0
- package/lib/constants.js +162 -0
- package/lib/generate.d.ts +25 -3
- package/lib/generate.js +97 -621
- package/lib/generate_create.d.ts +9 -0
- package/lib/generate_create.js +326 -0
- package/lib/generate_delete.d.ts +8 -0
- package/lib/generate_delete.js +156 -0
- package/lib/generate_init.d.ts +50 -0
- package/lib/generate_init.js +492 -0
- package/lib/generators/base-generator.d.ts +47 -0
- package/lib/generators/base-generator.js +92 -0
- package/lib/generators/generator-factory.d.ts +20 -0
- package/lib/generators/generator-factory.js +25 -0
- package/lib/generators/page-generator.d.ts +41 -0
- package/lib/generators/page-generator.js +552 -0
- package/lib/generators/resolver-generator.d.ts +12 -0
- package/lib/generators/resolver-generator.js +303 -0
- package/lib/generators/schema-generator.d.ts +7 -0
- package/lib/generators/schema-generator.js +57 -0
- package/lib/generators/service-generator.d.ts +7 -0
- package/lib/generators/service-generator.js +119 -0
- package/lib/generators/sql-generator.d.ts +8 -0
- package/lib/generators/sql-generator.js +52 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +14 -193
- package/lib/server/csrf.js +9 -16
- package/lib/server/db.js +6 -7
- package/lib/server/graphql.js +5 -6
- package/lib/server/plugins/date.js +1 -1
- package/lib/server/utils/graphql-cache.js +3 -3
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/project-config.d.ts +5 -0
- package/lib/utils/project-config.js +145 -0
- package/lib/utils.js +1 -1
- package/next.config.js +12 -8
- package/package.json +10 -7
- package/pages/_app.tsx +23 -28
- package/pages/_document.tsx +39 -19
- package/pages/index.tsx +84 -39
- package/pages/login.tsx +21 -21
- package/pages/template/manage.tsx +114 -89
- package/public/fonts/font-awesome.min.css +4 -0
- package/public/fonts/fontawesome-webfont.woff +0 -0
- package/public/fonts/fontawesome-webfont.woff2 +0 -0
- package/public/slbhealthcheck.html +1 -1
- package/server/apis/template.js +0 -2
- package/generation/eslintrc.js +0 -16
package/lib/constants.js
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.destPublicPath = exports.destPagesPath = exports.destServerUtilsPath = exports.destServerSqlPath = exports.destServerApisPath = exports.destServerModulesPath = exports.destServerPath = exports.destClientLayoutPath = exports.destClientUtilsPath = exports.destClientStyledLayoutPath = exports.destClientStyledPath = exports.destClientServicePath = exports.destClientReduxPath = exports.destClientPath = exports.sourceScriptsPath = exports.sourcePublicPath = exports.sourcePagesPath = exports.sourceServerPathGeneration = exports.sourceServerPath = exports.sourceClientPathGeneration = exports.sourceClientPath = exports.sourceGenerationPath = exports.restPath = exports.packagePath = exports.slbHealthCheckPath = exports.reduxReducersPath = exports.utilsMenuPath = exports.sqlPath = exports.apisPath = exports.modulesPath = exports.layoutPath = exports.utilsPath = exports.styledLayoutPath = exports.styledPath = exports.servicePath = exports.reduxPath = exports.scriptsPath = exports.scriptsPathSource = exports.publicPath = exports.publicPathSource = exports.pagesPath = exports.pagesPathSource = exports.serverPath = exports.serverPathSource = exports.clientPath = exports.clientPathSource = exports.generationPath = exports.isLocal = exports.destFolder = exports.sourceFolder = void 0;
|
|
40
|
+
exports.mysqlDatabase = exports.mysqlPort = exports.mysqlHost = exports.mysqlPassword = exports.mysqlUser = exports.destServerRestPath = exports.destPackagePath = exports.destPublicHealthCheckPath = exports.destClientReduxReducersAllPath = exports.destClientUtilsMenuPath = exports.destScriptsPath = void 0;
|
|
41
|
+
const path_1 = __importStar(require("path"));
|
|
42
|
+
const db_1 = __importDefault(require("./server/db"));
|
|
43
|
+
const sourceFolder = __dirname;
|
|
44
|
+
exports.sourceFolder = sourceFolder;
|
|
45
|
+
const destFolder = process.cwd();
|
|
46
|
+
exports.destFolder = destFolder;
|
|
47
|
+
const isLocal = sourceFolder === (0, path_1.resolve)(`${destFolder}/lib`);
|
|
48
|
+
exports.isLocal = isLocal;
|
|
49
|
+
const { getMysqlConfig } = db_1.default;
|
|
50
|
+
const { mysqlOptions } = getMysqlConfig();
|
|
51
|
+
const { user: mysqlUser, password: mysqlPassword, host: mysqlHost, port: mysqlPort, database: mysqlDatabase, } = mysqlOptions;
|
|
52
|
+
exports.mysqlUser = mysqlUser;
|
|
53
|
+
exports.mysqlPassword = mysqlPassword;
|
|
54
|
+
exports.mysqlHost = mysqlHost;
|
|
55
|
+
exports.mysqlPort = mysqlPort;
|
|
56
|
+
exports.mysqlDatabase = mysqlDatabase;
|
|
57
|
+
const generationPath = '../generation';
|
|
58
|
+
exports.generationPath = generationPath;
|
|
59
|
+
const clientPathSource = '../client';
|
|
60
|
+
exports.clientPathSource = clientPathSource;
|
|
61
|
+
const clientPath = './client';
|
|
62
|
+
exports.clientPath = clientPath;
|
|
63
|
+
const serverPathSource = '../server';
|
|
64
|
+
exports.serverPathSource = serverPathSource;
|
|
65
|
+
const serverPath = './server';
|
|
66
|
+
exports.serverPath = serverPath;
|
|
67
|
+
const pagesPathSource = '../pages';
|
|
68
|
+
exports.pagesPathSource = pagesPathSource;
|
|
69
|
+
const pagesPath = './pages';
|
|
70
|
+
exports.pagesPath = pagesPath;
|
|
71
|
+
const publicPathSource = '../public';
|
|
72
|
+
exports.publicPathSource = publicPathSource;
|
|
73
|
+
const publicPath = './public';
|
|
74
|
+
exports.publicPath = publicPath;
|
|
75
|
+
const scriptsPathSource = '../scripts';
|
|
76
|
+
exports.scriptsPathSource = scriptsPathSource;
|
|
77
|
+
const scriptsPath = './scripts';
|
|
78
|
+
exports.scriptsPath = scriptsPath;
|
|
79
|
+
const reduxPath = '/redux';
|
|
80
|
+
exports.reduxPath = reduxPath;
|
|
81
|
+
const servicePath = '/service';
|
|
82
|
+
exports.servicePath = servicePath;
|
|
83
|
+
const styledPath = '/styled';
|
|
84
|
+
exports.styledPath = styledPath;
|
|
85
|
+
const styledLayoutPath = '/layout';
|
|
86
|
+
exports.styledLayoutPath = styledLayoutPath;
|
|
87
|
+
const utilsPath = '/utils';
|
|
88
|
+
exports.utilsPath = utilsPath;
|
|
89
|
+
const layoutPath = '/layout';
|
|
90
|
+
exports.layoutPath = layoutPath;
|
|
91
|
+
const modulesPath = '/modules';
|
|
92
|
+
exports.modulesPath = modulesPath;
|
|
93
|
+
const apisPath = '/apis';
|
|
94
|
+
exports.apisPath = apisPath;
|
|
95
|
+
const sqlPath = '/sql';
|
|
96
|
+
exports.sqlPath = sqlPath;
|
|
97
|
+
const utilsMenuPath = '/menu.tsx';
|
|
98
|
+
exports.utilsMenuPath = utilsMenuPath;
|
|
99
|
+
const reduxReducersPath = '/reducers.ts';
|
|
100
|
+
exports.reduxReducersPath = reduxReducersPath;
|
|
101
|
+
const slbHealthCheckPath = '/slbhealthcheck.html';
|
|
102
|
+
exports.slbHealthCheckPath = slbHealthCheckPath;
|
|
103
|
+
const packagePath = '/package.json';
|
|
104
|
+
exports.packagePath = packagePath;
|
|
105
|
+
const restPath = '/rest.js';
|
|
106
|
+
exports.restPath = restPath;
|
|
107
|
+
const sourceGenerationPath = path_1.default.join(sourceFolder, generationPath);
|
|
108
|
+
exports.sourceGenerationPath = sourceGenerationPath;
|
|
109
|
+
const sourceClientPath = path_1.default.join(sourceFolder, clientPathSource);
|
|
110
|
+
exports.sourceClientPath = sourceClientPath;
|
|
111
|
+
const sourceClientPathGeneration = path_1.default.join(sourceGenerationPath, clientPath);
|
|
112
|
+
exports.sourceClientPathGeneration = sourceClientPathGeneration;
|
|
113
|
+
const sourceServerPath = path_1.default.join(sourceFolder, serverPathSource);
|
|
114
|
+
exports.sourceServerPath = sourceServerPath;
|
|
115
|
+
const sourceServerPathGeneration = path_1.default.join(sourceGenerationPath, serverPath);
|
|
116
|
+
exports.sourceServerPathGeneration = sourceServerPathGeneration;
|
|
117
|
+
const sourcePagesPath = path_1.default.join(sourceFolder, pagesPathSource);
|
|
118
|
+
exports.sourcePagesPath = sourcePagesPath;
|
|
119
|
+
const sourcePublicPath = path_1.default.join(sourceFolder, publicPathSource);
|
|
120
|
+
exports.sourcePublicPath = sourcePublicPath;
|
|
121
|
+
const sourceScriptsPath = path_1.default.join(sourceFolder, scriptsPathSource);
|
|
122
|
+
exports.sourceScriptsPath = sourceScriptsPath;
|
|
123
|
+
const destClientPath = path_1.default.join(destFolder, clientPath);
|
|
124
|
+
exports.destClientPath = destClientPath;
|
|
125
|
+
const destClientReduxPath = (0, path_1.resolve)(destClientPath + reduxPath);
|
|
126
|
+
exports.destClientReduxPath = destClientReduxPath;
|
|
127
|
+
const destClientServicePath = (0, path_1.resolve)(destClientPath + servicePath);
|
|
128
|
+
exports.destClientServicePath = destClientServicePath;
|
|
129
|
+
const destClientStyledPath = (0, path_1.resolve)(destClientPath + styledPath);
|
|
130
|
+
exports.destClientStyledPath = destClientStyledPath;
|
|
131
|
+
const destClientStyledLayoutPath = (0, path_1.resolve)(destClientStyledPath + styledLayoutPath);
|
|
132
|
+
exports.destClientStyledLayoutPath = destClientStyledLayoutPath;
|
|
133
|
+
const destClientUtilsPath = (0, path_1.resolve)(destClientPath + utilsPath);
|
|
134
|
+
exports.destClientUtilsPath = destClientUtilsPath;
|
|
135
|
+
const destClientLayoutPath = (0, path_1.resolve)(destClientPath + layoutPath);
|
|
136
|
+
exports.destClientLayoutPath = destClientLayoutPath;
|
|
137
|
+
const destServerPath = path_1.default.join(destFolder, serverPath);
|
|
138
|
+
exports.destServerPath = destServerPath;
|
|
139
|
+
const destServerModulesPath = (0, path_1.resolve)(destServerPath + modulesPath);
|
|
140
|
+
exports.destServerModulesPath = destServerModulesPath;
|
|
141
|
+
const destServerApisPath = (0, path_1.resolve)(destServerPath + apisPath);
|
|
142
|
+
exports.destServerApisPath = destServerApisPath;
|
|
143
|
+
const destServerSqlPath = (0, path_1.resolve)(destServerPath + sqlPath);
|
|
144
|
+
exports.destServerSqlPath = destServerSqlPath;
|
|
145
|
+
const destServerUtilsPath = (0, path_1.resolve)(destServerPath + utilsPath);
|
|
146
|
+
exports.destServerUtilsPath = destServerUtilsPath;
|
|
147
|
+
const destPagesPath = path_1.default.join(destFolder, pagesPath);
|
|
148
|
+
exports.destPagesPath = destPagesPath;
|
|
149
|
+
const destPublicPath = path_1.default.join(destFolder, publicPath);
|
|
150
|
+
exports.destPublicPath = destPublicPath;
|
|
151
|
+
const destScriptsPath = path_1.default.join(destFolder, scriptsPath);
|
|
152
|
+
exports.destScriptsPath = destScriptsPath;
|
|
153
|
+
const destClientUtilsMenuPath = (0, path_1.resolve)(destClientUtilsPath + utilsMenuPath);
|
|
154
|
+
exports.destClientUtilsMenuPath = destClientUtilsMenuPath;
|
|
155
|
+
const destClientReduxReducersAllPath = (0, path_1.resolve)(destClientReduxPath + reduxReducersPath);
|
|
156
|
+
exports.destClientReduxReducersAllPath = destClientReduxReducersAllPath;
|
|
157
|
+
const destPublicHealthCheckPath = (0, path_1.resolve)(destPublicPath + slbHealthCheckPath);
|
|
158
|
+
exports.destPublicHealthCheckPath = destPublicHealthCheckPath;
|
|
159
|
+
const destPackagePath = (0, path_1.resolve)(destFolder + packagePath);
|
|
160
|
+
exports.destPackagePath = destPackagePath;
|
|
161
|
+
const destServerRestPath = (0, path_1.resolve)(destServerPath + restPath);
|
|
162
|
+
exports.destServerRestPath = destServerRestPath;
|
package/lib/generate.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ProjectConfig } from './cli/types/project';
|
|
2
|
+
import { FieldDefinition } from './cli/utils/prompt';
|
|
3
|
+
/**
|
|
4
|
+
* 初始化项目文件和目录结构
|
|
5
|
+
* @param dictionary 目标目录名称,空字符串表示当前目录
|
|
6
|
+
* @param upgradeFlag 是否为升级模式,升级模式下不会安装依赖
|
|
7
|
+
* @param projectConfig 项目配置信息(可选)
|
|
8
|
+
*/
|
|
9
|
+
export declare const initFiles: (dictionary: string, upgradeFlag?: boolean, projectConfig?: ProjectConfig) => void;
|
|
10
|
+
/**
|
|
11
|
+
* 创建控制器相关文件
|
|
12
|
+
* @param controller 控制器名称
|
|
13
|
+
* @param action 动作名称
|
|
14
|
+
* @param dictionary 目标目录名称,空字符串表示当前目录
|
|
15
|
+
* @param fields 字段定义数组
|
|
16
|
+
*/
|
|
17
|
+
export declare const createFiles: (controller: string, action: string, dictionary?: string, fields?: FieldDefinition[]) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 删除控制器相关文件
|
|
20
|
+
* @param controller 控制器名称
|
|
21
|
+
* @param action 动作名称
|
|
22
|
+
* @param deleteDBFlag 是否删除数据库相关文件
|
|
23
|
+
* @param dictionary 目标目录名称,空字符串表示当前目录
|
|
24
|
+
*/
|
|
25
|
+
export declare const deleteFiles: (controller: string, action: string, deleteDBFlag?: boolean, dictionary?: string) => void;
|