Files
DeepTutor/apps/desktop/scripts/make-dmg.mjs
Bingxi Zhao (Frank) a4fa63b6e2 feat(desktop): add Open DeepTutor for macOS under apps/desktop
Move the Electron macOS app into the main repository and ship it with every
DeepTutor release.

- apps/desktop: Electron shell that installs a signed bundled runtime and
  hosts the web UI; versioned with the bundled core.
- White app icon with the black DeepTutor mark, generated by
  scripts/make-icon.swift; redesigned start screen and title bar.
- Shell copy in en/zh/de/fr/pl/uk, starting in English and following the
  interface language and theme from DeepTutor Settings, including live changes.
- Web UI labels itself "Open DeepTutor MacOS v<version>" inside the app
  (user-agent marker) and "Open DeepTutor Web v<version>" in a browser.
- Sealing refuses a missing or mismatched signing key instead of silently
  generating a new one.
- desktop-release.yml builds, smoke-tests and attaches the DMG to each
  GitHub Release; Developer ID signing and notarization run when secrets exist.
- tests.yml runs the shell checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 19:20:15 +08:00

18 lines
1.1 KiB
JavaScript

import { cp, mkdir, readFile, rm, symlink } from 'node:fs/promises';
import { execFileSync } from 'node:child_process';
import path from 'node:path';
const { coreVersion } = JSON.parse(await readFile('.local/seed/runtime.json', 'utf8'));
const built = path.resolve(`out/Open DeepTutor-darwin-${process.arch}`);
const stage = path.resolve('.local/dmg');
const dmg = path.resolve(`out/Open-DeepTutor-MacOS-v${coreVersion}-${process.arch}.dmg`);
await rm(stage, { recursive: true, force: true });
await mkdir(stage, { recursive: true });
await cp(path.join(built, 'Open DeepTutor.app'), path.join(stage, 'Open DeepTutor.app'), { recursive: true, verbatimSymlinks: true });
await cp(path.join(built, 'LICENSES.chromium.html'), path.join(stage, 'LICENSES.chromium.html'));
await symlink('/Applications', path.join(stage, 'Applications'));
await rm(dmg, { force: true });
execFileSync('/usr/bin/hdiutil', ['create', '-volname', 'Open DeepTutor', '-srcfolder', stage, '-fs', 'APFS', '-format', 'ULFO', dmg], { stdio: 'inherit' });
await rm(stage, { recursive: true, force: true });
console.log(dmg);