realize-package-specifier
Advanced tools
Comparing version 1.1.0 to 1.2.0
10
index.js
@@ -19,3 +19,3 @@ "use strict" | ||
? path.resolve(where, dep.spec) | ||
: path.resolve(spec) | ||
: path.resolve(dep.rawSpec? dep.rawSpec: dep.name) | ||
fs.stat(specpath, function (er, s) { | ||
@@ -29,3 +29,9 @@ if (er) return finalize() | ||
function finalize(type) { | ||
if (type != null) dep.type = type | ||
if (type != null && type != dep.type) { | ||
dep.type = type | ||
if (! dep.rawSpec) { | ||
dep.rawSpec = dep.name | ||
dep.name = null | ||
} | ||
} | ||
if (dep.type == "local" || dep.type == "directory") dep.spec = specpath | ||
@@ -32,0 +38,0 @@ cb(null, dep) |
{ | ||
"name": "realize-package-specifier", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Like npm-package-arg, but more so, producing full file paths and differentiating local tar and directory sources.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -88,1 +88,35 @@ "use strict" | ||
}) | ||
test("named realize-package-specifier", function (t) { | ||
t.plan(10) | ||
rps("a@a.tar.gz", function (err, result) { | ||
t.is(result.type, "local", "named local tarball") | ||
}) | ||
rps("b@b", function (err, result) { | ||
t.is(result.type, "directory", "named local package directory") | ||
}) | ||
rps("c@c", function (err, result) { | ||
t.is(result.type, "tag", "remote package, non-package local directory") | ||
}) | ||
rps("d@d", function (err, result) { | ||
t.is(result.type, "tag", "remote package, no local directory") | ||
}) | ||
rps("a@file:./a.tar.gz", function (err, result) { | ||
t.is(result.type, "local", "local tarball") | ||
}) | ||
rps("b@file:./b", function (err, result) { | ||
t.is(result.type, "directory", "local package directory") | ||
}) | ||
rps("c@file:./c", function (err, result) { | ||
t.is(result.type, "local", "non-package local directory, specified with a file URL") | ||
}) | ||
rps("d@file:./d", function (err, result) { | ||
t.is(result.type, "local", "no local directory, specified with a file URL") | ||
}) | ||
rps("e@e/1", function (err, result) { | ||
t.is(result.type, "directory", "local package directory") | ||
}) | ||
rps("e@e/2", function (err, result) { | ||
t.is(result.type, "github", "github package dependency") | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13500
370