New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

pkg-jq

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pkg-jq

Find the nearest package.json then modify it inline by jq syntax

latest
Source
npmnpm
Version
0.2.11
Version published
Maintainers
1
Created
Source

pkg-jq

NPM Version npm (tag) NPM TypeScript

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 (李卓桓) zixia@zixia.net

Profile of Huan LI (李卓桓) on StackOverflow

  • Code & Docs © 2019 - now Huan LI zixia@zixia.net
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

Keywords

package

FAQs

Package last updated on 08 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts