silphscope 1.4.20 → 1.4.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silphscope",
3
- "version": "1.4.20",
3
+ "version": "1.4.22",
4
4
  "description": "A firered/leafgreen ROM asset extractor for use in web applications",
5
5
  "main": "main.js",
6
6
  "types": "silphscope.d.ts",
@@ -69,7 +69,9 @@ export async function renderAllMons(rom, options = {}) {
69
69
  throw new TypeError(`renderAllMons(rom, options = { pngCompressionLevel, ... }) requires pngCompressionLevel to be a integer between 0 and 9 (received ${pngCompressionLevel})`)
70
70
  }
71
71
 
72
- fs.mkdirSync(outputDir, { recursive: true });
72
+ if (outputDir) {
73
+ fs.mkdirSync(outputDir, { recursive: true });
74
+ }
73
75
 
74
76
  const config = getRomConfig(rom);
75
77
  const reader = new RomReader(rom, config);
@@ -161,7 +163,9 @@ export async function renderAllIcons(rom, options = {}) {
161
163
  throw new TypeError(`renderAllIcons(rom, options = { pngCompressionLevel, ... }) requires pngCompressionLevel to be a integer between 0 and 9 (received ${pngCompressionLevel})`)
162
164
  }
163
165
 
164
- fs.mkdirSync(outputDir, { recursive: true });
166
+ if (outputDir) {
167
+ fs.mkdirSync(outputDir, { recursive: true });
168
+ }
165
169
 
166
170
  const config = getRomConfig(rom);
167
171
  const reader = new RomReader(rom, config);
@@ -247,7 +251,9 @@ export async function renderAllTrainers(rom, options = {}) {
247
251
  throw new TypeError(`renderAllTrainers(rom, options = { pngCompressionLevel, ... }) requires pngCompressionLevel to be a integer between 0 and 9 (received ${pngCompressionLevel})`)
248
252
  }
249
253
 
250
- fs.mkdirSync(outputDir, { recursive: true });
254
+ if (outputDir) {
255
+ fs.mkdirSync(outputDir, { recursive: true });
256
+ }
251
257
 
252
258
  const config = getRomConfig(rom);
253
259
  const reader = new RomReader(rom, config);
@@ -335,7 +341,9 @@ export async function renderAllMoves(rom, options = {}) {
335
341
  throw new TypeError(`renderAllMoves(rom, options = { pngCompressionLevel, ... }) requires pngCompressionLevel to be a integer between 0 and 9 (received ${pngCompressionLevel})`)
336
342
  }
337
343
 
338
- fs.mkdirSync(outputDir, { recursive: true });
344
+ if (outputDir) {
345
+ fs.mkdirSync(outputDir, { recursive: true });
346
+ }
339
347
 
340
348
  const config = getRomConfig(rom);
341
349
  const reader = new RomReader(rom, config);
@@ -426,7 +434,9 @@ export async function renderAllBalls(rom, options = {}) {
426
434
  throw new TypeError(`renderAllBalls(rom, options = { pngCompressionLevel, ... }) requires pngCompressionLevel to be a integer between 0 and 9 (received ${pngCompressionLevel})`)
427
435
  }
428
436
 
429
- fs.mkdirSync(outputDir, { recursive: true });
437
+ if (outputDir) {
438
+ fs.mkdirSync(outputDir, { recursive: true });
439
+ }
430
440
 
431
441
  const config = getRomConfig(rom);
432
442
  const reader = new RomReader(rom, config);
@@ -108,12 +108,12 @@ export async function renderMon(monName, mons, reader, rom, options = {}) {
108
108
  const dir = `${outputDir}/${monName}`;
109
109
  const fileName = `${dir}/${side}${variant === "shiny" ? "_shiny" : ""}.png`;
110
110
  await fs.promises.writeFile(fileName, pngBuffer);
111
+ fullFileCount += 1;
111
112
  }
112
113
 
113
114
  if (returnFileBuffer) {
114
115
  results.push(pngBuffer);
115
116
  }
116
- fullFileCount += 1;
117
117
  }
118
118
  }
119
119