electron-cli 0.3.0-alpha.6 → 0.3.0-alpha.8

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 CHANGED
@@ -64,6 +64,18 @@ version = "1.0.102"
64
64
  source = "registry+https://github.com/rust-lang/crates.io-index"
65
65
  checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
66
66
 
67
+ [[package]]
68
+ name = "base64"
69
+ version = "0.22.1"
70
+ source = "registry+https://github.com/rust-lang/crates.io-index"
71
+ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
72
+
73
+ [[package]]
74
+ name = "bitflags"
75
+ version = "2.11.1"
76
+ source = "registry+https://github.com/rust-lang/crates.io-index"
77
+ checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
78
+
67
79
  [[package]]
68
80
  name = "camino"
69
81
  version = "1.2.2"
@@ -134,15 +146,27 @@ dependencies = [
134
146
  "cfg-if",
135
147
  ]
136
148
 
149
+ [[package]]
150
+ name = "deranged"
151
+ version = "0.5.8"
152
+ source = "registry+https://github.com/rust-lang/crates.io-index"
153
+ checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c"
154
+ dependencies = [
155
+ "powerfmt",
156
+ ]
157
+
137
158
  [[package]]
138
159
  name = "electron-cli"
139
- version = "0.3.0-alpha.6"
160
+ version = "0.3.0-alpha.8"
140
161
  dependencies = [
141
162
  "anyhow",
142
163
  "camino",
143
164
  "clap",
165
+ "flate2",
166
+ "plist",
144
167
  "serde",
145
168
  "serde_json",
169
+ "tar",
146
170
  "zip",
147
171
  ]
148
172
 
@@ -152,12 +176,33 @@ version = "1.0.2"
152
176
  source = "registry+https://github.com/rust-lang/crates.io-index"
153
177
  checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"
154
178
 
179
+ [[package]]
180
+ name = "errno"
181
+ version = "0.3.14"
182
+ source = "registry+https://github.com/rust-lang/crates.io-index"
183
+ checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
184
+ dependencies = [
185
+ "libc",
186
+ "windows-sys",
187
+ ]
188
+
189
+ [[package]]
190
+ name = "filetime"
191
+ version = "0.2.29"
192
+ source = "registry+https://github.com/rust-lang/crates.io-index"
193
+ checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"
194
+ dependencies = [
195
+ "cfg-if",
196
+ "libc",
197
+ ]
198
+
155
199
  [[package]]
156
200
  name = "flate2"
157
201
  version = "1.1.9"
158
202
  source = "registry+https://github.com/rust-lang/crates.io-index"
159
203
  checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
160
204
  dependencies = [
205
+ "crc32fast",
161
206
  "miniz_oxide",
162
207
  "zlib-rs",
163
208
  ]
@@ -196,6 +241,18 @@ version = "1.0.18"
196
241
  source = "registry+https://github.com/rust-lang/crates.io-index"
197
242
  checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
198
243
 
244
+ [[package]]
245
+ name = "libc"
246
+ version = "0.2.186"
247
+ source = "registry+https://github.com/rust-lang/crates.io-index"
248
+ checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
249
+
250
+ [[package]]
251
+ name = "linux-raw-sys"
252
+ version = "0.12.1"
253
+ source = "registry+https://github.com/rust-lang/crates.io-index"
254
+ checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53"
255
+
199
256
  [[package]]
200
257
  name = "memchr"
201
258
  version = "2.8.1"
@@ -212,12 +269,37 @@ dependencies = [
212
269
  "simd-adler32",
213
270
  ]
214
271
 
272
+ [[package]]
273
+ name = "num-conv"
274
+ version = "0.2.2"
275
+ source = "registry+https://github.com/rust-lang/crates.io-index"
276
+ checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441"
277
+
215
278
  [[package]]
216
279
  name = "once_cell_polyfill"
217
280
  version = "1.70.2"
218
281
  source = "registry+https://github.com/rust-lang/crates.io-index"
219
282
  checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe"
220
283
 
284
+ [[package]]
285
+ name = "plist"
286
+ version = "1.9.0"
287
+ source = "registry+https://github.com/rust-lang/crates.io-index"
288
+ checksum = "092791278e026273c1b65bbdcfbba3a300f2994c896bd01ab01da613c29c46f1"
289
+ dependencies = [
290
+ "base64",
291
+ "indexmap",
292
+ "quick-xml",
293
+ "serde",
294
+ "time",
295
+ ]
296
+
297
+ [[package]]
298
+ name = "powerfmt"
299
+ version = "0.2.0"
300
+ source = "registry+https://github.com/rust-lang/crates.io-index"
301
+ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
302
+
221
303
  [[package]]
222
304
  name = "proc-macro2"
223
305
  version = "1.0.106"
@@ -227,6 +309,15 @@ dependencies = [
227
309
  "unicode-ident",
228
310
  ]
229
311
 
312
+ [[package]]
313
+ name = "quick-xml"
314
+ version = "0.39.4"
315
+ source = "registry+https://github.com/rust-lang/crates.io-index"
316
+ checksum = "cdcc8dd4e2f670d309a5f0e83fe36dfdc05af317008fea29144da1a2ac858e5e"
317
+ dependencies = [
318
+ "memchr",
319
+ ]
320
+
230
321
  [[package]]
231
322
  name = "quote"
232
323
  version = "1.0.45"
@@ -236,6 +327,19 @@ dependencies = [
236
327
  "proc-macro2",
237
328
  ]
238
329
 
330
+ [[package]]
331
+ name = "rustix"
332
+ version = "1.1.4"
333
+ source = "registry+https://github.com/rust-lang/crates.io-index"
334
+ checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190"
335
+ dependencies = [
336
+ "bitflags",
337
+ "errno",
338
+ "libc",
339
+ "linux-raw-sys",
340
+ "windows-sys",
341
+ ]
342
+
239
343
  [[package]]
240
344
  name = "serde"
241
345
  version = "1.0.228"
@@ -302,6 +406,48 @@ dependencies = [
302
406
  "unicode-ident",
303
407
  ]
304
408
 
409
+ [[package]]
410
+ name = "tar"
411
+ version = "0.4.46"
412
+ source = "registry+https://github.com/rust-lang/crates.io-index"
413
+ checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"
414
+ dependencies = [
415
+ "filetime",
416
+ "libc",
417
+ "xattr",
418
+ ]
419
+
420
+ [[package]]
421
+ name = "time"
422
+ version = "0.3.47"
423
+ source = "registry+https://github.com/rust-lang/crates.io-index"
424
+ checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"
425
+ dependencies = [
426
+ "deranged",
427
+ "itoa",
428
+ "num-conv",
429
+ "powerfmt",
430
+ "serde_core",
431
+ "time-core",
432
+ "time-macros",
433
+ ]
434
+
435
+ [[package]]
436
+ name = "time-core"
437
+ version = "0.1.8"
438
+ source = "registry+https://github.com/rust-lang/crates.io-index"
439
+ checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"
440
+
441
+ [[package]]
442
+ name = "time-macros"
443
+ version = "0.2.27"
444
+ source = "registry+https://github.com/rust-lang/crates.io-index"
445
+ checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215"
446
+ dependencies = [
447
+ "num-conv",
448
+ "time-core",
449
+ ]
450
+
305
451
  [[package]]
306
452
  name = "typed-path"
307
453
  version = "0.12.3"
@@ -335,6 +481,16 @@ dependencies = [
335
481
  "windows-link",
336
482
  ]
337
483
 
484
+ [[package]]
485
+ name = "xattr"
486
+ version = "1.6.1"
487
+ source = "registry+https://github.com/rust-lang/crates.io-index"
488
+ checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
489
+ dependencies = [
490
+ "libc",
491
+ "rustix",
492
+ ]
493
+
338
494
  [[package]]
339
495
  name = "zip"
340
496
  version = "8.6.0"
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "electron-cli"
3
- version = "0.3.0-alpha.6"
3
+ version = "0.3.0-alpha.8"
4
4
  edition = "2021"
5
5
  description = "Experimental Rust CLI for Electron project diagnostics and workflow automation"
6
6
  license = "MIT"
@@ -10,6 +10,9 @@ repository = "https://github.com/Ikana/electron-cli"
10
10
  anyhow = "1.0"
11
11
  camino = { version = "1.1", features = ["serde1"] }
12
12
  clap = { version = "4.6", features = ["derive"] }
13
+ flate2 = { version = "1.1", default-features = false, features = ["rust_backend"] }
14
+ plist = "1"
13
15
  serde = { version = "1.0", features = ["derive"] }
14
16
  serde_json = "1.0"
17
+ tar = "0.4"
15
18
  zip = { version = "8.6.0", default-features = false, features = ["deflate-flate2-zlib-rs"] }
package/README.md CHANGED
@@ -41,11 +41,29 @@ The Rust-native flow currently owns:
41
41
 
42
42
  - `init --template minimal`: writes a local Electron starter without Electron Forge.
43
43
  - `start`: launches the installed Electron runtime directly.
44
- - `package`: copies the installed Electron runtime, app files, and installed production dependency closure into a local app bundle for the current platform and architecture.
45
- - `make`: runs `package` and writes a ZIP distributable under `out/make/zip/<platform>/<arch>/`.
44
+ - `package`: copies the installed Electron runtime, app files, installed production dependency closure, app metadata, macOS icon, and extra resources into a local app bundle for the current platform and architecture.
45
+ - `make`: runs `package` and writes a distributable under `out/make/<target>/<platform>/<arch>/`; ZIP works on all platforms, and `--target deb` writes a Linux Debian package.
46
46
  - `publish`: runs `make` and publishes the distributable to a local directory with a manifest.
47
47
 
48
- Remote publishers such as GitHub Releases are not implemented yet. Platform-specific makers, app metadata, signing, and notarization are also still TODO.
48
+ Remote publishers such as GitHub Releases are not implemented yet. DMG, RPM, Windows installers, Windows/Linux icon embedding, signing, and notarization are also still TODO.
49
+
50
+ Package metadata can be configured in `package.json`:
51
+
52
+ ```json
53
+ {
54
+ "productName": "My App",
55
+ "electronCli": {
56
+ "packagerConfig": {
57
+ "appBundleId": "com.example.my-app",
58
+ "appCategoryType": "public.app-category.developer-tools",
59
+ "icon": "assets/icon",
60
+ "extraResource": "assets/config.json"
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ The package command also reads JSON-shaped `config.forge.packagerConfig` and `electronPackagerConfig` entries for the same fields. JavaScript Forge config files are not evaluated.
49
67
 
50
68
  ## Install
51
69
 
@@ -80,6 +98,7 @@ cargo run -- init my-app
80
98
  cargo run -- start --dry-run
81
99
  cargo run -- package --dry-run
82
100
  cargo run -- make --dry-run
101
+ cargo run -- make --target deb --dry-run
83
102
  cargo run -- publish --dry-run
84
103
  ```
85
104
 
@@ -103,8 +122,8 @@ The inspection and planning commands support `--json` so agents and scripts can
103
122
  `plan` is designed around that workflow: it recommends stable commands and reports missing project conventions as structured data.
104
123
  `init --dry-run --json` shows whether the CLI will write native template files or delegate to `create-electron-app`.
105
124
  `start --dry-run --json` shows the Electron executable that will be launched.
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.
125
+ `package --dry-run --json` shows the runtime, app file, metadata, icon, and extra-resource copy plan.
126
+ `make --dry-run --json` shows the package prerequisite and selected maker artifact path.
108
127
  `publish --dry-run --json` shows the make prerequisite, destination artifact, and manifest path.
109
128
 
