Monorepo for Aesthetic.Computer
aesthetic.computer
1// @ts-check
2const { notarize } = require("@electron/notarize");
3const path = require("path");
4
5/**
6 * Notarize the macOS app after signing
7 * Called by electron-builder via afterSign hook
8 */
9exports.default = async function notarizing(context) {
10 const { electronPlatformName, appOutDir } = context;
11
12 // Only notarize on macOS
13 if (electronPlatformName !== "darwin") {
14 console.log("Skipping notarization - not macOS");
15 return;
16 }
17
18 // Skip if not in CI or explicitly disabled
19 if (!process.env.CI && !process.env.FORCE_NOTARIZE) {
20 console.log("Skipping notarization - not in CI (set FORCE_NOTARIZE=1 to override)");
21 return;
22 }
23
24 // Check for required environment variables
25 const appleId = process.env.APPLE_ID;
26 const appleIdPassword = process.env.APPLE_NOTARIZE_PWD;
27 const teamId = process.env.APPLE_TEAM_ID;
28
29 if (!appleId || !appleIdPassword || !teamId) {
30 console.log("Skipping notarization - missing credentials");
31 console.log(" APPLE_ID:", appleId ? "✓" : "✗");
32 console.log(" APPLE_NOTARIZE_PWD:", appleIdPassword ? "✓" : "✗");
33 console.log(" APPLE_TEAM_ID:", teamId ? "✓" : "✗");
34 return;
35 }
36
37 const appName = context.packager.appInfo.productFilename;
38 const appPath = path.join(appOutDir, `${appName}.app`);
39
40 console.log(`Notarizing ${appPath}...`);
41
42 try {
43 await notarize({
44 tool: "notarytool",
45 appPath,
46 appleId,
47 appleIdPassword,
48 teamId,
49 });
50 console.log("Notarization complete!");
51 } catch (error) {
52 console.error("Notarization failed:", error);
53 throw error;
54 }
55};