@pika/pack project is unmaintained and archived, last release was 4 years ago. Even while there is an issue about author looking for help witn maintenance, it was created 3 years ago itself, and still has no answers. So, I think, it would be safe to say, that, sadly, but @pika/pack is dead. So this project is too.
@pika/pack build plugin to modify package.json file.
$ yarn add --dev pika-plugin-package.json
Or using npm
$ npm install --save-dev pika-plugin-package.json
{
"name": "example-package-json",
"version": "1.0.0",
"@pika/pack": {
"pipeline": [
// ---8<---
[
"pika-plugin-package.json",
{
"+dependencies": {
"lodash": "^"
},
"*keywords": ["+example"],
"*files": ["-bin/"],
"+author": "^",
"-devDependencies": {}
}
]
]
}
}
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.
"+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.
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).
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 ^_^