Skip to content

Commit 33bfd82

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #1091 from NativeScript/fatme/still-fixing-npm-cache
Still fixing npm cache unpack when framework option is specified
2 parents c746739 + d577bb4 commit 33bfd82

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/npm-installation-manager.ts

+8-9
Original file line numberDiff line numberDiff line change
@@ -151,17 +151,16 @@ export class NpmInstallationManager implements INpmInstallationManager {
151151
private installCore(packageName: string, pathToSave: string, version: string): IFuture<string> {
152152
return (() => {
153153
if (this.$options.frameworkPath) {
154-
if (this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile()) {
155-
this.npmInstall(packageName, pathToSave, version).wait();
156-
let pathToNodeModules = path.join(pathToSave, "node_modules");
157-
let folders = this.$fs.readDirectory(pathToNodeModules).wait();
154+
this.npmInstall(packageName, pathToSave, version).wait();
155+
let pathToNodeModules = path.join(pathToSave, "node_modules");
156+
let folders = this.$fs.readDirectory(pathToNodeModules).wait();
158157

159-
let data = this.$fs.readJson(path.join(pathToNodeModules, folders[0], "package.json")).wait();
160-
this.addToCache(data.name, data.version).wait();
161-
162-
return path.join(pathToNodeModules, folders[0]);
158+
let data = this.$fs.readJson(path.join(pathToNodeModules, folders[0], "package.json")).wait();
159+
if(!this.isPackageUnpacked(this.getCachedPackagePath(data.name, data.version), data.name).wait()) {
160+
this.cacheUnpack(data.name, data.version).wait();
163161
}
164-
return this.$options.frameworkPath;
162+
163+
return path.join(pathToNodeModules, folders[0]);
165164
} else {
166165
version = version || this.getLatestCompatibleVersion(packageName).wait();
167166
let packagePath = this.getCachedPackagePath(packageName, version);

lib/services/platform-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class PlatformService implements IPlatformService {
9696
let installedVersion = this.$fs.readJson(path.join(frameworkDir, "../", "package.json")).wait().version;
9797
platformData.platformProjectService.createProject(frameworkDir, installedVersion).wait();
9898

99-
if(this.$options.frameworkPath && this.$fs.getFsStats(this.$options.frameworkPath).wait().isFile() && !this.$options.symlink) {
99+
if(this.$options.frameworkPath && !this.$options.symlink) {
100100
// Need to remove unneeded node_modules folder
101101
// One level up is the runtime module and one above is the node_modules folder.
102102
this.$fs.deleteDirectory(path.join(frameworkDir, "../../")).wait();

0 commit comments

Comments
 (0)