Skip to content

Commit 1335ae7

Browse files
authored
Merge pull request #2304 from NativeScript/plamen5kov/fix_for_ios_inspector
Plamen5kov/fix for ios inspector
2 parents d6d52e5 + 6c543fd commit 1335ae7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lib/services/ios-debug-service.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,24 @@ class IOSDebugService implements IDebugService {
215215
if (this.$options.client) {
216216
return (() => {
217217
let inspectorPath = path.join(this.$projectData.projectDir, "node_modules", inspectorNpmPackageName);
218+
219+
// local installation takes precedence over cache
218220
if(!this.inspectorAlreadyInstalled(inspectorPath).wait()) {
219-
inspectorPath = this.$npmInstallationManager.install(inspectorNpmPackageName, this.$projectData.projectDir, {dependencyType: "save-dev"}).wait();
221+
let cachepath = this.$childProcess.exec("npm get cache").wait().trim();
222+
let version = this.$npmInstallationManager.getLatestCompatibleVersion(inspectorNpmPackageName).wait();
223+
let pathToPackageInCache = path.join(cachepath, inspectorNpmPackageName, version);
224+
let pathToUnzippedInspector = path.join(pathToPackageInCache, "package");
225+
226+
if(!this.$fs.exists(pathToPackageInCache).wait()) {
227+
this.$childProcess.exec(`npm cache add ${inspectorNpmPackageName}@${version}`).wait();
228+
let inspectorTgzPathInCache = path.join(pathToPackageInCache, "package.tgz");
229+
this.$childProcess.exec(`tar -xf ${inspectorTgzPathInCache} -C ${pathToPackageInCache}`).wait();
230+
this.$childProcess.exec(`npm install --prefix ${pathToUnzippedInspector}`).wait();
231+
}
232+
this.$logger.out("Using inspector from cache.");
233+
inspectorPath = pathToUnzippedInspector;
220234
}
235+
221236
let inspectorSourceLocation = path.join(inspectorPath, inspectorUiDir, "Main.html");
222237
let inspectorApplicationPath = path.join(inspectorPath, inspectorAppName);
223238

0 commit comments

Comments
 (0)