Use local svgo.cmd wrapper binary
Switch SVG optimizer resolution from bin/svgo-cli.exe to bin/svgo.cmd. Update unit tests to validate the new local binary path behavior. Co-Authored-By: Abacus.AI CLI <agent@abacus.ai>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { optimize } from "svgo";
|
||||
import fs from "fs";
|
||||
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length === 0) {
|
||||
console.error("Error: No input file");
|
||||
console.log("Usage: svgo <input.svg> [output.svg]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const [input, output = input] = args;
|
||||
|
||||
if (!fs.existsSync(input)) {
|
||||
console.error("Error: File not found:", input);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const svg = fs.readFileSync(input, "utf8");
|
||||
|
||||
const result = optimize(svg, { multipass: true });
|
||||
|
||||
fs.writeFileSync(output, result.data);
|
||||
|
||||
console.log("✔ Optimized:", input);
|
||||
Reference in New Issue
Block a user