Skip to content

Commit 2651502

Browse files
fix: Unable to create project from local path of template v2
`pacote` package does not work very well with relative paths, so ensure we pass full path to the `extractPackage` method. When trying to pass `.tgz` with relative path for template and the `.tgz` is located next to `.git` dir, the `pacote` package tries to download the repository instead of using the local .tgz package. Once full path is passed, it works correctly.
1 parent cd77446 commit 2651502

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/services/pacote-service.ts

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ export class PacoteService implements IPacoteService {
2929
_.extend(extractOptions, options);
3030
}
3131

32+
if (this.$fs.exists(packageName)) {
33+
packageName = path.resolve(packageName);
34+
}
35+
3236
const cache = await this.$npm.getCachePath();
3337
return new Promise<void>((resolve, reject) => {
3438
const source = pacote.tarball.stream(packageName, { cache });

0 commit comments

Comments
 (0)