Gamefroot / Gamefroot-Texture-Packer

Generate high quality texture atlases in Node.js, developed for Gamefroot.com and Kiwi.js.
MIT License
26 stars 3 forks source link

CLI and JS interfaces have different default options based on format #17

Open ayebear opened 6 years ago

ayebear commented 6 years ago

Problem

Since optimist always sets the same default values no matter what on the CLI, when using the JS interface, those values aren't defined yet, so the defaulting code runs and applies the defaults from the templates for all the formats.

To Reproduce

With JS, use { format: 'pixi.js' }, which will set 'trim' to true. This combined with gutter produces messed up results, and what led me to find this bug. On the CLI, use "-f pixi.js", which sets 'trim' to false. This works fine with gutter.

Possible solution

Remove the default values from the command line parser, so that the regular logic in the generate() function runs and properly populates these values.