Skip to content

Trying to provide default option values #55

@jhyland87

Description

@jhyland87

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions