export-table-pulgin-csharp 1.1.185 → 1.1.187

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Field, FieldType, DataTable } from "export-table-lib";
3
2
  export declare function TryConvValue(value: any, t: FieldType, f: Field): any;
4
3
  export declare function ConvValue(value: any, t: FieldType, f: Field): any;
@@ -1 +1 @@
1
- {"version":3,"file":"CSParseTool.d.ts","sourceRoot":"","sources":["../src/CSParseTool.ts"],"names":[],"mappings":";AACA,OAAO,EAA0B,KAAK,EAA4D,SAAS,EAAwB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGtK,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAWpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,MAAM,MAAM,UAAU,GAAG;IACxB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ,CAAA;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,UAAU,EAAE,CAAA;CAAE,GAAG,SAAS,CAoDlH;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,UAElD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAwE5E;AAED,eAAO,IAAI,qBAAqB,SAA0D,CAAA;AAE1F,eAAO,IAAI,oBAAoB,SAAsB,CAAA;AACrD,eAAO,IAAI,sBAAsB,QAA+D,CAAA;AA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AO,IAAI,cAAc,GAAa,QAAQ,SAAS,EAAE,EAAE,OAAO,KAAK,cAEtE,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,OAAO,GAAG,EAAE,GAAG,KAAK,KAAG,MAE/C,CAAA;AAED,eAAO,MAAM,QAAQ,GAAI,GAAG,KAAK,WAEhC,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,GAAG,KAAK,aAEpC,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,KAAK,sBAc1C,CAAA;AAED,eAAO,MAAM,wBAAwB,GAAI,GAAG,KAAK,WAYhD,CAAA;AAED,wBAAgB,yBAAyB,WAQxC;AAED,eAAO,IAAI,WAAW,SAAwD,CAAA;AAC9E,eAAO,IAAI,eAAe,QAAgC,CAAA;AAE1D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,cAAc,GAAG,IAAI,CAS7F"}
@@ -15,15 +15,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
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
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.outputFileSync = exports.useMMPNamespace = exports.isEnableMMP = exports.GetUsingJsonToolNamespace = exports.convTupleArrayTypeDefine = exports.convTupleArrayType = exports.getDescripts = exports.getTitle = exports.genValue = exports.getFkFieldType = exports.getCustomFieldTypeAnnotation = exports.getFieldAnnotation = exports.isTypeArray = exports.getFieldType = exports.getFieldElementType = exports.convVarName = exports.convMemberName = exports.firstLetterLower = exports.firstLetterUpper = exports.overwriteWithProtoPath = exports.isOverwriteWithProto = exports.isSkipExportDefaults0 = exports.ConvValue2Literal = exports.ToNewTupleStatement = exports.genTupleArrayValue = exports.ConvValue = exports.TryConvValue = void 0;
36
+ exports.useMMPNamespace = exports.isEnableMMP = exports.convTupleArrayTypeDefine = exports.convTupleArrayType = exports.getDescripts = exports.getTitle = exports.genValue = exports.getFkFieldType = exports.getCustomFieldTypeAnnotation = exports.getFieldAnnotation = exports.isTypeArray = exports.getFieldType = exports.getFieldElementType = exports.convVarName = exports.convMemberName = exports.firstLetterLower = exports.firstLetterUpper = exports.overwriteWithProtoPath = exports.isOverwriteWithProto = exports.isSkipExportDefaults0 = void 0;
37
+ exports.TryConvValue = TryConvValue;
38
+ exports.ConvValue = ConvValue;
39
+ exports.genTupleArrayValue = genTupleArrayValue;
40
+ exports.ToNewTupleStatement = ToNewTupleStatement;
41
+ exports.ConvValue2Literal = ConvValue2Literal;
42
+ exports.GetUsingJsonToolNamespace = GetUsingJsonToolNamespace;
43
+ exports.outputFileSync = outputFileSync;
27
44
  const export_table_lib_1 = require("export-table-lib");
28
45
  const fs = __importStar(require("fs-extra"));
29
46
  function TryConvValue(value, t, f) {
@@ -40,7 +57,6 @@ function TryConvValue(value, t, f) {
40
57
  }
41
58
  }
42
59
  }
43
- exports.TryConvValue = TryConvValue;
44
60
  function ConvValue(value, t, f) {
45
61
  if (t == "object") {
46
62
  return JSON.parse(value);
@@ -99,7 +115,6 @@ function ConvValue(value, t, f) {
99
115
  }
100
116
  throw new TypeError(`invalid unkown type ${f.name}:<${f.rawType} => ${f.type} << ${t}>`);
101
117
  }
102
- exports.ConvValue = ConvValue;
103
118
  function genTupleArrayValue(f, content) {
104
119
  var line = f.rawType.replaceAll(/(?<=[^\w])(boolean)(?=[^\w]|$)/g, "bool");
105
120
  let m = line.match(/\@\((\w+),(\w+)\)(\[\])?/);
@@ -148,11 +163,9 @@ function genTupleArrayValue(f, content) {
148
163
  }
149
164
  return undefined;
150
165
  }
151
- exports.genTupleArrayValue = genTupleArrayValue;
152
166
  function ToNewTupleStatement(obj) {
153
167
  return `new(){${(0, export_table_lib_1.iff)(obj.Item1 != null, () => `Item1=${obj.Item1},`)}${(0, export_table_lib_1.iff)(obj.Item2 != null, () => `Item2=${obj.Item2},`)}}`;
154
168
  }
155
- exports.ToNewTupleStatement = ToNewTupleStatement;
156
169
  function ConvValue2Literal(value, t, f) {
157
170
  // console.log(t)
158
171
  if (t == "object") {
@@ -244,7 +257,6 @@ function ConvValue2Literal(value, t, f) {
244
257
  }
245
258
  throw new Error(`invalid type ${f.name}:<${f.rawType} => unkown>`);
246
259
  }
247
- exports.ConvValue2Literal = ConvValue2Literal;
248
260
  exports.isSkipExportDefaults0 = process.argv.findIndex(v => v == "--SkipDefaults") >= 0;
249
261
  let withProtoIndex = process.argv.findIndex(v => v == "--WithProto");
250
262
  exports.isOverwriteWithProto = withProtoIndex >= 0;
@@ -505,7 +517,6 @@ function GetUsingJsonToolNamespace() {
505
517
  let useJsonToolNamesapce = jsonToolNamespace != null ? `using ${jsonToolNamespace};` : ``;
506
518
  return useJsonToolNamesapce;
507
519
  }
508
- exports.GetUsingJsonToolNamespace = GetUsingJsonToolNamespace;
509
520
  exports.isEnableMMP = process.argv.findIndex(v => v == "--EnableMMPB") >= 0;
510
521
  exports.useMMPNamespace = "using LoadTableMMP.Runtime;";
511
522
  function outputFileSync(savePath, content1, options) {
@@ -519,4 +530,3 @@ function outputFileSync(savePath, content1, options) {
519
530
  fs.outputFileSync(savePath, content1, options);
520
531
  }
521
532
  }
522
- exports.outputFileSync = outputFileSync;
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
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
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.CSProtoParser = exports.ClassInfo = exports.FieldInfo = void 0;
27
37
  const fs = __importStar(require("fs-extra"));
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAmD,MAAM,kBAAkB,CAAA;AAMtK,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAyRpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAI3C,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
1
+ {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAE,iBAAiB,EAAmD,MAAM,kBAAkB,CAAA;AAMtK,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA8RpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAM3C,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportPlugin = exports.export_stuff = void 0;
3
+ exports.ExportPlugin = void 0;
4
+ exports.export_stuff = export_stuff;
4
5
  const export_table_lib_1 = require("export-table-lib");
5
6
  const CSParseTool_1 = require("./CSParseTool");
6
7
  const CSProtoParser_1 = require("./CSProtoParser");
@@ -62,6 +63,7 @@ function export_stuff(paras) {
62
63
  let mmpPrefix = CSParseTool_1.isOverwriteWithProto ? "[MemoryPackable]" : "";
63
64
  let isMMPEnabled = allTags.indexOf('csharp:mmp') != -1;
64
65
  let mmpNamespace = isMMPEnabled ? CSParseTool_1.useMMPNamespace : "";
66
+ let translateFields = fields.filter(f => f.translate);
65
67
  let temp = `
66
68
  using System.Collections.Generic;
67
69
  using System.Linq;
@@ -69,6 +71,9 @@ using System.Runtime.InteropServices;${usingProtoNamespace}
69
71
  ${mmpNamespace}
70
72
 
71
73
  namespace ${exportNamespace}{
74
+ ${(0, export_table_lib_1.iff)(translateFields.length > 0, () => `
75
+ // NeedTranslateFields: [${translateFields.map(f => f.name).join(", ")}]
76
+ `)}
72
77
  [System.Serializable]
73
78
  public partial class ${RowClass}${extendClass} {
74
79
 
@@ -257,13 +262,14 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
257
262
  `;
258
263
  return temp;
259
264
  }
260
- exports.export_stuff = export_stuff;
261
265
  class ExportPlugin extends export_table_lib_1.PluginBase {
262
266
  name = "csharp";
263
267
  tags = ["cs"];
264
268
  handleBatch(paras) {
265
- console.log(`try parse proto: ${CSParseTool_1.overwriteWithProtoPath}`);
266
- protoParser.parseProtoFile(CSParseTool_1.overwriteWithProtoPath);
269
+ if (CSParseTool_1.overwriteWithProtoPath != null && CSParseTool_1.overwriteWithProtoPath != "") {
270
+ console.log(`try parse proto: ${CSParseTool_1.overwriteWithProtoPath}`);
271
+ protoParser.parseProtoFile(CSParseTool_1.overwriteWithProtoPath);
272
+ }
267
273
  }
268
274
  handleSheet(paras) {
269
275
  let content = export_stuff(paras);
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportLiteDBCSPlugin = exports.export_stuff = void 0;
3
+ exports.ExportLiteDBCSPlugin = void 0;
4
+ exports.export_stuff = export_stuff;
4
5
  const export_table_lib_1 = require("export-table-lib");
5
6
  const CSParseTool_1 = require("./CSParseTool");
6
7
  function export_stuff(paras) {
@@ -204,7 +205,6 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
204
205
  `;
205
206
  return temp;
206
207
  }
207
- exports.export_stuff = export_stuff;
208
208
  class ExportLiteDBCSPlugin extends export_table_lib_1.PluginBase {
209
209
  name = "litedbcs";
210
210
  tags = ["litedbcs"];
@@ -15,18 +15,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
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
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.ExportLiteDBUJsonPlugin = exports.ConvJson2LiteDB = exports.RemoveJsonFiles = exports.exportUJsonLoader = void 0;
39
+ exports.ExportLiteDBUJsonPlugin = void 0;
40
+ exports.exportUJsonLoader = exportUJsonLoader;
41
+ exports.RemoveJsonFiles = RemoveJsonFiles;
42
+ exports.ConvJson2LiteDB = ConvJson2LiteDB;
30
43
  const export_table_lib_1 = require("export-table-lib");
31
44
  const fs = __importStar(require("fs-extra"));
32
45
  const CSParseTool_1 = require("./CSParseTool");
@@ -74,7 +87,6 @@ namespace ${exportNamespace}
74
87
  `;
75
88
  return temp;
76
89
  }
77
- exports.exportUJsonLoader = exportUJsonLoader;
78
90
  async function RemoveJsonFiles(savePaths2) {
79
91
  let deleteTasks = savePaths2.map(async (savePath2) => {
80
92
  console.log(`delete file: ${savePath2}`);
@@ -90,7 +102,6 @@ async function RemoveJsonFiles(savePaths2) {
90
102
  });
91
103
  await Promise.all(deleteTasks);
92
104
  }
93
- exports.RemoveJsonFiles = RemoveJsonFiles;
94
105
  async function ConvJson2LiteDB(litedbpath, savePaths) {
95
106
  if (litedbpath != null && litedbpath != "") {
96
107
  let modulePath = require.resolve(".");
@@ -111,7 +122,6 @@ async function ConvJson2LiteDB(litedbpath, savePaths) {
111
122
  console.log(`no litedbpath given, skip conv database`);
112
123
  }
113
124
  }
114
- exports.ConvJson2LiteDB = ConvJson2LiteDB;
115
125
  class ExportLiteDBUJsonPlugin extends export_table_lib_1.PluginBase {
116
126
  name = "litedbujson";
117
127
  tags = ["litedbujson"];
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportUJsonPlugin = exports.exportUJsonLoader = exports.exportUJson = void 0;
3
+ exports.ExportUJsonPlugin = void 0;
4
+ exports.exportUJson = exportUJson;
5
+ exports.exportUJsonLoader = exportUJsonLoader;
4
6
  const export_table_lib_1 = require("export-table-lib");
5
7
  const CSParseTool_1 = require("./CSParseTool");
6
8
  var isSkipIndexLoader0 = process.argv.findIndex(v => v == "--SkipIndexLoader") >= 0;
@@ -59,7 +61,6 @@ function exportUJson(paras) {
59
61
  // `
60
62
  // return temp
61
63
  }
62
- exports.exportUJson = exportUJson;
63
64
  function exportUJsonLoader(paras) {
64
65
  let { datas, fields, name, objects, table, exportNamespace, allTags, } = paras;
65
66
  let useJsonToolNamesapce = (0, CSParseTool_1.GetUsingJsonToolNamespace)();
@@ -201,7 +202,6 @@ namespace ${exportNamespace}
201
202
  `;
202
203
  return temp;
203
204
  }
204
- exports.exportUJsonLoader = exportUJsonLoader;
205
205
  class ExportUJsonPlugin extends export_table_lib_1.PluginBase {
206
206
  name = "ujson";
207
207
  tags = ["ujson"];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ExportUnityMMPPlugin = exports.exportMMP = void 0;
3
+ exports.ExportUnityMMPPlugin = void 0;
4
+ exports.exportMMP = exportMMP;
4
5
  const export_table_lib_1 = require("export-table-lib");
5
6
  const CSParseTool_1 = require("./CSParseTool");
6
7
  var isEnableMMPB = process.argv.findIndex(v => v == "--EnableMMPB") >= 0;
@@ -98,7 +99,6 @@ ${(0, export_table_lib_1.iff)(f.rawType.startsWith("@") && f.rawType.endsWith("[
98
99
  `;
99
100
  return temp;
100
101
  }
101
- exports.exportMMP = exportMMP;
102
102
  class ExportUnityMMPPlugin extends export_table_lib_1.PluginBase {
103
103
  name = "mmp";
104
104
  tags = ["mmp"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.185",
3
+ "version": "1.1.187",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {},
@@ -13,7 +13,7 @@
13
13
  "dependencies": {
14
14
  "@types/commander": "2.12.2",
15
15
  "@types/node": "^17.0.18",
16
- "export-table-lib": "^1.0.68",
16
+ "export-table-lib": "^1.0.69",
17
17
  "fs": "^0.0.1-security",
18
18
  "fs-extra": "^10.0.0",
19
19
  "fse": "^4.0.1"
@@ -80,6 +80,8 @@ export function export_stuff(paras: HandleSheetParams): string | null {
80
80
  let isMMPEnabled = allTags.indexOf('csharp:mmp') != -1
81
81
  let mmpNamespace = isMMPEnabled ? useMMPNamespace : ""
82
82
 
83
+ let translateFields = fields.filter(f => f.translate)
84
+
83
85
  let temp = `
84
86
  using System.Collections.Generic;
85
87
  using System.Linq;
@@ -87,6 +89,9 @@ using System.Runtime.InteropServices;${usingProtoNamespace}
87
89
  ${mmpNamespace}
88
90
 
89
91
  namespace ${exportNamespace}{
92
+ ${iff(translateFields.length > 0, () => `
93
+ // NeedTranslateFields: [${translateFields.map(f => f.name).join(", ")}]
94
+ `)}
90
95
  [System.Serializable]
91
96
  public partial class ${RowClass}${extendClass} {
92
97
 
@@ -293,8 +298,10 @@ export class ExportPlugin extends PluginBase {
293
298
  tags: string[] = ["cs"]
294
299
 
295
300
  handleBatch(paras: HandleBatchParams): void {
296
- console.log(`try parse proto: ${overwriteWithProtoPath}`)
297
- protoParser.parseProtoFile(overwriteWithProtoPath)
301
+ if (overwriteWithProtoPath != null && overwriteWithProtoPath != "") {
302
+ console.log(`try parse proto: ${overwriteWithProtoPath}`)
303
+ protoParser.parseProtoFile(overwriteWithProtoPath)
304
+ }
298
305
  }
299
306
  handleSheet(paras: HandleSheetParams) {
300
307
  let content = export_stuff(paras)