Comparing version 0.1.0 to 0.2.0
@@ -14,3 +14,4 @@ var Client = require('silent-npm-registry-client'); | ||
if (err) return fn(err); | ||
fn(null, repo.url); | ||
fn(null, repo.url | ||
.replace(/^git\+/, '')); | ||
}); | ||
@@ -23,9 +24,6 @@ } | ||
fn(null, repo.url | ||
.replace('git://github.com/', 'git@github.com:')); | ||
.replace(/^.*github.com\//, 'git@github.com:')); | ||
}); | ||
}; | ||
// git://github.com/juliangruber/repo-url(.git) | ||
// https://github.com/juliangruber/repo-url.git | ||
repoUrl.https = function (module, fn) { | ||
@@ -35,2 +33,3 @@ getRepository(module, function (err, repo) { | ||
fn(null, repo.url | ||
.replace(/^git\+/, '') | ||
.replace('git://', 'https://')); | ||
@@ -37,0 +36,0 @@ }); |
{ | ||
"name": "repo-url", | ||
"description": "Get a npm package's repo url, with convenient cli.", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -1,2 +0,1 @@ | ||
# repo-url | ||
@@ -27,3 +26,3 @@ | ||
```bash | ||
``` | ||
$ repo-url [OPTIONS] [MODULE] | ||
@@ -30,0 +29,0 @@ |
@@ -19,1 +19,17 @@ var repoUrl = require('..'); | ||
}); | ||
test('git+https repo url', function (t) { | ||
t.plan(2); | ||
repoUrl('gulp', function (err, url) { | ||
t.error(err); | ||
t.equal(url, 'https://github.com/gulpjs/gulp.git'); | ||
}); | ||
}); | ||
test('git+https to ssh repo url', function (t) { | ||
t.plan(2); | ||
repoUrl.ssh('gulp', function (err, url) { | ||
t.error(err); | ||
t.equal(url, 'git@github.com:gulpjs/gulp.git'); | ||
}); | ||
}); |
5154
90
76