pkg-jq
v0.2.11
Published
Find the nearest package.json then modify it inline by jq syntax
Downloads
13,776
Readme
pkg-jq
Source: Processing JSON Data With jq
Find the nearest package.json then deal with jq syntax on it. (in-line edit supported!)
FEATURES
- Search
package.json
in current and all parent directories by default, powered by pkg-up. - Use
jq
syntax to deal with the json file, powered by node-jq. In-place
edit support by specify a-i
or--in-place
argument.
USAGE
$ npm-jq --help
usage: pkg-jq [-h] [-v] [-i] [-r] filter [path]
Node.js Package jq Utility
Positional arguments:
filter jq filter.
path npm project subdir, or json file. default: $PWD.
Optional arguments:
-h, --help Show this help message and exit.
-v, --version Show programs version number and exit.
-i, --in-place edit files in place.
-r, --raw output raw strings, not JSON texts.
Exmaple: pkg-jq -i '.publishConfig.tag="next"'
1. Query
$ grep version package.json
"version": "0.0.6",
$ pkg-jq .version
"0.0.6"
# Raw mode: -r
$ pkg-jq -r .version
0.0.6
2. Edit In Place
$ grep -E 'publish|tag' package.json
"publishConfig": {
"tag": "next"
$ pkg-jq -i '.publishConfig.tag="latest"'
$ grep -E 'publish|tag' package.json
"publishConfig": {
"tag": "latest"
DEVELOPMENT
Ubuntu
sudo apt-get install libtool
HISTORY
master
v0.2 (10 Jun 2019)
- Support in-line edit by
-i
parameter - Support raw mode by
-r
parameter - Good unit tests coverage
- Travis CI DevOps
v0.0.1 (09 Jun 2019)
- Project inited.
AUTHOR
Huan LI (李卓桓) [email protected]
COPYRIGHT & LICENSE
- Code & Docs © 2019 - now Huan LI [email protected]
- Code released under the Apache-2.0 License
- Docs released under Creative Commons