mirror of
https://github.com/smogon/sprites.git
synced 2026-12-05 15:31:38 -06:00
`magick convert` is ImageMagick 7 running its 6 compatibility entry point, which since 7.1.1 prints a deprecation warning on every invocation. The build runs it about eleven thousand times, so a deploy is eleven thousand lines of it, and the one warning worth reading -- gifsicle's, when a rule hands it more colors than a global colormap holds -- is buried in them. Drop `convert` and give gifsicle -w. Neither is a free rename: v7 semantics differ from the compatibility mode's, and gifsicle's rule identity is its command line, so the -w rebuilds every gif in the tree. `refactor --record` before and `refactor` after says 21847 files, 0 changed, so nothing published moves and no upload follows this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
49 lines
1.7 KiB
TypeScript
49 lines
1.7 KiB
TypeScript
|
|
import assert from 'node:assert/strict';
|
|
import {test} from 'node:test';
|
|
|
|
import {basenameNoExt, flattenCmds, substitute} from '../subst.ts';
|
|
|
|
test('substitute expands %f/%o/%b/%B', () => {
|
|
assert.equal(
|
|
substitute('convert %f -x %o', ['src/a.png'], ['build/a.png']),
|
|
'convert src/a.png -x build/a.png');
|
|
assert.equal(
|
|
substitute('%f + %b + %B', ['src/d/x.tar.gz', 'y.png'], []),
|
|
'src/d/x.tar.gz y.png + x.tar.gz y.png + x.tar y');
|
|
});
|
|
|
|
test('substitute handles quoted frame selector', () => {
|
|
assert.equal(
|
|
substitute('magick "%f[0]" -trim %o', ['src/models/a.gif'], ['out/a.png']),
|
|
'magick "src/models/a.gif[0]" -trim out/a.png');
|
|
});
|
|
|
|
test('substitute expands indexed %oN', () => {
|
|
assert.equal(
|
|
substitute('tool --image %o1 --stylesheet %o2 -- %f', ['a.png'], ['x.png', 'x.css']),
|
|
'tool --image x.png --stylesheet x.css -- a.png');
|
|
assert.equal(substitute('%o10', [], ['1', '2', '3', '4', '5', '6', '7', '8', '9', 'ten']), 'ten');
|
|
});
|
|
|
|
test('substitute rejects out-of-range %oN', () => {
|
|
assert.throws(() => substitute('%o2', ['a'], ['b']), /out of range/);
|
|
assert.throws(() => substitute('%o0', ['a'], ['b']), /out of range/);
|
|
});
|
|
|
|
test('substitute rejects unknown escapes', () => {
|
|
assert.throws(() => substitute('%d', ['a'], ['b']), /Unknown substitution/);
|
|
});
|
|
|
|
test('flattenCmds flattens, trims, drops empties', () => {
|
|
assert.deepEqual(
|
|
flattenCmds(['a', [' b ', [], ['c', '']], 'd']),
|
|
['a', 'b', 'c', 'd']);
|
|
});
|
|
|
|
test('basenameNoExt', () => {
|
|
assert.equal(basenameNoExt('src/dex/10001-b.png'), '10001-b');
|
|
assert.equal(basenameNoExt('noext'), 'noext');
|
|
assert.equal(basenameNoExt('a/.hidden'), '.hidden');
|
|
});
|