Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to provide default option values #55

Open
jhyland87 opened this issue Jan 4, 2016 · 2 comments
Open

Trying to provide default option values #55

jhyland87 opened this issue Jan 4, 2016 · 2 comments

Comments

@jhyland87
Copy link

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

@kevinSuttle
Copy link

See: https://docs.npmjs.com/misc/config#init-module. Note that I've filed this as well. npm/npm#11137 cc @isaacs.

@JordanMachado
Copy link

How we can pass some custom parameters so ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants