Skip to content

Commit 776ccc2

Browse files
FreFre
authored andcommitted
Merge remote-tracking branch 'upstream/master'
2 parents f68ea25 + b525bf1 commit 776ccc2

File tree

17 files changed

+128
-73
lines changed

17 files changed

+128
-73
lines changed

Changelog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Not released
22

3+
# 9.31.3
4+
5+
ElectronNET.CLI:
6+
7+
* New Feature: Set a description of the app in `electron.manifest.json` (thanks [BurtsevC](https://github.com/BurtsevC)) [\#433](https://github.com/ElectronNET/Electron.NET/pull/433)
8+
* New Feature: Set a target for the start command (thanks [gabecook](https://github.com/gabecook)) [\#463](https://github.com/ElectronNET/Electron.NET/pull/463)
9+
* New Feature: `electronize init` support for F# projects (thanks [kojo12228](https://github.com/kojo12228)) [\#457](https://github.com/ElectronNET/Electron.NET/pull/457)
10+
* New Feature: Linux support for the buildAll.sh (thanks [duncanawoods](https://github.com/duncanawoods)) [\#465](https://github.com/ElectronNET/Electron.NET/pull/465)
11+
* Fixed bug: ERR_UNKNOWN_URL_SCHEME by intercepting file:// protocol (thanks [duncanawoods](https://github.com/duncanawoods)) [\#467](https://github.com/ElectronNET/Electron.NET/pull/467)
12+
13+
ElectronNET.API:
14+
15+
* New Feature: Native Electron 9.2.0 support, but not all new features (we search contributors)
16+
* Fixed bug: Set default WebPreferences.DefaultFontSize (thanks [duncanawoods](https://github.com/duncanawoods)) [\#468](https://github.com/ElectronNET/Electron.NET/pull/468)
17+
318
# Released
419

520
# 9.31.2

ElectronNET.API/Entities/WebPreferences.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public class WebPreferences
142142
/// <summary>
143143
/// Defaults to 16.
144144
/// </summary>
145-
public int DefaultFontSize { get; set; }
145+
public int DefaultFontSize { get; set; } = 16;
146146

147147
/// <summary>
148148
/// Defaults to 13.

ElectronNET.CLI/Commands/AddCommand.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,16 @@ public Task<bool> ExecuteAsync()
7575
// ToDo: Not sure if this runs under linux/macos
7676
ProcessHelper.CmdExecute(@"npx tsc -p ../../", targetFilePath);
7777

78-
// search .csproj
79-
Console.WriteLine($"Search your .csproj to add configure CopyToPublishDirectory to 'Never'");
80-
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly).FirstOrDefault();
78+
// search .csproj or .fsproj (.csproj has higher precedence)
79+
Console.WriteLine($"Search your .csproj/.fsproj to add configure CopyToPublishDirectory to 'Never'");
80+
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly)
81+
.Union(Directory.EnumerateFiles(currentDirectory, "*.fsproj", SearchOption.TopDirectoryOnly))
82+
.FirstOrDefault();
8183

82-
Console.WriteLine($"Found your .csproj: {projectFile} - check for existing CopyToPublishDirectory setting or update it.");
84+
var extension = Path.GetExtension(projectFile);
85+
Console.WriteLine($"Found your {extension}: {projectFile} - check for existing CopyToPublishDirectory setting or update it.");
8386

84-
if (!EditCsProj(projectFile)) return false;
87+
if (!EditProjectFile(projectFile)) return false;
8588

8689
Console.WriteLine($"Everything done - happy electronizing with your custom npm packages!");
8790

@@ -90,7 +93,7 @@ public Task<bool> ExecuteAsync()
9093
}
9194

9295
// ToDo: Cleanup this copy/past code.
93-
private static bool EditCsProj(string projectFile)
96+
private static bool EditProjectFile(string projectFile)
9497
{
9598
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
9699
{
@@ -128,7 +131,7 @@ private static bool EditCsProj(string projectFile)
128131

129132
}
130133

131-
Console.WriteLine($"Publish setting added in csproj!");
134+
Console.WriteLine($"Publish setting added in csproj/fsproj!");
132135
return true;
133136
}
134137

ElectronNET.CLI/Commands/BuildCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public Task<bool> ExecuteAsync()
186186
ProcessHelper.CmdExecute($"node build-helper.js " + manifestFileName, tempPath);
187187

188188
Console.WriteLine($"Package Electron App for Platform {platformInfo.ElectronPackerPlatform}...");
189-
ProcessHelper.CmdExecute($"npx electron-builder --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.0.5 {electronParams}", tempPath);
189+
ProcessHelper.CmdExecute($"npx electron-builder --config=./bin/electron-builder.json --{platformInfo.ElectronPackerPlatform} --{electronArch} -c.electronVersion=9.2.0 {electronParams}", tempPath);
190190

191191
Console.WriteLine("... done");
192192

ElectronNET.CLI/Commands/InitCommand.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,22 @@ public Task<bool> ExecuteAsync()
7070
// Deploy config file
7171
EmbeddedFileHelper.DeployEmbeddedFileToTargetFile(currentDirectory, DefaultConfigFileName, ConfigName);
7272

73-
// search .csproj
74-
Console.WriteLine($"Search your .csproj to add the needed {ConfigName}...");
75-
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly).FirstOrDefault();
76-
77-
// update config file with the name of the csproj
78-
// ToDo: If the csproj name != application name, this will fail
73+
// search .csproj/.fsproj (.csproj has higher precedence)
74+
Console.WriteLine($"Search your .csproj/fsproj to add the needed {ConfigName}...");
75+
var projectFile = Directory.EnumerateFiles(currentDirectory, "*.csproj", SearchOption.TopDirectoryOnly)
76+
.Union(Directory.EnumerateFiles(currentDirectory, "*.fsproj", SearchOption.TopDirectoryOnly))
77+
.FirstOrDefault();
78+
79+
// update config file with the name of the csproj/fsproj
80+
// ToDo: If the csproj/fsproj name != application name, this will fail
7981
string text = File.ReadAllText(targetFilePath);
8082
text = text.Replace("{{executable}}", Path.GetFileNameWithoutExtension(projectFile));
8183
File.WriteAllText(targetFilePath, text);
8284

83-
Console.WriteLine($"Found your .csproj: {projectFile} - check for existing config or update it.");
85+
var extension = Path.GetExtension(projectFile);
86+
Console.WriteLine($"Found your {extension}: {projectFile} - check for existing config or update it.");
8487

85-
if (!EditCsProj(projectFile)) return false;
88+
if (!EditProjectFile(projectFile)) return false;
8689

8790
// search launchSettings.json
8891
Console.WriteLine($"Search your .launchSettings to add our electron debug profile...");
@@ -158,7 +161,7 @@ private static void EditLaunchSettings(string currentDirectory)
158161
}
159162
}
160163

161-
private static bool EditCsProj(string projectFile)
164+
private static bool EditProjectFile(string projectFile)
162165
{
163166
using (var stream = File.Open(projectFile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
164167
{
@@ -174,11 +177,11 @@ private static bool EditCsProj(string projectFile)
174177

175178
if (xmlDocument.ToString().Contains($"Content Update=\"{ConfigName}\""))
176179
{
177-
Console.WriteLine($"{ConfigName} already in csproj.");
180+
Console.WriteLine($"{ConfigName} already in csproj/fsproj.");
178181
return false;
179182
}
180183

181-
Console.WriteLine($"{ConfigName} will be added to csproj.");
184+
Console.WriteLine($"{ConfigName} will be added to csproj/fsproj.");
182185

183186
string itemGroupXmlString = "<ItemGroup>" +
184187
"<Content Update=\"" + ConfigName + "\">" +
@@ -204,7 +207,7 @@ private static bool EditCsProj(string projectFile)
204207

205208
}
206209

207-
Console.WriteLine($"{ConfigName} added in csproj!");
210+
Console.WriteLine($"{ConfigName} added in csproj/fsproj!");
208211
return true;
209212
}
210213
}

ElectronNET.CLI/Commands/StartElectronCommand.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public StartElectronCommand(string[] args)
2828
private string _clearCache = "clear-cache";
2929
private string _paramPublishReadyToRun = "PublishReadyToRun";
3030
private string _paramDotNetConfig = "dotnet-configuration";
31+
private string _paramTarget = "target";
3132

3233
public Task<bool> ExecuteAsync()
3334
{
@@ -59,8 +60,6 @@ public Task<bool> ExecuteAsync()
5960
Directory.CreateDirectory(tempPath);
6061
}
6162

62-
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
63-
6463
string tempBinPath = Path.Combine(tempPath, "bin");
6564
var resultCode = 0;
6665

@@ -74,6 +73,21 @@ public Task<bool> ExecuteAsync()
7473
publishReadyToRun += "true";
7574
}
7675

76+
// If target is specified as a command line argument, use it.
77+
// Format is the same as the build command.
78+
// If target is not specified, autodetect it.
79+
var platformInfo = GetTargetPlatformInformation.Do(string.Empty, string.Empty);
80+
if (parser.Arguments.ContainsKey(_paramTarget))
81+
{
82+
var desiredPlatform = parser.Arguments[_paramTarget][0];
83+
string specifiedFromCustom = string.Empty;
84+
if (desiredPlatform == "custom" && parser.Arguments[_paramTarget].Length > 1)
85+
{
86+
specifiedFromCustom = parser.Arguments[_paramTarget][1];
87+
}
88+
platformInfo = GetTargetPlatformInformation.Do(desiredPlatform, specifiedFromCustom);
89+
}
90+
7791
string configuration = "Debug";
7892
if (parser.Arguments.ContainsKey(_paramDotNetConfig))
7993
{

ElectronNET.Host/ElectronHostHook/connector.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.Host/ElectronHostHook/connector.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.Host/ElectronHostHook/index.js

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ElectronNET.Host/ElectronHostHook/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)