I’m new Node.js development and I have a question about best practices when writing package.json
files.
From my understanding, you have to list all devependences that you need to execute your app under "dependencies"
in the package.json
file. All your extra dependences that are required to run your test (or your build process) have to be listed in "devDependencies"
.
But what about tools that you additionally use, but which are not necessarily required by every developer. Take the node-inspector
package as an example, which I installed globally on my machine but did not add to the package.json
file.
Is that a good practice, or would you recommend to also file those packages as "devDependencies"
?
devDependencies
are packages you need in order to work on your project. Testing frameworks used in the project, mock APIs, CSS preprocessors (if you don’t ship a compiled version) fit here.
node-inspector
is not needed for you to run tests and make changes to parts of your code, so it should not be included in the package. Other users might use different debuggers.