electron-cli 0.3.0-alpha.14 → 0.3.0-alpha.16
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 +18 -1
- package/Cargo.toml +2 -1
- package/README.md +18 -6
- package/package.json +1 -1
- package/src/commands/make.rs +44 -15
- package/src/commands/package.rs +533 -21
- package/src/commands/publish.rs +45 -14
- package/src/forge_config.rs +547 -0
- package/src/main.rs +1 -0
package/Cargo.lock
CHANGED
|
@@ -376,7 +376,7 @@ checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
|
|
376
376
|
|
|
377
377
|
[[package]]
|
|
378
378
|
name = "electron-cli"
|
|
379
|
-
version = "0.3.0-alpha.
|
|
379
|
+
version = "0.3.0-alpha.16"
|
|
380
380
|
dependencies = [
|
|
381
381
|
"anyhow",
|
|
382
382
|
"apple-dmg",
|
|
@@ -386,6 +386,7 @@ dependencies = [
|
|
|
386
386
|
"fatfs",
|
|
387
387
|
"flate2",
|
|
388
388
|
"fscommon",
|
|
389
|
+
"json5",
|
|
389
390
|
"md5",
|
|
390
391
|
"msi",
|
|
391
392
|
"plist",
|
|
@@ -805,6 +806,16 @@ dependencies = [
|
|
|
805
806
|
"wasm-bindgen",
|
|
806
807
|
]
|
|
807
808
|
|
|
809
|
+
[[package]]
|
|
810
|
+
name = "json5"
|
|
811
|
+
version = "1.3.1"
|
|
812
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
813
|
+
checksum = "733a844dbd6fef128e98cb4487b887cb55454d92cd9994b1bafe004fabbe670c"
|
|
814
|
+
dependencies = [
|
|
815
|
+
"serde",
|
|
816
|
+
"ucd-trie",
|
|
817
|
+
]
|
|
818
|
+
|
|
808
819
|
[[package]]
|
|
809
820
|
name = "keccak"
|
|
810
821
|
version = "0.1.6"
|
|
@@ -1448,6 +1459,12 @@ version = "1.20.1"
|
|
|
1448
1459
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1449
1460
|
checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20"
|
|
1450
1461
|
|
|
1462
|
+
[[package]]
|
|
1463
|
+
name = "ucd-trie"
|
|
1464
|
+
version = "0.1.7"
|
|
1465
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1466
|
+
checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
|
|
1467
|
+
|
|
1451
1468
|
[[package]]
|
|
1452
1469
|
name = "unicode-ident"
|
|
1453
1470
|
version = "1.0.24"
|
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.16"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
description = "Experimental Rust CLI for Electron project diagnostics and workflow automation"
|
|
6
6
|
license = "MIT"
|
|
@@ -15,6 +15,7 @@ clap = { version = "4.6", features = ["derive"] }
|
|
|
15
15
|
fatfs = "0.3"
|
|
16
16
|
flate2 = { version = "1.1", default-features = false, features = ["rust_backend"] }
|
|
17
17
|
fscommon = "0.1"
|
|
18
|
+
json5 = "1"
|
|
18
19
|
md5 = "0.7"
|
|
19
20
|
msi = "0.10"
|
|
20
21
|
plist = "1"
|
package/README.md
CHANGED
|
@@ -35,13 +35,15 @@ The Rust-native flow currently owns:
|
|
|
35
35
|
|
|
36
36
|
- `init --template minimal`: writes a local Electron starter without Electron Forge.
|
|
37
37
|
- `start`: launches the installed Electron runtime directly.
|
|
38
|
-
- `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.
|
|
39
|
-
- `make`: runs `package` and writes distributables under `out/make/<target>/<platform>/<arch>/`; it reads JSON-shaped `config.forge.makers` / `electronCli.makers` arrays when `--target` is omitted, and `--target` still forces one maker. ZIP works on all platforms, `--target dmg` writes a basic macOS disk image, `--target deb` / `--target rpm` write Linux packages, and `--target msi` writes a basic Windows Installer package.
|
|
40
|
-
- `publish`: runs `make` and publishes distributables to a local directory with a manifest or to GitHub Releases; it reads JSON-shaped `config.forge.publishers` / `electronCli.publishers` arrays when `--publisher` is omitted, and `--publisher` still forces one publisher.
|
|
38
|
+
- `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; it reads package metadata from `package.json`, JSON-shaped Forge config, and static Forge config files.
|
|
39
|
+
- `make`: runs `package` and writes distributables under `out/make/<target>/<platform>/<arch>/`; it reads JSON-shaped `config.forge.makers` / `electronCli.makers` arrays and static Forge config files when `--target` is omitted, and `--target` still forces one maker. ZIP works on all platforms, `--target dmg` writes a basic macOS disk image, `--target deb` / `--target rpm` write Linux packages, and `--target msi` writes a basic Windows Installer package.
|
|
40
|
+
- `publish`: runs `make` and publishes distributables to a local directory with a manifest or to GitHub Releases; it reads JSON-shaped `config.forge.publishers` / `electronCli.publishers` arrays and static Forge config files when `--publisher` is omitted, and `--publisher` still forces one publisher.
|
|
41
41
|
|
|
42
42
|
The GitHub publisher creates or reuses a release, uploads selected make artifacts, and can replace an existing asset with `--force`. It reads `GITHUB_TOKEN` or `GH_TOKEN` and can infer `OWNER/REPO` from package metadata, Forge GitHub publisher config, or `package.json` `repository`. You can also pass `--github-repo`.
|
|
43
43
|
|
|
44
|
-
The
|
|
44
|
+
The package command recognizes macOS `packagerConfig.osxSign` and `packagerConfig.osxNotarize` options and reports the signing/notarization plan without serializing credential values. Actual Rust-native signing and notarization execution is not implemented yet.
|
|
45
|
+
|
|
46
|
+
The DMG maker is currently a pure-Rust FAT32 image with the app bundle and an Applications entry. The MSI maker writes a compressed embedded CAB, Windows Installer database tables, and a Start Menu shortcut when the packaged executable is present. HFS+/APFS DMG layout customization, installer UI customization, Windows/Linux icon embedding, signing execution, and notarization execution are still TODO.
|
|
45
47
|
|
|
46
48
|
Package metadata can be configured in `package.json`:
|
|
47
49
|
|
|
@@ -53,7 +55,15 @@ Package metadata can be configured in `package.json`:
|
|
|
53
55
|
"appBundleId": "com.example.my-app",
|
|
54
56
|
"appCategoryType": "public.app-category.developer-tools",
|
|
55
57
|
"icon": "assets/icon",
|
|
56
|
-
"extraResource": "assets/config.json"
|
|
58
|
+
"extraResource": "assets/config.json",
|
|
59
|
+
"osxSign": {
|
|
60
|
+
"identity": "Developer ID Application: Example, Inc. (TEAMID1234)",
|
|
61
|
+
"entitlements": "assets/entitlements.plist",
|
|
62
|
+
"hardenedRuntime": true
|
|
63
|
+
},
|
|
64
|
+
"osxNotarize": {
|
|
65
|
+
"keychainProfile": "notary-profile"
|
|
66
|
+
}
|
|
57
67
|
},
|
|
58
68
|
"makers": [
|
|
59
69
|
{ "name": "@electron-forge/maker-zip" },
|
|
@@ -87,7 +97,9 @@ Package metadata can be configured in `package.json`:
|
|
|
87
97
|
}
|
|
88
98
|
```
|
|
89
99
|
|
|
90
|
-
The package command also reads JSON-shaped `config.forge.packagerConfig` and `electronPackagerConfig` entries for the same fields. The make command maps JSON-shaped Forge maker names to the Rust-native targets it supports: zip, dmg, deb, rpm, and wix/msi. The publish command maps JSON-shaped publisher names to local and GitHub.
|
|
100
|
+
The package command also reads JSON-shaped `config.forge.packagerConfig` and `electronPackagerConfig` entries for the same fields. The make command maps JSON-shaped Forge maker names to the Rust-native targets it supports: zip, dmg, deb, rpm, and wix/msi. The publish command maps JSON-shaped publisher names to local and GitHub.
|
|
101
|
+
|
|
102
|
+
Static `forge.config.js`, `forge.config.cjs`, `forge.config.mjs`, and `forge.config.ts` files are parsed in Rust when they export an object literal directly or via a local `const`/`let`/`var` identifier. Dynamic JavaScript config that calls functions, reads environment state, or computes the config at runtime is not evaluated.
|
|
91
103
|
|
|
92
104
|
## Install
|
|
93
105
|
|
package/package.json
CHANGED
package/src/commands/make.rs
CHANGED
|
@@ -228,24 +228,13 @@ fn resolve_make_targets(
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
fn configured_makers(snapshot: &ProjectSnapshot) -> Result<Vec<ConfiguredMaker>> {
|
|
231
|
-
let
|
|
232
|
-
return Ok(Vec::new());
|
|
233
|
-
};
|
|
234
|
-
let package_json_path = Path::new(package_json_path.as_str());
|
|
235
|
-
let raw = fs::read_to_string(package_json_path)
|
|
236
|
-
.with_context(|| format!("Could not read {}", package_json_path.display()))?;
|
|
237
|
-
let package = serde_json::from_str::<JsonValue>(&raw)
|
|
238
|
-
.with_context(|| format!("Could not parse {}", package_json_path.display()))?;
|
|
231
|
+
let project_config = crate::forge_config::read(snapshot)?;
|
|
239
232
|
|
|
240
233
|
let mut makers = Vec::new();
|
|
241
234
|
for value in [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
.
|
|
245
|
-
.and_then(|forge| forge.get("makers")),
|
|
246
|
-
package
|
|
247
|
-
.get("electronCli")
|
|
248
|
-
.or_else(|| package.get("electron-cli"))
|
|
235
|
+
project_config.forge().and_then(|forge| forge.get("makers")),
|
|
236
|
+
project_config
|
|
237
|
+
.electron_cli()
|
|
249
238
|
.and_then(|config| config.get("makers")),
|
|
250
239
|
]
|
|
251
240
|
.into_iter()
|
|
@@ -2421,6 +2410,46 @@ mod tests {
|
|
|
2421
2410
|
let _ = fs::remove_dir_all(root);
|
|
2422
2411
|
}
|
|
2423
2412
|
|
|
2413
|
+
#[test]
|
|
2414
|
+
fn builds_make_reports_from_static_forge_config_js() {
|
|
2415
|
+
let root = unique_temp_dir("configured-makers-js");
|
|
2416
|
+
write_package_json(&root);
|
|
2417
|
+
fs::write(
|
|
2418
|
+
root.join("forge.config.js"),
|
|
2419
|
+
r#"
|
|
2420
|
+
module.exports = {
|
|
2421
|
+
makers: [
|
|
2422
|
+
{ name: '@electron-forge/maker-zip' },
|
|
2423
|
+
{ name: '@electron-forge/maker-rpm', platforms: ['linux'] },
|
|
2424
|
+
],
|
|
2425
|
+
};
|
|
2426
|
+
"#,
|
|
2427
|
+
)
|
|
2428
|
+
.expect("forge config should be written");
|
|
2429
|
+
write_app_file(&root);
|
|
2430
|
+
write_fake_electron_dist(&root);
|
|
2431
|
+
|
|
2432
|
+
let args = MakeArgs {
|
|
2433
|
+
cwd: root.clone(),
|
|
2434
|
+
out_dir: PathBuf::from("out"),
|
|
2435
|
+
name: None,
|
|
2436
|
+
platform: Some("linux".to_string()),
|
|
2437
|
+
arch: Some("x64".to_string()),
|
|
2438
|
+
target: None,
|
|
2439
|
+
skip_package: false,
|
|
2440
|
+
force: false,
|
|
2441
|
+
dry_run: true,
|
|
2442
|
+
json: true,
|
|
2443
|
+
};
|
|
2444
|
+
let reports = build_reports(&args).expect("reports should build");
|
|
2445
|
+
|
|
2446
|
+
assert_eq!(reports.len(), 2);
|
|
2447
|
+
assert_eq!(reports[0].target(), "zip");
|
|
2448
|
+
assert_eq!(reports[1].target(), "rpm");
|
|
2449
|
+
|
|
2450
|
+
let _ = fs::remove_dir_all(root);
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2424
2453
|
#[test]
|
|
2425
2454
|
fn explicit_make_target_overrides_configured_makers() {
|
|
2426
2455
|
let root = unique_temp_dir("target-override");
|