Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7d88912

Browse files
Add support for notarizing Mac DMG using electron-notarize
1 parent ee0ce97 commit 7d88912

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

packages/tad-app/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"css-loader": "^6.5.1",
6666
"electron": "17.0.0",
6767
"electron-builder": "^22.14.5",
68+
"electron-notarize": "^1.1.1",
6869
"file-loader": "^6.2.0",
6970
"image-webpack-loader": "^8.0.1",
7071
"less": "^3.13.1",
@@ -90,11 +91,13 @@
9091
"**/*reltab*"
9192
],
9293
"afterPack": "./tools/afterPack.js",
94+
"afterSign": "./tools/notarize.js",
9395
"directories": {
9496
"buildResources": "buildRes"
9597
},
9698
"dmg": {
97-
"icon": "dmgIcon.icns"
99+
"icon": "dmgIcon.icns",
100+
"sign": false
98101
},
99102
"extraResources": [
100103
"tad.sh",
@@ -150,7 +153,11 @@
150153
]
151154
},
152155
"mac": {
156+
"hardenedRuntime": true,
157+
"gatekeeperAssess": false,
153158
"category": "public.app-category.developer-tools",
159+
"entitlements": "res/entitlements.mac.plist",
160+
"entitlementsInherit": "res/entitlements.mac.plist",
154161
"target": [
155162
"zip",
156163
"dmg"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
6+
<true/>
7+
</dict>
8+
</plist>

packages/tad-app/tools/notarize.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { notarize } = require("electron-notarize");
2+
3+
exports.default = async function notarizing(context) {
4+
const { electronPlatformName, appOutDir } = context;
5+
if (electronPlatformName !== "darwin") {
6+
return;
7+
}
8+
9+
const appName = context.packager.appInfo.productFilename;
10+
const appleId = process.env.APPLEID;
11+
if (!appleId) {
12+
console.error(
13+
"notarize.js: APPLEID env var not set. Please set APPLEID and APPLEIDPASS env vars to your Apple ID and password"
14+
);
15+
throw new Error("notarize: Apple ID credentials not set");
16+
}
17+
18+
return await notarize({
19+
appBundleId: "com.antonycourtney.tad",
20+
appPath: `${appOutDir}/${appName}.app`,
21+
appleId,
22+
appleIdPassword: process.env.APPLEIDPASS,
23+
});
24+
};

0 commit comments

Comments
 (0)