Hello community,

here is the log from the commit of package nodejs-normalize-package-data for 
openSUSE:Factory checked in at 2015-07-02 22:39:21
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-normalize-package-data (Old)
 and      /work/SRC/openSUSE:Factory/.nodejs-normalize-package-data.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "nodejs-normalize-package-data"

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/nodejs-normalize-package-data/nodejs-normalize-package-data.changes
      2015-04-27 13:01:58.000000000 +0200
+++ 
/work/SRC/openSUSE:Factory/.nodejs-normalize-package-data.new/nodejs-normalize-package-data.changes
 2015-07-02 22:39:22.000000000 +0200
@@ -1,0 +2,10 @@
+Sat Jun  6 11:27:36 UTC 2015 - i...@marguerite.su
+
+- update version 2.2.0
+
+-------------------------------------------------------------------
+Fri Apr 24 12:25:21 UTC 2015 - hvo...@suse.com
+
+- Update to version 2.0.0
+
+-------------------------------------------------------------------

Old:
----
  normalize-package-data-1.0.3.tgz

New:
----
  normalize-package-data-2.2.0.tgz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ nodejs-normalize-package-data.spec ++++++
--- /var/tmp/diff_new_pack.pIzMUt/_old  2015-07-02 22:39:23.000000000 +0200
+++ /var/tmp/diff_new_pack.pIzMUt/_new  2015-07-02 22:39:23.000000000 +0200
@@ -19,7 +19,7 @@
 %define base_name normalize-package-data
 
 Name:           nodejs-normalize-package-data
-Version:        1.0.3
+Version:        2.2.0
 Release:        0
 Summary:        Normalizes data that can be found in package.json files
 License:        BSD-2-Clause

++++++ normalize-package-data-1.0.3.tgz -> normalize-package-data-2.2.0.tgz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/README.md new/package/README.md
--- old/package/README.md       2014-09-30 01:05:04.000000000 +0200
+++ new/package/README.md       2015-05-22 01:32:48.000000000 +0200
@@ -1,4 +1,4 @@
-# normalize-package-data [![Build 
Status](https://travis-ci.org/meryn/normalize-package-data.png?branch=master)](https://travis-ci.org/meryn/normalize-package-data)
+# normalize-package-data [![Build 
Status](https://travis-ci.org/npm/normalize-package-data.png?branch=master)](https://travis-ci.org/npm/normalize-package-data)
 
 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.
 
@@ -68,9 +68,11 @@
 * 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.
+* As of v2: Dependencies that point at known hosted git providers (currently: 
github, bitbucket, gitlab) will have their URLs canonicalized, but protocols 
will be preserved.
+* As of v2: Dependencies that use shortcuts for hosted git providers 
(`org/proj`, `github:org/proj`, `bitbucket:org/proj`, `gitlab:org/proj`, 
`gist:docid`) will have the shortcut left in place. (In the case of github, the 
`org/proj` form will be expanded to `github:org/proj`.) THIS MARKS A BREAKING 
CHANGE FROM V1, where the shorcut was previously expanded to a URL.
 * If `description` field does not exist, 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 `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 `repository.url` is not a valid url, but in the style of 
"[owner-name]/[repo-name]", `repository.url` will be set to 
https://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.
 * 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.
@@ -91,6 +93,10 @@
 
 If `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).
 
+### Rules for license field
+
+The `license` field should be a valid *SDPDX license expression* string, as 
determined by the `spdx.valid` method. See [documentation for the spdx 
module](https://github.com/kemitchell/spdx.js).
+
 ## Credits
 
 This package contains code based on read-package-json written by Isaac Z. 
Schlueter. Used with permisson.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/lib/fixer.js new/package/lib/fixer.js
--- old/package/lib/fixer.js    2014-09-30 01:09:04.000000000 +0200
+++ new/package/lib/fixer.js    2015-05-22 01:32:48.000000000 +0200
@@ -1,11 +1,11 @@
 var semver = require("semver")
-var parseGitHubURL = require("github-url-from-git")
+var spdx = require('spdx');
+var hostedGitInfo = require("hosted-git-info")
 var depTypes = ["dependencies","devDependencies","optionalDependencies"]
 var extractDescription = require("./extract_description")
 var url = require("url")
 var typos = require("./typos")
 var coreModuleNames = require("./core_module_names")
-var githubUserRepo = require("github-url-from-username-repo")
 
 var fixer = module.exports = {
   // default warning function
@@ -25,12 +25,10 @@
     }
     var r = data.repository.url || ""
     if (r) {
-      var ghurl = parseGitHubURL(r)
-      if (ghurl) {
-        r = ghurl.replace(/^https?:\/\//, 'git://')
-      } else if (githubUserRepo(r)) {
-        // repo has 'user/reponame' filled in as repo
-        data.repository.url = githubUserRepo(r)
+      var hosted = hostedGitInfo.fromUrl(r)
+      if (hosted) {
+        r = data.repository.url
+          = hosted.getDefaultRepresentation() == "shortcut" ? hosted.https() : 
hosted.toString()
       }
     }
 
@@ -57,7 +55,7 @@
       if (typeof data.scripts[k] !== "string") {
         this.warn("nonStringScript")
         delete data.scripts[k]
-      } else if (typos.script[k]) {
+      } else if (typos.script[k] && !data.scripts[typos.script[k]]) {
         this.warn("typo", k, typos.script[k], "scripts")
       }
     }, this)
@@ -143,11 +141,8 @@
           this.warn("nonStringDependency", d, JSON.stringify(r))
           delete data[deps][d]
         }
-        // "/" is not allowed as packagename for publishing, but for git-urls
-        // normalize shorthand-urls
-        if (githubUserRepo(data[deps][d])) {
-          data[deps][d] = 'git+' + githubUserRepo(data[deps][d])
-        }
+        var hosted = hostedGitInfo.fromUrl(data[deps][d])
+        if (hosted) data[deps][d] = hosted.toString()
       }, this)
     }, this)
   }
@@ -198,7 +193,10 @@
     modifyPeople(data, parsePerson)
   }
 
-, fixNameField: function(data, strict) {
+, fixNameField: function(data, options) {
+    if (typeof options === "boolean") options = {strict: options}
+    else if (typeof options === "undefined") options = {}
+    var strict = options.strict
     if (!data.name && !strict) {
       data.name = ""
       return
@@ -208,7 +206,7 @@
     }
     if (!strict)
       data.name = data.name.trim()
-    ensureValidName(data.name, strict)
+    ensureValidName(data.name, strict, options.allowLegacyCase)
     if (coreModuleNames.indexOf(data.name) !== -1)
       this.warn("conflictingName", data.name)
   }
@@ -234,12 +232,9 @@
 
 , fixBugsField: function(data) {
     if (!data.bugs && data.repository && data.repository.url) {
-      var gh = parseGitHubURL(data.repository.url)
-      if(gh) {
-        if(gh.match(/^https:\/\/github.com\//))
-          data.bugs = {url: gh + "/issues"}
-        else // gist url
-          data.bugs = {url: gh}
+      var hosted = hostedGitInfo.fromUrl(data.repository.url)
+      if(hosted && hosted.bugs()) {
+        data.bugs = {url: hosted.bugs()}
       }
     }
     else if(data.bugs) {
@@ -278,13 +273,10 @@
 
 , fixHomepageField: function(data) {
     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
+      var hosted = hostedGitInfo.fromUrl(data.repository.url)
+      if (hosted && hosted.docs()) data.homepage = hosted.docs()
+    }
+    if (!data.homepage) return
 
     if(typeof data.homepage !== "string") {
       this.warn("nonUrlHomepage")
@@ -295,6 +287,18 @@
       data.homepage = "http://"; + data.homepage
     }
   }
+
+, fixLicenseField: function(data) {
+    if (!data.license) {
+      return this.warn("missingLicense")
+    } else if (
+      typeof(data.license) !== 'string' ||
+      data.license.length < 1 ||
+      !spdx.valid(data.license)
+    ) {
+      this.warn("nonSPDXLicense")
+    }
+  }
 }
 
 function isValidScopedPackageName(spec) {
@@ -313,10 +317,10 @@
     spec === encodeURIComponent(spec)
 }
 
-function ensureValidName (name, strict) {
+function ensureValidName (name, strict, allowLegacyCase) {
   if (name.charAt(0) === "." ||
       !(isValidScopedPackageName(name) || isCorrectlyEncodedName(name)) ||
-      (strict && name !== name.toLowerCase()) ||
+      (strict && (!allowLegacyCase) && name !== name.toLowerCase()) ||
       name.toLowerCase() === "node_modules" ||
       name.toLowerCase() === "favicon.ico") {
         throw new Error("Invalid name: " + JSON.stringify(name))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/lib/normalize.js new/package/lib/normalize.js
--- old/package/lib/normalize.js        2014-04-25 00:48:20.000000000 +0200
+++ new/package/lib/normalize.js        2015-05-22 01:32:48.000000000 +0200
@@ -1,10 +1,12 @@
 module.exports = normalize
 
 var fixer = require("./fixer")
+normalize.fixer = fixer
+
 var makeWarning = require("./make_warning")
 
 var fieldsToFix = 
['name','version','description','repository','modules','scripts'
-                  ,'files','bin','man','bugs','keywords','readme','homepage']
+                  
,'files','bin','man','bugs','keywords','readme','homepage','license']
 var otherThingsToFix = ['dependencies','people', 'typos']
 
 var thingsToFix = fieldsToFix.map(function(fieldName) { 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/lib/warning_messages.json 
new/package/lib/warning_messages.json
--- old/package/lib/warning_messages.json       2014-09-30 01:08:55.000000000 
+0200
+++ new/package/lib/warning_messages.json       2015-05-22 01:32:48.000000000 
+0200
@@ -19,11 +19,13 @@
   ,"nonStringDescription": "'description' field should be a string"
   ,"missingDescription": "No description"
   ,"missingReadme": "No README data"
+  ,"missingLicense": "No license field."
   ,"nonEmailUrlBugsString": "Bug string field must be url, email, or 
{email,url}"
   ,"nonUrlBugsUrlField": "bugs.url field must be a string url. Deleted."
   ,"nonEmailBugsEmailField": "bugs.email field must be a string email. 
Deleted."
   ,"emptyNormalizedBugs": "Normalized value of bugs field is an empty object. 
Deleted."
   ,"nonUrlHomepage": "homepage field must be a string url. Deleted."
+  ,"nonSPDXLicense": "license should be a valid SPDX license expression"
   ,"missingProtocolHomepage": "homepage field must start with a protocol."
   ,"typo": "%s should probably be %s."
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json    2014-09-30 01:12:07.000000000 +0200
+++ new/package/package.json    2015-05-22 01:43:21.000000000 +0200
@@ -1,20 +1,21 @@
 {
   "name": "normalize-package-data",
-  "version": "1.0.3",
+  "version": "2.2.0",
   "author": "Meryn Stol <meryns...@gmail.com>",
   "description": "Normalizes data that can be found in package.json files.",
+  "license": "BSD-2-Clause",
   "repository": {
     "type": "git",
-    "url": "git://github.com/meryn/normalize-package-data.git"
+    "url": "git://github.com/npm/normalize-package-data.git"
   },
   "main": "lib/normalize.js",
   "scripts": {
     "test": "tap test/*.js"
   },
   "dependencies": {
-    "github-url-from-git": "^1.3.0",
-    "github-url-from-username-repo": "^1.0.0",
-    "semver": "2 || 3 || 4"
+    "hosted-git-info": "^2.0.2",
+    "semver": "2 || 3 || 4",
+    "spdx": "^0.4.0"
   },
   "devDependencies": {
     "tap": "~0.2.5",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/test/fixtures/read-package-json.json 
new/package/test/fixtures/read-package-json.json
--- old/package/test/fixtures/read-package-json.json    2013-04-20 
01:02:39.000000000 +0200
+++ new/package/test/fixtures/read-package-json.json    2015-05-22 
01:32:48.000000000 +0200
@@ -7,6 +7,7 @@
     "type": "git",
     "url": "git://github.com/isaacs/read-package-json.git"
   },
+  "license": "MIT",
   "main": "read-json.js",
   "scripts": {
     "test": "tap test/*.js"
@@ -24,4 +25,4 @@
     "npmlog": "0",
     "graceful-fs": "~1.1.8"
   }
-}
\ No newline at end of file
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/test/mixedcase-names.js 
new/package/test/mixedcase-names.js
--- old/package/test/mixedcase-names.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/mixedcase-names.js 2015-05-22 01:32:48.000000000 +0200
@@ -0,0 +1,32 @@
+var test = require('tap').test
+
+var normalize = require('../')
+var fixer = normalize.fixer
+
+test('mixedcase', function (t) {
+  t.doesNotThrow(function () {
+    fixer.fixNameField({name: 'foo'}, true)
+  })
+
+  t.doesNotThrow(function () {
+    fixer.fixNameField({name: 'foo'}, false)
+  })
+
+  t.doesNotThrow(function () {
+    fixer.fixNameField({name: 'foo'})
+  })
+
+  t.throws(function () {
+    fixer.fixNameField({name: 'Foo'}, true)
+  }, new Error('Invalid name: "Foo"'), 'should throw an error')
+
+  t.throws(function () {
+    fixer.fixNameField({name: 'Foo'}, {strict: true})
+  }, new Error('Invalid name: "Foo"'), 'should throw an error')
+
+  t.doesNotThrow(function () {
+    fixer.fixNameField({name: 'Foo'}, {strict: true, allowLegacyCase: true})
+  })
+
+  t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/test/normalize.js 
new/package/test/normalize.js
--- old/package/test/normalize.js       2014-06-06 08:06:18.000000000 +0200
+++ new/package/test/normalize.js       2015-05-22 01:32:48.000000000 +0200
@@ -9,6 +9,7 @@
 var safeFormat = require("../lib/safe_format")
 
 var rpjPath = path.resolve(__dirname,"./fixtures/read-package-json.json")
+
 tap.test("normalize some package data", function(t) {
   var packageData = require(rpjPath)
   var warnings = []
@@ -52,7 +53,8 @@
   t.same(warnings, [
     warningMessages.missingDescription,
     warningMessages.missingRepository,
-    warningMessages.missingReadme
+    warningMessages.missingReadme,
+    warningMessages.missingLicense
   ])
   t.end()
 })
@@ -75,7 +77,8 @@
       safeFormat(warningMessages.conflictingName, 'http'),
       warningMessages.nonEmailUrlBugsString,
       warningMessages.emptyNormalizedBugs,
-      warningMessages.nonUrlHomepage
+      warningMessages.nonUrlHomepage,
+      warningMessages.missingLicense
       ]
   t.same(warnings, expect)
   t.end()
@@ -109,9 +112,11 @@
       warningMessages.nonEmailBugsEmailField,
       warningMessages.emptyNormalizedBugs,
       warningMessages.missingReadme,
+      warningMessages.missingLicense,
       warningMessages.nonEmailUrlBugsString,
       warningMessages.emptyNormalizedBugs,
-      warningMessages.nonUrlHomepage ]
+      warningMessages.nonUrlHomepage,
+      warningMessages.missingLicense]
   t.same(warnings, expect)
   t.end()
 })
@@ -132,18 +137,40 @@
     [ warningMessages.missingDescription,
       warningMessages.missingRepository,
       warningMessages.missingReadme,
-      warningMessages.missingProtocolHomepage ]
+      warningMessages.missingProtocolHomepage,
+      warningMessages.missingLicense]
   t.same(warnings, expect)
   t.same(a.homepage, 'http://example.org')
   t.end()
 })
 
+tap.test("license field should be a valid SPDX expression", function(t) {
+  var warnings = []
+  function warn(w) {
+    warnings.push(w)
+  }
+  var a
+  normalize(a={
+    license: 'Apache 2'
+  }, warn)
+
+  console.error(a)
+
+  var expect =
+    [ warningMessages.missingDescription,
+      warningMessages.missingRepository,
+      warningMessages.missingReadme,
+      warningMessages.nonSPDXLicense]
+  t.same(warnings, expect)
+  t.end()
+})
+
 tap.test("gist bugs url", function(t) {
   var d = {
     repository: "g...@gist.github.com:123456.git"
   }
   normalize(d)
-  t.same(d.repository, { type: 'git', url: 'g...@gist.github.com:123456.git' })
+  t.same(d.repository, { type: 'git', url: 
'git+ssh://g...@gist.github.com/123456.git' })
   t.same(d.bugs, { url: 'https://gist.github.com/123456' })
   t.end();
 });
@@ -151,21 +178,21 @@
 tap.test("singularize repositories", function(t) {
   var d = {repositories:["g...@gist.github.com:123456.git"]}
   normalize(d)
-  t.same(d.repository, { type: 'git', url: 'g...@gist.github.com:123456.git' })
+  t.same(d.repository, { type: 'git', url: 
'git+ssh://g...@gist.github.com/123456.git' })
   t.end()
 });
 
 tap.test("treat visionmedia/express as github repo", function(t) {
   var d = {repository: {type: "git", url: "visionmedia/express"}}
   normalize(d)
-  t.same(d.repository, { type: "git", url: 
"https://github.com/visionmedia/express"; })
+  t.same(d.repository, { type: "git", url: 
"git+https://github.com/visionmedia/express.git"; })
   t.end()
 });
 
 tap.test("treat isaacs/node-graceful-fs as github repo", function(t) {
   var d = {repository: {type: "git", url: "isaacs/node-graceful-fs"}}
   normalize(d)
-  t.same(d.repository, { type: "git", url: 
"https://github.com/isaacs/node-graceful-fs"; })
+  t.same(d.repository, { type: "git", url: 
"git+https://github.com/isaacs/node-graceful-fs.git"; })
   t.end()
 });
 
@@ -174,7 +201,7 @@
   normalize(a={
     repository: { type: "git", url: 
"https://github.com/isaacs/node-graceful-fs"; }
   })
-  t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs')
+  t.same(a.homepage, 'https://github.com/isaacs/node-graceful-fs#readme')
   t.end()
 })
 
