Skip to content

Commit

Permalink
Add github prefix in preparation for shortcut support for other hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
iarna committed Oct 7, 2014
1 parent 52d4421 commit 3e86e76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
5 changes: 5 additions & 0 deletions npa.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ function parseUrl (res, arg, urlparse) {
res.spec = urlparse.pathname
break

case "github:":
res.type = "github"
res.spec = arg.replace(/^github:/, "")
break

default:
throw new Error("Unsupported URL Type: " + arg)
break
Expand Down
25 changes: 5 additions & 20 deletions test/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,12 @@ require("tap").test("basic", function (t) {
raw: "foo@user/foo-js"
},

"git+ssh://git@github.com/user/foo#1.2.3": {
"github:user/foo-js": {
name: null,
type: "git",
spec: "ssh://[email protected]/user/foo#1.2.3",
raw: "git+ssh://[email protected]/user/foo#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"
},
type: "github",
spec: "user/foo-js",
raw: "github:user/foo-js"
}

}

Expand Down

0 comments on commit 3e86e76

Please sign in to comment.