Is there a way to automatically build the package.json file for Node.js projects


Question

Is package.json supposed to be manually edited? Couldn't a program like npm just look through the files, see the "require" statements, and then use that to put the necessary entries in the package.json file? Are there any programs like that?

1
390
4/1/2012 2:45:56 AM

The package.json file is used by npm to learn about your node.js project.

Use npm init to generate package.json files for you!

It comes bundled with npm. Read its documentation here: https://docs.npmjs.com/cli/init

Also, there's an official tool you can use to generate this file programmatically: https://github.com/npm/init-package-json

583
6/13/2019 1:01:24 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon