From 03c08503cc319b73ec384dfd5e6439557b1351ed Mon Sep 17 00:00:00 2001 From: Florian Rappl Date: Tue, 4 Apr 2023 16:40:45 +0200 Subject: [PATCH] Updated build system with template --- .../Actions/DeployEmbeddedElectronFiles.cs | 2 +- src/ElectronNET.CLI/ElectronNET.CLI.csproj | 4 +- src/ElectronNET.CLI/ProcessHelper.cs | 4 +- src/ElectronNET.Host/package.json | 3 +- src/ElectronNET.Host/src/main.ts | 2 +- .../{ => template}/electron.manifest.json | 2 +- src/ElectronNET.Host/template/package.json | 11 +++ .../ElectronHostHook/.gitignore | 92 +------------------ 8 files changed, 20 insertions(+), 100 deletions(-) rename src/ElectronNET.Host/{ => template}/electron.manifest.json (94%) create mode 100644 src/ElectronNET.Host/template/package.json diff --git a/src/ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs b/src/ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs index 8305b8a..19aab12 100644 --- a/src/ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs +++ b/src/ElectronNET.CLI/Commands/Actions/DeployEmbeddedElectronFiles.cs @@ -30,7 +30,7 @@ namespace ElectronNET.CLI.Commands.Actions EmbeddedFileHelper.DeployEmbeddedFile(hostDistFolder, "build-helper.js", "dist."); EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "launch.json", ".vscode."); EmbeddedFileHelper.DeployEmbeddedFile(vscodeFolder, "tasks.json", ".vscode."); - EmbeddedFileHelper.DeployEmbeddedFile(splashscreenFolder, "index.html", "splashscreen."); + EmbeddedFileHelper.DeployEmbeddedFile(splashscreenFolder, "index.html", "splashscreen."); } } } diff --git a/src/ElectronNET.CLI/ElectronNET.CLI.csproj b/src/ElectronNET.CLI/ElectronNET.CLI.csproj index c4d12cc..c305196 100644 --- a/src/ElectronNET.CLI/ElectronNET.CLI.csproj +++ b/src/ElectronNET.CLI/ElectronNET.CLI.csproj @@ -39,8 +39,8 @@ - - + + diff --git a/src/ElectronNET.CLI/ProcessHelper.cs b/src/ElectronNET.CLI/ProcessHelper.cs index 3cfe6d1..9c40cd7 100644 --- a/src/ElectronNET.CLI/ProcessHelper.cs +++ b/src/ElectronNET.CLI/ProcessHelper.cs @@ -30,7 +30,7 @@ namespace ElectronNET.CLI var hookSource = Path.Combine(electronhosthookDir, "index.ts"); var hookTarget = Path.Combine(root, "dist", "host-hook.js"); Console.WriteLine("Bundle ElectronHostHook ..."); - CmdExecute($"npm start --outfile={hookTarget}", electronhosthookDir); + CmdExecute($"npm start -- --outfile={hookTarget}", electronhosthookDir); } } @@ -38,7 +38,7 @@ namespace ElectronNET.CLI { using (Process cmd = new Process()) { - bool isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); + var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); if (isWindows) { diff --git a/src/ElectronNET.Host/package.json b/src/ElectronNET.Host/package.json index 9c7764c..8335e0a 100644 --- a/src/ElectronNET.Host/package.json +++ b/src/ElectronNET.Host/package.json @@ -13,8 +13,7 @@ "build:main": "esbuild src/main.ts --external:electron --platform=node --target=es2020 --bundle --outdir=dist", "build:build-helper": "esbuild src/build-helper.ts --external:electron --platform=node --target=es2020 --bundle --outdir=dist" }, - "dependencies": {}, - "devDependencies": { + "dependencies": { "@types/dasherize": "^2.0.0", "@types/node": "^18.15.5", "@types/portscanner": "^2.1.1", diff --git a/src/ElectronNET.Host/src/main.ts b/src/ElectronNET.Host/src/main.ts index 9621c73..3f78234 100644 --- a/src/ElectronNET.Host/src/main.ts +++ b/src/ElectronNET.Host/src/main.ts @@ -47,7 +47,7 @@ const watchable = app.commandLine.hasSwitch("watch"); // if watch is enabled lets change the path const currentBinPath = watchable ? resolve(__dirname, "../../") - : resolve(__dirname.replace("app.asar", ""), "bin"); + : resolve(__dirname, "../../", "bin"); const hostHookScriptFilePath = resolve(__dirname, "host-hook.js"); const manifestJsonFilePath = resolve(currentBinPath, manifestJsonFileName); diff --git a/src/ElectronNET.Host/electron.manifest.json b/src/ElectronNET.Host/template/electron.manifest.json similarity index 94% rename from src/ElectronNET.Host/electron.manifest.json rename to src/ElectronNET.Host/template/electron.manifest.json index 014fdec..bb8593a 100644 --- a/src/ElectronNET.Host/electron.manifest.json +++ b/src/ElectronNET.Host/template/electron.manifest.json @@ -10,7 +10,7 @@ "build": { "appId": "com.{{executable}}.app", "productName": "{{executable}}", - "copyright": "Copyright © 2020", + "copyright": "Copyright © 2023", "buildVersion": "1.0.0", "compression": "maximum", "directories": { diff --git a/src/ElectronNET.Host/template/package.json b/src/ElectronNET.Host/template/package.json new file mode 100644 index 0000000..0ff1624 --- /dev/null +++ b/src/ElectronNET.Host/template/package.json @@ -0,0 +1,11 @@ +{ + "name": "electron-net", + "version": "1.0.0", + "description": "Host for Electron.NET.", + "main": "dist/main.js", + "author": "Gregor Biswanger, Florian Rappl", + "license": "MIT", + "devDependencies": { + "electron": "^23.2.0" + } +} diff --git a/src/ElectronNET.WebApp/ElectronHostHook/.gitignore b/src/ElectronNET.WebApp/ElectronHostHook/.gitignore index 3da6e16..3c3629e 100644 --- a/src/ElectronNET.WebApp/ElectronHostHook/.gitignore +++ b/src/ElectronNET.WebApp/ElectronHostHook/.gitignore @@ -1,91 +1 @@ - -# Created by https://www.gitignore.io/api/node -# Edit at https://www.gitignore.io/?templates=node - -### Node ### -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env -.env.test - -# parcel-bundler cache (https://parceljs.org/) -.cache - -# next.js build output -.next - -# nuxt.js build output -.nuxt - -# vuepress build output -.vuepress/dist - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# End of https://www.gitignore.io/api/node \ No newline at end of file +node_modules