Skip to content

Commit

Permalink
use file:, fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylang authored and othiym23 committed Sep 5, 2014
1 parent c8eb928 commit 8904117
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/cache/add-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function addLocal (p, pkgData, cb_) {
log.error("addLocal", "Could not install %s", p)
return cb_(er)
}
if (data && !data._fromGithub) data._from = p
if (data && !data._fromGithub) data._from = p.replace(process.cwd(), '.')
return cb_(er, data)
})
}
Expand Down
3 changes: 2 additions & 1 deletion lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function save (where, installed, tree, pretty, hasArguments, cb) {
catch(er) {}

if (u && u.protocol) w[1] = t.from
if (isLocal) w[1] = 'file:///' + t.from
if (isLocal) w[1] = 'file:' + t.from
return w
}).reduce(function (set, k) {
var rangeDescriptor = semver.valid(k[1], true) &&
Expand Down Expand Up @@ -755,6 +755,7 @@ function targetResolver (where, context, deps) {
return cb(null, [])
}


if (data && !data._from) data._from = what
if (er && parent && parent.name) er.parent = parent.name
return cb(er, data || [])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "package-with-local-paths",
"version": "0.0.0",
"dependencies": {
"package-local-dependency": "../package-local-dependency"
"package-local-dependency": "file:../package-local-dependency"
},
"devDependencies": {
"package-local-dev-dependency": "../package-local-dev-dependency"
"package-local-dev-dependency": "file:../package-local-dev-dependency"
}
}
4 changes: 2 additions & 2 deletions test/tap/install-save-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ 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': 'file:///../package-local-dependency'
'package-local-dependency': 'file:../package-local-dependency'
})
npm.config.set('save', undefined)

Expand All @@ -46,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': 'file:///../package-local-dev-dependency'
'package-local-dev-dependency': 'file:../package-local-dev-dependency'
})
npm.config.set('save', undefined)

Expand Down

0 comments on commit 8904117

Please sign in to comment.