@yangrunchi/a_6 1.0.5 → 1.0.7

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.
@@ -176,17 +176,17 @@
176
176
  ---------------------------------------------------------------------------------
177
177
  ```
178
178
  本地生成方式1:手动执行命令可自动生成(已集成VSCode任务【Run AutoCode】,可自定义快捷键)
179
- 本地生成方式2:http://localhost:8080/ 进入地址执行 (步骤: H:\NiePanChuanQi\Tools\Tool_other\bat_manager\sm.md)
179
+ 本地生成方式2:http://localhost:9964 (已集成VSCode任务【Run Bat Manager】启动本地Bat管理工具)
180
180
 
181
181
  ## 3. 配置来源(策划)
182
182
 
183
- 源文件: Project\MirServer\功能模块表
183
+ 源文件: Project\ModuleTable\table
184
184
 
185
185
  后端生成文件:Project\MirServer\Mir200\Envir\QuestDiary\cfgcsv —— 自动生成自动提交SVN
186
186
  前端生成文件:Project\996M2_Client\dev\GUILayout\ssrgame\csvcfg —— 自动生成自动提交SVN
187
187
 
188
188
  本地生成方式:策划提交配置后。手动执行命令可自动生成(已集成VSCode任务【Run Table Client】,可自定义快捷键)
189
- 远程生成方式:http://10.13.0.26:8080/ 进入地址执行
189
+ 远程生成方式:http://10.13.0.26:9964 进入地址执行
190
190
 
191
191
  ## 4. 数据来源(后端)
192
192
 
@@ -198,12 +198,12 @@
198
198
  前端生成文件:Project\996M2_Client\dev\GUILayout\ssrgame\mgr\FuncDataMgr.lua
199
199
 
200
200
  本地生成方式:后端提交协议(源文件)后,手动执行命令可自动生成(已集成VSCode任务【Run NetMsg Sync】,可自定义快捷键)
201
- 远程生成方式:http://10.13.0.26:8080/ 进入地址执行
201
+ 远程生成方式:http://10.13.0.26:9964 进入地址执行
202
202
 
203
203
  ## 5. 数据交互
204
204
 
205
- dev/GUILayout/ssrgame/funcData 存放协议数据类 【Run NetMsg Sync】 —— 自动生成自动提交SVN
206
- dev/GUILayout/ssrgame/mgr/FuncDataMgr.lua 注册协议类名 【Run NetMsg Sync】 —— 自动生成自动提交SVN
205
+ dev/GUILayout/ssrgame/funcData 存放协议数据类 【Run NetMsg Sync】 —— 自动生成且提交SVN
206
+ dev/GUILayout/ssrgame/mgr/FuncDataMgr.lua 注册协议类名 【Run NetMsg Sync】 —— 自动生成且提交SVN
207
207
  **例如:**
208
208
  ```lua
209
209
  -- 第一种:以第一列作为 Key
@@ -259,22 +259,72 @@
259
259
 
260
260
  ## 7. 启动游戏
261
261
 
262
- 已集成VSCode任务【Run 996M2 Client】,可自定义快捷键 默认使用启动【Ctrl+F6】
262
+ ### 7.1 快速启动(推荐)
263
+ - **VSCode 任务**:运行 `Run 996M2 Client`(已内置)
264
+ - **自定义快捷键**:默认为 `Ctrl+F6`(可修改)
263
265
 
266
+ ### 7.2 命令行启动
267
+ ```bash
268
+ # 安装工具(仅首次)
269
+ npm install -g @yangrunchi/a_6
270
+
271
+ # 查看a_6使用指南 终端输入
272
+ a_6
273
+
274
+ # 启动客户端
275
+ a_6 1
276
+
277
+ ```
264
278
  ## 8. 开发效率工具
265
279
 
266
- ### 方式一:VSCode 任务集成 + 快捷键安装脚本
280
+ ### 方式一: VSCode 任务集成(推荐)
281
+
282
+ ```bash
283
+
284
+ #已集成以下自动化任务,可直接在 VSCode 中运行:
285
+ | 任务名称 | 功能 |
286
+ | --- | --- |
287
+ | `Run 996M2 Client` | 启动游戏客户端 |
288
+ | `Run Table Client` | 同步策划配置表 |
289
+ | `Run NetMsg Sync` | 同步后端协议 |
290
+ | `Run AutoCode` | 自动生成 UI 代码 |
291
+ | `Run Bat Manager` | 启动本地管理工具(`http://IP或localhost:9964`) |
292
+
293
+ ```
294
+
295
+ #### 自定义快捷键
296
+ - **配置文件**:`a_tools/a_node/Tools/project-keys.json`
297
+ - **启用快捷键**:终端执行 `node a_tools/a_node/Tools/install-keys.js`
298
+ - **禁用快捷键**:终端执行 `node a_tools/a_node/Tools/uninstall-keys.js`
299
+
300
+ > ⚠️ 修改 `project-keys.json` 后,必须重新执行【启用快捷键】
301
+
302
+ ### 方式二: 全局命令行工具 `a_6`
303
+
304
+ ```bash
267
305
 
