nsgm-cli 2.1.42 → 2.1.44
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 +6 -6
- package/client/layout/index.tsx +1 -1
- package/client/redux/template/manage/reducers.ts +1 -1
- package/client/service/template/manage.ts +1 -1
- package/client/styled/template/manage.ts +1 -1
- package/client/utils/common.ts +1 -1
- package/client/utils/cookie.ts +1 -1
- package/client/utils/sso.ts +1 -1
- package/generation/README.md +11 -11
- package/generation/package.json +4 -0
- package/lib/args.js +35 -5
- package/lib/generate.js +3 -3
- package/lib/generators/file-generator.js +4 -4
- package/lib/index.js +0 -0
- package/lib/server/csrf.d.ts +2 -2
- package/lib/server/graphql.js +36 -3
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +45 -48
- package/pages/_app.tsx +3 -2
- package/pages/index.tsx +1 -1
- package/pages/login.tsx +1 -1
- package/pages/template/manage.tsx +1 -1
- package/scripts/performance-check.sh +0 -0
- package/scripts/shutdown.sh +0 -0
- package/scripts/startup.sh +0 -0
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ cp .env.example .env
|
|
|
113
113
|
|
|
114
114
|
```bash
|
|
115
115
|
# Generate secure password hash
|
|
116
|
-
|
|
116
|
+
pnpm run generate-password yourNewPassword
|
|
117
117
|
|
|
118
118
|
# Edit .env file with generated hash
|
|
119
119
|
nano .env
|
|
@@ -123,10 +123,10 @@ nano .env
|
|
|
123
123
|
|
|
124
124
|
```bash
|
|
125
125
|
# Install dependencies
|
|
126
|
-
|
|
126
|
+
pnpm install
|
|
127
127
|
|
|
128
128
|
# Start development server
|
|
129
|
-
|
|
129
|
+
pnpm run dev
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
Your application will be available at `http://localhost:3000` with:
|
|
@@ -173,9 +173,9 @@ nsgm upgrade # Upgrade project base files
|
|
|
173
173
|
nsgm export # Export static pages
|
|
174
174
|
|
|
175
175
|
# Development tools
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
pnpm run lint # Code linting
|
|
177
|
+
pnpm run test # Run tests
|
|
178
|
+
pnpm run test:coverage # Test coverage report
|
|
179
179
|
```
|
|
180
180
|
|
|
181
181
|
## 🎨 Generated Controller Features
|
package/client/layout/index.tsx
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
StyledContent,
|
|
12
12
|
} from "@/styled/layout";
|
|
13
13
|
import { useRouter } from "next/router";
|
|
14
|
-
import _ from "lodash";
|
|
14
|
+
import * as _ from "lodash";
|
|
15
15
|
import menuConfig, { getMenuConfig } from "@/utils/menu";
|
|
16
16
|
import { LogoutOutlined } from "@ant-design/icons";
|
|
17
17
|
import LanguageSwitcher from "@/components/LanguageSwitcher";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getLocalGraphql } from "@/utils/fetch";
|
|
2
|
-
import _ from "lodash";
|
|
2
|
+
import * as _ from "lodash";
|
|
3
3
|
|
|
4
4
|
export const getTemplateService = (page = 0, pageSize = 10) => {
|
|
5
5
|
const getTemplateQuery = `query ($page: Int, $pageSize: Int) { template(page: $page, pageSize: $pageSize) {
|
|
@@ -171,7 +171,7 @@ export const StyledInput = styled(Input)`
|
|
|
171
171
|
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
|
|
172
172
|
`;
|
|
173
173
|
|
|
174
|
-
export const StyledTable = styled(Table)`
|
|
174
|
+
export const StyledTable: any = styled(Table)`
|
|
175
175
|
margin-top: 16px;
|
|
176
176
|
border-radius: 12px;
|
|
177
177
|
overflow: hidden;
|
package/client/utils/common.ts
CHANGED
package/client/utils/cookie.ts
CHANGED
package/client/utils/sso.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { setCookie, getCookie, delCookie } from "./cookie";
|
|
3
3
|
import { getUrlParamByKey, getLocalApiPrefix, getLocalEnv, handleXSS } from "./common";
|
|
4
|
-
import _ from "lodash";
|
|
4
|
+
import * as _ from "lodash";
|
|
5
5
|
|
|
6
6
|
// 延迟初始化 cookie 名称,避免在模块加载时访问 process
|
|
7
7
|
const getLoginCookieId = () => `${getLocalEnv()}_cas_nsgm`;
|
package/generation/README.md
CHANGED
|
@@ -17,27 +17,27 @@
|
|
|
17
17
|
|
|
18
18
|
| 命令 | 说明 |
|
|
19
19
|
| ---------------- | ------------ |
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
20
|
+
| `pnpm run dev` | 开发模式 |
|
|
21
|
+
| `pnpm run start` | 生产模式 |
|
|
22
|
+
| `pnpm run build` | 编译项目 |
|
|
23
|
+
| `pnpm run export` | 导出静态页面 |
|
|
24
24
|
|
|
25
25
|
### 测试命令
|
|
26
26
|
|
|
27
27
|
| 命令 | 说明 |
|
|
28
28
|
| ----------------------- | ---------------- |
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
29
|
+
| `pnpm test` | 运行所有测试 |
|
|
30
|
+
| `pnpm run test:watch` | 监视模式运行测试 |
|
|
31
|
+
| `pnpm run test:coverage` | 生成覆盖率报告 |
|
|
32
32
|
|
|
33
33
|
### 代码生成命令
|
|
34
34
|
|
|
35
35
|
| 命令 | 说明 |
|
|
36
36
|
| ----------------------- | --------------------- |
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
37
|
+
| `pnpm run create` | 创建模板页面 |
|
|
38
|
+
| `pnpm run delete` | 删除模板页面 |
|
|
39
|
+
| `pnpm run create-config` | 从配置文件批量创建模块 |
|
|
40
|
+
| `pnpm run delete-config` | 从配置文件批量删除模块 |
|
|
41
41
|
|
|
42
42
|
### 项目维护命令
|
|
43
43
|
|
package/generation/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nsgm-cli-project",
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
+
"packageManager": "pnpm@10.28.0",
|
|
4
5
|
"description": "",
|
|
5
6
|
"main": "app.js",
|
|
6
7
|
"scripts": {
|
|
@@ -31,6 +32,9 @@
|
|
|
31
32
|
"@types/react": "^18.3.23",
|
|
32
33
|
"@types/react-dom": "^18.3.7",
|
|
33
34
|
"@types/lodash": "^4.17.20",
|
|
35
|
+
"@types/express-serve-static-core": "^5.1.1",
|
|
36
|
+
"@types/qs": "^6.14.0",
|
|
37
|
+
"@types/hoist-non-react-statics": "^3.3.7",
|
|
34
38
|
"typescript": "^5.8.3",
|
|
35
39
|
"jest": "^30.0.5",
|
|
36
40
|
"jest-environment-jsdom": "^30.0.5",
|
package/lib/args.js
CHANGED
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
})();
|
|
5
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
36
|
exports.getProcessArgvs = void 0;
|
|
7
|
-
const
|
|
37
|
+
const _ = __importStar(require("lodash"));
|
|
8
38
|
const getProcessArgvs = (removeItems = 2) => {
|
|
9
39
|
const args = process.argv.slice(removeItems);
|
|
10
40
|
const result = {
|
|
@@ -13,7 +43,7 @@ const getProcessArgvs = (removeItems = 2) => {
|
|
|
13
43
|
controller: "",
|
|
14
44
|
action: "", // create/delete controller=${controller} action=${action}
|
|
15
45
|
};
|
|
16
|
-
|
|
46
|
+
_.each(args, (item, index) => {
|
|
17
47
|
if (item.indexOf("=") !== -1) {
|
|
18
48
|
const itemArr = item.split("=");
|
|
19
49
|
const key = itemArr[0].toLowerCase();
|
package/lib/generate.js
CHANGED
|
@@ -13,7 +13,7 @@ const generate_init_1 = require("./generate_init");
|
|
|
13
13
|
const generate_create_1 = require("./generate_create");
|
|
14
14
|
const generate_delete_1 = require("./generate_delete");
|
|
15
15
|
// 常量提取
|
|
16
|
-
const
|
|
16
|
+
const PNPM_INSTALL_FLAGS = "--strict-peer-dependencies false";
|
|
17
17
|
// 辅助函数
|
|
18
18
|
const normalizeDirectory = (dictionary) => {
|
|
19
19
|
// 禁止绝对路径,强制所有生成目录都在 cwd 下
|
|
@@ -26,11 +26,11 @@ const installNpmPackages = (targetDir) => {
|
|
|
26
26
|
try {
|
|
27
27
|
const prefix = targetDir ? `cd ${targetDir} && ` : "";
|
|
28
28
|
console.log("Installing all dependencies from package.json...");
|
|
29
|
-
const installResult = shelljs_1.default.exec(`${prefix}
|
|
29
|
+
const installResult = shelljs_1.default.exec(`${prefix}pnpm install ${PNPM_INSTALL_FLAGS}`);
|
|
30
30
|
return installResult.code === 0;
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
|
-
console.error("Failed to install
|
|
33
|
+
console.error("Failed to install pnpm packages:", error);
|
|
34
34
|
return false;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
@@ -180,7 +180,7 @@ export const ModalContainer = styled.div\`
|
|
|
180
180
|
}
|
|
181
181
|
\`
|
|
182
182
|
|
|
183
|
-
export const StyledButton = styled(Button)
|
|
183
|
+
export const StyledButton: any = styled(Button)\`
|
|
184
184
|
display: flex;
|
|
185
185
|
align-items: center;
|
|
186
186
|
border-radius: 6px;
|
|
@@ -216,13 +216,13 @@ export const StyledButton = styled(Button)<{ $primary?: boolean; $export?: boole
|
|
|
216
216
|
\`}
|
|
217
217
|
\`
|
|
218
218
|
|
|
219
|
-
export const StyledInput = styled(Input)\`
|
|
219
|
+
export const StyledInput: any = styled(Input)\`
|
|
220
220
|
width: 200px;
|
|
221
221
|
border-radius: 6px;
|
|
222
222
|
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
|
|
223
223
|
\`
|
|
224
224
|
|
|
225
|
-
export const StyledTable = styled(Table)\`
|
|
225
|
+
export const StyledTable: any = styled(Table)\`
|
|
226
226
|
margin-top: 16px;
|
|
227
227
|
border-radius: 8px;
|
|
228
228
|
overflow: hidden;
|
|
@@ -254,7 +254,7 @@ export const IconWrapper = styled.i\`
|
|
|
254
254
|
margin-right: 5px;
|
|
255
255
|
\`
|
|
256
256
|
|
|
257
|
-
export const RoundedButton = styled(Button)\`
|
|
257
|
+
export const RoundedButton: any = styled(Button)\`
|
|
258
258
|
border-radius: 4px;
|
|
259
259
|
\`
|
|
260
260
|
|
package/lib/index.js
CHANGED
|
File without changes
|
package/lib/server/csrf.d.ts
CHANGED
|
@@ -12,6 +12,6 @@ declare module "express-serve-static-core" {
|
|
|
12
12
|
export declare const csrfProtection: (req: Request, res: Response, next: NextFunction) => unknown;
|
|
13
13
|
export declare const getCSRFToken: (req: Request, res: Response) => void;
|
|
14
14
|
export declare const securityMiddleware: {
|
|
15
|
-
basicHeaders:
|
|
15
|
+
basicHeaders: any;
|
|
16
16
|
};
|
|
17
|
-
export declare const createCSPMiddleware: () =>
|
|
17
|
+
export declare const createCSPMiddleware: () => any;
|
package/lib/server/graphql.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
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
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -6,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
39
|
const express_1 = require("graphql-http/lib/use/express");
|
|
7
40
|
const graphql_1 = require("graphql");
|
|
8
41
|
const fs_1 = __importDefault(require("fs"));
|
|
9
|
-
const
|
|
42
|
+
const _ = __importStar(require("lodash"));
|
|
10
43
|
const path_1 = require("path");
|
|
11
44
|
const date_1 = __importDefault(require("./plugins/date"));
|
|
12
45
|
const dataloaders_1 = require("./dataloaders");
|
|
@@ -62,9 +95,9 @@ function generateTypeDefsAndResolvers() {
|
|
|
62
95
|
...date_1.default,
|
|
63
96
|
...handleOutPlugins(),
|
|
64
97
|
};
|
|
65
|
-
const scalars =
|
|
98
|
+
const scalars = _.keys(resolvers);
|
|
66
99
|
let scalarStr = "";
|
|
67
|
-
|
|
100
|
+
_.each(scalars, (item) => {
|
|
68
101
|
scalarStr += `scalar ${item}\n `;
|
|
69
102
|
});
|
|
70
103
|
const _generateAllComponentRecursive = (path = defaultPath) => {
|