package.json Generator
Fill in the name, version, scripts, module type and engines to get a clean starter package.json for a new Node project.
Use the tool
Why this tool exists
npm init asks questions one at a time and still leaves you editing the file afterwards. Copying a package.json from an older project drags along dependencies and settings you do not want. The fields that matter at the start are few: name, version, module type, entry point, scripts, licence and the Node version you support.
This tool collects those in one form and prints valid, indented JSON. Scripts are entered in a compact name=command style separated by semicolons, and a bad pair produces a clear error rather than silent junk. Empty optional fields are left out of the output instead of printed as blanks. The file has no dependencies listed, so install them with your package manager afterwards. Generation is local.
How to use it
- Enter the package name, version, description and author.
- Choose module for ES modules or commonjs, and set the entry file.
- Write scripts as name=command pairs separated by semicolons.
- Copy the JSON into package.json and run npm install.
Frequently asked questions
What is the module type setting?
module makes .js files load as ES modules with import and export. commonjs keeps the older require style. Choose module for new projects unless a tool you rely on needs commonjs.
How do I write several scripts?
Use name=command and separate pairs with a semicolon, for example start=node index.js; test=node --test. Only the first equals sign splits name from command, so commands may contain more of them.
What does Private do?
It adds private: true, which makes npm refuse to publish the package. Use it for applications and internal projects so you cannot publish them by accident.
Does it add dependencies?
No. Run npm install package-name afterwards and npm will add the dependencies with the current version ranges. A generated file also includes an empty keywords array for you to fill.