268
- **配置文件:** `a_tools/a_node/Tools/project-keys.json`
269
- **启用快捷键:终端执行** `node a_tools/a_node/Tools/install-keys.js`
270
- **禁用快捷键:终端执行** `node a_tools/a_node/Tools/uninstall-keys.js`
271
- `修改 project-keys.json 后,必须重新执行【启用快捷键】`
306
+ #适合终端操作或 CI/CD 自动化场景:
307
+
308
+ # 安装
309
+ npm install -g @yangrunchi/a_6
310
+
311
+ # 卸载
312
+ npm uninstall -g @yangrunchi/a_6
313
+
314
+ # 命令用法
315
+ a_6 <编号>
316
+ 1 - 启动客户端
317
+ 2 - 打配置(同步策划表)
318
+ 3 - 同步协议(后端数据)
319
+ 4 - 工程更新
320
+ 5 - 自动代码生成
321
+ ```
272
322
 
273
- ### 方式二:远程执行脚本(适合非 VSCode 用户)无需安装 VSCode,打开浏览器即可使用
323
+ ### 方式三: 远程执行脚本
274
324
 
275
- ### 远程地址:http://10.13.0.26:9964/
325
+ ```bash
326
+ #(适合非 VSCode 用户)无需安装 VSCode,打开浏览器即可使用
276
327
 
328
+ 远程地址:http://10.13.0.26:9964/
277
329
 
