fix: installation of tarball from subfolder

Ref https://github.com/pnpm/supi/issues/10
This commit is contained in:
Zoltan Kochan
2017-08-31 00:20:07 +03:00
parent 0c07088aab
commit f1b8989070
2 changed files with 5 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ export default async function fetch (
pkg,
storeIndex: options.storeIndex,
verifyStoreIntegrity: options.verifyStoreIntegrity,
prefix: options.prefix,
})
}
@@ -156,6 +157,7 @@ function fetchToStore (opts: {
pkg?: Package,
storeIndex: Store,
verifyStoreIntegrity: boolean,
prefix: string,
}): {
fetchingFiles: Promise<PackageContentInfo>,
fetchingPkg: Promise<Package>,
@@ -228,6 +230,7 @@ function fetchToStore (opts: {
pkgId: opts.pkgId,
storePath: opts.storePath,
offline: opts.offline,
prefix: opts.prefix,
})
}(),
// removing only the folder with the unpacked files

View File

@@ -20,6 +20,7 @@ export type FetchOptions = {
got: Got,
storePath: string,
offline: boolean,
prefix: string,
}
export type PackageDist = {
@@ -79,7 +80,7 @@ function execGit (args: string[], opts?: Object) {
export function fetchFromTarball (dir: string, dist: PackageDist, opts: FetchOptions) {
if (dist.tarball.startsWith('file:')) {
dist = Object.assign({}, dist, {tarball: dist.tarball.slice(5)})
dist = Object.assign({}, dist, {tarball: path.join(opts.prefix, dist.tarball.slice(5))})
return fetchFromLocalTarball(dir, dist)
} else {
return fetchFromRemoteTarball(dir, dist, opts)