mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-23 15:34:37 +00:00
Improved code helpers
This commit is contained in:
@@ -7,26 +7,28 @@ namespace ElectronNET.CLI
|
||||
{
|
||||
public class ProcessHelper
|
||||
{
|
||||
public static void CheckNodeModules(string tempPath, bool force = false)
|
||||
public static void CheckNodeModules(string root, bool force = false)
|
||||
{
|
||||
var nodeModulesDirPath = Path.Combine(tempPath, "node_modules");
|
||||
var nodeModulesDirPath = Path.Combine(root, "node_modules");
|
||||
|
||||
if (!Directory.Exists(nodeModulesDirPath) || force)
|
||||
{
|
||||
Console.WriteLine("Starting npm install ...");
|
||||
ProcessHelper.CmdExecute("npm install", tempPath);
|
||||
ProcessHelper.CmdExecute("npm install", root);
|
||||
}
|
||||
}
|
||||
|
||||
public static void BundleHostHook(string tempPath)
|
||||
public static void BundleHostHook(string root)
|
||||
{
|
||||
var electronhosthookDir = Path.Combine(Directory.GetCurrentDirectory(), "ElectronHostHook");
|
||||
|
||||
if (Directory.Exists(electronhosthookDir))
|
||||
{
|
||||
CheckNodeModules(electronhosthookDir);
|
||||
|
||||
// TODO: should be more complex, i.e., look at package.json, determine "source" or "main" and resolve it
|
||||
var hookSource = Path.Combine(electronhosthookDir, "index.ts");
|
||||
var hookTarget = Path.Combine(tempPath, "dist", "host-hook.js");
|
||||
var hookTarget = Path.Combine(root, "dist", "host-hook.js");
|
||||
Console.WriteLine("Bundle ElectronHostHook ...");
|
||||
CmdExecute($"npm start --outfile={hookTarget}", electronhosthookDir);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { resolve } from "path";
|
||||
const manifestFileName = process.argv[2];
|
||||
const cwd = process.cwd();
|
||||
|
||||
const manifestFilePath = resolve(cwd, ".bin", manifestFileName);
|
||||
const manifestFilePath = resolve(cwd, "bin", manifestFileName);
|
||||
const manifestFile = require(manifestFilePath);
|
||||
const builderConfiguration = { ...manifestFile.build };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user