diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2016-05-19 06:06:48 +0300 |
---|---|---|
committer | Kat Marchán <kzm@sykosomatic.org> | 2016-05-19 12:35:59 +0300 |
commit | 584676f85eaebcb9d6c4d70d2ad320be8a8d6a74 (patch) | |
tree | 879cd5302e2be774e9067a5cff258f5d375b75b8 /node_modules/init-package-json | |
parent | 4c4609ea49e77303f9d72af6757620e6b3a9a6a9 (diff) |
init-package-json@1.9.4
Stop using `package` for a variable, which defeats some bundlers and linters.
Credit: @adius
PR-URL: https://github.com/npm/init-package-json/pull/62
Diffstat (limited to 'node_modules/init-package-json')
11 files changed, 123 insertions, 179 deletions
diff --git a/node_modules/init-package-json/init-package-json.js b/node_modules/init-package-json/init-package-json.js index 87c72ccf9..7dc4b0a39 100644 --- a/node_modules/init-package-json/init-package-json.js +++ b/node_modules/init-package-json/init-package-json.js @@ -40,7 +40,7 @@ function init (dir, input, config, cb) { } } - var package = path.resolve(dir, 'package.json') + var packageFile = path.resolve(dir, 'package.json') input = path.resolve(input) var pkg var ctx = { yes: yes(config) } @@ -49,14 +49,14 @@ function init (dir, input, config, cb) { readJson.extraSet = es.filter(function (fn) { return fn.name !== 'authors' && fn.name !== 'mans' }) - readJson(package, function (er, d) { + readJson(packageFile, function (er, d) { readJson.extraSet = es if (er) pkg = {} else pkg = d - ctx.filename = package - ctx.dirname = path.dirname(package) + ctx.filename = packageFile + ctx.dirname = path.dirname(packageFile) ctx.basename = path.basename(ctx.dirname) if (!pkg.version || !semver.valid(pkg.version)) delete pkg.version @@ -80,7 +80,7 @@ function init (dir, input, config, cb) { readJson.extraSet = es.filter(function (fn) { return fn.name !== 'authors' && fn.name !== 'mans' }) - readJson.extras(package, pkg, function (er, pkg) { + readJson.extras(packageFile, pkg, function (er, pkg) { readJson.extraSet = es if (er) return cb(er, pkg) pkg = unParsePeople(pkg) @@ -105,9 +105,9 @@ function init (dir, input, config, cb) { var d = JSON.stringify(pkg, null, 2) + '\n' function write (yes) { - fs.writeFile(package, d, 'utf8', function (er) { + fs.writeFile(packageFile, d, 'utf8', function (er) { if (!er && yes && !config.get('silent')) { - console.log('Wrote to %s:\n\n%s\n', package, d) + console.log('Wrote to %s:\n\n%s\n', packageFile, d) } return cb(er, pkg) }) @@ -115,7 +115,7 @@ function init (dir, input, config, cb) { if (ctx.yes) { return write(true) } - console.log('About to write to %s:\n\n%s\n', package, d) + console.log('About to write to %s:\n\n%s\n', packageFile, d) read({prompt:'Is this ok? ', default: 'yes'}, function (er, ok) { if (!ok || ok.toLowerCase().charAt(0) !== 'y') { console.log('Aborted.') diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore index fd4f2b066..ae5d8c36a 100644 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +++ b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore @@ -1,2 +1,5 @@ -node_modules -.DS_Store +test +.gitignore +.travis.yml +Makefile +example.js diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml deleted file mode 100644 index 6e5919de3..000000000 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile deleted file mode 100644 index fa5da71a6..000000000 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -test: - @node_modules/.bin/tape test/*.js - -.PHONY: test - diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md index 421f3aa5f..d6880b2f3 100644 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +++ b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md @@ -1,6 +1,6 @@ # balanced-match -Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. +Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well! [![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) [![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) @@ -16,6 +16,7 @@ var balanced = require('balanced-match'); console.log(balanced('{', '}', 'pre{in{nested}}post')); console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); ``` The matches are: @@ -28,6 +29,7 @@ $ node example.js pre: 'pre', body: 'first', post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } ``` ## API diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js deleted file mode 100644 index c02ad348e..000000000 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +++ /dev/null @@ -1,5 +0,0 @@ -var balanced = require('./'); - -console.log(balanced('{', '}', 'pre{in{nested}}post')); -console.log(balanced('{', '}', 'pre{first}between{second}post')); - diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js index 75f3d71cb..4670f7f79 100644 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +++ b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js @@ -1,5 +1,8 @@ module.exports = balanced; function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + var r = range(a, b, str); return r && { @@ -11,6 +14,11 @@ function balanced(a, b, str) { }; } +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + balanced.range = range; function range(a, b, str) { var begs, beg, left, right, result; diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json index 652900ae4..306b73b34 100644 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +++ b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json @@ -1,40 +1,49 @@ { "_args": [ [ - "balanced-match@^0.3.0", - "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" - ], - [ - "balanced-match@^0.3.0", - "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" + { + "name": "balanced-match", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", + "scope": null, + "spec": ">=0.4.1 <0.5.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion" ] ], - "_from": "balanced-match@>=0.3.0 <0.4.0", - "_id": "balanced-match@0.3.0", + "_from": "balanced-match@>=0.4.1 <0.5.0", + "_id": "balanced-match@0.4.1", "_inCache": true, "_installable": true, "_location": "/init-package-json/glob/minimatch/brace-expansion/balanced-match", - "_nodeVersion": "4.2.1", + "_nodeVersion": "6.0.0", + "_npmOperationalInternal": { + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/balanced-match-0.4.1.tgz_1462129663650_0.39764496590942144" + }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "2.14.7", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "balanced-match", - "raw": "balanced-match@^0.3.0", - "rawSpec": "^0.3.0", + "raw": "balanced-match@^0.4.1", + "rawSpec": "^0.4.1", "scope": null, - "spec": ">=0.3.0 <0.4.0", + "spec": ">=0.4.1 <0.5.0", "type": "range" }, "_requiredBy": [ "/init-package-json/glob/minimatch/brace-expansion" ], + "_resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz", + "_shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", "_shrinkwrap": null, - "_spec": "balanced-match@^0.3.0", - "_where": "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", + "_spec": "balanced-match@^0.4.1", + "_where": "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -46,14 +55,14 @@ "dependencies": {}, "description": "Match balanced character pairs, like \"{\" and \"}\"", "devDependencies": { - "tape": "~4.2.2" + "tape": "~4.5.0" }, "directories": {}, "dist": { - "shasum": "a91cdd1ebef1a86659e70ff4def01625fc2d6756", - "tarball": "http://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" + "shasum": "19053e2e0748eadb379da6c09d455cf5e1039335", + "tarball": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.1.tgz" }, - "gitHead": "a7114b0986554787e90b7ac595a043ca75ea77e5", + "gitHead": "7004b289baaaab6a832f4901735e29d37cc2a863", "homepage": "https://github.com/juliangruber/balanced-match", "keywords": [ "match", @@ -96,5 +105,5 @@ ], "files": "test/*.js" }, - "version": "0.3.0" + "version": "0.4.1" } diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js deleted file mode 100644 index f5e98e3f2..000000000 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +++ /dev/null @@ -1,84 +0,0 @@ -var test = require('tape'); -var balanced = require('..'); - -test('balanced', function(t) { - t.deepEqual(balanced('{', '}', 'pre{in{nest}}post'), { - start: 3, - end: 12, - pre: 'pre', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', '{{{{{{{{{in}post'), { - start: 8, - end: 11, - pre: '{{{{{{{{', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body{in}post'), { - start: 8, - end: 11, - pre: 'pre{body', - body: 'in', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre}{in{nest}}post'), { - start: 4, - end: 13, - pre: 'pre}', - body: 'in{nest}', - post: 'post' - }); - t.deepEqual(balanced('{', '}', 'pre{body}between{body2}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'body', - post: 'between{body2}post' - }); - t.notOk(balanced('{', '}', 'nope'), 'should be notOk'); - t.deepEqual(balanced('<b>', '</b>', 'pre<b>in<b>nest</b></b>post'), { - start: 3, - end: 19, - pre: 'pre', - body: 'in<b>nest</b>', - post: 'post' - }); - t.deepEqual(balanced('<b>', '</b>', 'pre</b><b>in<b>nest</b></b>post'), { - start: 7, - end: 23, - pre: 'pre</b>', - body: 'in<b>nest</b>', - post: 'post' - }); - t.deepEqual(balanced('{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 9, - pre: 'pre', - body: '{in}', - post: 'post' - }); - t.deepEqual(balanced('{{{', '}}', 'pre{{{in}}}post'), { - start: 3, - end: 8, - pre: 'pre', - body: 'in', - post: '}post' - }); - t.deepEqual(balanced('{', '}', 'pre{{first}in{second}post'), { - start: 4, - end: 10, - pre: 'pre{', - body: 'first', - post: 'in{second}post' - }); - t.deepEqual(balanced('<?', '?>', 'pre<?>post'), { - start: 3, - end: 4, - pre: 'pre', - body: '', - post: 'post' - }); - t.end(); -}); diff --git a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json index 1c2bcddd5..ad188114f 100644 --- a/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +++ b/node_modules/init-package-json/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json @@ -1,29 +1,32 @@ { "_args": [ [ - "brace-expansion@^1.0.0", - "/Users/rebecca/code/npm/node_modules/glob/node_modules/minimatch" - ], - [ - "brace-expansion@^1.0.0", - "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch" + { + "name": "brace-expansion", + "raw": "brace-expansion@^1.0.0", + "rawSpec": "^1.0.0", + "scope": null, + "spec": ">=1.0.0 <2.0.0", + "type": "range" + }, + "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch" ] ], "_from": "brace-expansion@>=1.0.0 <2.0.0", - "_id": "brace-expansion@1.1.3", + "_id": "brace-expansion@1.1.4", "_inCache": true, "_installable": true, "_location": "/init-package-json/glob/minimatch/brace-expansion", - "_nodeVersion": "5.5.0", + "_nodeVersion": "6.0.0", "_npmOperationalInternal": { - "host": "packages-6-west.internal.npmjs.com", - "tmp": "tmp/brace-expansion-1.1.3.tgz_1455216688668_0.948847763473168" + "host": "packages-12-west.internal.npmjs.com", + "tmp": "tmp/brace-expansion-1.1.4.tgz_1462130058897_0.14984136167913675" }, "_npmUser": { "email": "julian@juliangruber.com", "name": "juliangruber" }, - "_npmVersion": "3.3.12", + "_npmVersion": "3.8.6", "_phantomChildren": {}, "_requested": { "name": "brace-expansion", @@ -36,9 +39,11 @@ "_requiredBy": [ "/init-package-json/glob/minimatch" ], + "_resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz", + "_shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", "_shrinkwrap": null, "_spec": "brace-expansion@^1.0.0", - "_where": "/Users/rebecca/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch", + "_where": "/Users/zkat/Documents/code/npm/node_modules/init-package-json/node_modules/glob/node_modules/minimatch", "author": { "email": "mail@juliangruber.com", "name": "Julian Gruber", @@ -48,19 +53,19 @@ "url": "https://github.com/juliangruber/brace-expansion/issues" }, "dependencies": { - "balanced-match": "^0.3.0", + "balanced-match": "^0.4.1", "concat-map": "0.0.1" }, "description": "Brace expansion as known from sh/bash", "devDependencies": { - "tape": "4.4.0" + "tape": "4.5.1" }, "directories": {}, "dist": { - "shasum": "46bff50115d47fc9ab89854abb87d98078a10991", - "tarball": "http://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.3.tgz" + "shasum": "464a204c77f482c085c2a36c456bbfbafb67a127", + "tarball": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.4.tgz" }, - "gitHead": "f0da1bb668e655f67b6b2d660c6e1c19e2a6f231", + "gitHead": "1660b75d0bf03b022e7888b576cd5a4080692c1d", "homepage": "https://github.com/juliangruber/brace-expansion", "keywords": [], "license": "MIT", @@ -102,5 +107,5 @@ ], "files": "test/*.js" }, - "version": "1.1.3" + "version": "1.1.4" } diff --git a/node_modules/init-package-json/package.json b/node_modules/init-package-json/package.json index 21e33c570..fbca584dd 100644 --- a/node_modules/init-package-json/package.json +++ b/node_modules/init-package-json/package.json @@ -1,39 +1,54 @@ { "_args": [ [ - "init-package-json@~1.9.3", - "/Users/rebecca/code/npm" + { + "name": "init-package-json", + "raw": "init-package-json@latest", + "rawSpec": "latest", + "scope": null, + "spec": "latest", + "type": "tag" + }, + "/Users/zkat/Documents/code/npm" ] ], - "_from": "init-package-json@>=1.9.3 <1.10.0", - "_id": "init-package-json@1.9.3", + "_from": "init-package-json@latest", + "_id": "init-package-json@1.9.4", "_inCache": true, "_installable": true, "_location": "/init-package-json", - "_nodeVersion": "4.2.2", + "_nodeVersion": "5.10.1", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/init-package-json-1.9.4.tgz_1463610982259_0.011722659226506948" + }, "_npmUser": { - "email": "me@re-becca.org", - "name": "iarna" + "email": "kat@sykosomatic.org", + "name": "zkat" }, - "_npmVersion": "3.5.4", + "_npmVersion": "3.9.1", "_phantomChildren": { + "inflight": "1.0.5", + "inherits": "2.0.1", + "once": "1.3.3", "read": "1.0.7" }, "_requested": { "name": "init-package-json", - "raw": "init-package-json@~1.9.3", - "rawSpec": "~1.9.3", + "raw": "init-package-json@latest", + "rawSpec": "latest", "scope": null, - "spec": ">=1.9.3 <1.10.0", - "type": "range" + "spec": "latest", + "type": "tag" }, "_requiredBy": [ "/" ], - "_shasum": "ca2ff94709b6d9aaad66533c11a0aff645f15c7d", + "_resolved": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.9.4.tgz", + "_shasum": "b4053d0b40f0cf842a41966937cb3dc0f534e856", "_shrinkwrap": null, - "_spec": "init-package-json@~1.9.3", - "_where": "/Users/rebecca/code/npm", + "_spec": "init-package-json@latest", + "_where": "/Users/zkat/Documents/code/npm", "author": { "email": "i@izs.me", "name": "Isaac Z. Schlueter", @@ -60,39 +75,39 @@ }, "directories": {}, "dist": { - "shasum": "ca2ff94709b6d9aaad66533c11a0aff645f15c7d", - "tarball": "http://registry.npmjs.org/init-package-json/-/init-package-json-1.9.3.tgz" + "shasum": "b4053d0b40f0cf842a41966937cb3dc0f534e856", + "tarball": "https://registry.npmjs.org/init-package-json/-/init-package-json-1.9.4.tgz" }, - "gitHead": "12eb24ff2f75f84a4a27436bc6f6cb765cbd9ee2", + "gitHead": "3c34250fa58507056a94f3940ee2a28540f83592", "homepage": "https://github.com/npm/init-package-json#readme", "keywords": [ - "helper", "init", - "package", "package.json", - "prompt", - "start", + "package", + "helper", "wizard", - "wizerd" + "wizerd", + "prompt", + "start" ], "license": "ISC", "main": "init-package-json.js", "maintainers": [ { - "name": "isaacs", - "email": "isaacs@npmjs.com" + "email": "isaacs@npmjs.com", + "name": "isaacs" }, { - "name": "othiym23", - "email": "ogd@aoaioxxysz.net" + "email": "ogd@aoaioxxysz.net", + "name": "othiym23" }, { - "name": "iarna", - "email": "me@re-becca.org" + "email": "me@re-becca.org", + "name": "iarna" }, { - "name": "zkat", - "email": "kat@sykosomatic.org" + "email": "kat@sykosomatic.org", + "name": "zkat" } ], "name": "init-package-json", @@ -105,5 +120,5 @@ "scripts": { "test": "tap test/*.js" }, - "version": "1.9.3" + "version": "1.9.4" } |