electron-cli 0.3.0-alpha.2 → 0.3.0-alpha.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/Cargo.lock +96 -1
- package/Cargo.toml +2 -1
- package/README.md +28 -9
- package/package.json +2 -1
- package/src/cli.rs +120 -3
- package/src/commands/init.rs +413 -27
- package/src/commands/make.rs +426 -0
- package/src/commands/mod.rs +3 -0
- package/src/commands/package.rs +703 -0
- package/src/commands/plan.rs +50 -5
- package/src/commands/start.rs +287 -0
- package/src/main.rs +3 -0
- package/templates/minimal/gitignore +5 -0
- package/templates/minimal/src/index.html +82 -0
- package/templates/minimal/src/main.js +33 -0
- package/templates/minimal/src/preload.js +6 -0
- package/templates/minimal/src/renderer.js +5 -0
package/Cargo.lock
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
# It is not intended for manual editing.
|
|
3
3
|
version = 4
|
|
4
4
|
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "adler2"
|
|
7
|
+
version = "2.0.1"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
|
|
10
|
+
|
|
5
11
|
[[package]]
|
|
6
12
|
name = "anstream"
|
|
7
13
|
version = "1.0.0"
|
|
@@ -67,6 +73,12 @@ dependencies = [
|
|
|
67
73
|
"serde_core",
|
|
68
74
|
]
|
|
69
75
|
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "cfg-if"
|
|
78
|
+
version = "1.0.4"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
81
|
+
|
|
70
82
|
[[package]]
|
|
71
83
|
name = "clap"
|
|
72
84
|
version = "4.6.1"
|
|
@@ -113,23 +125,65 @@ version = "1.0.5"
|
|
|
113
125
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
114
126
|
checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570"
|
|
115
127
|
|
|
128
|
+
[[package]]
|
|
129
|
+
name = "crc32fast"
|
|
130
|
+
version = "1.5.0"
|
|
131
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
132
|
+
checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511"
|
|
133
|
+
dependencies = [
|
|
134
|
+
"cfg-if",
|
|
135
|
+
]
|
|
136
|
+
|
|
116
137
|
[[package]]
|
|
117
138
|
name = "electron-cli"
|
|
118
|
-
version = "0.3.0-alpha.
|
|
139
|
+
version = "0.3.0-alpha.4"
|
|
119
140
|
dependencies = [
|
|
120
141
|
"anyhow",
|
|
121
142
|
"camino",
|
|
122
143
|
"clap",
|
|
123
144
|
"serde",
|
|
124
145
|
"serde_json",
|
|
146
|
+
"zip",
|
|
147
|
+
]
|
|
148
|
+
|
|
149
|
+
[[package]]
|
|
150
|
+
name = "equivalent"
|
|
151
|
+
version = "1.0.2"
|
|
152
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
153
|
+
checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
|
|
154
|
+
|
|
155
|
+
[[package]]
|
|
156
|
+
name = "flate2"
|
|
157
|
+
version = "1.1.9"
|
|
158
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
159
|
+
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
|
|
160
|
+
dependencies = [
|
|
161
|
+
"miniz_oxide",
|
|
162
|
+
"zlib-rs",
|
|
125
163
|
]
|
|
126
164
|
|
|
165
|
+
[[package]]
|
|
166
|
+
name = "hashbrown"
|
|
167
|
+
version = "0.17.1"
|
|
168
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
169
|
+
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
170
|
+
|
|
127
171
|
[[package]]
|
|
128
172
|
name = "heck"
|
|
129
173
|
version = "0.5.0"
|
|
130
174
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
175
|
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
132
176
|
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "indexmap"
|
|
179
|
+
version = "2.14.0"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9"
|
|
182
|
+
dependencies = [
|
|
183
|
+
"equivalent",
|
|
184
|
+
"hashbrown",
|
|
185
|
+
]
|
|
186
|
+
|
|
133
187
|
[[package]]
|
|
134
188
|
name = "is_terminal_polyfill"
|
|
135
189
|
version = "1.70.2"
|
|
@@ -148,6 +202,16 @@ version = "2.8.1"
|
|
|
148
202
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
149
203
|
checksum = "6b947ae49db0d222b1dbc6b113ce7248a3fc3a6ca21b696717bfc000ba4484d8"
|
|
150
204
|
|
|
205
|
+
[[package]]
|
|
206
|
+
name = "miniz_oxide"
|
|
207
|
+
version = "0.8.9"
|
|
208
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
209
|
+
checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316"
|
|
210
|
+
dependencies = [
|
|
211
|
+
"adler2",
|
|
212
|
+
"simd-adler32",
|
|
213
|
+
]
|
|
214
|
+
|
|
151
215
|
[[package]]
|
|
152
216
|
name = "once_cell_polyfill"
|
|
153
217
|
version = "1.70.2"
|
|
@@ -215,6 +279,12 @@ dependencies = [
|
|
|
215
279
|
"zmij",
|
|
216
280
|
]
|
|
217
281
|
|
|
282
|
+
[[package]]
|
|
283
|
+
name = "simd-adler32"
|
|
284
|
+
version = "0.3.9"
|
|
285
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
286
|
+
checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214"
|
|
287
|
+
|
|
218
288
|
[[package]]
|
|
219
289
|
name = "strsim"
|
|
220
290
|
version = "0.11.1"
|
|
@@ -232,6 +302,12 @@ dependencies = [
|
|
|
232
302
|
"unicode-ident",
|
|
233
303
|
]
|
|
234
304
|
|
|
305
|
+
[[package]]
|
|
306
|
+
name = "typed-path"
|
|
307
|
+
version = "0.12.3"
|
|
308
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
309
|
+
checksum = "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e"
|
|
310
|
+
|
|
235
311
|
[[package]]
|
|
236
312
|
name = "unicode-ident"
|
|
237
313
|
version = "1.0.24"
|
|
@@ -259,6 +335,25 @@ dependencies = [
|
|
|
259
335
|
"windows-link",
|
|
260
336
|
]
|
|
261
337
|
|
|
338
|
+
[[package]]
|
|
339
|
+
name = "zip"
|
|
340
|
+
version = "8.6.0"
|
|
341
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
342
|
+
checksum = "2d04a6b5381502aa6087c94c669499eb1602eb9c5e8198e534de571f7154809b"
|
|
343
|
+
dependencies = [
|
|
344
|
+
"crc32fast",
|
|
345
|
+
"flate2",
|
|
346
|
+
"indexmap",
|
|
347
|
+
"memchr",
|
|
348
|
+
"typed-path",
|
|
349
|
+
]
|
|
350
|
+
|
|
351
|
+
[[package]]
|
|
352
|
+
name = "zlib-rs"
|
|
353
|
+
version = "0.6.3"
|
|
354
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
355
|
+
checksum = "3be3d40e40a133f9c916ee3f9f4fa2d9d63435b5fbe1bfc6d9dae0aa0ada1513"
|
|
356
|
+
|
|
262
357
|
[[package]]
|
|
263
358
|
name = "zmij"
|
|
264
359
|
version = "1.0.21"
|
package/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "electron-cli"
|
|
3
|
-
version = "0.3.0-alpha.
|
|
3
|
+
version = "0.3.0-alpha.4"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Experimental Rust CLI for Electron project diagnostics and workflow automation"
|
|
6
6
|
license = "MIT"
|
|
@@ -12,3 +12,4 @@ camino = { version = "1.1", features = ["serde1"] }
|
|
|
12
12
|
clap = { version = "4.6", features = ["derive"] }
|
|
13
13
|
serde = { version = "1.0", features = ["derive"] }
|
|
14
14
|
serde_json = "1.0"
|
|
15
|
+
zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This is an independent learning project. It is not affiliated with Electron, Ele
|
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
-
This repository is intentionally small and public-learning friendly. The first useful surface area is inspection and diagnostics, because those commands are valuable for humans and easy for agents to consume safely.
|
|
9
|
+
This repository is intentionally small and public-learning friendly. The first useful surface area is inspection and diagnostics, because those commands are valuable for humans and easy for agents to consume safely. The next surface area is a Rust-owned version of the main Electron Forge flow: initialize, start, package, make, and eventually publish.
|
|
10
10
|
|
|
11
11
|
Current commands:
|
|
12
12
|
|
|
@@ -14,22 +14,35 @@ Current commands:
|
|
|
14
14
|
electron-cli inspect
|
|
15
15
|
electron-cli doctor
|
|
16
16
|
electron-cli plan
|
|
17
|
-
electron-cli init my-app
|
|
17
|
+
electron-cli init my-app
|
|
18
|
+
electron-cli start
|
|
19
|
+
electron-cli package
|
|
20
|
+
electron-cli make
|
|
18
21
|
electron-cli inspect --json
|
|
19
22
|
electron-cli doctor --json
|
|
20
23
|
electron-cli plan --json
|
|
21
24
|
electron-cli init my-app --dry-run --json
|
|
25
|
+
electron-cli start --dry-run --json
|
|
26
|
+
electron-cli package --dry-run --json
|
|
27
|
+
electron-cli make --dry-run --json
|
|
22
28
|
```
|
|
23
29
|
|
|
24
30
|
Planned commands:
|
|
25
31
|
|
|
26
32
|
```sh
|
|
27
|
-
electron-cli
|
|
28
|
-
electron-cli dev
|
|
29
|
-
electron-cli make
|
|
33
|
+
electron-cli publish
|
|
30
34
|
```
|
|
31
35
|
|
|
32
|
-
The
|
|
36
|
+
The default `init` template is `minimal`, a built-in starter written by this project. Non-native template names are still passed to `create-electron-app` as an escape hatch while this project grows.
|
|
37
|
+
|
|
38
|
+
The Rust-native flow currently owns:
|
|
39
|
+
|
|
40
|
+
- `init --template minimal`: writes a local Electron starter without Electron Forge.
|
|
41
|
+
- `start`: launches the installed Electron runtime directly.
|
|
42
|
+
- `package`: copies the installed Electron runtime and app files into a local app bundle for the current platform and architecture. The first package pass supports apps without production `dependencies`; dependency pruning and bundled runtime dependencies are still TODO.
|
|
43
|
+
- `make`: runs `package` and writes a ZIP distributable under `out/make/zip/<platform>/<arch>/`.
|
|
44
|
+
|
|
45
|
+
`publish` is not implemented yet. It is the next piece of the Forge lifecycle to replace.
|
|
33
46
|
|
|
34
47
|
## Install
|
|
35
48
|
|
|
@@ -60,7 +73,10 @@ Or use Cargo directly:
|
|
|
60
73
|
```sh
|
|
61
74
|
cargo run -- doctor
|
|
62
75
|
cargo run -- inspect --json
|
|
63
|
-
cargo run -- init my-app
|
|
76
|
+
cargo run -- init my-app
|
|
77
|
+
cargo run -- start --dry-run
|
|
78
|
+
cargo run -- package --dry-run
|
|
79
|
+
cargo run -- make --dry-run
|
|
64
80
|
```
|
|
65
81
|
|
|
66
82
|
## Design Goals
|
|
@@ -68,7 +84,7 @@ cargo run -- init my-app --dry-run
|
|
|
68
84
|
- Learn Rust through a real developer tool.
|
|
69
85
|
- Make Electron project state easy to inspect.
|
|
70
86
|
- Prefer structured output for agentic workflows.
|
|
71
|
-
-
|
|
87
|
+
- Replace the main Forge-style app flow with narrow Rust-owned pieces.
|
|
72
88
|
- Keep the project clearly independent and experimental.
|
|
73
89
|
|
|
74
90
|
## Non-Goals
|
|
@@ -81,7 +97,10 @@ cargo run -- init my-app --dry-run
|
|
|
81
97
|
|
|
82
98
|
The inspection and planning commands support `--json` so agents and scripts can consume project state without scraping terminal output.
|
|
83
99
|
`plan` is designed around that workflow: it recommends stable commands and reports missing project conventions as structured data.
|
|
84
|
-
`init --dry-run --json` shows the
|
|
100
|
+
`init --dry-run --json` shows whether the CLI will write native template files or delegate to `create-electron-app`.
|
|
101
|
+
`start --dry-run --json` shows the Electron executable that will be launched.
|
|
102
|
+
`package --dry-run --json` shows the runtime and app file copy plan.
|
|
103
|
+
`make --dry-run --json` shows the package prerequisite and ZIP artifact path.
|
|
85
104
|
|
|
86
105
|
```sh
|
|
87
106
|
electron-cli plan --json
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "electron-cli",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.4",
|
|
4
4
|
"description": "Experimental Rust CLI for Electron project diagnostics and workflow automation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"bin/electron-cli.js",
|
|
19
19
|
"scripts",
|
|
20
20
|
"src",
|
|
21
|
+
"templates",
|
|
21
22
|
"tests",
|
|
22
23
|
"Cargo.toml",
|
|
23
24
|
"Cargo.lock",
|
package/src/cli.rs
CHANGED
|
@@ -18,12 +18,18 @@ pub struct Cli {
|
|
|
18
18
|
pub enum Commands {
|
|
19
19
|
/// Check whether the current project looks ready for Electron development.
|
|
20
20
|
Doctor(CommandArgs),
|
|
21
|
-
/// Bootstrap a new Electron app
|
|
21
|
+
/// Bootstrap a new Electron app.
|
|
22
22
|
Init(InitArgs),
|
|
23
23
|
/// Print a structured snapshot of the current JavaScript/Electron project.
|
|
24
24
|
Inspect(CommandArgs),
|
|
25
|
+
/// Create distributable artifacts from a packaged Electron app.
|
|
26
|
+
Make(MakeArgs),
|
|
27
|
+
/// Create a local Electron application bundle without Electron Forge.
|
|
28
|
+
Package(PackageArgs),
|
|
25
29
|
/// Recommend next commands and risks from the project snapshot.
|
|
26
30
|
Plan(CommandArgs),
|
|
31
|
+
/// Launch the current Electron app without Electron Forge.
|
|
32
|
+
Start(StartArgs),
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
#[derive(Debug, Clone, Args)]
|
|
@@ -47,8 +53,8 @@ pub struct InitArgs {
|
|
|
47
53
|
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
48
54
|
pub cwd: PathBuf,
|
|
49
55
|
|
|
50
|
-
///
|
|
51
|
-
#[arg(long, short = 't', default_value = "
|
|
56
|
+
/// Template to use. "minimal" is native; other names are passed to create-electron-app.
|
|
57
|
+
#[arg(long, short = 't', default_value = "minimal")]
|
|
52
58
|
pub template: String,
|
|
53
59
|
|
|
54
60
|
/// Package manager command strategy to use.
|
|
@@ -80,6 +86,103 @@ pub struct InitArgs {
|
|
|
80
86
|
pub json: bool,
|
|
81
87
|
}
|
|
82
88
|
|
|
89
|
+
#[derive(Debug, Clone, Args)]
|
|
90
|
+
pub struct StartArgs {
|
|
91
|
+
/// Project directory to launch.
|
|
92
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
93
|
+
pub cwd: PathBuf,
|
|
94
|
+
|
|
95
|
+
/// Print the launch command without starting Electron.
|
|
96
|
+
#[arg(long)]
|
|
97
|
+
pub dry_run: bool,
|
|
98
|
+
|
|
99
|
+
/// Emit machine-readable JSON.
|
|
100
|
+
#[arg(long)]
|
|
101
|
+
pub json: bool,
|
|
102
|
+
|
|
103
|
+
/// Extra arguments passed to Electron after `--`.
|
|
104
|
+
#[arg(last = true, value_name = "ELECTRON_ARG")]
|
|
105
|
+
pub electron_args: Vec<String>,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
#[derive(Debug, Clone, Args)]
|
|
109
|
+
pub struct PackageArgs {
|
|
110
|
+
/// Project directory to package.
|
|
111
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
112
|
+
pub cwd: PathBuf,
|
|
113
|
+
|
|
114
|
+
/// Output directory for packaged app bundles.
|
|
115
|
+
#[arg(long, default_value = "out", value_name = "PATH")]
|
|
116
|
+
pub out_dir: PathBuf,
|
|
117
|
+
|
|
118
|
+
/// Override the packaged application name.
|
|
119
|
+
#[arg(long)]
|
|
120
|
+
pub name: Option<String>,
|
|
121
|
+
|
|
122
|
+
/// Target platform label. Defaults to the current platform.
|
|
123
|
+
#[arg(long)]
|
|
124
|
+
pub platform: Option<String>,
|
|
125
|
+
|
|
126
|
+
/// Target architecture label. Defaults to the current architecture.
|
|
127
|
+
#[arg(long)]
|
|
128
|
+
pub arch: Option<String>,
|
|
129
|
+
|
|
130
|
+
/// Overwrite an existing package output directory.
|
|
131
|
+
#[arg(long)]
|
|
132
|
+
pub force: bool,
|
|
133
|
+
|
|
134
|
+
/// Print the package plan without creating files.
|
|
135
|
+
#[arg(long)]
|
|
136
|
+
pub dry_run: bool,
|
|
137
|
+
|
|
138
|
+
/// Emit machine-readable JSON.
|
|
139
|
+
#[arg(long)]
|
|
140
|
+
pub json: bool,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
#[derive(Debug, Clone, Args)]
|
|
144
|
+
pub struct MakeArgs {
|
|
145
|
+
/// Project directory to make distributables for.
|
|
146
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
147
|
+
pub cwd: PathBuf,
|
|
148
|
+
|
|
149
|
+
/// Output directory used for package and make artifacts.
|
|
150
|
+
#[arg(long, default_value = "out", value_name = "PATH")]
|
|
151
|
+
pub out_dir: PathBuf,
|
|
152
|
+
|
|
153
|
+
/// Override the application name.
|
|
154
|
+
#[arg(long)]
|
|
155
|
+
pub name: Option<String>,
|
|
156
|
+
|
|
157
|
+
/// Target platform label. Defaults to the current platform.
|
|
158
|
+
#[arg(long)]
|
|
159
|
+
pub platform: Option<String>,
|
|
160
|
+
|
|
161
|
+
/// Target architecture label. Defaults to the current architecture.
|
|
162
|
+
#[arg(long)]
|
|
163
|
+
pub arch: Option<String>,
|
|
164
|
+
|
|
165
|
+
/// Maker target to run.
|
|
166
|
+
#[arg(long, value_enum, default_value_t = MakeTarget::Zip)]
|
|
167
|
+
pub target: MakeTarget,
|
|
168
|
+
|
|
169
|
+
/// Reuse an existing package output instead of running package first.
|
|
170
|
+
#[arg(long)]
|
|
171
|
+
pub skip_package: bool,
|
|
172
|
+
|
|
173
|
+
/// Overwrite existing package and make artifacts.
|
|
174
|
+
#[arg(long)]
|
|
175
|
+
pub force: bool,
|
|
176
|
+
|
|
177
|
+
/// Print the make plan without creating files.
|
|
178
|
+
#[arg(long)]
|
|
179
|
+
pub dry_run: bool,
|
|
180
|
+
|
|
181
|
+
/// Emit machine-readable JSON.
|
|
182
|
+
#[arg(long)]
|
|
183
|
+
pub json: bool,
|
|
184
|
+
}
|
|
185
|
+
|
|
83
186
|
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
84
187
|
#[value(rename_all = "lower")]
|
|
85
188
|
pub enum PackageManager {
|
|
@@ -99,3 +202,17 @@ impl PackageManager {
|
|
|
99
202
|
}
|
|
100
203
|
}
|
|
101
204
|
}
|
|
205
|
+
|
|
206
|
+
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
207
|
+
#[value(rename_all = "lower")]
|
|
208
|
+
pub enum MakeTarget {
|
|
209
|
+
Zip,
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
impl MakeTarget {
|
|
213
|
+
pub fn as_str(self) -> &'static str {
|
|
214
|
+
match self {
|
|
215
|
+
MakeTarget::Zip => "zip",
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|