mirror of
https://github.com/smogon/sprites.git
synced 2026-08-20 08:45:06 -05:00
sheet: pass list of sprites in a tmp file
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
import 'make-promises-safe';
|
||||
import cp from 'child_process';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import crypto from 'crypto';
|
||||
|
||||
const sheetjs = process.argv[2];
|
||||
const dest = process.argv[3];
|
||||
@@ -21,9 +23,14 @@ for (let i = 0; i < sheet.entries.length; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
// Store list of sprite files in a temp file, Windows can't handle large cli arg
|
||||
// lists. Just append a random string to the dest file
|
||||
const tmpFile = `${dest}.tmp.${crypto.randomBytes(6).readUIntLE(0,6).toString(36)}`;
|
||||
fs.writeFileSync(tmpFile, sheet.entries.join("\n"), 'utf8');
|
||||
|
||||
cp.execFileSync("magick", [
|
||||
"montage",
|
||||
...sheet.entries,
|
||||
`@${tmpFile}`,
|
||||
"-background", "transparent",
|
||||
"-geometry", `${sheet.width}x${sheet.height}>`,
|
||||
"-gravity", "center",
|
||||
@@ -31,3 +38,5 @@ cp.execFileSync("magick", [
|
||||
"-depth", "8",
|
||||
dest
|
||||
]);
|
||||
|
||||
fs.unlinkSync(tmpFile);
|
||||
|
||||
Reference in New Issue
Block a user