@@ -7,26 +7,28 @@ namespace ElectronNET.CLI
77{
88 public class ProcessHelper
99 {
10- public static void CheckNodeModules ( string tempPath , bool force = false )
10+ public static void CheckNodeModules ( string root , bool force = false )
1111 {
12- var nodeModulesDirPath = Path . Combine ( tempPath , "node_modules" ) ;
12+ var nodeModulesDirPath = Path . Combine ( root , "node_modules" ) ;
1313
1414 if ( ! Directory . Exists ( nodeModulesDirPath ) || force )
1515 {
1616 Console . WriteLine ( "Starting npm install ..." ) ;
17- ProcessHelper . CmdExecute ( "npm install" , tempPath ) ;
17+ ProcessHelper . CmdExecute ( "npm install" , root ) ;
1818 }
1919 }
2020
21- public static void BundleHostHook ( string tempPath )
21+ public static void BundleHostHook ( string root )
2222 {
2323 var electronhosthookDir = Path . Combine ( Directory . GetCurrentDirectory ( ) , "ElectronHostHook" ) ;
2424
2525 if ( Directory . Exists ( electronhosthookDir ) )
2626 {
27+ CheckNodeModules ( electronhosthookDir ) ;
28+
2729 // TODO: should be more complex, i.e., look at package.json, determine "source" or "main" and resolve it
2830 var hookSource = Path . Combine ( electronhosthookDir , "index.ts" ) ;
29- var hookTarget = Path . Combine ( tempPath , "dist" , "host-hook.js" ) ;
31+ var hookTarget = Path . Combine ( root , "dist" , "host-hook.js" ) ;
3032 Console . WriteLine ( "Bundle ElectronHostHook ..." ) ;
3133 CmdExecute ( $ "npm start --outfile={ hookTarget } ", electronhosthookDir ) ;
3234 }
0 commit comments