Add new Electronize CLI command #273

This commit is contained in:
Gregor Biswanger
2020-04-21 19:38:16 +02:00
parent 11fbd6b259
commit 3ba3fa6414
4 changed files with 18 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ namespace ElectronNET.CLI.Commands
private string _aspCoreProjectPath = "project-path";
private string _arguments = "args";
private string _manifest = "manifest";
private string _clearCache = "clear-cache";
public Task<bool> ExecuteAsync()
{
@@ -104,6 +105,11 @@ namespace ElectronNET.CLI.Commands
arguments += " --manifest=" + parser.Arguments[_manifest].First();
}
if (parser.Arguments.ContainsKey(_clearCache))
{
arguments += " --clear-cache=true";
}
string path = Path.Combine(tempPath, "node_modules", ".bin");
bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);

View File

@@ -210,6 +210,11 @@ module.exports = (socket, app) => {
if (loadUrl) {
window.loadURL(loadUrl);
}
if (app.commandLine.hasSwitch('clear-cache') &&
app.commandLine.getSwitchValue('clear-cache')) {
window.webContents.session.clearCache();
console.log('auto clear-cache active for new window.');
}
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
});

File diff suppressed because one or more lines are too long

View File

@@ -248,6 +248,12 @@ export = (socket: SocketIO.Socket, app: Electron.App) => {
window.loadURL(loadUrl);
}
if (app.commandLine.hasSwitch('clear-cache') &&
app.commandLine.getSwitchValue('clear-cache')) {
window.webContents.session.clearCache();
console.log('auto clear-cache active for new window.');
}
windows.push(window);
electronSocket.emit('BrowserWindowCreated', window.id);
});