package.json code example
Example 1: change name in package json from command line
cd some/node/project
npe name
npe scripts
npe scripts.test
npe repository.url
open $(npe repository.url)
npe name foo
npe scripts.start "node index.js"
npe keywords "foo, bar, cheese whiz"
npe keywords "foo bar baz"
npe name --package=some/other/package.json
npe name other --package=some/other/package.json
Example 2: package.json what is it for
Metadata that is specific to the project. It contains a collection of any
given project's dependencies.
A web application is used to identify the project and acts as a
baseline for users and contributors to get information about the project.
Example 3: what is npm init
The npm init command is a step-by-step tool to scaffold out your project.
It will prompt you for input for a few aspects of the project
in the following order:
The project's name,
The project's initial version,
The project's description,
The project's entry point (meaning the project's main file),
The project's test command (to trigger testing with something like Standard)
The project's git repository (where the project source can be found)
The project's keywords (basically, tags related to the project)
The project's license (this defaults to ISC - most open-source Node.js projects are MIT)
Example 4: what is package.json in node
All npm packages contain a file, usually in the project root, called package. json - this file holds various metadata relevant to the project. This file is used to give information to npm that allows it to identify the project as well as handle the project's dependencies.
Example 5: what is package.json
metadata specific to the project
a web application, Node.js module, or even just a plain JavaScirpt library.
identifies the project and acts as a baseline for users and contributors
to get information about the project.
contains a collection of any given project's dependencies
Example 6: package.json files property local
"scripts": {
"postinstall": "node install.js"
},
"localDependencies": {
"ui-elements": "file:path/to/ui-elements"
},
"dependencies": {
"ui-elements": "git+https://[email protected]/user/ui-elements.git"
}