Socket
Socket
Sign inDemoInstall

normalize-package-data

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

normalize-package-data - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

24

lib/fixer.js

@@ -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()

{
"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.",

@@ -73,2 +73,3 @@ # normalize-package-data [![Build Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](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

@@ -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)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc