@@ -215,9 +215,24 @@ class IOSDebugService implements IDebugService {
215
215
if ( this . $options . client ) {
216
216
return ( ( ) => {
217
217
let inspectorPath = path . join ( this . $projectData . projectDir , "node_modules" , inspectorNpmPackageName ) ;
218
+
219
+ // local installation takes precedence over cache
218
220
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 ;
220
234
}
235
+
221
236
let inspectorSourceLocation = path . join ( inspectorPath , inspectorUiDir , "Main.html" ) ;
222
237
let inspectorApplicationPath = path . join ( inspectorPath , inspectorAppName ) ;
223
238
0 commit comments