feat(electron): walking skeleton for the desktop shell

Phase 1 step 1 of VNCprodbuild: electron/main.ts boots the same Next.js
"standalone" server artifact the Dockerfile already produces (next.config.ts's
output: "standalone") as a child process on a random localhost port, then
opens a BrowserWindow at it. electron/preload.ts is a contextBridge stub
(window.vnc.isElectron) for now.

scripts/assemble-standalone.mjs copies public/ and .next/static into
.next/standalone, mirroring what the Dockerfile does by hand, since `next
build` deliberately leaves both out of the standalone output.
scripts/build-electron.mjs bundles main.ts/preload.ts to CommonJS via esbuild
(already a devDependency).

New npm scripts: build:standalone, build:electron, electron:dev.
electron-builder.config.js is intentionally minimal - no signing, no
platform targets yet, just enough to prove the concept end to end.

Also fixes a pre-existing repo-wide lint gap: vnc/plugins/smime is an
independent sub-package (own package.json/esbuild build, browser-only
globals) that was never added to eslint's ignores alongside repos:: and
examples/**, so `npm run lint` - and the husky pre-commit hook - was failing
on every commit regardless of what changed. Excluded it the same way those
are, and added node globals for scripts/**/*.mjs so the new build helpers
above lint cleanly too.

Verified manually: npm run build:standalone && npm run build:electron &&
electron . boots the server and opens a window with no errors.
This commit is contained in:
Bernd Rodler
2026-08-04 12:41:35 +02:00
parent 5c1f14fa8b
commit 218a584fb3
6 changed files with 274 additions and 0 deletions
+20
View File
@@ -53,6 +53,18 @@ export default [
},
},
},
{
// Plain Node scripts (electron bundling/packaging helpers) - not React/
// browser code, so they get node globals only, no react/jsx parsing.
files: ["scripts/**/*.{mjs,cjs,js}"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.node,
},
},
},
{
files: ["**/*.test.{ts,tsx}", "**/*.spec.{ts,tsx}"],
languageOptions: {
@@ -70,6 +82,8 @@ export default [
{
ignores: [
".next/**",
"dist-electron/**",
"dist-electron-builds/**",
"node_modules/**",
"repos/**",
"data/admin/plugins/**",
@@ -81,6 +95,12 @@ export default [
"benchmark/**",
"examples/**",
"integration/**",
// Independent sub-package with its own package.json/build (esbuild,
// browser-only globals) - same reasoning as repos/** and examples/**
// above. Pre-existing gap: this was blocking `npm run lint` (and thus
// the pre-commit hook) repo-wide before this Electron work even
// touched anything - see the electron-desktop branch's first commits.
"vnc/plugins/smime/**",
],
},
];