clean-package
clean-package copied to clipboard
Package JSON specification expects string for specific keys
For example, peer dependencies can simply be a numeric string ("1", "2", etc.). However, the following code converts such values to numbers (1, 2, etc.).
https://github.com/roydukkey/clean-package/blob/a03da14f3c9cb6fae61807ec299bc724d2ecd905/src/clean.ts#L41
At the very least the values should probably maintain the same type in which they are provided. Possible using a replacer like this:
JSON.stringify(source, (key, value) => value);
hummm... this appears to only affect CLI input, which is coerced into their type from strings. So this culprit doesn't appear to be the JSON stringification.
Maybe there should be some notation to prevent this coercion. For example, possibly quotes around the value.
--replace peerDependencies.depOne='1' peerDependencies.depTwo="2"