278
- ### 方式三: npm 安装
279
- ### 安装 npm install -g @yangrunchi/a_6
280
- ### 卸载 npm uninstall @yangrunchi/a_6
330
+ ```
package/AutoCfg/csvcfg.js CHANGED
@@ -356,21 +356,21 @@ function main() {
356
356
 
357
357
  // 添加新增文件
358
358
  console.log('检查并添加新增文件...');
359
- const addedTFiles = addNewFilesToSvn(tPath);
359
+ //const addedTFiles = addNewFilesToSvn(tPath);
360
360
  const addedServerFiles = addNewFilesToSvn(sPath);
361
361
  const addedClientFiles = addNewFilesToSvn(cPath);
362
362
 
363
- console.log(`表格目录新增文件: ${addedTFiles.length} 个`);
363
+ //console.log(`表格目录新增文件: ${addedTFiles.length} 个`);
364
364
  console.log(`服务器目录新增文件: ${addedServerFiles.length} 个`);
365
365
  console.log(`客户端目录新增文件: ${addedClientFiles.length} 个`);
366
366
 
367
367
  // 标记删除文件
368
368
  console.log('检查并标记删除的文件...');
369
- const deletedTFiles = markDeletedFiles(tPath);
369
+ //const deletedTFiles = markDeletedFiles(tPath);
370
370
  const deletedServerFiles = markDeletedFiles(sPath);
371
371
  const deletedClientFiles = markDeletedFiles(cPath);
372
372
 
373
- console.log(`表格目录删除文件: ${deletedTFiles.length} 个`);
373
+ //console.log(`表格目录删除文件: ${deletedTFiles.length} 个`);
374
374
  console.log(`服务器目录删除文件: ${deletedServerFiles.length} 个`);
375
375
  console.log(`客户端目录删除文件: ${deletedClientFiles.length} 个`);
376
376
 
@@ -378,10 +378,10 @@ function main() {
378
378
  const hasContentChanges = checkContentChanges();
379
379
 
380
380
  // 检查各目录是否有更改
381
- const hasTChanges = hasChanges(tPath);
381
+ //const hasTChanges = hasChanges(tPath);
382
382
  const hasSChanges = hasChanges(sPath);
383
383
  const hasCChanges = hasChanges(cPath);
384
- const hasAnyChanges = hasTChanges || hasSChanges || hasCChanges;
384
+ const hasAnyChanges = hasSChanges || hasCChanges;
385
385
 
386
386
  // 定义 shouldCommit
387
387
  const shouldCommit = hasAnyChanges && hasContentChanges;
@@ -133,10 +133,11 @@ function commitToSvn(filePath, action, responseCount = 0, requestCount = 0) {
133
133
 
134
134
  try {
135
135
  const fileName = path.basename(filePath);
136
+ const projectRootForSvn = path.resolve(__dirname, '../../..');
136
137
 
137
138
  let isVersioned = false;
138
139
  try {
139
- execSync(`svn info "${filePath}"`, { stdio: 'ignore' });
140
+ execSync(`svn info "${filePath}"`, { stdio: 'ignore', cwd: projectRootForSvn });
140
141
  isVersioned = true;
141
142
  } catch (err) {
142
143
  isVersioned = false;
@@ -144,17 +145,17 @@ function commitToSvn(filePath, action, responseCount = 0, requestCount = 0) {
144
145
 
145
146
  if (!isVersioned) {
146
147
  console.log(` 📝 添加新文件: ${fileName}`);
147
- execSync(`svn add "${filePath}"`, { stdio: 'ignore' });
148
+ execSync(`svn add "${filePath}"`, { stdio: 'ignore', cwd: projectRootForSvn });
148
149
  }
149
150
 
150
- const statusOutput = execSync(`svn status "${filePath}"`, { encoding: 'utf8' });
151
+ const statusOutput = execSync(`svn status "${filePath}"`, { encoding: 'utf8', cwd: projectRootForSvn });
151
152
  const needCommit = statusOutput.trim().length > 0 &&
152
153
  (statusOutput.trim().startsWith('M') || statusOutput.trim().startsWith('A'));
153
154
 
154
155
  if (needCommit) {
155
156
  const commitMsg = getCommitMessage(action, fileName, responseCount, requestCount);
156
157
  console.log(` 📤 提交: ${fileName} - ${commitMsg}`);
157
- execSync(`svn commit "${filePath}" -m "${commitMsg}"`, { stdio: 'ignore' });
158
+ execSync(`svn commit "${filePath}" -m "${commitMsg}"`, { stdio: 'ignore', cwd: projectRootForSvn });
158
159
  return true;
159
160
  }
160
161
  return false;
@@ -4,6 +4,7 @@
4
4
  // -- 描述: SVN 工具函数集
5
5
 
6
6
  const fs = require('fs');
7
+ const path = require('path');
7
8
  const { execSync, spawnSync } = require('child_process');
8
9
 
9
10
  // 详细检测 SVN 是否可用
@@ -43,9 +44,18 @@ function runCommand(svnPath, description) {
43
44
  }
44
45
 
45
46
  try {
47
+ // 计算项目根目录(从 svnPath 向上查找包含 .svn 的目录)
48
+ let projectRoot = svnPath;
49
+ while (projectRoot && !fs.existsSync(path.join(projectRoot, '.svn'))) {
50
+ const parent = path.dirname(projectRoot);
51
+ if (parent === projectRoot) break;
52
+ projectRoot = parent;
53
+ }
54
+
46
55
  const result = spawnSync('svn', ['update', svnPath], {
47
56
  encoding: 'utf8',
48
- stdio: 'inherit'
57
+ stdio: 'inherit',
58
+ cwd: projectRoot || undefined
49
59
  });
50
60
 
51
61
  if (result.status === 0) {
@@ -70,12 +80,22 @@ function runCommit(filePaths, description) {
70
80
  try {
71
81
  // 如果传入的是数组,转换为多个参数
72
82
  const paths = Array.isArray(filePaths) ? filePaths : [filePaths];
83
+
84
+ // 计算项目根目录(从第一个文件路径向上查找包含 .svn 的目录)
85
+ let projectRoot = paths[0];
86
+ while (projectRoot && !fs.existsSync(path.join(projectRoot, '.svn'))) {
87
+ const parent = path.dirname(projectRoot);
88
+ if (parent === projectRoot) break;
89
+ projectRoot = parent;
90
+ }
91
+
73
92
  const args = ['commit', ...paths, '-m', description];
74
93
 
75
94
  const result = spawnSync('svn', args, {
76
95
  encoding: 'buffer',
77
96
  env: { ...process.env, LANG: 'zh_CN.UTF-8' },
78
- stdio: 'inherit'
97
+ stdio: 'inherit',
98
+ cwd: projectRoot || undefined
79
99
  });
80
100
 
81
101
  if (result.status === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yangrunchi/a_6",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "996M2 客户端 Node.js 工具集 — 协议同步、自动生成代码、CSV配置、SVN管理、BAT脚本管理器",
5
5
  "main": "index.js",
6
6
  "bin": {