Skip to content

Commit

Permalink
when saving, using file://
Browse files Browse the repository at this point in the history
  • Loading branch information
dylang authored and othiym23 committed Sep 5, 2014
1 parent 9fe98c4 commit c8eb928
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ function save (where, installed, tree, pretty, hasArguments, cb) {
}
catch(er) {}

if (u && u.protocol || isLocal) w[1] = t.from
if (u && u.protocol) w[1] = t.from
if (isLocal) w[1] = 'file:///' + t.from
return w
}).reduce(function (set, k) {
var rangeDescriptor = semver.valid(k[1], true) &&
Expand Down
7 changes: 2 additions & 5 deletions test/tap/install-save-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ test('"npm install --save ../local/path" should install local package and save t

var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8'))
t.deepEqual(pkgJson.dependencies, {
'package-local-dependency': '../package-local-dependency'
'package-local-dependency': 'file:///../package-local-dependency'
})
npm.config.set('save', undefined)

//var devDependencyPackageJson = path.resolve(pkgDir, 'node_modules/package-local-dev-dependency/package.json')
//t.ok(JSON.parse(fs.readFileSync(devDependencyPackageJson, 'utf8')))

t.end()
})
})
Expand All @@ -49,7 +46,7 @@ test('"npm install --save-dev ../local/path" should install local package and sa

var pkgJson = JSON.parse(fs.readFileSync(pkg + '/package.json', 'utf8'))
t.deepEqual(pkgJson.devDependencies, {
'package-local-dev-dependency': '../package-local-dev-dependency'
'package-local-dev-dependency': 'file:///../package-local-dev-dependency'
})
npm.config.set('save', undefined)

Expand Down

0 comments on commit c8eb928

Please sign in to comment.