Skip to content

Commit 7dc3072

Browse files
author
Gabe Stocco
committed
Adds additional new parameter to force a node install, instead of
skipping due to an existing node_modules folder. This is also implicitly triggered by providing your own package.json file. This ensures that the actual packages match the package.json.
1 parent 6642f9d commit 7dc3072

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public class BuildCommand : ICommand
2222
"Optional: '/relative-path' to specify output a subdirectory for output." + Environment.NewLine +
2323
"Optional: '/absolute-path to specify and absolute path for output." + Environment.NewLine +
2424
"Optional: '/package-json' to specify a custom package.json file." + Environment.NewLine +
25+
"Optional: '/install-modules' to force node module install. Implied by '/package-json'" + Environment.NewLine +
2526
"Full example for a 32bit debug build with electron prune: build /target custom win7-x86;win32 /dotnet-configuration Debug /electron-arch ia32 /electron-params \"--prune=true \"";
2627

2728
public static IList<CommandOption> CommandOptions { get; set; } = new List<CommandOption>();
@@ -40,7 +41,7 @@ public BuildCommand(string[] args)
4041
private string _paramOutputDirectory = "relative-path";
4142
private string _paramAbsoluteOutput = "absolute-path";
4243
private string _paramPackageJson = "package-json";
43-
44+
private string _paramForceNodeInstall = "install-modules";
4445

4546
public Task<bool> ExecuteAsync()
4647
{
@@ -100,7 +101,7 @@ public Task<bool> ExecuteAsync()
100101

101102
var checkForNodeModulesDirPath = Path.Combine(tempPath, "node_modules");
102103

103-
if (Directory.Exists(checkForNodeModulesDirPath) == false)
104+
if (Directory.Exists(checkForNodeModulesDirPath) == false || parser.Contains(_paramForceNodeInstall) || parser.Contains(_paramPackageJson))
104105
{
105106
Console.WriteLine("node_modules missing in: " + checkForNodeModulesDirPath);
106107

0 commit comments

Comments
 (0)