Skip to content

Plamen5kov/fix for ios inspector #2304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/services/ios-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,24 @@ class IOSDebugService implements IDebugService {
if (this.$options.client) {
return (() => {
let inspectorPath = path.join(this.$projectData.projectDir, "node_modules", inspectorNpmPackageName);

// local installation takes precedence over cache
if(!this.inspectorAlreadyInstalled(inspectorPath).wait()) {
inspectorPath = this.$npmInstallationManager.install(inspectorNpmPackageName, this.$projectData.projectDir, {dependencyType: "save-dev"}).wait();
let cachepath = this.$childProcess.exec("npm get cache").wait().trim();
let version = this.$npmInstallationManager.getLatestCompatibleVersion(inspectorNpmPackageName).wait();
let pathToPackageInCache = path.join(cachepath, inspectorNpmPackageName, version);
let pathToUnzippedInspector = path.join(pathToPackageInCache, "package");

if(!this.$fs.exists(pathToPackageInCache).wait()) {
this.$childProcess.exec(`npm cache add ${inspectorNpmPackageName}@${version}`).wait();
let inspectorTgzPathInCache = path.join(pathToPackageInCache, "package.tgz");
this.$childProcess.exec(`tar -xf ${inspectorTgzPathInCache} -C ${pathToPackageInCache}`).wait();
this.$childProcess.exec(`npm install --prefix ${pathToUnzippedInspector}`).wait();
}
this.$logger.out("Using inspector from cache.");
inspectorPath = pathToUnzippedInspector;
}

let inspectorSourceLocation = path.join(inspectorPath, inspectorUiDir, "Main.html");
let inspectorApplicationPath = path.join(inspectorPath, inspectorAppName);

Expand Down