Skip to content

Commit

Permalink
Electron Forge support (#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Dec 30, 2023
1 parent bce23f3 commit 4b200eb
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 102 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
.DS_Store?
dist/*
out/*
node_modules/*
third_party/*
package-lock.json
Expand Down
109 changes: 7 additions & 102 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,12 @@
},
"devDependencies": {
"electron": "28.1.0",
"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": {
Expand Down Expand Up @@ -101,106 +105,7 @@
"report-dir": "dist/nyc/coverage",
"temp-dir": "dist/nyc/.nyc_output"
},
"build": {
"appId": "com.lutzroeder.netron",
"productName": "Netron",
"files": [ "source/**/*" ],
"directories": { "buildResources": "./publish" },
"fileAssociations": [
{ "ext": "armnn", "name": "Arm NN Model" },
{ "ext": "caffemodel", "name": "Caffe Model" },
{ "ext": "circle", "name": "Circle Model" },
{ "ext": "ckpt", "name": "Model Checkpoint" },
{ "ext": "cmf", "name": "CNTK Model" },
{ "ext": "dlc", "name": "DLC Model" },
{ "ext": "dnn", "name": "CNTK Model" },
{ "ext": "h5", "name": "Keras Model" },
{ "ext": "har", "name": "Hailo Model" },
{ "ext": "hd5", "name": "Keras Model" },
{ "ext": "hdf5", "name": "Keras Model" },
{ "ext": "hn", "name": "Hailo Model" },
{ "ext": "keras", "name": "Keras Model" },
{ "ext": "kmodel", "name": "Kendryte Model" },
{ "ext": "lite", "name": "TensorFlow Lite Model" },
{ "ext": "mar", "name": "MXNet Model" },
{ "ext": "maxviz", "name": "Modular Model" },
{ "ext": "meta", "name": "TensorFlow Meta Graph" },
{ "ext": "mge", "name": "MegEngine Mge Model" },
{ "ext": "mlmodel", "name": "Core ML Model" },
{ "ext": "mlnet", "name": "ML.NET Model" },
{ "ext": "mlpackage", "name": "Core ML Model Package", "isPackage": true },
{ "ext": "mnn", "name": "MNN Model" },
{ "ext": "model", "name": "Model" },
{ "ext": "nb", "name": "Paddle Lite Model" },
{ "ext": "ngf", "name": "ONNX Model" },
{ "ext": "nn", "name": "Barracuda Model" },
{ "ext": "nnp", "name": "Neural Network Libraries" },
{ "ext": "npy", "name": "NumPy Array" },
{ "ext": "npz", "name": "NumPy Archive" },
{ "ext": "om", "name": "DaVinci OM Model" },
{ "ext": "onnx", "name": "ONNX Model" },
{ "ext": "ort", "name": "ONNX Runtime Model" },
{ "ext": "paddle", "name": "PaddlePaddle Model" },
{ "ext": "param", "name": "NCNN Model" },
{ "ext": "pb", "name": "Protocol Buffer" },
{ "ext": "pbtxt", "name": "Text Protocol Buffer" },
{ "ext": "pdiparams", "name": "PaddlePaddle Model" },
{ "ext": "pdmodel", "name": "PaddlePaddle Model" },
{ "ext": "pdopt", "name": "PaddlePaddle Model" },
{ "ext": "pdparams", "name": "PaddlePaddle Model" },
{ "ext": "pkl", "name": "Pickle Model" },
{ "ext": "prototxt", "name": "Text Protocol Buffer" },
{ "ext": "pt", "name": "PyTorch Model" },
{ "ext": "pth", "name": "PyTorch Model" },
{ "ext": "ptl", "name": "PyTorch Model" },
{ "ext": "rknn", "name": "RKNN Model" },
{ "ext": "safetensors", "name": "Safetensors Checkpoint" },
{ "ext": "t7", "name": "Torch Model" },
{ "ext": "tfl", "name": "TensorFlow Lite Model" },
{ "ext": "tflite", "name": "TensorFlow Lite Model" },
{ "ext": "tmfile", "name": "Tengine Model" },
{ "ext": "tm", "name": "MegEngine Traced Model" },
{ "ext": "tnnproto", "name": "TNN Model" },
{ "ext": "torchscript", "name": "PyTorch Model" },
{ "ext": "uff", "name": "UFF Model" },
{ "ext": "xmodel", "name": "Vitis AI Model" }
],
"afterSign": "./publish/notarize.cjs",
"publish": [
{ "provider": "github", "releaseType": "release" }
],
"linux": {
"target": [ "AppImage", "snap" ]
},
"mac": {
"artifactName": "${productName}-${version}-mac.${ext}",
"category": "public.app-category.developer-tools",
"darkModeSupport": true,
"gatekeeperAssess": false,
"hardenedRuntime": true,
"target": [ "dmg", "zip" ]
},
"win": {
"target": [ "nsis" ],
"signingHashAlgorithms": [ "sha256" ],
"verifyUpdateCodeSignature": false
},
"dmg": {
"artifactName": "${productName}-${version}.${ext}",
"title": "${productName} ${version}",
"writeUpdateInfo": false,
"iconSize": 160,
"contents": [
{ "x": 180, "y": 170 },
{ "x": 480, "y": 170, "type": "link", "path": "/Applications" }
]
},
"nsis": {
"differentialPackage": false
},
"snap": {
"plugs": [ "default", "removable-media" ],
"publish": [ { "provider": "snapStore", "channels": [ "stable" ] } ]
}
"config": {
"forge": "publish/forge.config.js"
}
}
59 changes: 59 additions & 0 deletions publish/forge.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

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',
// name: "Netron-${version}"
}
}
],
publishers: [
{
"name": "@electron-forge/publisher-github",
"config": {}
},
{
"name": "@electron-forge/publisher-snapcraft",
"config": {}
}
]
};

0 comments on commit 4b200eb

Please sign in to comment.