New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pika-plugin-package.json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pika-plugin-package.json

@pika/pack build plugin to modify package.json file

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
decreased by-17.24%
Maintainers
1
Weekly downloads
 
Created
Source

pika-plugin-package.json

Build Status Coverage Status License NPM Made with Love

@pika/pack build plugin to modify package.json file.

Install

$ yarn add --dev pika-plugin-package.json

Or using npm

$ npm install --save-dev pika-plugin-package.json

Usage

{
  "name": "example-package-json",
  "version": "1.0.0",
  "@pika/pack": {
    "pipeline": [
      // ---8<---
      [
        "pika-plugin-package.json",
        {
          "+dependencies": {
            "lodash": "^"
          },
          "*keywords": ["+example"],
          "*files": ["-bin/"],
          "+author": "^",
          "-devDependencies": {}
        }
      ]
    ]
  }
}

Options

Pass any object, and it will be merged to result pkg/package.json
There are three modifiers, which you can add to properties / array items:

  • -: remove this property / item
  • *: merge this property (if there is no such property - it will be added)
  • +: add this property / item (if already exists - it will be replaced)

By default (without modifier) - merge (*) is applied. But I recomment always define modifiers for more expressness and clarity.

If you want, for some reason, add property named *prop (for example) — you can escape modifier like this - \\*prop - or just explicitly define needed modifier - +*prop - as I recommended before.

For example

"+license": "MIT"
will add (or replace) license field.

"-devDependencies": {}
will remove devDependencies (value is not really matters here).

"*dependencies": { "lodash": "^4.17.15" }
will add lodash dependency to existing dependencies (or will create dependencies with lodash, if there were no any dependencies).

"*files": ["-bin/"]
will remove bin/ item from files property.

Inheritance

You can specify special value ^ to any property, and value will be populated from original package.json. For example:

"+author": "^"
will add author field with value from original package.json (if defined).

This should work on any deep level, but only with object properties (no arrays).

Real world example

You can check this package's package.json, I use pika-plugin-package.json in pipeline to modify pika-plugin-package.json's package.json ^_^

Sponsored

Setplex

Keywords

FAQs

Package last updated on 09 Jan 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc