Skip to content

feat: plugin lifecycle, watchdog opt-out, and splash screen#6

Open
robingenz wants to merge 8 commits into
mainfrom
feat/watchdog-opt-out-and-initialize-hook
Open

feat: plugin lifecycle, watchdog opt-out, and splash screen#6
robingenz wants to merge 8 commits into
mainfrom
feat/watchdog-opt-out-and-initialize-hook

Conversation

@robingenz

@robingenz robingenz commented Jul 13, 2026

Copy link
Copy Markdown
Member

What

Platform primitives for the upcoming Electron implementation of @capawesome/capacitor-live-update, plus a splash screen covering the plugin-load boot phase.

  • Watchdog opt-out on setActiveBundle: setActiveBundle(dir, { bootWatchdog: false }) repoints + reloads without arming the failed-boot watchdog and without persisting a pending marker, so the startup pending-check never reverts an externally-managed bundle. notifyBootReady() becomes a no-op for such activations. Default remains true — non-breaking, no state-format change.
  • ElectronPlugin base class + load() lifecycle (exported from ./plugin): plugins extend the class (platform as devDependency + optional peerDependency, matching the Android/iOS mental model) and override load(), which is awaited sequentially after all plugins are constructed and before the first window load — async setup (e.g. repointing the active bundle) takes effect on first paint, and a throwing load aborts boot loudly. Detection stays structural (no instanceof), so zero-dependency marker-only plugins with a structural load() keep working. load is reserved and never bridged (boot error if listed in methods); the earlier duck-typed initialize hook is gone and initialize is an ordinary method name again.
  • Splash screen: covers the gap from app-ready to first paint (exactly where load() hooks run — the app previously showed nothing). Config: splashScreen: { enabled?, path?, width?, height?, backgroundColor?, minimumDurationMs? }. Default lookup assets/splash.htmlassets/splash.png (the latter matches the community platform convention for zero-config migration; splashScreenImageName: 'x.gif'path: 'assets/x.gif'). path accepts HTML or an image (image is wrapped in a generated data-URI document). The splash window is fully outside the bridge: sandboxed, no preload, no custom scheme, navigation blocked. Closes after main-window ready-to-show (+ optional minimum duration) and on every boot-failure path. Includes a theme-aware scaffold template and a packaging fix: assets/**/* added to the electron-builder files (buildResources are otherwise excluded from packaged apps — the splash would have vanished in production builds).

Tests

  • bundles.spec.ts: watchdog opt-out semantics, startup pending-check behavior, mixed activation sequences.
  • plugin-host.spec.ts: base-class + marker-only load() coverage, reserved-name rejection, boot-failure on throwing hooks.
  • splash.spec.ts: path resolution/fallback/enabled semantics, HTML-vs-image branching, wrapper generation, minimum-duration timing.
  • 49 tests passing; build + lint clean.

Related PRs

🤖 Generated with Claude Code`withversionimported fromelectron/package.json. Scaffold example + resolveJsonModule` included.

Tests}

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds two new Electron runtime primitives intended to support OTA/live-update workflows: a per-activation “boot watchdog” opt-out for bundle activation, and an optional async plugin initialize() lifecycle hook awaited during PluginHost.start().

Changes:

  • Extend BundlesService.setActiveBundle() to accept { bootWatchdog?: boolean }, allowing opt-out from pending-marker persistence and watchdog rollback behavior.
  • Add an optional plugin instance initialize() hook that runs sequentially after plugin construction and before the platform finishes starting.
  • Add/extend Vitest coverage for both the watchdog opt-out behavior and the new lifecycle hook.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/runtime/plugin-host.ts Await optional plugin initialize() hook during startup.
src/runtime/plugin-host.spec.ts Tests for sync/async initialize() behavior and failure handling.
src/runtime/index.ts Re-export ElectronPluginLifecycle type.
src/runtime/bundles.ts Add watchdog opt-out option to setActiveBundle() and adjust pending/watchdog behavior.
src/runtime/bundles.spec.ts New test suite covering watchdog opt-out, restart behavior, and mixed sequences.
src/plugin/index.ts Update BundlesService API docs/signature; introduce ElectronPluginLifecycle.
README.md Document optional plugin initialize() lifecycle hook.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runtime/plugin-host.ts Outdated
Comment thread src/plugin/index.ts Outdated
Comment thread README.md Outdated
robingenz and others added 3 commits July 14, 2026 11:12
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…() lifecycle

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@robingenz robingenz changed the title feat: add watchdog opt-out and async plugin initialize hook feat: plugin lifecycle, watchdog opt-out, and splash screen Jul 14, 2026
@robingenz robingenz self-assigned this Jul 14, 2026
@robingenz robingenz added the feature Feature label Jul 14, 2026
@robingenz robingenz requested a review from Copilot July 14, 2026 11:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Comment thread src/runtime/splash.ts
Comment thread src/config/index.ts
Comment thread src/config/index.ts Outdated
robingenz and others added 4 commits July 14, 2026 14:17
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants