diff --git a/.gitignore b/.gitignore index c1020df2ab0..bd0362a7850 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.js b/package.js index b40fa41e4aa..d4b65fcb770 100644 --- a/package.js +++ b/package.js @@ -579,6 +579,14 @@ const coverage = async () => { await exec('nyc --instrument npx electron ./dist/nyc'); }; +const forge = async() => { + await exec('npm install @electron-forge/cli@7.2.0'); + await exec('npm install @electron-forge/core@7.2.0'); + await exec('npm install @electron-forge/maker-snap@7.2.0'); + await exec('npm install @electron-forge/maker-dmg@7.2.0'); + await exec('npm install @electron-forge/maker-zip@7.2.0'); +}; + const analyze = async () => { const exists = await access('third_party/tools/codeql'); if (!exists) { @@ -630,6 +638,7 @@ const next = async () => { case 'pull': await pull(); break; case 'analyze': await analyze(); break; case 'coverage': await coverage(); break; + case 'forge': await forge(); break; default: throw new Error(`Unsupported task '${task}'.`); } } catch (err) { diff --git a/package.json b/package.json index 17b83356bfe..e9eb8a300ed 100755 --- a/package.json +++ b/package.json @@ -104,6 +104,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 00000000000..15b2623f463 --- /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": {} + } + ] +};