export-table-pulgin-csharp 1.1.112 → 1.1.115

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.
Binary file
Binary file
@@ -1 +1 @@
1
- {"version":3,"file":"ExportLiteDBCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportLiteDBCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAInL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA4NpE;AAED,qBAAa,oBAAqB,SAAQ,UAAU;IACnD,IAAI,SAAa;IACjB,IAAI,EAAE,MAAM,EAAE,CAAe;IAE7B,WAAW,CAAC,KAAK,EAAE,iBAAiB;CASpC"}
1
+ {"version":3,"file":"ExportLiteDBCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportLiteDBCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAInL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAgOpE;AAED,qBAAa,oBAAqB,SAAQ,UAAU;IACnD,IAAI,SAAa;IACjB,IAAI,EAAE,MAAM,EAAE,CAAe;IAE7B,WAAW,CAAC,KAAK,EAAE,iBAAiB;CASpC"}
@@ -41,62 +41,66 @@ function export_stuff(paras) {
41
41
  using System.Collections.Generic;
42
42
  using System.Linq;
43
43
 
44
- namespace ${exportNamespace}{
45
- [System.Serializable]
46
- public partial class ${RowClass} {
44
+ namespace ${exportNamespace}
45
+ {
46
+ [System.Serializable]
47
+ public partial class ${RowClass}
48
+ {
47
49
 
48
- private static List<${RowClass}> _configs;
50
+ private static List<${RowClass}> _configs;
49
51
 
50
- public static List<${RowClass}> Configs
51
- {
52
- get
52
+ public static List<${RowClass}> Configs
53
53
  {
54
- if (_configs == null)
54
+ get
55
55
  {
56
- _configs = Collection.FindAll().ToList();
57
- }
56
+ if (_configs == null)
57
+ {
58
+ _configs = Collection.FindAll().ToList();
59
+ }
58
60
 
59
- return _configs;
61
+ return _configs;
62
+ }
60
63
  }
61
- }
62
64
 
63
- public ${RowClass}() { }
64
- public ${RowClass}(${(0, export_table_lib_1.st)(() => fields.map(f => `${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.convVarName)(f.name)}`).join(", "))})
65
- {
66
- ${(0, export_table_lib_1.foreach)(fields, f => ` this.${(0, CSParseTool_1.convMemberName)(f.name)} = ${(0, CSParseTool_1.convVarName)(f.name)};`)}
67
- }
65
+ public ${RowClass}()
66
+ {
67
+ }
68
+ public ${RowClass}(${(0, export_table_lib_1.st)(() => fields.map(f => `${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.convVarName)(f.name)}`).join(", "))})
69
+ {
70
+ ${(0, export_table_lib_1.foreach)(fields, f => ` this.${(0, CSParseTool_1.convMemberName)(f.name)} = ${(0, CSParseTool_1.convVarName)(f.name)};`)}
71
+ }
68
72
 
69
- public virtual ${RowClass} MergeFrom(${RowClass} source)
70
- {
71
- ${(0, export_table_lib_1.foreach)(fields, f => ` this.${(0, CSParseTool_1.convMemberName)(f.name)} = source.${(0, CSParseTool_1.convMemberName)(f.name)};`)}
72
- return this;
73
- }
73
+ public virtual ${RowClass} MergeFrom(${RowClass} source)
74
+ {
75
+ ${(0, export_table_lib_1.foreach)(fields, f => ` this.${(0, CSParseTool_1.convMemberName)(f.name)} = source.${(0, CSParseTool_1.convMemberName)(f.name)};`)}
76
+ return this;
77
+ }
74
78
 
75
- public virtual ${RowClass} Clone()
76
- {
77
- var config = new ${RowClass}();
78
- config.MergeFrom(this);
79
- return config;
80
- }
79
+ public virtual ${RowClass} Clone()
80
+ {
81
+ var config = new ${RowClass}();
82
+ config.MergeFrom(this);
83
+ return config;
84
+ }
81
85
 
82
86
  ${(0, export_table_lib_1.cmm)( /**生成字段 */)}
83
87
  ${(0, export_table_lib_1.foreach)(fields, f => `
84
- /// <summary>
85
- ${(0, export_table_lib_1.foreach)((0, CSParseTool_1.getDescripts)(f), line => ` /// ${line}`)}
86
- /// </summary>
87
- public ${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.convMemberName)(f.name)};
88
+ /// <summary>
89
+ ${(0, export_table_lib_1.foreach)((0, CSParseTool_1.getDescripts)(f), line => ` /// ${line}`)}
90
+ /// </summary>
91
+ public ${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.convMemberName)(f.name)};
88
92
 
89
93
  ${(0, export_table_lib_1.iff)(f.rawType.startsWith("@"), () => `
90
- /// <summary>
91
- ${(0, export_table_lib_1.foreach)((0, CSParseTool_1.getDescripts)(f), line => ` /// ${line}`)}
92
- /// </summary>
93
- ${(0, CSParseTool_1.convTupleArrayType)(f)}`)}`)}
94
+ /// <summary>
95
+ ${(0, export_table_lib_1.foreach)((0, CSParseTool_1.getDescripts)(f), line => ` /// ${line}`)}
96
+ /// </summary>
97
+ ${(0, CSParseTool_1.convTupleArrayType)(f)}`)}`)}
94
98
 
95
99
  ${(0, export_table_lib_1.cmm)( /**生成get字段 */)}
96
100
  #region get字段
97
101
  ${(0, export_table_lib_1.foreach)(fields, f => {
98
102
  if (f.nameOrigin != f.name) {
99
- return ` public ${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.getTitle)(f).replace(" ", "_")} => ${(0, CSParseTool_1.convMemberName)(f.name)};`;
103
+ return ` public ${(0, CSParseTool_1.getFieldType)(f)} ${(0, CSParseTool_1.getTitle)(f).replace(" ", "_")} => ${(0, CSParseTool_1.convMemberName)(f.name)};`;
100
104
  }
101
105
  else {
102
106
  return "";
@@ -1,6 +1,8 @@
1
1
  import { HandleSheetParams, PluginBase, HandleBatchParams } from "export-table-lib";
2
2
  export declare function exportUJson(paras: HandleSheetParams): string | null;
3
3
  export declare function exportUJsonLoader(paras: HandleSheetParams): string | null;
4
+ export declare function RemoveJsonFiles(savePaths2: string[]): Promise<void>;
5
+ export declare function ConvJson2LiteDB(litedbpath: string, savePaths: string[]): Promise<void>;
4
6
  export declare class ExportLiteDBUJsonPlugin extends PluginBase {
5
7
  name: string;
6
8
  tags: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"ExportLiteDBUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportLiteDBUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAWxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAsDzE;AAED,qBAAa,uBAAwB,SAAQ,UAAU;IACtD,IAAI,SAAgB;IACpB,IAAI,EAAE,MAAM,EAAE,CAAkB;IAEhC,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAmEpC,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAmC3C"}
1
+ {"version":3,"file":"ExportLiteDBUnityCSJsonPlugin.d.ts","sourceRoot":"","sources":["../src/ExportLiteDBUnityCSJsonPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAqC,MAAM,kBAAkB,CAAA;AAUxJ,wBAAgB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAuFnE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAsDzE;AAED,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,iBAczD;AACD,wBAAsB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,iBAmB5E;AAED,qBAAa,uBAAwB,SAAQ,UAAU;IACtD,IAAI,SAAgB;IACpB,IAAI,EAAE,MAAM,EAAE,CAAkB;IAEhC,WAAW,CAAC,KAAK,EAAE,iBAAiB;IAoB9B,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;CAgDjD"}
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ExportLiteDBUJsonPlugin = exports.exportUJsonLoader = exports.exportUJson = void 0;
29
+ exports.ExportLiteDBUJsonPlugin = exports.ConvJson2LiteDB = exports.RemoveJsonFiles = exports.exportUJsonLoader = exports.exportUJson = void 0;
30
30
  const export_table_lib_1 = require("export-table-lib");
31
31
  const fs = __importStar(require("fs-extra"));
32
32
  const CSParseTool_1 = require("./CSParseTool");
@@ -160,6 +160,43 @@ namespace ${exportNamespace}
160
160
  return temp;
161
161
  }
162
162
  exports.exportUJsonLoader = exportUJsonLoader;
163
+ async function RemoveJsonFiles(savePaths2) {
164
+ let deleteTasks = savePaths2.map(async (savePath2) => {
165
+ console.log(`delete file: ${savePath2}`);
166
+ try {
167
+ if (fs.existsSync(savePath2)) {
168
+ fs.removeSync(savePath2);
169
+ }
170
+ }
171
+ catch (ex) {
172
+ console.error(`error: cannot delete file ${savePath2}`);
173
+ console.error(ex);
174
+ }
175
+ });
176
+ await Promise.all(deleteTasks);
177
+ }
178
+ exports.RemoveJsonFiles = RemoveJsonFiles;
179
+ async function ConvJson2LiteDB(litedbpath, savePaths) {
180
+ if (litedbpath != null) {
181
+ let modulePath = require.resolve(".");
182
+ let binPath = path_1.default.resolve(modulePath, "../../bin/Json2LiteDB.exe");
183
+ // let dbPath = path.resolve("../../../GameClient/Assets/Bundles/GameConfigs/Auto/MainConfig.db.bytes");
184
+ let dbPath = path_1.default.resolve(litedbpath);
185
+ let savePaths2 = savePaths.map(savePath => path_1.default.resolve(savePath));
186
+ let cmdParas = savePaths2.concat();
187
+ cmdParas.unshift(litedbpath);
188
+ let cmdParasLine = cmdParas.join(" ");
189
+ let cmdline = `${binPath} ${cmdParasLine}`;
190
+ console.log("execute-cmdline: " + cmdline);
191
+ var output = cp.spawnSync(binPath, cmdParas);
192
+ console.log(output.output.toString());
193
+ RemoveJsonFiles(savePaths2);
194
+ }
195
+ else {
196
+ console.log(`no litedbpath given, skip conv database`);
197
+ }
198
+ }
199
+ exports.ConvJson2LiteDB = ConvJson2LiteDB;
163
200
  class ExportLiteDBUJsonPlugin extends export_table_lib_1.PluginBase {
164
201
  name = "litedbujson";
165
202
  tags = ["litedbujson"];
@@ -177,58 +214,11 @@ class ExportLiteDBUJsonPlugin extends export_table_lib_1.PluginBase {
177
214
  if (content2 != null) {
178
215
  let savePath = new export_table_lib_1.OutFilePath(paras.outPath, fullName, ".json").fullPath;
179
216
  fs.outputFileSync(savePath, content2, "utf-8");
180
- console.log(`try conv json2litedb`);
181
- var argvparse = require('argv-parse');
182
- var args = argvparse({
183
- foo: {
184
- type: 'boolean',
185
- alias: 'f'
186
- },
187
- bar: {
188
- type: 'string',
189
- alias: 'b'
190
- },
191
- qux: {
192
- type: 'array',
193
- alias: 'q'
194
- },
195
- norf: {
196
- type: 'boolean',
197
- alias: 'n'
198
- }
199
- });
200
- var options = new commander_1.default.Command().option("--litedbpath <string>").parse(process.argv).opts();
201
- let litedbpath = options["litedbpath"];
202
- console.log(`litedbpath: ${litedbpath}`);
203
- if (litedbpath != null) {
204
- let modulePath = require.resolve(".");
205
- let binPath = path_1.default.resolve(modulePath, "../../bin/Json2LiteDB.exe");
206
- // let dbPath = path.resolve("../../../GameClient/Assets/Bundles/GameConfigs/Auto/MainConfig.db.bytes");
207
- let dbPath = path_1.default.resolve(litedbpath);
208
- var savePath2 = path_1.default.resolve(savePath);
209
- let cmdline = `${binPath} ${savePath2} ${dbPath}`;
210
- console.log("execute-cmdline: " + cmdline);
211
- var output = cp.spawnSync(binPath, [savePath2, dbPath]);
212
- console.log(output.output.toString());
213
- console.log(`delete file: ${savePath2}`);
214
- try {
215
- if (fs.existsSync(savePath2)) {
216
- fs.removeSync(savePath2);
217
- }
218
- }
219
- catch (ex) {
220
- console.error(`error: cannot delete file ${savePath2}`);
221
- console.error(ex);
222
- }
223
- }
224
- else {
225
- console.log(`no litedbpath given, skip conv database`);
226
- }
227
217
  }
228
218
  return content2;
229
219
  }
230
220
  }
231
- handleBatch(paras) {
221
+ async handleBatch(paras) {
232
222
  let { moreOptions, tables, exportNamespace, } = paras;
233
223
  let isSkipIndexLoader = !!moreOptions?.SkipIndexLoader ?? false;
234
224
  if (isSkipIndexLoader0) {
@@ -256,6 +246,15 @@ ${(0, export_table_lib_1.foreach)(tables.sort((ta, tb) => ta.name.localeCompare(
256
246
  `;
257
247
  let savePath = paras.outPath + "/DefaultConfigLoader.cs";
258
248
  fs.outputFileSync(savePath, temp, "utf-8");
249
+ var options = new commander_1.default.Command().option("--litedbpath <string>").parse(process.argv).opts();
250
+ let litedbpath = options["litedbpath"];
251
+ console.log(`litedbpath: ${litedbpath}`);
252
+ let cmdParas = tables.map(table => {
253
+ var fullName = `${table.workbookName}-${table.name}`;
254
+ let savePath = new export_table_lib_1.OutFilePath(paras.outPath, fullName, ".json").fullPath;
255
+ return savePath;
256
+ });
257
+ await ConvJson2LiteDB(litedbpath, cmdParas);
259
258
  }
260
259
  }
261
260
  exports.ExportLiteDBUJsonPlugin = ExportLiteDBUJsonPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.112",
3
+ "version": "1.1.115",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {},
@@ -13,15 +13,12 @@
13
13
  "dependencies": {
14
14
  "@types/commander": "^2.12.2",
15
15
  "@types/node": "^17.0.18",
16
- "@types/yargs-parser": "^21.0.3",
17
- "argv-parse": "^1.0.1",
18
16
  "export-table-lib": "^1.0.59",
19
17
  "fs": "^0.0.1-security",
20
18
  "fs-extra": "^10.0.0",
21
19
  "fse": "^4.0.1"
22
20
  },
23
21
  "devDependencies": {
24
- "@types/fs-extra": "^9.0.13",
25
- "@types/yargs": "^17.0.32"
22
+ "@types/fs-extra": "^9.0.13"
26
23
  }
27
24
  }
@@ -31,71 +31,75 @@ export function export_stuff(paras: HandleSheetParams): string | null {
31
31
  using System.Collections.Generic;
32
32
  using System.Linq;
33
33
 
34
- namespace ${exportNamespace}{
35
- [System.Serializable]
36
- public partial class ${RowClass} {
34
+ namespace ${exportNamespace}
35
+ {
36
+ [System.Serializable]
37
+ public partial class ${RowClass}
38
+ {
37
39
 
38
- private static List<${RowClass}> _configs;
40
+ private static List<${RowClass}> _configs;
39
41
 
40
- public static List<${RowClass}> Configs
41
- {
42
- get
42
+ public static List<${RowClass}> Configs
43
43
  {
44
- if (_configs == null)
44
+ get
45
45
  {
46
- _configs = Collection.FindAll().ToList();
47
- }
46
+ if (_configs == null)
47
+ {
48
+ _configs = Collection.FindAll().ToList();
49
+ }
48
50
 
49
- return _configs;
51
+ return _configs;
52
+ }
50
53
  }
51
- }
52
54
 
53
- public ${RowClass}() { }
54
- public ${RowClass}(${st(() => fields.map(f => `${getFieldType(f)} ${convVarName(f.name)}`).join(", "))})
55
- {
55
+ public ${RowClass}()
56
+ {
57
+ }
58
+ public ${RowClass}(${st(() => fields.map(f => `${getFieldType(f)} ${convVarName(f.name)}`).join(", "))})
59
+ {
56
60
  ${foreach(fields, f =>
57
- ` this.${convMemberName(f.name)} = ${convVarName(f.name)};`
61
+ ` this.${convMemberName(f.name)} = ${convVarName(f.name)};`
58
62
  )}
59
- }
63
+ }
60
64
 
61
- public virtual ${RowClass} MergeFrom(${RowClass} source)
62
- {
65
+ public virtual ${RowClass} MergeFrom(${RowClass} source)
66
+ {
63
67
  ${foreach(fields, f =>
64
- ` this.${convMemberName(f.name)} = source.${convMemberName(f.name)};`
68
+ ` this.${convMemberName(f.name)} = source.${convMemberName(f.name)};`
65
69
  )}
66
- return this;
67
- }
70
+ return this;
71
+ }
68
72
 
69
- public virtual ${RowClass} Clone()
70
- {
71
- var config = new ${RowClass}();
72
- config.MergeFrom(this);
73
- return config;
74
- }
73
+ public virtual ${RowClass} Clone()
74
+ {
75
+ var config = new ${RowClass}();
76
+ config.MergeFrom(this);
77
+ return config;
78
+ }
75
79
 
76
80
  ${cmm(/**生成字段 */)}
77
81
  ${foreach(fields, f => `
78
- /// <summary>
82
+ /// <summary>
79
83
  ${foreach(getDescripts(f), line =>
80
- ` /// ${line}`
84
+ ` /// ${line}`
81
85
  )}
82
- /// </summary>
83
- public ${getFieldType(f)} ${convMemberName(f.name)};
86
+ /// </summary>
87
+ public ${getFieldType(f)} ${convMemberName(f.name)};
84
88
 
85
89
  ${iff(f.rawType.startsWith("@"), () => `
86
- /// <summary>
90
+ /// <summary>
87
91
  ${foreach(getDescripts(f), line =>
88
- ` /// ${line}`
92
+ ` /// ${line}`
89
93
  )}
90
- /// </summary>
91
- ${convTupleArrayType(f)}`)}`
94
+ /// </summary>
95
+ ${convTupleArrayType(f)}`)}`
92
96
  )}
93
97
 
94
98
  ${cmm(/**生成get字段 */)}
95
99
  #region get字段
96
100
  ${foreach(fields, f => {
97
101
  if (f.nameOrigin != f.name) {
98
- return ` public ${getFieldType(f)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`
102
+ return ` public ${getFieldType(f)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`
99
103
  } else {
100
104
  return ""
101
105
  }
@@ -5,7 +5,6 @@ import { TryConvValue, convMemberName } from "./CSParseTool";
5
5
  import path from "path";
6
6
  import * as cp from "child_process"
7
7
  import program from "commander"
8
- import yargs from "yargs";
9
8
 
10
9
  var isSkipIndexLoader0 = process.argv.findIndex(v => v == "--SkipIndexLoader") >= 0
11
10
 
@@ -155,6 +154,42 @@ namespace ${exportNamespace}
155
154
 
156
155
  }
157
156
 
157
+ export async function RemoveJsonFiles(savePaths2: string[]) {
158
+ let deleteTasks = savePaths2.map(async (savePath2) => {
159
+ console.log(`delete file: ${savePath2}`)
160
+ try {
161
+ if (fs.existsSync(savePath2)) {
162
+ fs.removeSync(savePath2);
163
+ }
164
+ } catch (ex) {
165
+ console.error(`error: cannot delete file ${savePath2}`);
166
+ console.error(ex);
167
+ }
168
+ })
169
+
170
+ await Promise.all(deleteTasks)
171
+ }
172
+ export async function ConvJson2LiteDB(litedbpath: string, savePaths: string[]) {
173
+ if (litedbpath != null) {
174
+ let modulePath = require.resolve(".")
175
+ let binPath = path.resolve(modulePath, "../../bin/Json2LiteDB.exe")
176
+ // let dbPath = path.resolve("../../../GameClient/Assets/Bundles/GameConfigs/Auto/MainConfig.db.bytes");
177
+ let dbPath = path.resolve(litedbpath)
178
+ let savePaths2 = savePaths.map(savePath => path.resolve(savePath))
179
+ let cmdParas = savePaths2.concat();
180
+ cmdParas.unshift(litedbpath);
181
+ let cmdParasLine = cmdParas.join(" ");
182
+ let cmdline = `${binPath} ${cmdParasLine}`;
183
+ console.log("execute-cmdline: " + cmdline)
184
+ var output = cp.spawnSync(binPath, cmdParas)
185
+ console.log(output.output.toString())
186
+
187
+ RemoveJsonFiles(savePaths2)
188
+ } else {
189
+ console.log(`no litedbpath given, skip conv database`)
190
+ }
191
+ }
192
+
158
193
  export class ExportLiteDBUJsonPlugin extends PluginBase {
159
194
  name = "litedbujson"
160
195
  tags: string[] = ["litedbujson"]
@@ -173,60 +208,13 @@ export class ExportLiteDBUJsonPlugin extends PluginBase {
173
208
  if (content2 != null) {
174
209
  let savePath = new OutFilePath(paras.outPath, fullName, ".json").fullPath
175
210
  fs.outputFileSync(savePath, content2, "utf-8")
176
-
177
- console.log(`try conv json2litedb`)
178
- var argvparse = require('argv-parse')
179
- var args = argvparse({
180
- foo: {
181
- type: 'boolean',
182
- alias: 'f'
183
- },
184
- bar: {
185
- type: 'string',
186
- alias: 'b'
187
- },
188
- qux: {
189
- type: 'array',
190
- alias: 'q'
191
- },
192
- norf: {
193
- type: 'boolean',
194
- alias: 'n'
195
- }
196
- })
197
-
198
- var options = new program.Command().option("--litedbpath <string>").parse(process.argv).opts()
199
- let litedbpath = options["litedbpath"]
200
- console.log(`litedbpath: ${litedbpath}`);
201
- if (litedbpath != null) {
202
- let modulePath = require.resolve(".")
203
- let binPath = path.resolve(modulePath, "../../bin/Json2LiteDB.exe")
204
- // let dbPath = path.resolve("../../../GameClient/Assets/Bundles/GameConfigs/Auto/MainConfig.db.bytes");
205
- let dbPath = path.resolve(litedbpath)
206
- var savePath2 = path.resolve(savePath);
207
- let cmdline = `${binPath} ${savePath2} ${dbPath}`;
208
- console.log("execute-cmdline: " + cmdline)
209
- var output = cp.spawnSync(binPath, [savePath2, dbPath])
210
- console.log(output.output.toString())
211
- console.log(`delete file: ${savePath2}`)
212
- try {
213
- if (fs.existsSync(savePath2)) {
214
- fs.removeSync(savePath2);
215
- }
216
- } catch (ex) {
217
- console.error(`error: cannot delete file ${savePath2}`);
218
- console.error(ex);
219
- }
220
- } else {
221
- console.log(`no litedbpath given, skip conv database`)
222
- }
223
211
  }
224
212
 
225
213
  return content2
226
214
  }
227
215
  }
228
216
 
229
- handleBatch(paras: HandleBatchParams): void {
217
+ async handleBatch(paras: HandleBatchParams): void {
230
218
 
231
219
  let {
232
220
  moreOptions,
@@ -260,5 +248,18 @@ ${foreach(tables.sort((ta, tb) => ta.name.localeCompare(tb.name)), (table) => `
260
248
  `
261
249
  let savePath = paras.outPath + "/DefaultConfigLoader.cs";
262
250
  fs.outputFileSync(savePath, temp, "utf-8");
251
+
252
+ var options = new program.Command().option("--litedbpath <string>").parse(process.argv).opts()
253
+ let litedbpath = options["litedbpath"]
254
+ console.log(`litedbpath: ${litedbpath}`);
255
+
256
+ let cmdParas = tables.map(table => {
257
+ var fullName = `${table.workbookName}-${table.name}`
258
+ let savePath = new OutFilePath(paras.outPath, fullName, ".json").fullPath
259
+ return savePath
260
+ })
261
+
262
+ await ConvJson2LiteDB(litedbpath, cmdParas);
263
+
263
264
  }
264
265
  }
@@ -1,2 +1,2 @@
1
1
  node E:\DATA\Projects\netease\quicktable\export-table\dist\launch.js export src dist --tags csharp:litedbcs --libs E:\DATA\Projects\netease\quicktable %*
2
- node E:\DATA\Projects\netease\quicktable\export-table\dist\launch.js export src dist --tags csharp:litedbujson --libs E:\DATA\Projects\netease\quicktable --litedbpath Assets/Bundles/GameConfigs/Auto/MainConfig.db.bytes %*
2
+ node E:\DATA\Projects\netease\quicktable\export-table\dist\launch.js export src dist --tags csharp:litedbujson --libs E:\DATA\Projects\netease\quicktable --litedbpath ./dist/MainConfig.db.bytes %*