fix: resolve local-registry config

This commit is contained in:
zkochan committed 2017-02-27 00:10:01 +02:00
1 parent be633ffb73
commit 15402c4803
2 files changed
+12 -3

No files matched your search

+3
View File
@@ -35,5 +35,8 @@ export default (opts?: PnpmOptions): StrictPnpmOptions => {
if (extendedOpts.force) {
logger.warn('using --force I sure hope you know what you are doing')
}
if (extendedOpts.localRegistry !== DEFAULT_LOCAL_REGISTRY) {
extendedOpts.localRegistry = expandTilde(extendedOpts.localRegistry, extendedOpts.cwd)
}
return extendedOpts
}
+9 -3
View File
@@ -1,13 +1,19 @@
import osHomedir = require('os-homedir')
import path = require('path')
export default function expandTilde (filepath: string) {
export default function expandTilde (filepath: string, cwd?: string) {
const home = getHomedir()
if (!isHomepath(filepath)) {
if (isHomepath(filepath)) {
return path.join(home, filepath.substr(2))
}
if (path.isAbsolute(filepath)) {
return filepath
}
return path.resolve(home, filepath.substr(2))
if (cwd) {
return path.join(cwd, filepath)
}
return path.resolve(filepath)
}
function getHomedir () {