diff options
Diffstat (limited to 'node_modules/init-package-json')
-rw-r--r-- | node_modules/init-package-json/default-input.js | 22 | ||||
-rw-r--r-- | node_modules/init-package-json/package.json | 10 | ||||
-rw-r--r-- | node_modules/init-package-json/test/npm-defaults.js | 52 |
3 files changed, 73 insertions, 11 deletions
diff --git a/node_modules/init-package-json/default-input.js b/node_modules/init-package-json/default-input.js index c86894b26..9f459f019 100644 --- a/node_modules/init-package-json/default-input.js +++ b/node_modules/init-package-json/default-input.js @@ -41,7 +41,10 @@ function readDeps (test) { return function (cb) { var name = package.name || basename exports.name = yes ? name : prompt('name', name) -var version = package.version || config.get('init-version') || '1.0.0' +var version = package.version || + config.get('init-version') || + config.get('init.version') || + '1.0.0' exports.version = yes ? version : prompt('version', version) if (!package.description) { @@ -177,14 +180,21 @@ if (!package.keywords) { } if (!package.author) { - exports.author = config.get('init-author-name') + exports.author = config.get('init-author-name') || + config.get('init.author.name') ? { - "name" : config.get('init-author-name'), - "email" : config.get('init-author-email'), - "url" : config.get('init-author-url') + "name" : config.get('init-author-name') || + config.get('init.author.name'), + "email" : config.get('init-author-email') || + config.get('init.author.email'), + "url" : config.get('init-author-url') || + config.get('init.author.url') } : prompt('author') } -var license = package.license || config.get('init-license') || 'ISC' +var license = package.license || + config.get('init-license') || + config.get('init.license') || + 'ISC' exports.license = yes ? license : prompt('license', license) diff --git a/node_modules/init-package-json/package.json b/node_modules/init-package-json/package.json index 54aa7cbdf..b70a5ef2f 100644 --- a/node_modules/init-package-json/package.json +++ b/node_modules/init-package-json/package.json @@ -1,6 +1,6 @@ { "name": "init-package-json", - "version": "1.1.1", + "version": "1.1.2", "main": "init-package-json.js", "scripts": { "test": "tap test/*.js" @@ -40,12 +40,12 @@ ], "readme": "# init-package-json\n\nA node module to get your node module started.\n\n## Usage\n\n```javascript\nvar init = require('init-package-json')\nvar path = require('path')\n\n// a path to a promzard module. In the event that this file is\n// not found, one will be provided for you.\nvar initFile = path.resolve(process.env.HOME, '.npm-init')\n\n// the dir where we're doin stuff.\nvar dir = process.cwd()\n\n// extra stuff that gets put into the PromZard module's context.\n// In npm, this is the resolved config object. Exposed as 'config'\n// Optional.\nvar configData = { some: 'extra stuff' }\n\n// Any existing stuff from the package.json file is also exposed in the\n// PromZard module as the `package` object. There will also be free\n// vars for:\n// * `filename` path to the package.json file\n// * `basename` the tip of the package dir\n// * `dirname` the parent of the package dir\n\ninit(dir, initFile, configData, function (er, data) {\n // the data's already been written to {dir}/package.json\n // now you can do stuff with it\n})\n```\n\nOr from the command line:\n\n```\n$ npm-init\n```\n\nSee [PromZard](https://github.com/isaacs/promzard) for details about\nwhat can go in the config file.\n", "readmeFilename": "README.md", - "gitHead": "a4df4e57f9b6a2bf906ad50612dbed7dcb2f2c2b", + "gitHead": "3c72949ef6a776e0ce963fb13560a1b810f371c8", "bugs": { "url": "https://github.com/isaacs/init-package-json/issues" }, "homepage": "https://github.com/isaacs/init-package-json", - "_id": "init-package-json@1.1.1", - "_shasum": "e09e9f1fb541e0fddc9175c5ce1736fd45ff4bf8", - "_from": "init-package-json@>=1.1.1 <2.0.0" + "_id": "init-package-json@1.1.2", + "_shasum": "bc6c02d1da87253141600972f0d6bdcdd016990e", + "_from": "init-package-json@>=1.1.2 <1.2.0" } diff --git a/node_modules/init-package-json/test/npm-defaults.js b/node_modules/init-package-json/test/npm-defaults.js index 8229c84a0..cc46a8e28 100644 --- a/node_modules/init-package-json/test/npm-defaults.js +++ b/node_modules/init-package-json/test/npm-defaults.js @@ -42,6 +42,58 @@ test("npm configuration values pulled from environment", function (t) { }) }) +test("npm configuration values pulled from dotted config", function (t) { + /*eslint camelcase:0 */ + var config = { + yes : "yes", + + "init.author.name" : "npmbot", + "init.author.email" : "n@p.m", + "init.author.url" : "http://npm.im", + + "init.license" : EXPECTED.license, + "init.version" : EXPECTED.version + } + + npm.load(config, function (err) { + t.ifError(err, "npm loaded successfully") + + process.chdir(resolve(__dirname)) + init(__dirname, __dirname, npm.config, function (er, data) { + t.ifError(err, "init ran successfully") + + t.same(data, EXPECTED, "got the package data from the config") + t.end() + }) + }) +}) + +test("npm configuration values pulled from dashed config", function (t) { + /*eslint camelcase:0 */ + var config = { + yes : "yes", + + "init-author-name" : "npmbot", + "init-author-email" : "n@p.m", + "init-author-url" : "http://npm.im", + + "init-license" : EXPECTED.license, + "init-version" : EXPECTED.version + } + + npm.load(config, function (err) { + t.ifError(err, "npm loaded successfully") + + process.chdir(resolve(__dirname)) + init(__dirname, __dirname, npm.config, function (er, data) { + t.ifError(err, "init ran successfully") + + t.same(data, EXPECTED, "got the package data from the config") + t.end() + }) + }) +}) + test("cleanup", function (t) { rimraf.sync(resolve(__dirname, "package.json")) t.pass("cleaned up") |