electron-cli 0.3.0-alpha.2 → 0.3.0-alpha.3
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 +1 -1
- package/Cargo.toml +1 -1
- package/README.md +23 -8
- package/package.json +2 -1
- package/src/cli.rs +61 -3
- package/src/commands/init.rs +413 -27
- package/src/commands/mod.rs +2 -0
- package/src/commands/package.rs +665 -0
- package/src/commands/plan.rs +43 -4
- package/src/commands/start.rs +287 -0
- package/src/main.rs +2 -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
package/Cargo.toml
CHANGED
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,33 @@ 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
|
|
18
20
|
electron-cli inspect --json
|
|
19
21
|
electron-cli doctor --json
|
|
20
22
|
electron-cli plan --json
|
|
21
23
|
electron-cli init my-app --dry-run --json
|
|
24
|
+
electron-cli start --dry-run --json
|
|
25
|
+
electron-cli package --dry-run --json
|
|
22
26
|
```
|
|
23
27
|
|
|
24
28
|
Planned commands:
|
|
25
29
|
|
|
26
30
|
```sh
|
|
27
|
-
electron-cli package
|
|
28
|
-
electron-cli dev
|
|
29
31
|
electron-cli make
|
|
32
|
+
electron-cli publish
|
|
30
33
|
```
|
|
31
34
|
|
|
32
|
-
The
|
|
35
|
+
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.
|
|
36
|
+
|
|
37
|
+
The Rust-native flow currently owns:
|
|
38
|
+
|
|
39
|
+
- `init --template minimal`: writes a local Electron starter without Electron Forge.
|
|
40
|
+
- `start`: launches the installed Electron runtime directly.
|
|
41
|
+
- `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.
|
|
42
|
+
|
|
43
|
+
`make` and `publish` are not implemented yet. They are the next pieces of the Forge lifecycle to replace.
|
|
33
44
|
|
|
34
45
|
## Install
|
|
35
46
|
|
|
@@ -60,7 +71,9 @@ Or use Cargo directly:
|
|
|
60
71
|
```sh
|
|
61
72
|
cargo run -- doctor
|
|
62
73
|
cargo run -- inspect --json
|
|
63
|
-
cargo run -- init my-app
|
|
74
|
+
cargo run -- init my-app
|
|
75
|
+
cargo run -- start --dry-run
|
|
76
|
+
cargo run -- package --dry-run
|
|
64
77
|
```
|
|
65
78
|
|
|
66
79
|
## Design Goals
|
|
@@ -68,7 +81,7 @@ cargo run -- init my-app --dry-run
|
|
|
68
81
|
- Learn Rust through a real developer tool.
|
|
69
82
|
- Make Electron project state easy to inspect.
|
|
70
83
|
- Prefer structured output for agentic workflows.
|
|
71
|
-
-
|
|
84
|
+
- Replace the main Forge-style app flow with narrow Rust-owned pieces.
|
|
72
85
|
- Keep the project clearly independent and experimental.
|
|
73
86
|
|
|
74
87
|
## Non-Goals
|
|
@@ -81,7 +94,9 @@ cargo run -- init my-app --dry-run
|
|
|
81
94
|
|
|
82
95
|
The inspection and planning commands support `--json` so agents and scripts can consume project state without scraping terminal output.
|
|
83
96
|
`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
|
|
97
|
+
`init --dry-run --json` shows whether the CLI will write native template files or delegate to `create-electron-app`.
|
|
98
|
+
`start --dry-run --json` shows the Electron executable that will be launched.
|
|
99
|
+
`package --dry-run --json` shows the runtime and app file copy plan.
|
|
85
100
|
|
|
86
101
|
```sh
|
|
87
102
|
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.3",
|
|
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,16 @@ 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 a local Electron application bundle without Electron Forge.
|
|
26
|
+
Package(PackageArgs),
|
|
25
27
|
/// Recommend next commands and risks from the project snapshot.
|
|
26
28
|
Plan(CommandArgs),
|
|
29
|
+
/// Launch the current Electron app without Electron Forge.
|
|
30
|
+
Start(StartArgs),
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
#[derive(Debug, Clone, Args)]
|
|
@@ -47,8 +51,8 @@ pub struct InitArgs {
|
|
|
47
51
|
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
48
52
|
pub cwd: PathBuf,
|
|
49
53
|
|
|
50
|
-
///
|
|
51
|
-
#[arg(long, short = 't', default_value = "
|
|
54
|
+
/// Template to use. "minimal" is native; other names are passed to create-electron-app.
|
|
55
|
+
#[arg(long, short = 't', default_value = "minimal")]
|
|
52
56
|
pub template: String,
|
|
53
57
|
|
|
54
58
|
/// Package manager command strategy to use.
|
|
@@ -80,6 +84,60 @@ pub struct InitArgs {
|
|
|
80
84
|
pub json: bool,
|
|
81
85
|
}
|
|
82
86
|
|
|
87
|
+
#[derive(Debug, Clone, Args)]
|
|
88
|
+
pub struct StartArgs {
|
|
89
|
+
/// Project directory to launch.
|
|
90
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
91
|
+
pub cwd: PathBuf,
|
|
92
|
+
|
|
93
|
+
/// Print the launch command without starting Electron.
|
|
94
|
+
#[arg(long)]
|
|
95
|
+
pub dry_run: bool,
|
|
96
|
+
|
|
97
|
+
/// Emit machine-readable JSON.
|
|
98
|
+
#[arg(long)]
|
|
99
|
+
pub json: bool,
|
|
100
|
+
|
|
101
|
+
/// Extra arguments passed to Electron after `--`.
|
|
102
|
+
#[arg(last = true, value_name = "ELECTRON_ARG")]
|
|
103
|
+
pub electron_args: Vec<String>,
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#[derive(Debug, Clone, Args)]
|
|
107
|
+
pub struct PackageArgs {
|
|
108
|
+
/// Project directory to package.
|
|
109
|
+
#[arg(long, default_value = ".", value_name = "PATH")]
|
|
110
|
+
pub cwd: PathBuf,
|
|
111
|
+
|
|
112
|
+
/// Output directory for packaged app bundles.
|
|
113
|
+
#[arg(long, default_value = "out", value_name = "PATH")]
|
|
114
|
+
pub out_dir: PathBuf,
|
|
115
|
+
|
|
116
|
+
/// Override the packaged application name.
|
|
117
|
+
#[arg(long)]
|
|
118
|
+
pub name: Option<String>,
|
|
119
|
+
|
|
120
|
+
/// Target platform label. Defaults to the current platform.
|
|
121
|
+
#[arg(long)]
|
|
122
|
+
pub platform: Option<String>,
|
|
123
|
+
|
|
124
|
+
/// Target architecture label. Defaults to the current architecture.
|
|
125
|
+
#[arg(long)]
|
|
126
|
+
pub arch: Option<String>,
|
|
127
|
+
|
|
128
|
+
/// Overwrite an existing package output directory.
|
|
129
|
+
#[arg(long)]
|
|
130
|
+
pub force: bool,
|
|
131
|
+
|
|
132
|
+
/// Print the package plan without creating files.
|
|
133
|
+
#[arg(long)]
|
|
134
|
+
pub dry_run: bool,
|
|
135
|
+
|
|
136
|
+
/// Emit machine-readable JSON.
|
|
137
|
+
#[arg(long)]
|
|
138
|
+
pub json: bool,
|
|
139
|
+
}
|
|
140
|
+
|
|
83
141
|
#[derive(Debug, Clone, Copy, ValueEnum)]
|
|
84
142
|
#[value(rename_all = "lower")]
|
|
85
143
|
pub enum PackageManager {
|