electron-cli 0.3.0-alpha.3 → 0.3.0-alpha.5
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 +12 -3
- package/package.json +1 -1
- package/src/cli.rs +130 -0
- package/src/commands/make.rs +449 -0
- package/src/commands/mod.rs +2 -0
- package/src/commands/package.rs +41 -3
- package/src/commands/plan.rs +21 -2
- package/src/commands/publish.rs +432 -0
- package/src/main.rs +2 -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.5"
|
|
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.5"
|
|
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
|
@@ -17,19 +17,22 @@ electron-cli plan
|
|
|
17
17
|
electron-cli init my-app
|
|
18
18
|
electron-cli start
|
|
19
19
|
electron-cli package
|
|
20
|
+
electron-cli make
|
|
21
|
+
electron-cli publish
|
|
20
22
|
electron-cli inspect --json
|
|
21
23
|
electron-cli doctor --json
|
|
22
24
|
electron-cli plan --json
|
|
23
25
|
electron-cli init my-app --dry-run --json
|
|
24
26
|
electron-cli start --dry-run --json
|
|
25
27
|
electron-cli package --dry-run --json
|
|
28
|
+
electron-cli make --dry-run --json
|
|
29
|
+
electron-cli publish --dry-run --json
|
|
26
30
|
```
|
|
27
31
|
|
|
28
32
|
Planned commands:
|
|
29
33
|
|
|
30
34
|
```sh
|
|
31
|
-
electron-cli
|
|
32
|
-
electron-cli publish
|
|
35
|
+
electron-cli publish --publisher github
|
|
33
36
|
```
|
|
34
37
|
|
|
35
38
|
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.
|
|
@@ -39,8 +42,10 @@ The Rust-native flow currently owns:
|
|
|
39
42
|
- `init --template minimal`: writes a local Electron starter without Electron Forge.
|
|
40
43
|
- `start`: launches the installed Electron runtime directly.
|
|
41
44
|
- `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.
|
|
45
|
+
- `make`: runs `package` and writes a ZIP distributable under `out/make/zip/<platform>/<arch>/`.
|
|
46
|
+
- `publish`: runs `make` and publishes the distributable to a local directory with a manifest.
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
Remote publishers such as GitHub Releases are not implemented yet. They are the next publisher targets to replace.
|
|
44
49
|
|
|
45
50
|
## Install
|
|
46
51
|
|
|
@@ -74,6 +79,8 @@ cargo run -- inspect --json
|
|
|
74
79
|
cargo run -- init my-app
|
|
75
80
|
cargo run -- start --dry-run
|
|
76
81
|
cargo run -- package --dry-run
|
|
82
|
+
cargo run -- make --dry-run
|
|
83
|
+
cargo run -- publish --dry-run
|
|
77
84
|
```
|
|
78
85
|
|
|
79
86
|
## Design Goals
|
|
@@ -97,6 +104,8 @@ The inspection and planning commands support `--json` so agents and scripts can
|
|
|
97
104
|
`init --dry-run --json` shows whether the CLI will write native template files or delegate to `create-electron-app`.
|
|
98
105
|
`start --dry-run --json` shows the Electron executable that will be launched.
|
|
99
106
|
`package --dry-run --json` shows the runtime and app file copy plan.
|
|
107
|
+
`make --dry-run --json` shows the package prerequisite and ZIP artifact path.
|
|
108
|
+
`publish --dry-run --json` shows the make prerequisite, destination artifact, and manifest path.
|
|
100
109
|
|
|
101
110
|
```sh
|
|
102
111
|
electron-cli plan --json
|
package/package.json
CHANGED
package/src/cli.rs
CHANGED
|
@@ -22,10 +22,14 @@ pub enum Commands {
|
|
|
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),
|
|
25
27
|
/// Create a local Electron application bundle without Electron Forge.
|
|
26
28
|
Package(PackageArgs),
|
|
27
29
|
/// Recommend next commands and risks from the project snapshot.
|
|
28
30
|
Plan(CommandArgs),
|
|
31
|
+
/// Publish made artifacts to a distribution target.
|
|
32
|
+
Publish(PublishArgs),
|
|
29
33
|
/// Launch the current Electron app without Electron Forge.
|
|
30
34
|
Start(StartArgs),
|
|
31
35
|
}
|
|
@@ -138,6 +142,104 @@ pub struct PackageArgs {
|
|
|
138
142
|
pub json: bool,
|
|
139
143
|
}
|
|
140
144
|
|
|
145
|
+
#[derive(Debug, Clone, Args)]
|
|
146
|
+
pub struct MakeArgs {
|
|
147
|
+
/// Project directory to make distributables for.
|
|
148
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
149
|
+
pub cwd: PathBuf,
|
|
150
|
+
|
|
151
|
+
/// Output directory used for package and make artifacts.
|
|
152
|
+
#[arg(long, default_value = "out", value_name = "PATH")]
|
|
153
|
+
pub out_dir: PathBuf,
|
|
154
|
+
|
|
155
|
+
/// Override the application name.
|
|
156
|
+
#[arg(long)]
|
|
157
|
+
pub name: Option<String>,
|
|
158
|
+
|
|
159
|
+
/// Target platform label. Defaults to the current platform.
|
|
160
|
+
#[arg(long)]
|
|
161
|
+
pub platform: Option<String>,
|
|
162
|
+
|
|
163
|
+
/// Target architecture label. Defaults to the current architecture.
|
|
164
|
+
#[arg(long)]
|
|
165
|
+
pub arch: Option<String>,
|
|
166
|
+
|
|
167
|
+
/// Maker target to run.
|
|
168
|
+
#[arg(long, value_enum, default_value_t = MakeTarget::Zip)]
|
|
169
|
+
pub target: MakeTarget,
|
|
170
|
+
|
|
171
|
+
/// Reuse an existing package output instead of running package first.
|
|
172
|
+
#[arg(long)]
|
|
173
|
+
pub skip_package: bool,
|
|
174
|
+
|
|
175
|
+
/// Overwrite existing package and make artifacts.
|
|
176
|
+
#[arg(long)]
|
|
177
|
+
pub force: bool,
|
|
178
|
+
|
|
179
|
+
/// Print the make plan without creating files.
|
|
180
|
+
#[arg(long)]
|
|
181
|
+
pub dry_run: bool,
|
|
182
|
+
|
|
183
|
+
/// Emit machine-readable JSON.
|
|
184
|
+
#[arg(long)]
|
|
185
|
+
pub json: bool,
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
#[derive(Debug, Clone, Args)]
|
|
189
|
+
pub struct PublishArgs {
|
|
190
|
+
/// Project directory to publish from.
|
|
191
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
192
|
+
pub cwd: PathBuf,
|
|
193
|
+
|
|
194
|
+
/// Output directory used for package, make, and publish artifacts.
|
|
195
|
+
#[arg(long, default_value = "out", value_name = "PATH")]
|
|
196
|
+
pub out_dir: PathBuf,
|
|
197
|
+
|
|
198
|
+
/// Override the application name.
|
|
199
|
+
#[arg(long)]
|
|
200
|
+
pub name: Option<String>,
|
|
201
|
+
|
|
202
|
+
/// Target platform label. Defaults to the current platform.
|
|
203
|
+
#[arg(long)]
|
|
204
|
+
pub platform: Option<String>,
|
|
205
|
+
|
|
206
|
+
/// Target architecture label. Defaults to the current architecture.
|
|
207
|
+
#[arg(long)]
|
|
208
|
+
pub arch: Option<String>,
|
|
209
|
+
|
|
210
|
+
/// Maker target whose artifact should be published.
|
|
211
|
+
#[arg(long, value_enum, default_value_t = MakeTarget::Zip)]
|
|
212
|
+
pub target: MakeTarget,
|
|
213
|
+
|
|
214
|
+
/// Publisher target to use.
|
|
215
|
+
#[arg(long, value_enum, default_value_t = PublishTarget::Local)]
|
|
216
|
+
pub publisher: PublishTarget,
|
|
217
|
+
|
|
218
|
+
/// Destination for local published artifacts.
|
|
219
|
+
#[arg(long, default_value = "out/publish/local", value_name = "PATH")]
|
|
220
|
+
pub to: PathBuf,
|
|
221
|
+
|
|
222
|
+
/// Release channel label written into the publish manifest.
|
|
223
|
+
#[arg(long, default_value = "default")]
|
|
224
|
+
pub channel: String,
|
|
225
|
+
|
|
226
|
+
/// Reuse an existing make artifact instead of running package and make first.
|
|
227
|
+
#[arg(long)]
|
|
228
|
+
pub skip_make: bool,
|
|
229
|
+
|
|
230
|
+
/// Overwrite existing publish artifacts.
|
|
231
|
+
#[arg(long)]
|
|
232
|
+
pub force: bool,
|
|
233
|
+
|
|
234
|
+
/// Print the publish plan without creating files.
|
|
235
|
+
#[arg(long)]
|
|
236
|
+
pub dry_run: bool,
|
|
237
|
+
|
|
238
|
+
/// Emit machine-readable JSON.
|
|
239
|
+
#[arg(long)]
|
|
240
|
+
pub json: bool,
|
|
241
|
+
}
|
|
242
|
+
|
|
141
243
|
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
142
244
|
#[value(rename_all = "lower")]
|
|
143
245
|
pub enum PackageManager {
|
|
@@ -157,3 +259,31 @@ impl PackageManager {
|
|
|
157
259
|
}
|
|
158
260
|
}
|
|
159
261
|
}
|
|
262
|
+
|
|
263
|
+
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
264
|
+
#[value(rename_all = "lower")]
|
|
265
|
+
pub enum MakeTarget {
|
|
266
|
+
Zip,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
impl MakeTarget {
|
|
270
|
+
pub fn as_str(self) -> &'static str {
|
|
271
|
+
match self {
|
|
272
|
+
MakeTarget::Zip => "zip",
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
278
|
+
#[value(rename_all = "lower")]
|
|
279
|
+
pub enum PublishTarget {
|
|
280
|
+
Local,
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
impl PublishTarget {
|
|
284
|
+
pub fn as_str(self) -> &'static str {
|
|
285
|
+
match self {
|
|
286
|
+
PublishTarget::Local => "local",
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|