init-package-json
init-package-json copied to clipboard
Trying to provide default option values
My code example (below) is pretty much exactly what was taken from the README file, just with less comments and the configData
populated differently.
I thought that passing an object to the 3rd parameter of the init
method would provide it with default options, but I guess thats not the case?
var init = require('init-package-json')
var path = require('path')
var initFile = path.resolve(process.env.HOME, '.npm-init')
var dir = process.cwd()
// Desired default settings/options
var configData = {
name: 'Default Name..',
description: 'Default description..',
some: 'extra stuff' // What is this one even suppose to do then?..
}
init(dir, initFile, configData, ( er, data ) => {
console.log('Result:', err || data)
})
Is there a way to provide default options? Short of creating the package.json manually
Thanks
See: https://docs.npmjs.com/misc/config#init-module. Note that I've filed this as well. https://github.com/npm/npm/issues/11137 cc @isaacs.
How we can pass some custom parameters so ?