electron-cli 0.3.0-alpha.2 → 0.3.0-alpha.20
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 +5380 -101
- package/Cargo.toml +17 -1
- package/README.md +103 -12
- package/package.json +2 -1
- package/src/cli.rs +226 -4
- package/src/commands/init.rs +443 -27
- package/src/commands/make.rs +3076 -0
- package/src/commands/mod.rs +4 -0
- package/src/commands/package.rs +3238 -0
- package/src/commands/plan.rs +65 -5
- package/src/commands/publish.rs +1832 -0
- package/src/commands/start.rs +287 -0
- package/src/forge_config.rs +547 -0
- package/src/main.rs +5 -0
- package/src/project.rs +52 -1
- 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/src/commands/plan.rs
CHANGED
|
@@ -83,7 +83,9 @@ fn build_report(snapshot: &project::ProjectSnapshot) -> PlanReport {
|
|
|
83
83
|
let mut risks = Vec::new();
|
|
84
84
|
let mut notes = Vec::new();
|
|
85
85
|
|
|
86
|
-
if
|
|
86
|
+
if matches!(project_type, ProjectType::Electron) && snapshot.main.is_some() {
|
|
87
|
+
recommended_commands.insert("dev".to_string(), "electron-cli start".to_string());
|
|
88
|
+
} else if let Some(script) = first_script(snapshot, &["start", "dev"]) {
|
|
87
89
|
recommended_commands.insert("dev".to_string(), run_script(snapshot, script));
|
|
88
90
|
} else if snapshot.electron_dependency.is_some() && snapshot.main.is_some() {
|
|
89
91
|
recommended_commands.insert("dev".to_string(), package_exec(snapshot, "electron ."));
|
|
@@ -94,7 +96,9 @@ fn build_report(snapshot: &project::ProjectSnapshot) -> PlanReport {
|
|
|
94
96
|
missing.push("No start or dev script was found.".to_string());
|
|
95
97
|
}
|
|
96
98
|
|
|
97
|
-
if
|
|
99
|
+
if matches!(project_type, ProjectType::Electron) && snapshot.main.is_some() {
|
|
100
|
+
recommended_commands.insert("package".to_string(), "electron-cli package".to_string());
|
|
101
|
+
} else if let Some(script) = first_script(snapshot, &["package", "pack"]) {
|
|
98
102
|
recommended_commands.insert("package".to_string(), run_script(snapshot, script));
|
|
99
103
|
} else if matches!(project_type, ProjectType::ElectronForge) {
|
|
100
104
|
missing.push(
|
|
@@ -102,10 +106,18 @@ fn build_report(snapshot: &project::ProjectSnapshot) -> PlanReport {
|
|
|
102
106
|
);
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
if
|
|
109
|
+
if matches!(project_type, ProjectType::Electron) && snapshot.main.is_some() {
|
|
110
|
+
recommended_commands.insert("make".to_string(), "electron-cli make".to_string());
|
|
111
|
+
} else if let Some(script) = first_script(snapshot, &["make", "dist"]) {
|
|
106
112
|
recommended_commands.insert("make".to_string(), run_script(snapshot, script));
|
|
107
113
|
}
|
|
108
114
|
|
|
115
|
+
if matches!(project_type, ProjectType::Electron) && snapshot.main.is_some() {
|
|
116
|
+
recommended_commands.insert("publish".to_string(), "electron-cli publish".to_string());
|
|
117
|
+
} else if let Some(script) = first_script(snapshot, &["publish", "release"]) {
|
|
118
|
+
recommended_commands.insert("publish".to_string(), run_script(snapshot, script));
|
|
119
|
+
}
|
|
120
|
+
|
|
109
121
|
recommended_commands.insert(
|
|
110
122
|
"diagnostics".to_string(),
|
|
111
123
|
"electron-cli doctor --json".to_string(),
|
|
@@ -134,9 +146,9 @@ fn build_report(snapshot: &project::ProjectSnapshot) -> PlanReport {
|
|
|
134
146
|
}
|
|
135
147
|
|
|
136
148
|
if matches!(project_type, ProjectType::ElectronForge) {
|
|
137
|
-
notes.push("Electron Forge was detected;
|
|
149
|
+
notes.push("Electron Forge was detected; its scripts remain the safest path for Forge-managed apps today.".to_string());
|
|
138
150
|
} else if snapshot.electron_dependency.is_some() {
|
|
139
|
-
notes.push("Electron was detected without Forge;
|
|
151
|
+
notes.push("Electron was detected without Forge; electron-cli can start, package, make, and publish local artifacts directly.".to_string());
|
|
140
152
|
} else {
|
|
141
153
|
notes.push("This does not currently look like an Electron app.".to_string());
|
|
142
154
|
}
|
|
@@ -232,4 +244,52 @@ mod tests {
|
|
|
232
244
|
);
|
|
233
245
|
assert!(report.risks.is_empty());
|
|
234
246
|
}
|
|
247
|
+
|
|
248
|
+
#[test]
|
|
249
|
+
fn plans_native_electron_cli_flow_for_plain_electron_app() {
|
|
250
|
+
let snapshot = project::ProjectSnapshot {
|
|
251
|
+
root: camino::Utf8PathBuf::from("/tmp/native-app"),
|
|
252
|
+
package_json: Some(camino::Utf8PathBuf::from("/tmp/native-app/package.json")),
|
|
253
|
+
name: Some("native-app".to_string()),
|
|
254
|
+
version: Some("0.1.0".to_string()),
|
|
255
|
+
repository: None,
|
|
256
|
+
license: None,
|
|
257
|
+
main: Some("src/main.js".to_string()),
|
|
258
|
+
package_manager: Some("npm".to_string()),
|
|
259
|
+
scripts: BTreeMap::new(),
|
|
260
|
+
dependencies: BTreeMap::new(),
|
|
261
|
+
dev_dependencies: BTreeMap::from([("electron".to_string(), "30.0.0".to_string())]),
|
|
262
|
+
optional_dependencies: BTreeMap::new(),
|
|
263
|
+
peer_dependencies: BTreeMap::new(),
|
|
264
|
+
electron_dependency: Some("30.0.0".to_string()),
|
|
265
|
+
forge_dependencies: BTreeMap::new(),
|
|
266
|
+
signals: vec!["electron dependency declared".to_string()],
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
let report = build_report(&snapshot);
|
|
270
|
+
|
|
271
|
+
assert!(matches!(report.project_type, ProjectType::Electron));
|
|
272
|
+
assert_eq!(
|
|
273
|
+
report.recommended_commands.get("dev").map(String::as_str),
|
|
274
|
+
Some("electron-cli start")
|
|
275
|
+
);
|
|
276
|
+
assert_eq!(
|
|
277
|
+
report
|
|
278
|
+
.recommended_commands
|
|
279
|
+
.get("package")
|
|
280
|
+
.map(String::as_str),
|
|
281
|
+
Some("electron-cli package")
|
|
282
|
+
);
|
|
283
|
+
assert_eq!(
|
|
284
|
+
report.recommended_commands.get("make").map(String::as_str),
|
|
285
|
+
Some("electron-cli make")
|
|
286
|
+
);
|
|
287
|
+
assert_eq!(
|
|
288
|
+
report
|
|
289
|
+
.recommended_commands
|
|
290
|
+
.get("publish")
|
|
291
|
+
.map(String::as_str),
|
|
292
|
+
Some("electron-cli publish")
|
|
293
|
+
);
|
|
294
|
+
}
|
|
235
295
|
}
|