I recently learned that it's possible to set default values for the package.json file when running the npm init command.

For example, I ran the following commands to set defaults for the version, author, and license fields:

npm set init.version "0.0.0"
npm set init.author.name "Kieran Barker"
npm set init.author.email "kieranbarker@outlook.com"
npm set init.author.url "https://kbarker.dev"
npm set init.license "MIT"

Now when I run npm init, these are the defaults:

"name": "some-package",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"keywords": [],
"author": "Kieran Barker <kieranbarker@outlook.com> (https://kbarker.dev)",
"license": "MIT"

Reference: Setting config options for the init command.