Package Exports
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (sort-jsonc-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
sort-jsonc-cli
✅ CLI for sort JSONC files without mangling comments!
Works with regular JSON files too, of course!
See sort-jsonc for the underlying library.
Usage
sort-jsonc [options] <files>
Options
Option | Alias | Description |
---|---|---|
--order |
-o |
The preferred order to sort keys as a comma-separated string. Prioritized over --order-file . Keys not in this list will be sorted alphabetically at the end. |
--order-file |
-O |
Path to a JSON file containing a list of strings in preferred order. Keys not in this list will be sorted alphabetically at the end. |
--remove-comments |
-c |
Whether to remove comments from the JSON. |
--spaces |
-S |
Number of spaces to indent the JSON. |
--silent |
-s |
Whether to suppress output. |
--help |
-v |
Show help info. |
Examples
Sort a file
$ sort-jsonc sort-jsonc path/to/file.jsonc
Sort multiple files
$ sort-jsonc path/to/file1.jsonc path/to/file2.jsonc
Sort a file by preferred order
$ sort-jsonc sort-jsonc path/to/file.jsonc -o name,version,description
Sort a file by preferred order from a file
$ sort-jsonc sort-jsonc path/to/file.jsonc -O path/to/order.json
Sort a file and remove comments
$ sort-jsonc sort-jsonc path/to/file.jsonc -c