Is there an existing issue for this?
Current Behavior
As of 8.1.2 of npm-package-arg, a particular style of git URL specifying a semver range gets misinterpreted as a directory type instead of git.
I narrowed it down to this commit: npm/npm-package-arg@881f1c3 in which hosted-git-info was updated from v3 to v4.
Repro (using npm-package-arg):
index.js
const npa = require("npm-package-arg");
// Incorrect as of 8.1.2 of npm-package-arg, which is v4 of hosted-git-info instead of v3
console.log(npa.resolve('package-2', '[email protected]:user/package-2#semver:^1.0.0').type); // "directory"
// Correct
// (version range removed)
console.log(npa.resolve('package-2', '[email protected]:user/package-2#semver').type); // "git"
// (alternative syntax for start of URL, version range still present)
console.log(npa.resolve('package-2', 'github:user/package-2#semver:^1.0.0').type); // "git"
console.log(npa.resolve('package-2', 'git+ssh://github.com:user/package-2#semver:^1.0.0').type); // "git"
console.log(npa.resolve('package-2', 'git://github.com:user/package-2#semver:^1.0.0').type); // "git"
Expected Behavior
I expect to [email protected]:user/package-2#semver:^1.0.0 be handled correctly by hosted-git-info
(therefore allowing console.log(npa.resolve('package-2', '[email protected]:user/package-2#semver:^1.0.0').type); to correctly log "git")
Steps To Reproduce
Create the index.js file as I provided above and run node index.js
Environment
N/A
Is there an existing issue for this?
Current Behavior
As of
8.1.2ofnpm-package-arg, a particular style of git URL specifying a semver range gets misinterpreted as adirectorytype instead ofgit.I narrowed it down to this commit: npm/npm-package-arg@881f1c3 in which
hosted-git-infowas updated from v3 to v4.Repro (using
npm-package-arg):index.js
Expected Behavior
I expect to
[email protected]:user/package-2#semver:^1.0.0be handled correctly byhosted-git-info(therefore allowing
console.log(npa.resolve('package-2', '[email protected]:user/package-2#semver:^1.0.0').type);to correctly log "git")Steps To Reproduce
Create the index.js file as I provided above and run
node index.jsEnvironment
N/A