create-ekka-desktop-app 0.4.3 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ekka-desktop-app",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Create an EKKA desktop app with built-in demo backend. No setup required.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -88,7 +88,7 @@ pub fn engine_request(req: EngineRequest, state: State<EngineState>, app_handle:
88
88
  "auth.set" => auth::handle_set(&req.payload, &state),
89
89
 
90
90
  // Node Credentials (routed to Desktop Core process via JSON-RPC)
91
- // After successful set, app restarts to run full startup with credentials
91
+ // After successful set, TS calls engine_connect and proceeds to login
92
92
  "nodeCredentials.set" => handle_node_credentials_set_via_core(&req.payload, &state, app_handle),
93
93
  "nodeCredentials.status" => state.core_process.request("nodeCredentials.status", &req.payload),
94
94
  "nodeCredentials.clear" => state.core_process.request("nodeCredentials.clear", &req.payload),
@@ -307,11 +307,11 @@ fn handle_setup_status(state: &EngineState) -> EngineResponse {
307
307
  // Node Credentials Handlers
308
308
  // =============================================================================
309
309
 
310
- /// Set node credentials via Desktop Core process, then restart app
310
+ /// Set node credentials via Desktop Core process
311
311
  ///
312
312
  /// Core handles validation and encrypted storage.
313
- /// Host handles the app restart (Bridge-specific).
314
- fn handle_node_credentials_set_via_core(payload: &Value, state: &EngineState, app_handle: AppHandle) -> EngineResponse {
313
+ /// TS handles the post-onboarding transition: handleSetupComplete() → ekka.connect() → login.
314
+ fn handle_node_credentials_set_via_core(payload: &Value, state: &EngineState, _app_handle: AppHandle) -> EngineResponse {
315
315
  tracing::info!(op = "rust.local.op", opName = "nodeCredentials.set", "Routing nodeCredentials.set to Desktop Core");
316
316
 
317
317
  let resp = state.core_process.request("nodeCredentials.set", payload);
@@ -319,11 +319,8 @@ fn handle_node_credentials_set_via_core(payload: &Value, state: &EngineState, ap
319
319
  if resp.ok {
320
320
  tracing::info!(
321
321
  op = "desktop.onboarding.complete",
322
- "Credentials stored via Core - restarting app for full startup"
322
+ "Credentials stored via Core - TS will call engine_connect and proceed"
323
323
  );
324
- // Restart app to run full startup with credentials
325
- // This triggers: updater check → node auth → engine spawn
326
- app_handle.restart();
327
324
  }
328
325
 
329
326
  resp
@@ -303,33 +303,48 @@ fn find_core_binary() -> Result<std::path::PathBuf, String> {
303
303
  }
304
304
  }
305
305
 
306
- // 3. Cargo target directory (dev builds)
306
+ // 3. Workspace target directory (dev builds)
307
307
  let manifest_dir = env!("CARGO_MANIFEST_DIR");
308
- let dev_path = std::path::PathBuf::from(manifest_dir)
309
- .join("crates")
310
- .join("ekka-desktop-core")
311
- .join("target")
312
- .join("debug")
313
- .join("ekka-desktop-core");
314
- if dev_path.exists() {
315
- return Ok(dev_path);
308
+ for profile in &["debug", "release"] {
309
+ let candidate = std::path::PathBuf::from(manifest_dir)
310
+ .join("target")
311
+ .join(profile)
312
+ .join("ekka-desktop-core");
313
+ if candidate.exists() {
314
+ return Ok(candidate);
315
+ }
316
316
  }
317
317
 
318
- // Also check release
319
- let release_path = std::path::PathBuf::from(manifest_dir)
320
- .join("crates")
321
- .join("ekka-desktop-core")
318
+ // 4. Dev convenience: auto-build on first run
319
+ tracing::info!(
320
+ op = "core.binary.auto_build",
321
+ "Desktop Core binary not found — building automatically..."
322
+ );
323
+ let status = Command::new("cargo")
324
+ .args(["build", "-p", "ekka-desktop-core"])
325
+ .current_dir(manifest_dir)
326
+ .status()
327
+ .map_err(|e| format!("Failed to run cargo build: {}", e))?;
328
+
329
+ if !status.success() {
330
+ return Err(format!(
331
+ "Failed to auto-build Desktop Core (exit {:?}). Build manually:\n \
332
+ cd {} && cargo build -p ekka-desktop-core",
333
+ status.code(),
334
+ manifest_dir
335
+ ));
336
+ }
337
+
338
+ let built = std::path::PathBuf::from(manifest_dir)
322
339
  .join("target")
323
- .join("release")
340
+ .join("debug")
324
341
  .join("ekka-desktop-core");
325
- if release_path.exists() {
326
- return Ok(release_path);
342
+ if built.exists() {
343
+ return Ok(built);
327
344
  }
328
345
 
329
346
  Err(format!(
330
- "Desktop Core binary not found. Build it first:\n \
331
- cd {}/crates/ekka-desktop-core && cargo build\n \
332
- Or set EKKA_DESKTOP_CORE_BIN env var.",
333
- manifest_dir
347
+ "Desktop Core binary not found after build. Expected at: {}",
348
+ built.display()
334
349
  ))
335
350
  }