diff options
-rw-r--r-- | node_modules/init-package-json/.npmignore | 2 | ||||
-rw-r--r-- | node_modules/init-package-json/default-input.js | 12 | ||||
-rw-r--r-- | node_modules/init-package-json/package.json | 15 | ||||
-rw-r--r-- | node_modules/init-package-json/test/npm-defaults.js | 49 | ||||
-rw-r--r-- | package.json | 2 |
5 files changed, 66 insertions, 14 deletions
diff --git a/node_modules/init-package-json/.npmignore b/node_modules/init-package-json/.npmignore new file mode 100644 index 000000000..44a3be18e --- /dev/null +++ b/node_modules/init-package-json/.npmignore @@ -0,0 +1,2 @@ +node_modules/ +.eslintrc diff --git a/node_modules/init-package-json/default-input.js b/node_modules/init-package-json/default-input.js index 721da45b7..c86894b26 100644 --- a/node_modules/init-package-json/default-input.js +++ b/node_modules/init-package-json/default-input.js @@ -41,7 +41,7 @@ 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') || '1.0.0' exports.version = yes ? version : prompt('version', version) if (!package.description) { @@ -177,14 +177,14 @@ if (!package.keywords) { } if (!package.author) { - exports.author = config.get('init.author.name') + exports.author = 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'), + "email" : config.get('init-author-email'), + "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') || '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 dc98eac23..54aa7cbdf 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.0", + "version": "1.1.1", "main": "init-package-json.js", "scripts": { "test": "tap test/*.js" @@ -24,8 +24,9 @@ "semver": "2.x || 3.x || 4" }, "devDependencies": { - "tap": "~0.2.5", - "rimraf": "~2.0.2" + "npm": "^2.1.4", + "rimraf": "^2.1.4", + "tap": "^0.4.13" }, "keywords": [ "init", @@ -39,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": "f6ced3cecbee6b4717624a6a905db3566100c90a", + "gitHead": "a4df4e57f9b6a2bf906ad50612dbed7dcb2f2c2b", "bugs": { "url": "https://github.com/isaacs/init-package-json/issues" }, "homepage": "https://github.com/isaacs/init-package-json", - "_id": "init-package-json@1.1.0", - "_shasum": "fea80c641974421ddd4c6169c3a911118b116d5c", - "_from": "init-package-json@>=1.1.0 <1.2.0" + "_id": "init-package-json@1.1.1", + "_shasum": "e09e9f1fb541e0fddc9175c5ce1736fd45ff4bf8", + "_from": "init-package-json@>=1.1.1 <2.0.0" } diff --git a/node_modules/init-package-json/test/npm-defaults.js b/node_modules/init-package-json/test/npm-defaults.js new file mode 100644 index 000000000..8229c84a0 --- /dev/null +++ b/node_modules/init-package-json/test/npm-defaults.js @@ -0,0 +1,49 @@ +var test = require("tap").test +var rimraf = require("rimraf") +var resolve = require("path").resolve + +var npm = require("npm") +var init = require("../") + +var EXPECTED = { + name : "test", + version : "3.1.4", + description : "", + main : "basic.js", + scripts : { + test : 'echo "Error: no test specified" && exit 1' + }, + keywords : [], + author : "npmbot <n@p.m> (http://npm.im)", + license : "WTFPL" +} + +test("npm configuration values pulled from environment", function (t) { + /*eslint camelcase:0 */ + process.env.npm_config_yes = "yes" + + process.env.npm_config_init_author_name = "npmbot" + process.env.npm_config_init_author_email = "n@p.m" + process.env.npm_config_init_author_url = "http://npm.im" + + process.env.npm_config_init_license = EXPECTED.license + process.env.npm_config_init_version = EXPECTED.version + + npm.load({}, 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 environment") + t.end() + }) + }) +}) + +test("cleanup", function (t) { + rimraf.sync(resolve(__dirname, "package.json")) + t.pass("cleaned up") + t.end() +}) diff --git a/package.json b/package.json index a435f59e8..3b9bd959c 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "inflight": "~1.0.4", "inherits": "~2.0.1", "ini": "~1.3.0", - "init-package-json": "~1.1.0", + "init-package-json": "~1.1.1", "lockfile": "~1.0.0", "lru-cache": "~2.5.0", "minimatch": "~1.0.0", |