diff options
author | isaacs <i@izs.me> | 2013-05-11 04:24:55 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2013-05-11 04:24:55 +0400 |
commit | b2120688f71ff65e5e32fe74756262bbcb10cf13 (patch) | |
tree | a87a2e742fee0044e5c2a7ef9d77c56e1a2760a1 /node_modules/read-package-json | |
parent | 25ad7461738ee1f4cef482d7c8a3f3a5c1e41fa5 (diff) |
update normalize-package-json
Diffstat (limited to 'node_modules/read-package-json')
8 files changed, 85 insertions, 36 deletions
diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE b/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE new file mode 100644 index 000000000..9cea2e3c9 --- /dev/null +++ b/node_modules/read-package-json/node_modules/normalize-package-data/LICENSE @@ -0,0 +1,30 @@ +This package contains code originally written by Isaac Z. Schlueter. +Used with permission. + +Copyright (c) Meryn Stol ("Author") +All rights reserved. + +The BSD License + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/README.md b/node_modules/read-package-json/node_modules/normalize-package-data/README.md index 59d132d12..5712bd9ee 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/README.md +++ b/node_modules/read-package-json/node_modules/normalize-package-data/README.md @@ -2,6 +2,8 @@ normalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry. +normalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools. + ## Installation ``` @@ -37,19 +39,19 @@ If the supplied data has an invalid name or version vield, `normalizeData` will ## What normalization (currently) entails -* The value of `name` field gets trimmed +* The value of `name` field gets trimmed. * The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver). * If `name` and/or `version` fields are missing, they are set to empty strings. -* If `repository` field is a string, it will become am object with `url` set to the original string value, and `type` set to `"git"`. * If `files` field is not an array, it will be removed. * If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value. -* If `man` field is a string, it will become an array with the original string as its sole member +* If `man` field is a string, it will become an array with the original string as its sole member. * If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\s+`. -* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`. * All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties. -* If the value of any of the depedencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) are strings, they get converted into objects with familiar `name=>value` pairs. -* The values in `optionalDependencies` get added to `dependencies`. `optionalDependencies` array is left untouched. -* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken a value for `description`. +* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`. +* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs. +* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched. +* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`. +* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `"git"`. * If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value. * If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. * If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed. @@ -70,4 +72,9 @@ If `version` field is given, the value of the version field must be a valid *sem ## Credits -This code is based on read-package-json written by Isaac Schlueter. +This package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson. + +## License + +normalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). +Copyright (c) 2013 Meryn Stol
\ No newline at end of file diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js b/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js index d8d0bb7af..b42b30eee 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js +++ b/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js @@ -6,7 +6,7 @@ var url = require("url") var fixer = module.exports = { fixRepositoryField: function(data) { - if (data.repostories) { + if (data.repositories) { this.warn("'repositories' (plural) Not supported.\n" + "Please pick one as the 'repository' field"); data.repository = data.repositories[0] diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js b/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js index 34a399348..509fab491 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js +++ b/node_modules/read-package-json/node_modules/normalize-package-data/lib/is_valid.js @@ -18,7 +18,8 @@ function isValid (data, warnFunc) { }) checkBugsField(data.bugs, warn) checkScriptsField(data.scripts, warn) - if (!data.readme) warn("No readme data!") + if (!data.repository) warn("No repository field.") + if (!data.readme) warn("No readme data.") if (data.description && typeof data.description !== 'string') { warn("'description' field should be a string") } @@ -53,5 +54,5 @@ function makeTypoWarning (providedName, probableName, field) { providedName = field + "['" + providedName + "']" probableName = field + "['" + probableName + "']" } - return providedName + " should probably be " + probableName + return providedName + " should probably be " + probableName + "." } diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/package.json b/node_modules/read-package-json/node_modules/normalize-package-data/package.json index 7aaf89d77..0479feac5 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/package.json +++ b/node_modules/read-package-json/node_modules/normalize-package-data/package.json @@ -1,6 +1,6 @@ { "name": "normalize-package-data", - "version": "0.1.2", + "version": "0.1.6", "author": { "name": "Meryn Stol", "email": "merynstol@gmail.com" @@ -33,11 +33,11 @@ "email": "merynstol@gmail.com" } ], - "readme": "# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)\n\nnormalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.\n\n## Installation\n\n```\nnpm install normalize-package-data\n```\n\n## Usage\n\nBasic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nnormalizeData(packageData)\n// packageData is now normalized\n```\n\nOptionally, you may pass a \"warning\" function. It gets called whenever the normalizeData function encounters something that doesn't look right. It indicates less than perfect input data.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, warnFn)\n// packageData is now normalized. Any number of warnings may have been logged.\n```\n\nIf you don't provide a warning function, `normalizeData` functions silently.\n\n### Potential exceptions\n\nIf the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.\n\n## What normalization (currently) entails\n\n* The value of `name` field gets trimmed\n* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n* If `name` and/or `version` fields are missing, they are set to empty strings.\n* If `repository` field is a string, it will become am object with `url` set to the original string value, and `type` set to `\"git\"`.\n* If `files` field is not an array, it will be removed.\n* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.\n* If `man` field is a string, it will become an array with the original string as its sole member\n* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\\s+`.\n* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.\n* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.\n* If the value of any of the depedencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) are strings, they get converted into objects with familiar `name=>value` pairs.\n* The values in `optionalDependencies` get added to `dependencies`. `optionalDependencies` array is left untouched.\n* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken a value for `description`.\n* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.\n* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.\n* If `homepage` field is not a string, it will be removed.\n\n### Rules for name field\n\nIf `name` field is given, the value of the name field must be a string. The string may not:\n\n* start with a period.\n* contain the following characters: `/@\\s+%`\n* contain and characters that would need to be encoded for use in urls.\n* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).\n\n### Rules for version field\n\nIf `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n\n## Credits\n\nThis code is based on read-package-json written by Isaac Schlueter.\n", + "readme": "# normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)\n\nnormalize-package data exports a function that normalizes package metadata. This data is typically found in a package.json file, but in principle could come from any source - for example the npm registry.\n\nnormalize-package-data is used by [read-package-json](https://npmjs.org/package/read-package-json) to normalize the data it reads from a package.json file. In turn, read-package-json is used by [npm](https://npmjs.org/package/npm) and various npm-related tools.\n\n## Installation\n\n```\nnpm install normalize-package-data\n```\n\n## Usage\n\nBasic usage is really simple. You call the function that normalize-package-data exports. Let's call it `normalizeData`.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nnormalizeData(packageData)\n// packageData is now normalized\n```\n\nOptionally, you may pass a \"warning\" function. It gets called whenever the normalizeData function encounters something that doesn't look right. It indicates less than perfect input data.\n\n```javascript\nnormalizeData = require('normalize-package-data')\npackageData = fs.readfileSync(\"package.json\")\nwarnFn = function(msg) { console.error(msg) }\nnormalizeData(packageData, warnFn)\n// packageData is now normalized. Any number of warnings may have been logged.\n```\n\nIf you don't provide a warning function, `normalizeData` functions silently.\n\n### Potential exceptions\n\nIf the supplied data has an invalid name or version vield, `normalizeData` will throw an error. Depending on where you call `normalizeData`, you may want to catch these errors so can pass them to a callback.\n\n## What normalization (currently) entails\n\n* The value of `name` field gets trimmed.\n* The value of the `version` field gets cleaned by `semver.clean`. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n* If `name` and/or `version` fields are missing, they are set to empty strings.\n* If `files` field is not an array, it will be removed.\n* If `bin` field is a string, then `bin` field will become an object with `name` set to the value of the `name` field, and `bin` set to the original string value.\n* If `man` field is a string, it will become an array with the original string as its sole member.\n* If `keywords` field is string, it is considered to be a list of keywords separated by one or more white-space characters. It gets converted to an array by splitting on `\\s+`.\n* All people fields (`author`, `maintainers`, `contributors`) get converted into objects with name, email and url properties.\n* If `bundledDependencies` field (a typo) exists and `bundleDependencies` field does not, `bundledDependencies` will get renamed to `bundleDependencies`.\n* If the value of any of the dependencies fields (`dependencies`, `devDependencies`, `optionalDependencies`) is a string, it gets converted into an object with familiar `name=>value` pairs.\n* The values in `optionalDependencies` get added to `dependencies`. The `optionalDependencies` array is left untouched.\n* If `description` field does not exists, but `readme` field does, then (more or less) the first paragraph of text that's found in the readme is taken as value for `description`.\n* If `repository` field is a string, it will become an object with `url` set to the original string value, and `type` set to `\"git\"`.\n* If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value.\n* If `bugs` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `bugs` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/issues . If the repository field points to a GitHub Gist repo url, the associated http url is chosen.\n* If `bugs` field is an object, the resulting value only has email and url properties. If email and url properties are not strings, they are ignored. If no valid values for either email or url is found, bugs field will be removed.\n* If `homepage` field is not a string, it will be removed.\n\n### Rules for name field\n\nIf `name` field is given, the value of the name field must be a string. The string may not:\n\n* start with a period.\n* contain the following characters: `/@\\s+%`\n* contain and characters that would need to be encoded for use in urls.\n* resemble the word `node_modules` or `favicon.ico` (case doesn't matter).\n\n### Rules for version field\n\nIf `version` field is given, the value of the version field must be a valid *semver* string, as determined by the `semver.valid` method. See [documentation for the semver module](https://github.com/isaacs/node-semver).\n\n## Credits\n\nThis package contains code based on read-package-json written by Isaac Z. Schlueter. Used with permisson.\n\n## License\n\nnormalize-package-data is released under the [BSD 2-Clause License](http://opensource.org/licenses/MIT). \nCopyright (c) 2013 Meryn Stol ", "readmeFilename": "README.md", "bugs": { "url": "https://github.com/meryn/normalize-package-data/issues" }, - "_id": "normalize-package-data@0.1.2", + "_id": "normalize-package-data@0.1.6", "_from": "normalize-package-data@~0.1.2" } diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js b/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js index 2d6d198d2..b015a6a49 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js +++ b/node_modules/read-package-json/node_modules/normalize-package-data/test/normalize.js @@ -47,7 +47,7 @@ tap.test("empty object", function(t) { } normalize(packageData, warn) t.same(packageData, expect) - t.same(warnings, ["No readme data!"]) + t.same(warnings, ["No repository field.","No readme data."]) t.end() }) @@ -73,7 +73,8 @@ tap.test("urls required", function(t) { console.error(a) var expect = - [ 'No readme data!', + [ 'No repository field.', + 'No readme data.', 'bugs.url field must be a string url. Deleted.', 'bugs.email field must be a string email. Deleted.', 'Normalized value of bugs field is an empty object. Deleted.', @@ -98,3 +99,10 @@ tap.test('no new globals', function(t) { t.same(Object.keys(global), globals) t.end() }) + +tap.test("singularize repositories", function(t) { + d = {repositories:["git@gist.github.com:123456.git"]} + normalize(d) + t.same(d.repository, { type: 'git', url: 'git@gist.github.com:123456.git' }) + t.end() +});
\ No newline at end of file diff --git a/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js b/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js index 565fd7c25..d7d3af0e2 100644 --- a/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js +++ b/node_modules/read-package-json/node_modules/normalize-package-data/test/typo.js @@ -9,27 +9,30 @@ test('typos', function(t) { } var expect = - [ 'dependancies should probably be dependencies', - 'dependecies should probably be dependencies', - 'depdenencies should probably be dependencies', - 'devEependencies should probably be devDependencies', - 'depends should probably be dependencies', - 'dev-dependencies should probably be devDependencies', - 'devDependences should probably be devDependencies', - 'devDepenencies should probably be devDependencies', - 'devdependencies should probably be devDependencies', - 'repostitory should probably be repository', - 'prefereGlobal should probably be preferGlobal', - 'hompage should probably be homepage', - 'hampage should probably be homepage', - 'autohr should probably be author', - 'autor should probably be author', - 'contributers should probably be contributors', - 'publicationConfig should probably be publishConfig', - 'No readme data!', + [ 'dependancies should probably be dependencies.', + 'dependecies should probably be dependencies.', + 'depdenencies should probably be dependencies.', + 'devEependencies should probably be devDependencies.', + 'depends should probably be dependencies.', + 'dev-dependencies should probably be devDependencies.', + 'devDependences should probably be devDependencies.', + 'devDepenencies should probably be devDependencies.', + 'devdependencies should probably be devDependencies.', + 'repostitory should probably be repository.', + 'prefereGlobal should probably be preferGlobal.', + 'hompage should probably be homepage.', + 'hampage should probably be homepage.', + 'autohr should probably be author.', + 'autor should probably be author.', + 'contributers should probably be contributors.', + 'publicationConfig should probably be publishConfig.', + 'No repository field.', + 'No repository field.', + 'No readme data.', 'bugs.url field must be a string url. Deleted.', 'Normalized value of bugs field is an empty object. Deleted.', - 'No readme data!' ] + 'No repository field.', + 'No readme data.' ] normalize({"dependancies": "dependencies" ,"dependecies": "dependencies" diff --git a/node_modules/read-package-json/package.json b/node_modules/read-package-json/package.json index 0049e5e9c..6a2796e0b 100644 --- a/node_modules/read-package-json/package.json +++ b/node_modules/read-package-json/package.json @@ -35,5 +35,5 @@ "url": "https://github.com/isaacs/read-package-json/issues" }, "_id": "read-package-json@0.4.1", - "_from": "read-package-json@latest" + "_from": "read-package-json@~0.4.1" } |