110
129
  ```sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "electron-cli",
3
- "version": "0.3.0-alpha.6",
3
+ "version": "0.3.0-alpha.8",
4
4
  "description": "Experimental Rust CLI for Electron project diagnostics and workflow automation",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/cli.rs CHANGED
@@ -240,7 +240,7 @@ pub struct PublishArgs {
240
240
  pub json: bool,
241
241
  }
242
242
 
243
- #[derive(Debug, Clone, Copy, ValueEnum)]
243
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
244
244
  #[value(rename_all = "lower")]
245
245
  pub enum PackageManager {
246
246
  Npm,
@@ -260,15 +260,17 @@ impl PackageManager {
260
260
  }
261
261
  }
262
262
 
263
- #[derive(Debug, Clone, Copy, ValueEnum)]
263
+ #[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
264
264
  #[value(rename_all = "lower")]
265
265
  pub enum MakeTarget {
266
+ Deb,
266
267
  Zip,
267
268
  }
268
269
 
269
270
  impl MakeTarget {
270
271
  pub fn as_str(self) -> &'static str {
271
272
  match self {
273
+ MakeTarget::Deb => "deb",
272
274
  MakeTarget::Zip => "zip",
273
275
  }
274
276
  }
@@ -447,8 +447,11 @@ fn write_template_file(target: &Path, relative_path: &str, contents: &str) -> Re
447
447
  }
448
448
 
449
449
  fn package_json(package_name: &str, electron_version: &str) -> Result<String> {
450
+ let product_name = product_name(package_name);
451
+ let app_bundle_id = format!("com.electron.{package_name}");
450
452
  let package = serde_json::json!({
451
453
  "name": package_name,
454
+ "productName": product_name,
452
455
  "version": "0.1.0",
453
456
  "private": true,
454
457
  "description": "Minimal Electron app generated by electron-cli",
@@ -459,6 +462,11 @@ fn package_json(package_name: &str, electron_version: &str) -> Result<String> {
459
462
  },
460
463
  "devDependencies": {
461
464
  "electron": electron_version
465
+ },
466
+ "electronCli": {
467
+ "packagerConfig": {
468
+ "appBundleId": app_bundle_id
469
+ }
462
470
  }
463
471
  });
464
472
 
@@ -639,6 +647,25 @@ fn sanitize_package_name(raw_name: &str) -> String {
639
647
  }
640
648
  }
641
649
 
650
+ fn product_name(package_name: &str) -> String {
651
+ package_name
652
+ .split(['-', '_', '.'])
653
+ .filter(|part| !part.is_empty())
654
+ .map(|part| {
655
+ let mut chars = part.chars();
656
+ match chars.next() {
657
+ Some(first) => {
658
+ let mut word = first.to_uppercase().collect::<String>();
659
+ word.push_str(chars.as_str());
660
+ word
661
+ }
662
+ None => String::new(),
663
+ }
664
+ })
665
+ .collect::<Vec<_>>()
666
+ .join(" ")
667
+ }
668
+
642
669
  fn utf8_path(path: PathBuf) -> Result<Utf8PathBuf> {
643
670
  Utf8PathBuf::from_path_buf(path).map_err(|path| {
644
671
  anyhow::anyhow!(
@@ -756,7 +783,9 @@ mod tests {
756
783
  assert!(target.join("src/renderer.js").exists());
757
784
  assert!(target.join(".github/workflows/ci.yml").exists());
758
785
  assert!(package_json.contains("\"name\": \"native-app\""));
786
+ assert!(package_json.contains("\"productName\": \"Native App\""));
759
787
  assert!(package_json.contains("\"electron\": \"30.0.0\""));
788
+ assert!(package_json.contains("\"appBundleId\": \"com.electron.native-app\""));
760
789
  assert!(config.contains("\"generator\": \"electron-cli\""));
761
790
 
762
791
  let _ = fs::remove_dir_all(cwd);
@@ -767,6 +796,7 @@ mod tests {
767
796
  assert_eq!(sanitize_package_name("Native App"), "native-app");
768
797
  assert_eq!(sanitize_package_name("..."), "electron-app");
769
798
  assert_eq!(sanitize_package_name("@Scope/App"), "scope-app");
799
+ assert_eq!(product_name("native-app"), "Native App");
770
800
  }
771
801
 
772
802
  fn unique_temp_dir() -> PathBuf {