cli tool that cleans up package.json files.
A package.json file scrubber for the truly insane.
It will re-write your package.json file as follows:
- name first
- description second
- version third
- author fourth
- all other keys in alphabetical order
- dependencies and devDependencies sorted alphabetically
- newline at the end of the file
It will warn you if any of these are missing:
Fix all indenting to 2 spaces.
Oh, and it will tolerate improperly quoted and comma'd JSON thanks to ALCE.
Oh, and can do same if you pass it a
bower.json file or whatnot.
- install it globally
npm i -g fixpack
- run it in the same directory as your package.json, that's it.
npm i cool_package --save && fixpack
It's configurable. You can create a
.fixpackrc file in your project or anywhere up the tree to your
$HOME directory. Or overwrite options via CLI arguments.
Uses the rc module to do this. So you can pass all these as CLI args too.
The available options and their defaults shown below:
// will put these first in this order if presentsortToTop:'name''description''version''author'// will error if these not presentrequired:'name''version'// will warn if these not presentwarn:'description''author''repository''keywords''main''bugs''homepage''license'// if `private: true` in package.json will use the next two lists insteadrequiredOnPrivate:warnOnPrivate: 'name' 'version' 'description' 'main'// sub items to sort by defaultsortedSubItems:'dependencies''devDependencies''jshintConfig''scripts''keywords'// if you set quiet to true it won't do output anything to the consolequiet: false// files to scrubfiles: 'package.json'
- 2.0.1 - don't error on missing bower file by default.
- 2.0.0 - configurable via
.fixpackrcfile using rc module.
- x.x.x - unknown miscellaneous madness and poor version tracking
- 0.0.2 diff - EOF newline
- 0.0.1 - initial release
This embarrassing display of insanity, type-A-ness, and OCD brought to you by @HenrikJoreteg.