Find the nearest package.json then deal with jq syntax on it. (in-line edit supported!)
APACHE-2.0 License
Source: Processing JSON Data With jq
Find the nearest package.json then deal with jq syntax on it. (in-line edit supported!)
package.json
in current and all parent directories by default, powered by pkg-up.jq
syntax to deal with the json file, powered by node-jq.In-place
edit support by specify a -i
or --in-place
argument.$ 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"'
$ grep version package.json
"version": "0.0.6",
$ pkg-jq .version
"0.0.6"
# Raw mode: -r
$ pkg-jq -r .version
0.0.6
$ grep -E 'publish|tag' package.json
"publishConfig": {
"tag": "next"
$ pkg-jq -i '.publishConfig.tag="latest"'
$ grep -E 'publish|tag' package.json
"publishConfig": {
"tag": "latest"
sudo apt-get install libtool
-i
parameter-r
parameterHuan LI (李卓桓) [email protected]