Files
lobehub__lobehub/packages/electron-mac-notifications/scripts/build-native.mjs
Innei 67058d0f96 ✨ feat(desktop): support macOS communication notifications with agent avatars (#18441)
* ✨ feat(desktop): support macOS communication notifications with agent avatars

* 🐛 fix(desktop): load mac notifications addon when wrapper is inlined into the main bundle

* ♻️ refactor(desktop): auto-discover first-party native addons via shared napi loader

* 👷 ci(desktop): prepare macOS provisioning profile in desktop build workflows

* 🐛 fix(desktop): timeout stalled avatars and bound notification cache

* 🐛 fix(desktop): resolve TS2454 in notification avatar cache eviction

* 🐛 fix(desktop): skip mac notification native rebuild on Windows

* ♻️ refactor(desktop): resolve mac NotificationCtr via os file overlay
2026-08-19 14:24:51 +08:00

25 lines
875 B
JavaScript

import { execFile } from 'node:child_process';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { promisify } from 'node:util';
const execFileAsync = promisify(execFile);
if (process.platform !== 'darwin') {
console.info('[electron-mac-notifications] non-darwin platform, skipping native build');
process.exit(0);
}
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const require = createRequire(import.meta.url);
const nodeGyp = require.resolve('node-gyp/bin/node-gyp.js');
const { stdout, stderr } = await execFileAsync(process.execPath, [nodeGyp, 'rebuild'], {
cwd: packageRoot,
maxBuffer: 16 * 1024 * 1024,
});
if (stdout) console.info(stdout);
if (stderr) console.info(stderr);
console.info('[electron-mac-notifications] native build completed');