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 "kieran@barker.codes"
npm set init.author.url "https://barker.codes"
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 <kieran@barker.codes> (https://barker.codes)",
"license": "MIT"

Reference: Setting config options for the init command.