@zappdev/cli 0.5.0-alpha.2 → 0.5.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/native/app/app.zc CHANGED
@@ -39,7 +39,7 @@ fn app_get_bootstrap_name() -> string {
39
39
  fn app_get_bootstrap_web_content_inspectable() -> bool {
40
40
  let app = (App*)app_get_active();
41
41
  if app == NULL { return false; }
42
- match app.config.inspectable {
42
+ match app.config.webContentInspectable {
43
43
  ZappInspectable::On => { return true; },
44
44
  ZappInspectable::Off => { return false; },
45
45
  ZappInspectable::Auto => { return zapp_build_dev_tools_default() > 0; },
@@ -179,7 +179,7 @@ enum ZappInspectable {
179
179
  struct AppConfig {
180
180
  name: string;
181
181
  applicationShouldTerminateAfterLastWindowClosed: bool;
182
- inspectable: ZappInspectable;
182
+ webContentInspectable: ZappInspectable;
183
183
  maxWorkers: int;
184
184
  qjsStackSize: int;
185
185
  backend: bool; // enable backend worker (src/backend.ts)
@@ -189,13 +189,13 @@ struct AppConfig {
189
189
  // Zapp namespace — convenience accessors for framework enums and values.
190
190
  //
191
191
  // Usage:
192
- // inspectable: Zapp::inspectable_auto(),
193
- // inspectable: Zapp::inspectable_on(),
194
- // inspectable: Zapp::inspectable_off(),
192
+ // webContentInspectable: Zapp::inspectable_auto(),
193
+ // webContentInspectable: Zapp::inspectable_on(),
194
+ // webContentInspectable: Zapp::inspectable_off(),
195
195
  //
196
196
  // These return the proper enum type so you get match exhaustiveness and
197
197
  // type checking. The enum constructors also work directly if you prefer:
198
- // inspectable: ZappInspectable::Auto(),
198
+ // webContentInspectable: ZappInspectable::Auto(),
199
199
  //
200
200
  // As Zapp adds more framework-level options (log levels, security modes,
201
201
  // etc.), new accessors will appear here under the same Zapp:: namespace.
@@ -221,7 +221,7 @@ struct App {
221
221
  impl App {
222
222
  fn new(config: AppConfig) -> App {
223
223
  let wm = WindowManager::new();
224
- match config.inspectable {
224
+ match config.webContentInspectable {
225
225
  ZappInspectable::On => { wm.webContentInspectable = true; },
226
226
  ZappInspectable::Off => { wm.webContentInspectable = false; },
227
227
  ZappInspectable::Auto => {
package/native/build.zc CHANGED
@@ -53,7 +53,7 @@ fn main() -> int {
53
53
  let config = AppConfig{
54
54
  name: "Zapp v2 Test",
55
55
  applicationShouldTerminateAfterLastWindowClosed: true,
56
- inspectable: Zapp::inspectable_on(),
56
+ webContentInspectable: Zapp::inspectable_on(),
57
57
  maxWorkers: 0,
58
58
  qjsStackSize: 0,
59
59
  backend: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappdev/cli",
3
- "version": "0.5.0-alpha.2",
3
+ "version": "0.5.0-alpha.3",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zapp": "./src/zapp-cli.ts"
package/src/config.ts CHANGED
@@ -26,6 +26,7 @@ export interface ZappConfig {
26
26
  version?: string;
27
27
  assetDir?: string; // Default: "./dist" (Vite), configurable for static sites
28
28
  devPort?: number; // Default: 5173
29
+ backend?: string; // Path to backend worker source (e.g. "src/server.ts"). Omit for no backend.
29
30
  deepLinkSchemes?: string[]; // e.g. ["myapp"] → registers myapp:// URL scheme
30
31
  macos?: MacOSConfig;
31
32
  security?: SecurityConfig;
package/src/init.ts CHANGED
@@ -51,7 +51,7 @@ fn run_app() -> int {
51
51
  let config = AppConfig{
52
52
  name: "${name}",
53
53
  applicationShouldTerminateAfterLastWindowClosed: true,
54
- inspectable: Zapp::inspectable_auto(),
54
+ webContentInspectable: Zapp::inspectable_auto(),
55
55
  maxWorkers: 0,
56
56
  qjsStackSize: 0,
57
57
  backend: false,
@@ -117,6 +117,7 @@ fn main() -> int {
117
117
  ...pkgObj.scripts,
118
118
  "dev": "zapp dev",
119
119
  "build": "zapp build",
120
+ "package": "zapp package",
120
121
  "generate": "zapp generate",
121
122
  };
122
123
 
@@ -158,6 +159,7 @@ export default defineConfig({
158
159
  process.stdout.write(` Then add to your entry file (e.g. src/main.ts):\n\n`);
159
160
  process.stdout.write(` import { Window, WindowEvent, Services } from "@zappdev/runtime";\n\n`);
160
161
  process.stdout.write(` Run:\n`);
161
- process.stdout.write(` zapp dev # development with Vite HMR\n`);
162
- process.stdout.write(` zapp build # production build\n\n`);
162
+ process.stdout.write(` bun run dev # development with Vite HMR\n`);
163
+ process.stdout.write(` bun run build # production build\n`);
164
+ process.stdout.write(` bun run package # .app bundle (macOS)\n\n`);
163
165
  }
package/src/workers.ts CHANGED
@@ -45,7 +45,7 @@ async function discoverWorkers(srcDir: string): Promise<WorkerEntry[]> {
45
45
  return [...found.entries()].map(([entryPath, specifier]) => ({ entryPath, specifier }));
46
46
  }
47
47
 
48
- export async function bundleWorkers(root: string): Promise<number> {
48
+ export async function bundleWorkers(root: string, backendConfig?: string): Promise<number> {
49
49
  const srcDir = path.join(root, "src");
50
50
  const outDir = path.join(root, ".zapp", "workers");
51
51
  await mkdir(outDir, { recursive: true });
@@ -81,8 +81,10 @@ export async function bundleWorkers(root: string): Promise<number> {
81
81
  }
82
82
  }
83
83
 
84
- // Backend worker — convention: src/backend.ts
85
- const backendPath = path.join(root, "src", "backend.ts");
84
+ // Backend worker — from config or fall back to src/backend.ts convention
85
+ const backendPath = backendConfig
86
+ ? path.resolve(root, backendConfig)
87
+ : path.join(root, "src", "backend.ts");
86
88
  try {
87
89
  await stat(backendPath);
88
90
  const outPath = path.join(outDir, "backend.mjs");
@@ -95,12 +97,12 @@ export async function bundleWorkers(root: string): Promise<number> {
95
97
  minify: false,
96
98
  });
97
99
  if (result.success) {
98
- process.stdout.write("[zapp] backend worker detected: src/backend.ts\n");
100
+ process.stdout.write(`[zapp] backend worker: ${path.relative(root, backendPath)}\n`);
99
101
  } else {
100
102
  process.stderr.write("[zapp] backend bundle failed\n");
101
103
  }
102
104
  } catch {
103
- // No backend.ts — that's fine, backend is optional
105
+ // No backend file — that's fine, backend is optional
104
106
  }
105
107
 
106
108
  return workers.length;