From 09003fd1256295731cb4de1b6fd0d8da35428b6c Mon Sep 17 00:00:00 2001 From: Lutz Roeder Date: Sat, 30 Dec 2023 11:10:54 -0800 Subject: [PATCH] Electron Forge support (#632) --- .gitignore | 1 + package.json | 8 +++++ publish/forge.config.js | 65 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 publish/forge.config.js diff --git a/.gitignore b/.gitignore index c1020df2ab..bd0362a785 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .DS_Store .DS_Store? dist/* +out/* node_modules/* third_party/* package-lock.json diff --git a/package.json b/package.json index 4b3b5c6369..5d3f2ee8ee 100755 --- a/package.json +++ b/package.json @@ -36,6 +36,11 @@ "electron": "28.1.1", "electron-builder": "24.9.1", "@electron/notarize": "2.2.0", + "@electron-forge/cli": "7.2.0", + "@electron-forge/core": "7.2.0", + "@electron-forge/maker-snap": "7.2.0", + "@electron-forge/maker-dmg": "7.2.0", + "@electron-forge/maker-zip": "7.2.0", "eslint": "8.56.0" }, "eslintConfig": { @@ -103,6 +108,9 @@ "report-dir": "dist/nyc/coverage", "temp-dir": "dist/nyc/.nyc_output" }, + "config": { + "forge": "publish/forge.config.js" + }, "build": { "appId": "com.lutzroeder.netron", "productName": "Netron", diff --git a/publish/forge.config.js b/publish/forge.config.js new file mode 100644 index 0000000000..15b2623f46 --- /dev/null +++ b/publish/forge.config.js @@ -0,0 +1,65 @@ + +/* +const APPLE_API_KEY_ID = process.env.APPLE_API_KEY_ID; +const APPLE_API_KEY_ISSUER_ID = process.env.APPLE_API_KEY_ISSUER_ID; +*/ + +export default { + outDir: 'dist', + packagerConfig: { + icon: "publish/icon", + dir: [ + 'source' + ], + ignore: [ + "publish", + "third_party", + "test", + "tools" + ], + /* + osxNotarize: { + tool: 'notarytool', + appleApiKey: `~/.private_keys/AuthKey_${APPLE_API_KEY_ID}.p8`, + appleApiKeyId: APPLE_API_KEY_ID, + appleApiIssuer: APPLE_API_KEY_ISSUER_ID + }, + */ + asar: true + }, + /* + makeTargets: { + win32: ['nsis'], + darwin: ['dmg', 'zip'], + linux: ['snap'], + }, + */ + makers: [ + { + name: '@electron-forge/maker-zip', + config: { + platforms: [ 'darwin' ], + // name: "${name}-${version}-mac.zip" + } + }, + { + name: '@electron-forge/maker-dmg', + config: { + background: './publish/background.png', + /* eslint-disable no-template-curly-in-string */ + name: "Netron-${version}" + /* eslint-enable no-template-curly-in-string */ + } + } + ], + publishers: [ + { + "name": "@electron-forge/publisher-github", + "config": {} + }, + { + "name": "@electron-forge/publisher-snapcraft", + "config": {} + } + ] +};