|
NAMEnpm-pkg - Manages your package.jsonSynopsisnpm pkg set <key>=<value> [<key>=<value> ...] npm pkg get [<key> [<key> ...]] npm pkg delete <key> [<key> ...] DescriptionA command that automates the management of package.json files. npm pkg provide 3 different sub commands that allow you to modify or retrieve values for given object keys in your package.json.The syntax to retrieve and set fields is a dot separated representation of the nested object properties to be found within your package.json, it's the same notation used in npm help view to retrieve information from the registry manifest, below you can find more examples on how to use it. Returned values are always in json format.
npm pkg get name npm pkg get name version npm pkg get scripts.test npm pkg get contributors.email npm pkg get contributors[0].email
npm pkg set bin.mynewcommand=cli.js npm pkg set description='Awesome package' engines.node='>=10' npm pkg set contributors[0].name='Foo' contributors[0].email='foo@bar.ca' npm pkg set contributors[].name='Foo' contributors[].name='Bar' npm pkg set private=true --json npm pkg set tap.timeout=60 --json
npm pkg delete scripts.build Workspaces supportYou can set/get/delete items across your configured workspaces by using the workspace or workspaces config options.For example, setting a funding value across all configured workspaces of a project: npm pkg set funding=https://example.com --ws When using npm pkg get to retrieve info from your configured workspaces, the returned result will be in a json format in which top level keys are the names of each workspace, the values of these keys will be the result values returned from each of the configured workspaces, e.g: npm pkg get name version --ws { "a": { "name": "a", "version": "1.0.0" }, "b": { "name": "b", "version": "1.0.0" } } Configurationforce
Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input.
If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option! json
Whether or not to output JSON data, rather than the normal output.
Not supported by all npm commands. workspace
Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option. Valid values for the workspace config are either:
When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project. This value is not exported to the environment for child processes. workspaces
Set to true to run the command in the context of all configured workspaces. Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:
This value is not exported to the environment for child processes. See Also
Visit the GSP FreeBSD Man Page Interface. |