@cordy/electro-cli 1.3.0 → 1.4.0

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 ADDED
@@ -0,0 +1,159 @@
1
+ # @cordy/electro-cli
2
+
3
+ CLI for Electro applications.
4
+
5
+ It is responsible for:
6
+
7
+ - scanning your app source for Electro features
8
+ - generating preload scripts and bridge typings
9
+ - running the Electron + Vite development workflow
10
+ - building main, preload, and renderer output for production
11
+ - previewing the built app locally
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ bun add -d @cordy/electro-cli
17
+ bun add @cordy/electro electron vite
18
+ ```
19
+
20
+ Peer dependencies:
21
+
22
+ - `@cordy/electro >=1`
23
+ - `electron >=41`
24
+ - `vite >=8`
25
+
26
+ ## Expected Inputs
27
+
28
+ The CLI expects an Electro app with:
29
+
30
+ - an `electro.config.ts` file by default
31
+ - a `runtime` defined with `defineRuntime(...)`
32
+ - optional `views` defined with `defineView(...)`
33
+ - application source under `src/`
34
+
35
+ You can point to another config file with `--config`.
36
+
37
+ ## Commands
38
+
39
+ ### `electro generate`
40
+
41
+ Scans `src/` and writes generated files without launching Electron or building bundles.
42
+
43
+ ```bash
44
+ electro generate
45
+ electro generate --config apps/desktop/electro.config.ts --output .electro
46
+ ```
47
+
48
+ Options:
49
+
50
+ - `-c, --config <path>`: path to `electro.config.ts`
51
+ - `-o, --output <dir>`: output directory for generated files, default `.electro`
52
+
53
+ Generated output includes:
54
+
55
+ - `.electro/generated/preload/<view>.gen.ts`
56
+ - `bridge.gen.ts` next to each `view.config.ts`
57
+ - `src/electro-env.d.ts`
58
+
59
+ ### `electro dev`
60
+
61
+ Runs Electro in development mode:
62
+
63
+ - loads the config
64
+ - runs code generation
65
+ - starts the renderer Vite dev server
66
+ - builds main and preload in watch mode
67
+ - launches Electron
68
+
69
+ ```bash
70
+ electro dev
71
+ electro dev --inspect
72
+ electro dev --rendererOnly
73
+ ```
74
+
75
+ Useful options:
76
+
77
+ - `--config <path>`
78
+ - `--clearScreen`
79
+ - `--logLevel <level>`
80
+ - `--sourcemap <mode>`
81
+ - `--outDir <dir>`
82
+ - `--inspect [port]`
83
+ - `--inspectBrk [port]`
84
+ - `--remoteDebuggingPort <port>`
85
+ - `--noSandbox`
86
+ - `--rendererOnly`
87
+
88
+ Extra arguments after `--` are forwarded to Electron in dev mode.
89
+
90
+ ### `electro build`
91
+
92
+ Runs code generation and builds the app for production.
93
+
94
+ ```bash
95
+ electro build
96
+ electro build --outDir dist --bytecode
97
+ ```
98
+
99
+ Useful options:
100
+
101
+ - `-c, --config <path>`
102
+ - `-o, --outDir <dir>`
103
+ - `--sourcemap <mode>`
104
+ - `--minify`
105
+ - `--no-minify`
106
+ - `--bytecode`
107
+ - `-l, --logLevel <level>`
108
+
109
+ Typical output structure:
110
+
111
+ - `dist/main/*`
112
+ - `dist/preload/<view>.cjs`
113
+ - `dist/renderer/<view>/index.html`
114
+
115
+ ### `electro preview`
116
+
117
+ Builds the app and launches Electron from the build output.
118
+
119
+ ```bash
120
+ electro preview
121
+ electro preview --skip-build
122
+ ```
123
+
124
+ Useful options:
125
+
126
+ - `-c, --config <path>`
127
+ - `-o, --outDir <dir>`
128
+ - `--sourcemap <mode>`
129
+ - `--minify`
130
+ - `--no-minify`
131
+ - `--bytecode`
132
+ - `--skip-build`
133
+ - `-l, --logLevel <level>`
134
+
135
+ ## Suggested `package.json` Scripts
136
+
137
+ ```json
138
+ {
139
+ "scripts": {
140
+ "dev": "electro dev",
141
+ "build": "electro build",
142
+ "preview": "electro preview",
143
+ "generate": "electro generate"
144
+ }
145
+ }
146
+ ```
147
+
148
+ ## Notes
149
+
150
+ - `electro dev`, `electro build`, and `electro preview` all run code generation automatically.
151
+ - View names must be unique.
152
+ - Renderer access is controlled by `features` in each `defineView(...)`.
153
+ - If a view omits `entry`, the CLI falls back to `./index.html`.
154
+
155
+ See [`@cordy/electro`](../electro/README.md) for the runtime API and the root [README](../../README.md) for the end-to-end quick start.
156
+
157
+ ## License
158
+
159
+ MIT
package/dist/index.mjs CHANGED
@@ -11,7 +11,7 @@ import { tmpdir } from "node:os";
11
11
  import { spawn } from "node:child_process";
12
12
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
13
13
  //#region package.json
14
- var version$1 = "1.3.0";
14
+ var version$1 = "1.4.0";
15
15
  //#endregion
16
16
  //#region src/dev/bridge-types.ts
17
17
  const GENERATED_BRIDGE_DIRS = ["views", "windows"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordy/electro-cli",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "CLI for @cordy/electro — dev server, build, and code generation commands",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -50,12 +50,12 @@
50
50
  "vite": ">=8"
51
51
  },
52
52
  "dependencies": {
53
- "@cordy/electro-generator": "1.3.0",
53
+ "@cordy/electro-generator": "1.4.0",
54
54
  "cac": "^7.0.0",
55
55
  "magic-string": "^0.30.21"
56
56
  },
57
57
  "devDependencies": {
58
- "@cordy/electro": "1.3.0",
58
+ "@cordy/electro": "1.4.0",
59
59
  "@types/node": "^25.5.0",
60
60
  "electron": "^41.0.3",
61
61
  "tsdown": "^0.21.4",