@devisfuture/electron-modular 1.1.2 → 1.1.4
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.
- package/README.md +12 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,13 @@ TypeScript setup:
|
|
|
66
66
|
|
|
67
67
|
> Tip: This package is published as ESM. When importing local modules, use `.js` extensions in runtime imports, e.g. `import { UserModule } from "./user/module.js"`.
|
|
68
68
|
|
|
69
|
+
## Folders (build outputs)
|
|
70
|
+
|
|
71
|
+
The `folders` option in `initSettings` tells the framework where your build artifacts live:
|
|
72
|
+
|
|
73
|
+
- `distRenderer` — the build output folder for your renderer (web) bundle (e.g. Vite/webpack output).
|
|
74
|
+
- `distMain` — the build output folder for your main process bundle (compiled ESM files).
|
|
75
|
+
|
|
69
76
|
---
|
|
70
77
|
|
|
71
78
|
## Quick Start
|
|
@@ -102,6 +109,10 @@ app.on("ready", async () => {
|
|
|
102
109
|
|
|
103
110
|
---
|
|
104
111
|
|
|
112
|
+
## Example App
|
|
113
|
+
|
|
114
|
+
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.
|
|
115
|
+
|
|
105
116
|
## Module Structure
|
|
106
117
|
|
|
107
118
|
An example of each module's structure, but you can use your own:
|
|
@@ -175,7 +186,7 @@ export class UserService {
|
|
|
175
186
|
|
|
176
187
|
### Approach 2: Provider Pattern (Advanced)
|
|
177
188
|
|
|
178
|
-
Use `provide` and `useFactory` to expose only necessary
|
|
189
|
+
Use `provide` and `useFactory` to expose only necessary types.
|
|
179
190
|
|
|
180
191
|
#### tokens.ts
|
|
181
192
|
|
|
@@ -662,8 +673,6 @@ my-feature/
|
|
|
662
673
|
|
|
663
674
|
### 1. Use Providers for Cross-Module Communication
|
|
664
675
|
|
|
665
|
-
✅ **Good:**
|
|
666
|
-
|
|
667
676
|
```typescript
|
|
668
677
|
{
|
|
669
678
|
provide: AUTH_PROVIDER,
|
|
@@ -675,19 +684,10 @@ my-feature/
|
|
|
675
684
|
}
|
|
676
685
|
```
|
|
677
686
|
|
|
678
|
-
❌ **Bad:**
|
|
679
|
-
|
|
680
|
-
```typescript
|
|
681
|
-
// Don't export entire service
|
|
682
|
-
exports: [AuthService];
|
|
683
|
-
```
|
|
684
|
-
|
|
685
687
|
### 2. Keep Services Focused
|
|
686
688
|
|
|
687
689
|
Each service should have a single responsibility.
|
|
688
690
|
|
|
689
|
-
✅ **Good:**
|
|
690
|
-
|
|
691
691
|
```typescript
|
|
692
692
|
@Injectable()
|
|
693
693
|
export class ResourcesService {
|
|
@@ -702,8 +702,6 @@ export class CacheWindowsService {
|
|
|
702
702
|
|
|
703
703
|
### 3. Use Tokens for All Cross-Module Dependencies
|
|
704
704
|
|
|
705
|
-
✅ **Good:**
|
|
706
|
-
|
|
707
705
|
```typescript
|
|
708
706
|
export const RESOURCES_REST_API_PROVIDER = Symbol("RESOURCES_REST_API_PROVIDER");
|
|
709
707
|
|
package/package.json
CHANGED