zero-tools 1.4.0 → 1.4.1

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/bin.ts CHANGED
@@ -187,6 +187,7 @@ let fn = {
187
187
  await p.parserConfig()
188
188
  await p.loadInfo()
189
189
  await p.readDir("")
190
+ console.log("转换结束", p.count)
190
191
  }
191
192
 
192
193
  test().then(() => {
@@ -205,7 +206,7 @@ let fn = {
205
206
  console.log(helpString)
206
207
  },
207
208
  v: () => {
208
- console.log("1.4.0")
209
+ console.log("1.4.1")
209
210
  }
210
211
  }
211
212
  let isFree = true
package/dist/bin.js CHANGED
@@ -136,6 +136,7 @@ var fn = {
136
136
  return [4 /*yield*/, p.readDir("")];
137
137
  case 3:
138
138
  _a.sent();
139
+ console.log("转换结束", p.count);
139
140
  return [2 /*return*/];
140
141
  }
141
142
  });
@@ -154,7 +155,7 @@ var fn = {
154
155
  console.log(helpString);
155
156
  },
156
157
  v: function () {
157
- console.log("1.4.0");
158
+ console.log("1.4.1");
158
159
  }
159
160
  };
160
161
  var isFree = true;
package/dist/tinify.js CHANGED
@@ -149,7 +149,7 @@ var TaskParser = /** @class */ (function () {
149
149
  };
150
150
  TaskParser.prototype.pick = function (element) {
151
151
  return __awaiter(this, void 0, void 0, function () {
152
- var inPath, outPath, info, reg, buffer, md5, code, _a, doc;
152
+ var inPath, outPath, info, reg, buffer, md5, code, _a, pathKey, doc;
153
153
  return __generator(this, function (_b) {
154
154
  switch (_b.label) {
155
155
  case 0:
@@ -179,7 +179,8 @@ var TaskParser = /** @class */ (function () {
179
179
  if (!_a) return [3 /*break*/, 6];
180
180
  return [3 /*break*/, 15];
181
181
  case 6:
182
- doc = this.info[inPath];
182
+ pathKey = inPath.replace("\\", "/");
183
+ doc = this.info[pathKey];
183
184
  if (!(doc == null)) return [3 /*break*/, 9];
184
185
  //没有记录
185
186
  // this.count++
@@ -224,7 +225,7 @@ var TaskParser = /** @class */ (function () {
224
225
  };
225
226
  TaskParser.prototype.tinify = function (inPath, outPath, buffer, code) {
226
227
  return __awaiter(this, void 0, void 0, function () {
227
- var outBuffer, md5Hash, inMd5, outMd5;
228
+ var outBuffer, md5Hash, inMd5, outMd5, pathKey;
228
229
  return __generator(this, function (_a) {
229
230
  switch (_a.label) {
230
231
  case 0:
@@ -237,11 +238,11 @@ var TaskParser = /** @class */ (function () {
237
238
  outMd5 = md5Hash.update(outBuffer).digest('hex');
238
239
  this.witeBuffer(outPath, outBuffer);
239
240
  console.log(inMd5, outMd5);
240
- // await this.db.updateOne({ inPath }, { inPath, outPath, inMd5, outMd5 }, { upsert: true })
241
- this.info[inPath] = { outPath: outPath, inMd5: inMd5, outMd5: outMd5 };
241
+ pathKey = inPath.replace("\\", "/");
242
+ outPath = outPath.replace("\\", "/");
243
+ this.info[pathKey] = { outPath: outPath, inMd5: inMd5, outMd5: outMd5 };
242
244
  this.saveInfo();
243
245
  this.count++;
244
- console.log("转换结束", this.count);
245
246
  return [2 /*return*/];
246
247
  }
247
248
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zero-tools",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Zero游戏开发工具",
5
5
  "main": "index.ts",
6
6
  "scripts": {
package/tinify.ts CHANGED
@@ -79,7 +79,8 @@ export class TaskParser {
79
79
  if (this.config.skipSpine && await this.isSpine(inPath)) {
80
80
  } else {
81
81
  // let doc = await this.db.findOne({ inPath })
82
- let doc = this.info[inPath]
82
+ let pathKey = inPath.replace("\\", "/")
83
+ let doc = this.info[pathKey]
83
84
 
84
85
  if (doc == null) {
85
86
  //没有记录
@@ -115,10 +116,11 @@ export class TaskParser {
115
116
  this.witeBuffer(outPath, outBuffer)
116
117
  console.log(inMd5, outMd5)
117
118
  // await this.db.updateOne({ inPath }, { inPath, outPath, inMd5, outMd5 }, { upsert: true })
118
- this.info[inPath] = { outPath, inMd5, outMd5 }
119
+ let pathKey = inPath.replace("\\", "/")
120
+ outPath = outPath.replace("\\", "/")
121
+ this.info[pathKey] = { outPath, inMd5, outMd5 }
119
122
  this.saveInfo()
120
123
  this.count++
121
- console.log("转换结束", this.count)
122
124
  }
123
125
  async copy(inPath: string, outPath: string, buffer: Buffer, code: string): Promise<void> {
124
126
  await this.witeBuffer(inPath, await this.readBuffer(outPath))