diff options
16 files changed, 223 insertions, 138 deletions
diff --git a/node_modules/init-package-json/default-input.js b/node_modules/init-package-json/default-input.js index 3af2f62af..6d8d9e7bd 100644 --- a/node_modules/init-package-json/default-input.js +++ b/node_modules/init-package-json/default-input.js @@ -54,7 +54,8 @@ if (scope) { exports.name = yes ? name : prompt('name', name, function (data) { var its = validateName(data) if (its.validForNewPackages) return data - var er = new Error('Sorry, ' + its.errors.join(' and ') + '.') + var errors = (its.errors || []).concat(its.warnings || []) + var er = new Error('Sorry, ' + errors.join(' and ') + '.') er.notValid = true return er }) diff --git a/node_modules/init-package-json/example/example-basic.js b/node_modules/init-package-json/example/example-basic.js index 29b0c818d..0d13bda06 100644 --- a/node_modules/init-package-json/example/example-basic.js +++ b/node_modules/init-package-json/example/example-basic.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() var initFile = require.resolve('./init/basic-init.js') diff --git a/node_modules/init-package-json/example/example-default.js b/node_modules/init-package-json/example/example-default.js index f3aea518c..29a819906 100644 --- a/node_modules/init-package-json/example/example-default.js +++ b/node_modules/init-package-json/example/example-default.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() init(dir, 'file that does not exist', function (err, data) { diff --git a/node_modules/init-package-json/example/example-npm.js b/node_modules/init-package-json/example/example-npm.js index b394eeabc..292da6a7a 100644 --- a/node_modules/init-package-json/example/example-npm.js +++ b/node_modules/init-package-json/example/example-npm.js @@ -1,5 +1,4 @@ var init = require('../init-package-json.js') -var path = require('path') var dir = process.cwd() var npm = require('npm') @@ -10,4 +9,3 @@ npm.load(function (er, npm) { console.log('written successfully') }) }) - diff --git a/node_modules/init-package-json/node_modules/promzard/package.json b/node_modules/init-package-json/node_modules/promzard/package.json index 42900314b..1407e97be 100644 --- a/node_modules/init-package-json/node_modules/promzard/package.json +++ b/node_modules/init-package-json/node_modules/promzard/package.json @@ -8,7 +8,7 @@ "description": "prompting wizardly", "version": "0.3.0", "repository": { - "url": "git://github.com/isaacs/promzard" + "url": "git://github.com/isaacs/promzard.git" }, "dependencies": { "read": "1" @@ -46,5 +46,6 @@ "tarball": "http://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz" }, "directories": {}, - "_resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz" + "_resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz", + "readme": "ERROR: No README data found!" } diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json index e650240c7..c5ec77f13 100644 --- a/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/node_modules/builtins/package.json @@ -4,7 +4,7 @@ "description": "List of node.js builtin modules", "repository": { "type": "git", - "url": "git://github.com/juliangruber/builtins" + "url": "git://github.com/juliangruber/builtins.git" }, "license": "MIT", "main": "builtins.json", @@ -41,5 +41,6 @@ ], "directories": {}, "_shasum": "355219cd6cf18dbe7c01cc7fd2dce765cfdc549a", - "_resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz" + "_resolved": "https://registry.npmjs.org/builtins/-/builtins-0.0.7.tgz", + "readme": "ERROR: No README data found!" } diff --git a/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json b/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json index d421ae9fa..dd17dd820 100644 --- a/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json +++ b/node_modules/init-package-json/node_modules/validate-npm-package-name/package.json @@ -17,7 +17,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/npm/validate-npm-package-name" + "url": "git+https://github.com/npm/validate-npm-package-name.git" }, "keywords": [ "npm", @@ -53,5 +53,6 @@ "shasum": "ca006761b2b325f107fab172fb0cfcfc5e412c58", "tarball": "http://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.0.1.tgz" }, - "_resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.0.1.tgz" + "_resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-2.0.1.tgz", + "readme": "ERROR: No README data found!" } diff --git a/node_modules/init-package-json/package.json b/node_modules/init-package-json/package.json index a7deb8823..a0acb61d1 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.4.1", + "version": "1.4.2", "main": "init-package-json.js", "scripts": { "test": "tap test/*.js" @@ -42,12 +42,12 @@ ], "readme": "# init-package-json\n\nA node module to get your node module started.\n\n[![Build Status](https://secure.travis-ci.org/npm/init-package-json.svg)](http://travis-ci.org/npm/init-package-json)\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": "037635311227464c4e512e79792616288683c3b9", + "gitHead": "99bddf908a582daeacf27cf05bd46ec5b0ec5e42", "bugs": { "url": "https://github.com/isaacs/init-package-json/issues" }, "homepage": "https://github.com/isaacs/init-package-json#readme", - "_id": "init-package-json@1.4.1", - "_shasum": "6f68a14e181941849d84f6861f946e0028716cee", - "_from": "init-package-json@>=1.4.1 <1.5.0" + "_id": "init-package-json@1.4.2", + "_shasum": "66e606c5ab458340fb229fa4c25f9062879ffa88", + "_from": "init-package-json@>=1.4.2 <1.5.0" } diff --git a/node_modules/init-package-json/test/basic.js b/node_modules/init-package-json/test/basic.js index 7e3134ee6..f07f435bc 100644 --- a/node_modules/init-package-json/test/basic.js +++ b/node_modules/init-package-json/test/basic.js @@ -1,48 +1,33 @@ -var tap = require('tap') +var common = require('./lib/common') var init = require('../') +var path = require('path') var rimraf = require('rimraf') -var semver = require('semver') +var test = require('tap').test -tap.test('the basics', function (t) { - var i = __dirname + '/basic.input' - var dir = __dirname - init(dir, i, {foo:'bar'}, function (er, data) { +test('the basics', function (t) { + var i = path.join(__dirname, 'basic.input') + init(__dirname, i, { foo: 'bar' }, function (er, data) { if (er) throw er - var expect = - { name: 'the-name', - version: '1.2.5', - description: 'description', - author: 'npmbot <n@p.m> (http://npm.im)', - scripts: { test: 'make test' }, - main: 'main.js', - config: { foo: 'bar' }, - package: {} } + var expect = { + name: 'the-name', + version: '1.2.5', + description: 'description', + author: 'npmbot <n@p.m> (http://npm.im)', + scripts: { test: 'make test' }, + main: 'main.js', + config: { foo: 'bar' }, + package: {} + } t.same(data, expect) t.end() }) - var stdin = process.stdin - var name = 'the-name\n' - var desc = 'description\n' - var yes = 'yes\n' - if (semver.gte(process.versions.node, '0.11.0')) { - ;[name, desc, yes].forEach(function (chunk) { - stdin.push(chunk) - }) - } else { - function input (chunk, ms) { - setTimeout(function () { - stdin.emit('data', chunk) - }, ms) - } - stdin.once('readable', function () { - var ms = 0 - ;[name, desc, yes].forEach(function (chunk) { - input(chunk, ms += 50) - }) - }) - } + common.drive([ + 'the-name\n', + 'description\n', + 'yes\n' + ]) }) -tap.test('teardown', function (t) { +test('teardown', function (t) { rimraf(__dirname + '/package.json', t.end.bind(t)) }) diff --git a/node_modules/init-package-json/test/lib/common.js b/node_modules/init-package-json/test/lib/common.js new file mode 100644 index 000000000..de45089f9 --- /dev/null +++ b/node_modules/init-package-json/test/lib/common.js @@ -0,0 +1,24 @@ +module.exports.drive = drive + +var semver = require('semver') + +function drive (input) { + var stdin = process.stdin + function emit (chunk, ms) { + setTimeout(function () { + stdin.emit('data', chunk) + }, ms) + } + if (semver.gte(process.versions.node, '0.11.0')) { + input.forEach(function (chunk) { + stdin.push(chunk) + }) + } else { + stdin.once('readable', function () { + var ms = 0 + input.forEach(function (chunk) { + emit(chunk, ms += 50) + }) + }) + } +} diff --git a/node_modules/init-package-json/test/name-spaces.js b/node_modules/init-package-json/test/name-spaces.js new file mode 100644 index 000000000..dee974fc8 --- /dev/null +++ b/node_modules/init-package-json/test/name-spaces.js @@ -0,0 +1,38 @@ +var test = require('tap').test +var init = require('../') +var rimraf = require('rimraf') +var common = require('./lib/common') + +test('spaces', function (t) { + init(__dirname, '', {}, function (er, data) { + t.ok(!er, 'should not error') + var wanted = { + name: 'the-name', + version: '1.0.0', + description: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + license: 'ISC', + author: '', + main: 'basic.js' + } + t.same(data, wanted) + t.end() + }) + common.drive([ + 'the name\n', + 'the-name\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + 'yes\n' + ]) +}) + +test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/node_modules/init-package-json/test/name-uppercase.js b/node_modules/init-package-json/test/name-uppercase.js new file mode 100644 index 000000000..ddedc30e5 --- /dev/null +++ b/node_modules/init-package-json/test/name-uppercase.js @@ -0,0 +1,38 @@ +var test = require('tap').test +var init = require('../') +var rimraf = require('rimraf') +var common = require('./lib/common') + +test('uppercase', function (t) { + init(__dirname, '', {}, function (er, data) { + t.ok(!er, 'should not error') + var wanted = { + name: 'the-name', + version: '1.0.0', + description: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + license: 'ISC', + author: '', + main: 'basic.js' + } + t.same(data, wanted) + t.end() + }) + common.drive([ + 'THE-NAME\n', + 'the-name\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + '\n', + 'yes\n' + ]) +}) + +test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) +}) diff --git a/node_modules/init-package-json/test/npm-defaults.js b/node_modules/init-package-json/test/npm-defaults.js index 666e9a1c4..292b9623a 100644 --- a/node_modules/init-package-json/test/npm-defaults.js +++ b/node_modules/init-package-json/test/npm-defaults.js @@ -1,109 +1,109 @@ -var test = require("tap").test -var rimraf = require("rimraf") -var resolve = require("path").resolve +var test = require('tap').test +var rimraf = require('rimraf') +var resolve = require('path').resolve -var npm = require("npm") -var init = require("../") +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' + 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" + keywords: [], + author: 'npmbot <n@p.m> (http://npm.im/)', + license: 'WTFPL' } -test("npm configuration values pulled from environment", function (t) { +test('npm configuration values pulled from environment', function (t) { /*eslint camelcase:0 */ - process.env.npm_config_yes = "yes" + 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_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") + t.ifError(err, 'npm loaded successfully') // clear out dotted names from test environment - npm.config.del("init.author.name") - npm.config.del("init.author.email") - npm.config.del("init.author.url") + npm.config.del('init.author.name') + npm.config.del('init.author.email') + npm.config.del('init.author.url') // the following have npm defaults, and need to be explicitly overridden - npm.config.set("init.license", "") - npm.config.set("init.version", "") + npm.config.set('init.license', '') + npm.config.set('init.version', '') process.chdir(resolve(__dirname)) init(__dirname, __dirname, npm.config, function (er, data) { - t.ifError(err, "init ran successfully") + t.ifError(err, 'init ran successfully') - t.same(data, EXPECTED, "got the package data from the environment") + t.same(data, EXPECTED, 'got the package data from the environment') t.end() }) }) }) -test("npm configuration values pulled from dotted config", function (t) { +test('npm configuration values pulled from dotted config', function (t) { /*eslint camelcase:0 */ var config = { - yes : "yes", + yes: 'yes', - "init.author.name" : "npmbot", - "init.author.email" : "n@p.m", - "init.author.url" : "http://npm.im", + 'init.author.name': 'npmbot', + 'init.author.email': 'n@p.m', + 'init.author.url': 'http://npm.im', - "init.license" : EXPECTED.license, - "init.version" : EXPECTED.version + 'init.license': EXPECTED.license, + 'init.version': EXPECTED.version } npm.load(config, function (err) { - t.ifError(err, "npm loaded successfully") + 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.ifError(err, 'init ran successfully') - t.same(data, EXPECTED, "got the package data from the config") + t.same(data, EXPECTED, 'got the package data from the config') t.end() }) }) }) -test("npm configuration values pulled from dashed config", function (t) { +test('npm configuration values pulled from dashed config', function (t) { /*eslint camelcase:0 */ var config = { - yes : "yes", + yes: 'yes', - "init-author-name" : "npmbot", - "init-author-email" : "n@p.m", - "init-author-url" : "http://npm.im", + 'init-author-name': 'npmbot', + 'init-author-email': 'n@p.m', + 'init-author-url': 'http://npm.im', - "init-license" : EXPECTED.license, - "init-version" : EXPECTED.version + 'init-license': EXPECTED.license, + 'init-version': EXPECTED.version } npm.load(config, function (err) { - t.ifError(err, "npm loaded successfully") + 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.ifError(err, 'init ran successfully') - t.same(data, EXPECTED, "got the package data from the config") + 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") +test('cleanup', function (t) { + rimraf.sync(resolve(__dirname, 'package.json')) + t.pass('cleaned up') t.end() }) diff --git a/node_modules/init-package-json/test/scope.js b/node_modules/init-package-json/test/scope.js index 05968fcc0..971916f2d 100644 --- a/node_modules/init-package-json/test/scope.js +++ b/node_modules/init-package-json/test/scope.js @@ -1,38 +1,38 @@ -var tap = require("tap") -var init = require("../") -var rimraf = require("rimraf") +var tap = require('tap') +var init = require('../') +var rimraf = require('rimraf') var EXPECT = { - name: "@foo/test" - , version: "1.2.5" - , description: "description" - , author: "npmbot <n@p.m> (http://npm.im)" - , scripts: { test: "make test" } - , main: "main.js" - , config: { scope: "@foo" } - , package: {} + name: '@foo/test', + version: '1.2.5', + description: 'description', + author: 'npmbot <n@p.m> (http://npm.im)', + scripts: { test: 'make test' }, + main: 'main.js', + config: { scope: '@foo' }, + package: {} } -tap.test("the scope", function (t) { - var i = __dirname + "/basic.input" +tap.test('the scope', function (t) { + var i = __dirname + '/basic.input' var dir = __dirname - init(dir, i, {scope: "@foo"}, function (er, data) { + init(dir, i, {scope: '@foo'}, function (er, data) { if (er) throw er t.same(EXPECT, data) t.end() }) setTimeout(function () { - process.stdin.emit("data", "@foo/test\n") + process.stdin.emit('data', '@foo/test\n') }, 50) setTimeout(function () { - process.stdin.emit("data", "description\n") + process.stdin.emit('data', 'description\n') }, 100) setTimeout(function () { - process.stdin.emit("data", "yes\n") + process.stdin.emit('data', 'yes\n') }, 150) }) -tap.test("teardown", function (t) { - rimraf(__dirname + "/package.json", t.end.bind(t)) +tap.test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) }) diff --git a/node_modules/init-package-json/test/yes-defaults.js b/node_modules/init-package-json/test/yes-defaults.js index f1d50c025..747ab38fd 100644 --- a/node_modules/init-package-json/test/yes-defaults.js +++ b/node_modules/init-package-json/test/yes-defaults.js @@ -1,20 +1,20 @@ -var tap = require("tap") -var init = require("../") -var rimraf = require("rimraf") +var tap = require('tap') +var init = require('../') +var rimraf = require('rimraf') var EXPECT = { - name: "test" - , version: "1.0.0" - , description: "" - , author: "" - , scripts: { test: "echo \"Error: no test specified\" && exit 1" } - , main: "basic.js" - , keywords: [] - , license: "ISC" + name: 'test', + version: '1.0.0', + description: '', + author: '', + scripts: { test: 'echo "Error: no test specified" && exit 1' }, + main: 'basic.js', + keywords: [], + license: 'ISC' } -tap.test("--yes defaults", function (t) { - init(__dirname, __dirname, {yes: "yes"}, function (er, data) { +tap.test('--yes defaults', function (t) { + init(__dirname, __dirname, {yes: 'yes'}, function (er, data) { if (er) throw er t.same(EXPECT, data, 'used the default data') @@ -22,6 +22,6 @@ tap.test("--yes defaults", function (t) { }) }) -tap.test("teardown", function (t) { - rimraf(__dirname + "/package.json", t.end.bind(t)) +tap.test('teardown', function (t) { + rimraf(__dirname + '/package.json', t.end.bind(t)) }) diff --git a/package.json b/package.json index ebbf830ac..fed651b37 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "inflight": "~1.0.4", "inherits": "~2.0.1", "ini": "~1.3.3", - "init-package-json": "~1.4.1", + "init-package-json": "~1.4.2", "lockfile": "~1.0.0", "lru-cache": "~2.6.1", "minimatch": "~2.0.4", |