@devisfuture/electron-modular 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +26 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -40,6 +40,8 @@ Instead of wrestling with service initialization order or managing global state,
40
40
 
41
41
  A small example app demonstrating how to use this package is available at [trae-op/quick-start_react_electron-modular](https://github.com/trae-op/quick-start_react_electron-modular). It contains a minimal React + Electron project that shows module registration, IPC handlers and window managers in action — check its README for setup and run instructions.
42
42
 
43
+ For a full starter application with complete settings and built-in features, see the boilerplate at [trae-op/electron-modular-boilerplate](https://github.com/trae-op/electron-modular-boilerplate). This repo contains a ready-to-use React + Electron starter demonstrating advanced integrations (OAuth with Google & GitHub, auto-update support, authentication flows), build and dev scripts, and sensible defaults to help you get started quickly — see its README for details and setup instructions.
44
+
43
45
  ---
44
46
 
45
47
  ## Installation
@@ -342,6 +344,30 @@ export class UserWindow implements TWindowManager {
342
344
  }
343
345
  ```
344
346
 
347
+ ### Preload script — default behavior 🔧
348
+
349
+ By default the framework sets the BrowserWindow's `webPreferences.preload` to the package `preload` file located in the `distMain` folder you configured via `initSettings`. Concretely this resolves to `<app path>/<distMain>/preload.cjs` (production), and the development build is resolved appropriately when running in dev mode.
350
+
351
+ By default the source `preload` file should be placed at `src/main/preload.cts` in your project; it will be compiled/bundled to `preload.cjs` in your configured `distMain` folder during the build step.
352
+
353
+ If you need a custom preload for a specific window, set `options.webPreferences.preload` on the `@WindowManager` config — this will override the framework default:
354
+
355
+ ```ts
356
+ @WindowManager<TWindows["userProfile"]>({
357
+ hash: "window:user-profile",
358
+ isCache: true,
359
+ options: {
360
+ width: 600,
361
+ height: 400,
362
+ webPreferences: {
363
+ preload: '/absolute/or/relative/path/to/custom-preload.js'
364
+ }
365
+ },
366
+ })
367
+ ```
368
+
369
+ > Note: the custom `preload` you provide will override the default `preload` the package injects.
370
+
345
371
  ### Lifecycle Hooks (Window & WebContents events) ✅
346
372
 
347
373
  The window manager supports lifecycle hooks by naming methods on your class following a simple convention:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devisfuture/electron-modular",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "Core module system, DI container, IPC handlers, and window utilities for Electron main process.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",