@@ -192,14 +219,14 @@
   normalize(a={
     repository: { type: "git", url: "sindresorhus/chalk" }
   })
-  t.same(a.homepage, 'https://github.com/sindresorhus/chalk')
+  t.same(a.homepage, 'https://github.com/sindresorhus/chalk#readme')
   t.end()
 })
 
-tap.test("treat isaacs/node-graceful-fs as github repo in dependencies", 
function(t) {
+tap.test("don't mangle github shortcuts in dependencies", function(t) {
   var d = {dependencies: {"node-graceful-fs": "isaacs/node-graceful-fs"}}
   normalize(d)
-  t.same(d.dependencies, {"node-graceful-fs": 
"git+https://github.com/isaacs/node-graceful-fs"; })
+  t.same(d.dependencies, {"node-graceful-fs": "github:isaacs/node-graceful-fs" 
})
   t.end()
 });
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/package/test/typo.js new/package/test/typo.js
--- old/package/test/typo.js    2014-04-25 00:48:20.000000000 +0200
+++ new/package/test/typo.js    2015-05-22 01:32:48.000000000 +0200
@@ -15,6 +15,7 @@
 
   var expect =
     [ warningMessages.missingRepository,
+      warningMessages.missingLicense,
       typoMessage('dependancies', 'dependencies'),
       typoMessage('dependecies', 'dependencies'),
       typoMessage('depdenencies', 'dependencies'),
@@ -66,7 +67,8 @@
       typoMessage("bugs['name']", "bugs['url']"),
       warningMessages.nonUrlBugsUrlField,
       warningMessages.emptyNormalizedBugs,
-      warningMessages.missingReadme ]
+      warningMessages.missingReadme,
+      warningMessages.missingLicense]
 
   normalize({name:"name"
             ,version:"1.2.5"
@@ -79,6 +81,7 @@
     [ warningMessages.missingDescription,
       warningMessages.missingRepository,
       warningMessages.missingReadme,
+      warningMessages.missingLicense,
       typoMessage('script', 'scripts') ]
 
   normalize({name:"name"
@@ -93,7 +96,8 @@
       warningMessages.missingRepository,
       typoMessage("scripts['server']", "scripts['start']"),
       typoMessage("scripts['tests']", "scripts['test']"),
-      warningMessages.missingReadme ]
+      warningMessages.missingReadme,
+      warningMessages.missingLicense]
 
   normalize({name:"name"
             ,version:"1.2.5"
@@ -101,6 +105,20 @@
 
   t.same(warnings, expect)
 
+  warnings.length = 0
+  expect =
+    [ warningMessages.missingDescription,
+      warningMessages.missingRepository,
+      warningMessages.missingReadme,
+      warningMessages.missingLicense]
+
+  normalize({name:"name"
+            ,version:"1.2.5"
+            ,scripts:{server:"start",tests:"test"
+                     ,start:"start",test:"test"}}, warn)
+
+  t.same(warnings, expect)
+
   warnings.length = 0
   expect = []
 


Reply via email to