normalize-package-data
Advanced tools
+2
-1
| # Names sorted by how much code was originally theirs. | ||
| Isaac Z. Schlueter <i@izs.me> | ||
| Meryn Stol <merynstol@gmail.com> | ||
| Meryn Stol <merynstol@gmail.com> | ||
| Robert Kowalski <rok@kowalski.gd> |
+16
-8
@@ -186,4 +186,4 @@ var semver = require("semver") | ||
| modifyPeople(data, unParsePerson) | ||
| modifyPeople(data, parsePerson) | ||
| } | ||
| modifyPeople(data, parsePerson) | ||
| } | ||
@@ -202,4 +202,4 @@ , fixNameField: function(data, strict) { | ||
| } | ||
| , fixDescriptionField: function (data) { | ||
@@ -214,3 +214,3 @@ if (data.description && typeof data.description !== 'string') { | ||
| } | ||
| , fixReadmeField: function (data) { | ||
@@ -222,3 +222,3 @@ if (!data.readme) { | ||
| } | ||
| , fixBugsField: function(data) { | ||
@@ -269,3 +269,11 @@ if (!data.bugs && data.repository && data.repository.url) { | ||
| , fixHomepageField: function(data) { | ||
| if(!data.homepage) return true; | ||
| if (!data.homepage && data.repository && data.repository.url) { | ||
| var gh = parseGitHubURL(data.repository.url) | ||
| if (gh) | ||
| data.homepage = gh | ||
| else | ||
| return true | ||
| } else if (!data.homepage) | ||
| return true | ||
| if(typeof data.homepage !== "string") { | ||
@@ -331,3 +339,3 @@ this.warn("homepage field must be a string url. Deleted.") | ||
| }) | ||
| data.dependencies = d | ||
| data.dependencies = d | ||
| } | ||
@@ -344,3 +352,3 @@ | ||
| return typeof d === "string" | ||
| }).forEach(function(d) { | ||
| }).forEach(function(d) { | ||
| d = d.trim().split(/(:?[@\s><=])/) | ||
@@ -347,0 +355,0 @@ var dn = d.shift() |
+1
-1
| { | ||
| "name": "normalize-package-data", | ||
| "version": "0.2.2", | ||
| "version": "0.2.3", | ||
| "author": "Meryn Stol <merynstol@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Normalizes data that can be found in package.json files.", |
+2
-0
@@ -73,2 +73,3 @@ # normalize-package-data [](https://travis-ci.org/meryn/normalize-package-data) | ||
| * 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 `repository.url` is not a valid url, but in the style of "[owner-name]/[repo-name]", `repository.url` will be set to git://github.com/[owner-name]/[repo-name] | ||
| * If `bugs` field is a string, the value of `bugs` field is changed into an object with `url` set to the original string value. | ||
@@ -79,2 +80,3 @@ * 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 the url in the `homepage` field does not specify a protocol, then http is assumed. For example, `myproject.org` will be changed to `http://myproject.org`. | ||
| * If `homepage` field does not exist, but `repository` field points to a repository hosted on GitHub, the value of the `homepage` field gets set to an url in the form of https://github.com/[owner-name]/[repo-name]/ . If the repository field points to a GitHub Gist repo url, the associated http url is chosen. | ||
@@ -81,0 +83,0 @@ ### Rules for name field |
+27
-0
@@ -146,2 +146,29 @@ var tap = require("tap") | ||
| tap.test("homepage field will set to github url if repository is a github repo", function(t) { | ||
| var a | ||
| normalize(a={ | ||
| repository: { type: "git", url: "git://github.com/isaacs/node-graceful-fs" } | ||
| }) | ||
| t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs') | ||
| t.end() | ||
| }) | ||
| tap.test("homepage field will set to github gist url if repository is a gist", function(t) { | ||
| var a | ||
| normalize(a={ | ||
| repository: { type: "git", url: "git@gist.github.com:123456.git" } | ||
| }) | ||
| t.same(a.homepage, 'https://gist.github.com/123456') | ||
| t.end() | ||
| }) | ||
| tap.test("homepage field will set to github gist url if repository is a shorthand reference", function(t) { | ||
| var a | ||
| normalize(a={ | ||
| repository: { type: "git", url: "sindresorhus/chalk" } | ||
| }) | ||
| t.same(a.homepage, 'https://github.com/sindresorhus/chalk') | ||
| t.end() | ||
| }) | ||
| tap.test('no new globals', function(t) { | ||
@@ -148,0 +175,0 @@ t.same(Object.keys(global), globals) |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
46264
3.39%1254
2.53%101
2.02%