mirror of
https://github.com/pnpm/pnpm.git
synced 2026-03-26 19:12:12 -04:00
fix: resolve local-registry config
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user