npm json file 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: 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 3: 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.