nsgm-cli 2.1.11 → 2.1.13

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 CHANGED
@@ -64,6 +64,7 @@ For security setup and login configuration, please refer to [SECURITY.md](./SECU
64
64
  1. Generate password hash:
65
65
 
66
66
  ```bash
67
+ # Using npm script
67
68
  npm run generate-password yourSecurePassword
68
69
  ```
69
70
 
@@ -145,7 +146,7 @@ The `server` folder in the project root contains the following:
145
146
  - `apis/` - Stores REST API interfaces
146
147
  - `modules/` - Stores GraphQL resolvers and schemas
147
148
  - `plugins/` - Stores GraphQL plugins
148
- - `*.js` - Route files, e.g., `csrf-test.js` handles requests to `/csrf-test/*` and `${prefix}/csrf-test/*`
149
+ - `*.js` - Route files
149
150
 
150
151
  ### Example Code
151
152
 
@@ -30,10 +30,10 @@
30
30
 
31
31
  ### 项目维护命令
32
32
 
33
- | 命令 | 说明 |
34
- | --------------------------- | ---------------- |
35
- | `npm run upgrade` | 升级项目基础文件 |
36
- | `npm run generate-password` | 生成安全密码哈希 |
33
+ | 命令 | 说明 |
34
+ | ----------------------------------- | ---------------- |
35
+ | `npm run upgrade` | 升级项目基础文件 |
36
+ | `npm run generate-password [密码]` | 生成安全密码哈希 |
37
37
 
38
38
  ## 参数说明
39
39
 
@@ -152,6 +152,7 @@ module.exports = {
152
152
  1. **生成密码哈希**:
153
153
 
154
154
  ```bash
155
+ # 使用 npm 脚本
155
156
  npm run generate-password yourSecurePassword
156
157
  ```
157
158
 
@@ -13,6 +13,7 @@
13
13
  "create": "nsgm create",
14
14
  "delete": "nsgm delete",
15
15
  "deletedb": "nsgm deletedb",
16
+ "generate-password": "node scripts/generate-password-hash.js",
16
17
  "postversion": "git push && git push --tags",
17
18
  "test": "echo \"Error: no test specified\" && exit 1"
18
19
  },
package/lib/generate.js CHANGED
@@ -282,10 +282,13 @@ const initFiles = (dictionary, upgradeFlag = false) => {
282
282
  const initScriptsFiles = () => {
283
283
  const scriptsStartupPath = '/startup.sh';
284
284
  const scriptsShutdownPath = '/shutdown.sh';
285
+ const scriptsPasswordPath = '/generate-password-hash.js';
285
286
  const sourceScriptsStartupPath = (0, path_1.resolve)(sourceScriptsPath + scriptsStartupPath);
286
287
  const sourceScriptsShutdownPath = (0, path_1.resolve)(sourceScriptsPath + scriptsShutdownPath);
288
+ const sourceScriptsPasswordPath = (0, path_1.resolve)(sourceScriptsPath + scriptsPasswordPath);
287
289
  let destScriptsStartupPath = (0, path_1.resolve)(destScriptsPath + scriptsStartupPath);
288
290
  let destScriptsShutdownPath = (0, path_1.resolve)(destScriptsPath + scriptsShutdownPath);
291
+ let destScriptsPasswordPath = (0, path_1.resolve)(destScriptsPath + scriptsPasswordPath);
289
292
  if (dictionary === '') {
290
293
  (0, utils_1.mkdirSync)(destScriptsPath);
291
294
  }
@@ -294,9 +297,11 @@ const initFiles = (dictionary, upgradeFlag = false) => {
294
297
  (0, utils_1.mkdirSync)(newDestScriptsPath);
295
298
  destScriptsStartupPath = (0, path_1.resolve)(newDestScriptsPath + scriptsStartupPath);
296
299
  destScriptsShutdownPath = (0, path_1.resolve)(newDestScriptsPath + scriptsShutdownPath);
300
+ destScriptsPasswordPath = (0, path_1.resolve)(newDestScriptsPath + scriptsPasswordPath);
297
301
  }
298
302
  (0, utils_1.copyFileSync)(sourceScriptsStartupPath, destScriptsStartupPath);
299
303
  (0, utils_1.copyFileSync)(sourceScriptsShutdownPath, destScriptsShutdownPath);
304
+ (0, utils_1.copyFileSync)(sourceScriptsPasswordPath, destScriptsPasswordPath);
300
305
  };
301
306
  const initRootFiles = () => {
302
307
  const rootNextConfigPath = '/next.config.js';