Hello community,
here is the log from the commit of package nodejs-npm-package-arg for
openSUSE:Factory checked in at 2015-07-02 22:39:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/nodejs-npm-package-arg (Old)
and /work/SRC/openSUSE:Factory/.nodejs-npm-package-arg.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nodejs-npm-package-arg"
Changes:
--------
---
/work/SRC/openSUSE:Factory/nodejs-npm-package-arg/nodejs-npm-package-arg.changes
2015-04-27 13:03:05.000000000 +0200
+++
/work/SRC/openSUSE:Factory/.nodejs-npm-package-arg.new/nodejs-npm-package-arg.changes
2015-07-02 22:39:28.000000000 +0200
@@ -1,0 +2,10 @@
+Sat Jun 6 11:31:47 UTC 2015 - [email protected]
+
+- update version 4.0.1
+
+-------------------------------------------------------------------
+Fri Apr 24 12:28:49 UTC 2015 - [email protected]
+
+- Update to version 4.0.0
+
+-------------------------------------------------------------------
Old:
----
npm-package-arg-2.1.3.tgz
New:
----
npm-package-arg-4.0.1.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ nodejs-npm-package-arg.spec ++++++
--- /var/tmp/diff_new_pack.WkaIlb/_old 2015-07-02 22:39:28.000000000 +0200
+++ /var/tmp/diff_new_pack.WkaIlb/_new 2015-07-02 22:39:28.000000000 +0200
@@ -19,7 +19,7 @@
%define base_name npm-package-arg
Name: nodejs-npm-package-arg
-Version: 2.1.3
+Version: 4.0.1
Release: 0
Summary: Parse things that can be arguments to `npm install`
License: ISC
++++++ npm-package-arg-2.1.3.tgz -> npm-package-arg-4.0.1.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-27 07:35:23.000000000 +0200
+++ new/package/README.md 2015-05-21 22:46:39.000000000 +0200
@@ -1,26 +1,54 @@
# npm-package-arg
-Parse the things that can be arguments to `npm install`
+Parse package name and specifier passed to commands like `npm install` or
+`npm cache add`. This just parses the text given-- it's worth noting that
+`npm` has further logic it applies by looking at your disk to figure out
+what ambiguous specifiers are. If you want that logic, please see
+[realize-package-specifier].
-Takes an argument like `[email protected]`, or `foo@user/foo`, or
-`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`, and
-figures out what type of thing it is.
+[realize-package-specifier]:
https://www.npmjs.org/package/realize-package-specifier
-## USAGE
+Arguments look like: `[email protected]`, `@bar/[email protected]`, `foo@user/foo`,
`http://x.com/foo.tgz`,
+`git+https://github.com/user/foo`, `bitbucket:user/foo`, `foo.tar.gz` or `bar`
+
+## EXAMPLES
```javascript
var assert = require("assert")
var npa = require("npm-package-arg")
// Pass in the descriptor, and it'll return an object
-var parsed = npa("[email protected]")
+var parsed = npa("@bar/[email protected]")
+
+// Returns an object like:
+{
+ raw: '@bar/[email protected]', // what was passed in
+ name: "@bar/foo", // the name of the package
+ scope: "@bar", // the private scope of the package, or null
+ type: "range", // the type of specifier this is
+ spec: ">=1.2.0 <1.3.0" // the expanded specifier
+ rawSpec: "1.2" // the specifier as passed in
+ }
+
+// Parsing urls pointing at hosted git services produces a variation:
+var parsed = npa("git+https://github.com/user/foo")
// Returns an object like:
-// {
-// name: "foo", // The bit in front of the @
-// type: "range", // the type of descriptor this is
-// spec: "1.2" // the specifier for this descriptor
-// }
+{
+ raw: 'git+https://github.com/user/foo',
+ scope: null,
+ name: null,
+ rawSpec: 'git+https://github.com/user/foo',
+ spec: 'user/foo',
+ type: 'hosted',
+ hosted: {
+ type: 'github',
+ ssh: '[email protected]:user/foo.git',
+ sshurl: 'git+ssh://[email protected]/user/foo.git',
+ https: 'https://github.com/user/foo.git',
+ directUrl: 'https://raw.githubusercontent.com/user/foo/master/package.json'
+ }
+}
// Completely unreasonable invalid garbage throws an error
// Make sure you wrap this in a try/catch if you have not
@@ -30,23 +58,41 @@
})
```
-For more examples, see the test file.
+## USING
+
+`var npa = require('npm-package-arg')`
+
+* var result = npa(*arg*)
+
+Parses *arg* and returns a result object detailing what *arg* is.
+
+*arg* -- a package descriptor, like: `[email protected]`, or `foo@user/foo`, or
+`http://x.com/foo.tgz`, or `git+https://github.com/user/foo`
-## Result Objects
+## RESULT OBJECT
The objects that are returned by npm-package-arg contain the following
-fields:
+keys:
* `name` - If known, the `name` field expected in the resulting pkg.
* `type` - One of the following strings:
* `git` - A git repo
- * `github` - A github shorthand, like `user/project`
+ * `hosted` - A hosted project, from github, bitbucket or gitlab. Originally
+ either a full url pointing at one of these services or a shorthand like
+ `user/project` or `github:user/project` for github or
`bitbucket:user/project`
+ for bitbucket.
* `tag` - A tagged version, like `"foo@latest"`
* `version` - A specific version number, like `"[email protected]"`
* `range` - A version range, like `"[email protected]"`
* `local` - A local file or folder path
* `remote` - An http url (presumably to a tgz)
* `spec` - The "thing". URL, the range, git repo, etc.
+* `hosted` - If type=hosted this will be an object with the following keys:
+ * `type` - github, bitbucket or gitlab
+ * `ssh` - The ssh path for this git repo
+ * `sshUrl` - The ssh URL for this git repo
+ * `httpsUrl` - The HTTPS URL for this git repo
+ * `directUrl` - The URL for the package.json in this git repo
* `raw` - The original un-modified string that was provided.
* `rawSpec` - The part after the `name@...`, as it was originally
provided.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/npa.js new/package/npa.js
--- old/package/npa.js 2014-09-27 07:35:23.000000000 +0200
+++ new/package/npa.js 2015-05-21 22:51:43.000000000 +0200
@@ -3,14 +3,15 @@
var util = require("util")
var semver = require("semver")
var path = require("path")
+var HostedGit = require("hosted-git-info")
module.exports = npa
var isWindows = process.platform === "win32" || global.FAKE_WINDOWS
-var slashRe = isWindows ? /\\|\// : /\//
+var slashRe = isWindows ? /\\|[/]/ : /[/]/
-var parseName = /^(?:@([^\/]+?)\/)?([^\/]+?)$/
-var nameAt = /^(@([^\/]+?)\/)?([^\/]+?)@/
+var parseName = /^(?:@([^/]+?)[/])?([^/]+?)$/
+var nameAt = /^(@([^/]+?)[/])?([^/]+?)@/
var debug = util.debuglog ? util.debuglog("npa")
: /\bnpa\b/i.test(process.env.NODE_DEBUG || "")
? function () {
@@ -25,7 +26,7 @@
var n = name.trim()
if (!n || n.charAt(0) === "."
|| !n.match(/^[a-zA-Z0-9]/)
- || n.match(/[\/\(\)&\?#\|<>@:%\s\\\*'"!~`]/)
+ || n.match(/[/()&?#|<>@:%\s\\*'"!~`]/)
|| n.toLowerCase() === "node_modules"
|| n !== encodeURIComponent(n)
|| n.toLowerCase() === "favicon.ico") {
@@ -70,20 +71,11 @@
urlparse = {}
}
- if (urlparse.protocol) {
+ if (urlparse.protocol || HostedGit.fromUrl(arg)) {
return parseUrl(res, arg, urlparse)
}
- // parse git stuff
- // parse tag/range/local/remote
-
- if (maybeGitHubShorthand(arg)) {
- res.type = "github"
- res.spec = arg
- return res
- }
-
- // at this point, it's not a url, and not github
+ // at this point, it's not a url, and not hosted
// If it's a valid name, and doesn't already have a name, then assume
// $name@"" range
//
@@ -132,19 +124,22 @@
res.spec = path.resolve(arg)
}
-function maybeGitHubShorthand (arg) {
- // Note: This does not fully test the git ref format.
- // See
https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
- //
- // The only way to do this properly would be to shell out to
- // git-check-ref-format, and as this is a fast sync function,
- // we don't want to do that. Just let git fail if it turns
- // out that the commit-ish is invalid.
- // GH usernames cannot start with . or -
- return /^[^@%\/\s\.-][^@%\/\s]*\/[^@\s\/%]+(?:#.*)?$/.test(arg)
-}
-
function parseUrl (res, arg, urlparse) {
+ var gitHost = HostedGit.fromUrl(arg)
+ if (gitHost) {
+ res.type = "hosted"
+ res.spec = gitHost.toString(),
+ res.hosted = {
+ type: gitHost.type,
+ ssh: gitHost.ssh(),
+ sshUrl: gitHost.sshurl(),
+ httpsUrl: gitHost.https(),
+ gitUrl: gitHost.git(),
+ shortcut: gitHost.shortcut(),
+ directUrl: gitHost.file("package.json")
+ }
+ return res
+ }
// check the protocol, and then see if it's git or not
switch (urlparse.protocol) {
case "git:":
@@ -154,23 +149,23 @@
case "git+ftp:":
case "git+ssh:":
case "git+file:":
- res.type = 'git'
- res.spec = arg.replace(/^git\+/, '')
+ res.type = "git"
+ res.spec = arg.replace(/^git[+]/, "")
break
- case 'http:':
- case 'https:':
- res.type = 'remote'
+ case "http:":
+ case "https:":
+ res.type = "remote"
res.spec = arg
break
- case 'file:':
- res.type = 'local'
+ case "file:":
+ res.type = "local"
res.spec = urlparse.pathname
- break;
+ break
default:
- throw new Error('Unsupported URL Type: ' + arg)
+ throw new Error("Unsupported URL Type: " + arg)
break
}
@@ -181,7 +176,8 @@
function Result () {
if (!(this instanceof Result)) return new Result
}
-Result.prototype.name = null
-Result.prototype.type = null
-Result.prototype.spec = null
-Result.prototype.raw = null
+Result.prototype.name = null
+Result.prototype.type = null
+Result.prototype.spec = null
+Result.prototype.raw = null
+Result.prototype.hosted = null
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/package.json new/package/package.json
--- old/package/package.json 2014-09-29 18:40:39.000000000 +0200
+++ new/package/package.json 2015-05-21 22:54:12.000000000 +0200
@@ -1,12 +1,13 @@
{
"name": "npm-package-arg",
- "version": "2.1.3",
+ "version": "4.0.1",
"description": "Parse the things that can be arguments to `npm install`",
"main": "npa.js",
"directories": {
"test": "test"
},
"dependencies": {
+ "hosted-git-info": "^2.1.4",
"semver": "4"
},
"devDependencies": {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/package.json~ new/package/package.json~
--- old/package/package.json~ 2014-09-29 17:42:29.000000000 +0200
+++ new/package/package.json~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,28 +0,0 @@
-{
- "name": "npm-package-arg",
- "version": "2.1.2",
- "description": "Parse the things that can be arguments to `npm install`",
- "main": "npa.js",
- "directories": {
- "test": "test"
- },
- "dependencies": {
- "semver": "^2.3.0 || 3.x || 4"
- },
- "devDependencies": {
- "tap": "^0.4.9"
- },
- "scripts": {
- "test": "tap test/*.js"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/npm/npm-package-arg"
- },
- "author": "Isaac Z. Schlueter <[email protected]> (http://blog.izs.me/)",
- "license": "ISC",
- "bugs": {
- "url": "https://github.com/npm/npm-package-arg/issues"
- },
- "homepage": "https://github.com/npm/npm-package-arg"
-}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/basic.js new/package/test/basic.js
--- old/package/test/basic.js 2014-09-29 18:40:04.000000000 +0200
+++ new/package/test/basic.js 2015-05-21 22:51:58.000000000 +0200
@@ -63,11 +63,11 @@
rawSpec: "=v1.2.3"
},
- "git+ssh://[email protected]/user/foo#1.2.3": {
+ "git+ssh://[email protected]/user/foo#1.2.3": {
name: null,
type: "git",
- spec: "ssh://[email protected]/user/foo#1.2.3",
- raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ spec: "ssh://[email protected]/user/foo#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
},
"git+file://path/to/repo#1.2.3": {
@@ -77,25 +77,25 @@
raw: "git+file://path/to/repo#1.2.3"
},
- "git://github.com/user/foo": {
+ "git://notgithub.com/user/foo": {
name: null,
type: "git",
- spec: "git://github.com/user/foo",
- raw: "git://github.com/user/foo"
+ spec: "git://notgithub.com/user/foo",
+ raw: "git://notgithub.com/user/foo"
},
- "@foo/bar@git+ssh://github.com/user/foo": {
+ "@foo/bar@git+ssh://notgithub.com/user/foo": {
name: "@foo/bar",
scope: "@foo",
- spec: "ssh://github.com/user/foo",
- rawSpec: "git+ssh://github.com/user/foo",
- raw: "@foo/bar@git+ssh://github.com/user/foo"
+ spec: "ssh://notgithub.com/user/foo",
+ rawSpec: "git+ssh://notgithub.com/user/foo",
+ raw: "@foo/bar@git+ssh://notgithub.com/user/foo"
},
"/path/to/foo": {
name: null,
type: "local",
- spec: "/path/to/foo",
+ spec: path.resolve(__dirname, "/path/to/foo"),
raw: "/path/to/foo"
},
@@ -134,41 +134,6 @@
raw: "https://server.com/foo.tgz"
},
- "user/foo-js": {
- name: null,
- type: "github",
- spec: "user/foo-js",
- raw: "user/foo-js"
- },
-
- "user/foo-js#bar/baz": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz",
- raw: "user/foo-js#bar/baz"
- },
-
- "user..blerg--/..foo-js# . . . . . some . tags / / /": {
- name: null,
- type: "github",
- spec: "user..blerg--/..foo-js# . . . . . some . tags / / /",
- raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
- },
-
- "user/foo-js#bar/baz/bin": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz/bin",
- raw: "user/foo-js#bar/baz/bin"
- },
-
- "foo@user/foo-js": {
- name: "foo",
- type: "github",
- spec: "user/foo-js",
- raw: "foo@user/foo-js"
- },
-
"foo@latest": {
name: "foo",
type: "tag",
@@ -186,8 +151,8 @@
Object.keys(tests).forEach(function (arg) {
var res = npa(arg)
- t.type(res, "Result")
- t.has(res, tests[arg])
+ t.type(res, "Result", arg + " is result")
+ t.has(res, tests[arg], arg + " matches expectations")
})
// Completely unreasonable invalid garbage throws an error
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/basic.js~ new/package/test/basic.js~
--- old/package/test/basic.js~ 2014-09-27 07:35:23.000000000 +0200
+++ new/package/test/basic.js~ 1970-01-01 01:00:00.000000000 +0100
@@ -1,203 +0,0 @@
-var npa = require("../npa.js")
-var path = require("path")
-
-require("tap").test("basic", function (t) {
- t.setMaxListeners(999)
-
- var tests = {
- "[email protected]": {
- name: "foo",
- type: "range",
- spec: ">=1.2.0-0 <1.3.0-0",
- raw: "[email protected]",
- rawSpec: "1.2"
- },
-
- "@foo/bar": {
- raw: "@foo/bar",
- name: "@foo/bar",
- scope: "@foo",
- rawSpec: "",
- spec: "*",
- type: "range"
- },
-
- "@foo/bar@": {
- raw: "@foo/bar@",
- name: "@foo/bar",
- scope: "@foo",
- rawSpec: "",
- spec: "*",
- type: "range"
- },
-
- "@foo/bar@baz": {
- raw: "@foo/bar@baz",
- name: "@foo/bar",
- scope: "@foo",
- rawSpec: "baz",
- spec: "baz",
- type: "tag"
- },
-
- "@f fo o al/ a d s ;f ": {
- raw: "@f fo o al/ a d s ;f",
- name: null,
- rawSpec: "@f fo o al/ a d s ;f",
- spec: path.resolve("@f fo o al/ a d s ;f"),
- type: "local"
- },
-
- "[email protected]": {
- name: "foo",
- type: "version",
- spec: "1.2.3",
- raw: "[email protected]"
- },
-
- "foo@=v1.2.3": {
- name: "foo",
- type: "version",
- spec: "1.2.3",
- raw: "foo@=v1.2.3",
- rawSpec: "=v1.2.3"
- },
-
- "git+ssh://[email protected]/user/foo#1.2.3": {
- name: null,
- type: "git",
- spec: "ssh://[email protected]/user/foo#1.2.3",
- raw: "git+ssh://[email protected]/user/foo#1.2.3"
- },
-
- "git+file://path/to/repo#1.2.3": {
- name: null,
- type: "git",
- spec: "file://path/to/repo#1.2.3",
- raw: "git+file://path/to/repo#1.2.3"
- },
-
- "git://github.com/user/foo": {
- name: null,
- type: "git",
- spec: "git://github.com/user/foo",
- raw: "git://github.com/user/foo"
- },
-
- "@foo/bar@git+ssh://github.com/user/foo": {
- name: "@foo/bar",
- scope: "@foo",
- spec: "ssh://github.com/user/foo",
- rawSpec: "git+ssh://github.com/user/foo",
- raw: "@foo/bar@git+ssh://github.com/user/foo"
- },
-
- "/path/to/foo": {
- name: null,
- type: "local",
- spec: "/path/to/foo",
- raw: "/path/to/foo"
- },
-
- "file:path/to/foo": {
- name: null,
- type: "local",
- spec: "path/to/foo",
- raw: "file:path/to/foo"
- },
-
- "file:~/path/to/foo": {
- name: null,
- type: "local",
- spec: "~/path/to/foo",
- raw: "file:~/path/to/foo"
- },
-
- "file:../path/to/foo": {
- name: null,
- type: "local",
- spec: "../path/to/foo",
- raw: "file:../path/to/foo"
- },
-
- "file:///path/to/foo": {
- name: null,
- type: "local",
- spec: "/path/to/foo",
- raw: "file:///path/to/foo"
- },
-
- "https://server.com/foo.tgz": {
- name: null,
- type: "remote",
- spec: "https://server.com/foo.tgz",
- raw: "https://server.com/foo.tgz"
- },
-
- "user/foo-js": {
- name: null,
- type: "github",
- spec: "user/foo-js",
- raw: "user/foo-js"
- },
-
- "user/foo-js#bar/baz": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz",
- raw: "user/foo-js#bar/baz"
- },
-
- "user..blerg--/..foo-js# . . . . . some . tags / / /": {
- name: null,
- type: "github",
- spec: "user..blerg--/..foo-js# . . . . . some . tags / / /",
- raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
- },
-
- "user/foo-js#bar/baz/bin": {
- name: null,
- type: "github",
- spec: "user/foo-js#bar/baz/bin",
- raw: "user/foo-js#bar/baz/bin"
- },
-
- "foo@user/foo-js": {
- name: "foo",
- type: "github",
- spec: "user/foo-js",
- raw: "foo@user/foo-js"
- },
-
- "foo@latest": {
- name: "foo",
- type: "tag",
- spec: "latest",
- raw: "foo@latest"
- },
-
- "foo": {
- name: "foo",
- type: "range",
- spec: "*",
- raw: "foo"
- }
- }
-
- Object.keys(tests).forEach(function (arg) {
- var res = npa(arg)
- t.type(res, "Result")
- t.has(res, tests[arg])
- })
-
- // Completely unreasonable invalid garbage throws an error
- t.throws(function() {
- npa("this is not a \0 valid package name or url")
- })
-
- t.throws(function() {
- npa("gopher://yea right")
- }, "Unsupported URL Type: gopher://yea right")
-
- t.end()
-})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/bitbucket.js
new/package/test/bitbucket.js
--- old/package/test/bitbucket.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/bitbucket.js 2015-05-21 22:51:43.000000000 +0200
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "bitbucket:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js",
+ raw: "bitbucket:user/foo-js"
+ },
+
+ "bitbucket:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js#bar/baz",
+ raw: "bitbucket:user/foo-js#bar/baz"
+ },
+
+ "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "bitbucket:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js#bar/baz/bin",
+ raw: "bitbucket:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@bitbucket:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js",
+ raw: "foo@bitbucket:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "https://bitbucket.org/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+https://bitbucket.org/user/foo.git",
+ raw: "https://bitbucket.org/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://bitbucket.org/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://bitbucket.org/user/foo",
+ raw: "@foo/bar@git+ssh://bitbucket.org/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/bitbucket.js~
new/package/test/bitbucket.js~
--- old/package/test/bitbucket.js~ 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/bitbucket.js~ 2015-05-21 22:48:51.000000000 +0200
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "bitbucket:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js",
+ raw: "bitbucket:user/foo-js"
+ },
+
+ "bitbucket:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js#bar/baz",
+ raw: "bitbucket:user/foo-js#bar/baz"
+ },
+
+ "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "bitbucket:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "bitbucket:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js#bar/baz/bin",
+ raw: "bitbucket:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@bitbucket:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "bitbucket:user/foo-js",
+ raw: "foo@bitbucket:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "https://bitbucket.org/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+https:bitbucket.org/user/foo.git",
+ raw: "https://bitbucket.org/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://bitbucket.org/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "bitbucket" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://bitbucket.org/user/foo",
+ raw: "@foo/bar@git+ssh://bitbucket.org/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/github.js new/package/test/github.js
--- old/package/test/github.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/github.js 2015-05-21 22:51:43.000000000 +0200
@@ -0,0 +1,106 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "user/foo-js"
+ },
+
+ "user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js#bar/baz",
+ raw: "user/foo-js#bar/baz"
+ },
+
+ "user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ raw: "github:user/foo-js#bar/baz/bin",
+ raw: "user/foo-js#bar/baz/bin"
+ },
+
+ "foo@user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "foo@user/foo-js"
+ },
+
+ "github:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "github:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "git://github.com/user/foo": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git://github.com/user/foo.git",
+ raw: "git://github.com/user/foo"
+ },
+
+ "https://github.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+https://github.com/user/foo.git",
+ raw: "https://github.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://github.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://github.com/user/foo",
+ raw: "@foo/bar@git+ssh://github.com/user/foo"
+ },
+
+ "foo@bar/foo": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:bar/foo",
+ raw: "foo@bar/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/github.js~ new/package/test/github.js~
--- old/package/test/github.js~ 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/github.js~ 2015-05-21 22:48:51.000000000 +0200
@@ -0,0 +1,106 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "user/foo-js"
+ },
+
+ "user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js#bar/baz",
+ raw: "user/foo-js#bar/baz"
+ },
+
+ "user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ raw: "github:user/foo-js#bar/baz/bin",
+ raw: "user/foo-js#bar/baz/bin"
+ },
+
+ "foo@user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "foo@user/foo-js"
+ },
+
+ "github:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:user/foo-js",
+ raw: "github:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "git://github.com/user/foo": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git://github.com/user/foo.git",
+ raw: "git://github.com/user/foo"
+ },
+
+ "https://github.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+https:github.com/user/foo.git",
+ raw: "https://github.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://github.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://github.com/user/foo",
+ raw: "@foo/bar@git+ssh://github.com/user/foo"
+ },
+
+ "foo@bar/foo": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "github" },
+ spec: "github:bar/foo",
+ raw: "foo@bar/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/gitlab.js new/package/test/gitlab.js
--- old/package/test/gitlab.js 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/gitlab.js 2015-05-21 22:51:43.000000000 +0200
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "gitlab:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ raw: "gitlab:user/foo-js",
+ raw: "gitlab:user/foo-js"
+ },
+
+ "gitlab:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ raw: "gitlab:user/foo-js#bar/baz",
+ raw: "gitlab:user/foo-js#bar/baz"
+ },
+
+ "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "gitlab:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user/foo-js#bar/baz/bin",
+ raw: "gitlab:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@gitlab:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user/foo-js",
+ raw: "foo@gitlab:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "https://gitlab.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+https://gitlab.com/user/foo.git",
+ raw: "https://gitlab.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://gitlab.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://gitlab.com/user/foo",
+ raw: "@foo/bar@git+ssh://gitlab.com/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/gitlab.js~ new/package/test/gitlab.js~
--- old/package/test/gitlab.js~ 1970-01-01 01:00:00.000000000 +0100
+++ new/package/test/gitlab.js~ 2015-05-21 22:48:52.000000000 +0200
@@ -0,0 +1,82 @@
+var npa = require("../npa.js")
+var path = require("path")
+
+require("tap").test("basic", function (t) {
+ t.setMaxListeners(999)
+
+ var tests = {
+ "gitlab:user/foo-js": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ raw: "gitlab:user/foo-js",
+ raw: "gitlab:user/foo-js"
+ },
+
+ "gitlab:user/foo-js#bar/baz": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ raw: "gitlab:user/foo-js#bar/baz",
+ raw: "gitlab:user/foo-js#bar/baz"
+ },
+
+ "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /",
+ raw: "gitlab:user..blerg--/..foo-js# . . . . . some . tags / / /"
+ },
+
+ "gitlab:user/foo-js#bar/baz/bin": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user/foo-js#bar/baz/bin",
+ raw: "gitlab:user/foo-js#bar/baz/bin"
+ },
+
+ "foo@gitlab:user/foo-js": {
+ name: "foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "gitlab:user/foo-js",
+ raw: "foo@gitlab:user/foo-js"
+ },
+
+ "git+ssh://[email protected]/user/foo#1.2.3": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://[email protected]/user/foo.git#1.2.3",
+ raw: "git+ssh://[email protected]/user/foo#1.2.3"
+ },
+
+ "https://gitlab.com/user/foo.git": {
+ name: null,
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+https:gitlab.com/user/foo.git",
+ raw: "https://gitlab.com/user/foo.git"
+ },
+
+ "@foo/bar@git+ssh://gitlab.com/user/foo": {
+ name: "@foo/bar",
+ scope: "@foo",
+ type: "hosted",
+ hosted: { type: "gitlab" },
+ spec: "git+ssh://[email protected]/user/foo.git",
+ rawSpec: "git+ssh://gitlab.com/user/foo",
+ raw: "@foo/bar@git+ssh://gitlab.com/user/foo"
+ }
+ }
+
+ Object.keys(tests).forEach(function (arg) {
+ var res = npa(arg)
+ t.type(res, "Result", arg + " is a result")
+ t.has(res, tests[arg], arg + " matches expectations")
+ })
+
+ t.end()
+})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/package/test/windows.js new/package/test/windows.js
--- old/package/test/windows.js 2014-09-27 07:35:23.000000000 +0200
+++ new/package/test/windows.js 2015-05-21 22:46:39.000000000 +0200
@@ -6,28 +6,28 @@
var cases = {
"C:\\x\\y\\z": {
- raw: 'C:\\x\\y\\z',
+ raw: "C:\\x\\y\\z",
scope: null,
name: null,
- rawSpec: 'C:\\x\\y\\z',
- spec: path.resolve('C:\\x\\y\\z'),
- type: 'local'
+ rawSpec: "C:\\x\\y\\z",
+ spec: path.resolve("C:\\x\\y\\z"),
+ type: "local"
},
"foo@C:\\x\\y\\z": {
- raw: 'foo@C:\\x\\y\\z',
+ raw: "foo@C:\\x\\y\\z",
scope: null,
- name: 'foo',
- rawSpec: 'C:\\x\\y\\z',
- spec: path.resolve('C:\\x\\y\\z'),
- type: 'local'
+ name: "foo",
+ rawSpec: "C:\\x\\y\\z",
+ spec: path.resolve("C:\\x\\y\\z"),
+ type: "local"
},
"foo@/foo/bar/baz": {
- raw: 'foo@/foo/bar/baz',
+ raw: "foo@/foo/bar/baz",
scope: null,
- name: 'foo',
- rawSpec: '/foo/bar/baz',
- spec: path.resolve('/foo/bar/baz'),
- type: 'local'
+ name: "foo",
+ rawSpec: "/foo/bar/baz",
+ spec: path.resolve("/foo/bar/baz"),
+ type: "local"
}
}