Skip to content
Find the nearest package.json then deal with jq syntax on it. (in-line edit supported!)
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode make eslint happy Jun 9, 2019
bin Add help msg for raw Jun 16, 2019
docs/images add pkg-jq banner image Jun 9, 2019
scripts fix self redirect problem Jun 10, 2019
src Add help msg for raw Jun 16, 2019
tests fix raw version in ci Jun 10, 2019
.editorconfig init files Jun 9, 2019
.eslintrc.yaml make eslint happy Jun 9, 2019
.gitignore
.travis.yml
LICENSE init files Jun 9, 2019
README.md Merge branch 'master' of github.com:huan/pkg-jq Jun 20, 2019
package.json 0.2.4 Jun 20, 2019
tsconfig.json init files Jun 9, 2019

README.md

pkg-jq

NPM Version npm (tag) Build Status TypeScript Greenkeeper badge

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

  1. Search package.json in current and all parent directories by default, powered by pkg-up.
  2. Use jq syntax to deal with the json file, powered by node-jq.
  3. 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)

  1. Support in-line edit by -i parameter
  2. Support raw mode by -r parameter
  3. Good unit tests coverage
  4. Travis CI DevOps

v0.0.1 (09 Jun 2019)

  1. Project inited.

AUTHOR

Huan LI (李卓桓) zixia@zixia.net

Profile of Huan LI (李卓桓) on StackOverflow

COPYRIGHT & LICENSE

  • Code & Docs © 2019 - now Huan LI zixia@zixia.net
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons
You can’t perform that action at this time.