@zappdev/cli 0.5.0-alpha.4 → 0.5.0-alpha.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/init.ts +9 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappdev/cli",
3
- "version": "0.5.0-alpha.4",
3
+ "version": "0.5.0-alpha.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "zapp": "./src/zapp-cli.ts"
package/src/init.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Does NOT modify the Vite template files — users add Zapp imports themselves.
4
4
 
5
5
  import path from "node:path";
6
- import { mkdir, rm } from "node:fs/promises";
6
+ import { mkdir } from "node:fs/promises";
7
7
  import { existsSync } from "node:fs";
8
8
 
9
9
  interface InitOptions {
@@ -21,26 +21,20 @@ export async function runInit(opts: InitOptions) {
21
21
  process.exit(1);
22
22
  }
23
23
 
24
- // 1. Create Vite project
25
- // Use bunx create-vite (not `bun create vite`) to avoid auto-installing
26
- // deps and triggering template postinstall scripts that can start a dev
27
- // server. The user runs `bun install` themselves after init.
24
+ // 1. Scaffold Vite project files (no install, no dev server).
25
+ // create-vite has an --immediate flag that auto-installs + starts the dev
26
+ // server, and an interactive prompt that does the same if confirmed.
27
+ // --no-interactive skips the prompt and defaults to no install.
28
28
  process.stdout.write(`[zapp] creating ${name} with template ${template}...\n`);
29
- const viteProc = Bun.spawn(["bunx", "create-vite", name, "--template", template], {
30
- cwd: root,
31
- stdout: "inherit",
32
- stderr: "inherit",
33
- });
29
+ const viteProc = Bun.spawn(
30
+ ["bunx", "create-vite@latest", name, "--template", template, "--no-interactive"],
31
+ { cwd: root, stdout: "inherit", stderr: "inherit" },
32
+ );
34
33
  if ((await viteProc.exited) !== 0) {
35
34
  process.stderr.write("[zapp] vite scaffold failed\n");
36
35
  process.exit(1);
37
36
  }
38
37
 
39
- // Remove node_modules if create-vite auto-installed — we modify
40
- // package.json (add zapp deps/scripts) before the user installs.
41
- const autoModules = path.join(projectDir, "node_modules");
42
- try { await rm(autoModules, { recursive: true }); } catch {}
43
-
44
38
  // 2. Add zapp/ native code
45
39
  const zappDir = path.join(projectDir, "zapp");
46
40
  await mkdir(zappDir, { recursive: true });