exportc 0.0.5 → 0.0.6

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/README.md CHANGED
@@ -8,9 +8,6 @@ Add [export](https://github.com/ihasq/export) to existing Vite projects. One com
8
8
  # In your existing Vite project
9
9
  npx exportc init
10
10
 
11
- # Install export dependencies
12
- cd export && npm install && cd ..
13
-
14
11
  # Start development (Wrangler starts automatically!)
15
12
  npm run dev
16
13
 
@@ -18,6 +15,8 @@ npm run dev
18
15
  npm run export
19
16
  ```
20
17
 
18
+ That's it. Dependencies are installed automatically.
19
+
21
20
  ## What You Get
22
21
 
23
22
  - **Single command dev** -- `npm run dev` starts both Vite and Wrangler
package/commands/init.js CHANGED
@@ -3,6 +3,7 @@ import pc from "picocolors";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
+ import { execSync } from "node:child_process";
6
7
 
7
8
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
9
 
@@ -308,6 +309,28 @@ declare module "export/" {
308
309
  }
309
310
  }
310
311
 
312
+ // Install dependencies in export directory
313
+ if (!isNonInteractive) {
314
+ s.stop("Files created!");
315
+ s.start("Installing dependencies...");
316
+ } else {
317
+ console.log("Installing dependencies...");
318
+ }
319
+
320
+ try {
321
+ execSync("npm install", {
322
+ cwd: exportDir,
323
+ stdio: isNonInteractive ? "inherit" : "pipe",
324
+ });
325
+ } catch (err) {
326
+ if (!isNonInteractive) {
327
+ s.stop("Failed to install dependencies");
328
+ p.log.error(`Run ${pc.cyan("cd export && npm install")} manually.`);
329
+ } else {
330
+ console.error("Failed to install dependencies. Run 'cd export && npm install' manually.");
331
+ }
332
+ }
333
+
311
334
  if (!isNonInteractive) {
312
335
  s.stop("Export initialized!");
313
336
 
@@ -328,27 +351,23 @@ ${pc.cyan("export-env.d.ts")} ${pc.dim("# Type declarations for export/ impo
328
351
 
329
352
  ${pc.bold("Next steps:")}
330
353
 
331
- 1. Install export dependencies:
332
- ${pc.cyan("cd export && npm install && cd ..")}
333
-
334
- 2. Start development (Vite + Wrangler auto-start):
354
+ 1. Start development (Vite + Wrangler auto-start):
335
355
  ${pc.cyan("npm run dev")}
336
356
 
337
- 3. Import in your client code:
357
+ 2. Import in your client code:
338
358
  ${pc.cyan(`import { hello } from "export/";`)}
339
359
  ${pc.cyan(`const message = await hello("World");`)}
340
360
 
341
- 4. Deploy to Cloudflare Workers Sites:
361
+ 3. Deploy to Cloudflare Workers Sites:
342
362
  ${pc.cyan("npm run export")}
343
363
  ${pc.dim("# Builds Vite + deploys everything to Workers")}`,
344
- "Created"
364
+ "Ready"
345
365
  );
346
366
 
347
- p.outro(`Run ${pc.cyan("cd export && npm install")} to get started!`);
367
+ p.outro(`Run ${pc.cyan("npm run dev")} to start!`);
348
368
  } else {
349
369
  console.log("Export initialized successfully!");
350
370
  console.log("\nNext steps:");
351
- console.log(" cd export && npm install && cd ..");
352
371
  console.log(" npm run dev");
353
372
  }
354
373
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exportc",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "CLI to add export to existing projects",
5
5
  "scripts": {
6
6
  "test": "node --test test/init.test.mjs",