@drzl/cli 1.0.0 → 1.1.0

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
@@ -13,6 +13,20 @@ Analyze your Drizzle schema and generate validation, services, and routers.
13
13
 
14
14
  </div>
15
15
 
16
+ ## 💚 Sponsor DRZL
17
+
18
+ <div align="center">
19
+
20
+ <strong>DRZL is crafted nights & weekends. Sponsorships keep the generators fast, tested, and free.</strong>
21
+
22
+ [![Sponsor DRZL](https://img.shields.io/badge/GitHub%20Sponsors-Support%20the%20project-ff69b4?logo=github)](https://github.com/sponsors/omar-dulaimi)
23
+
24
+ </div>
25
+
26
+ - Every dollar speeds up CI hardware and offsets long test runs on my aging laptop.
27
+ - Sponsors get roadmap input and priority responses in GitHub Issues.
28
+ - Prefer a quick overview? Check `docs/sponsor.md` for the current goals and thank-yous.
29
+
16
30
  ## Commands
17
31
 
18
32
  - Init: `pnpm dlx @drzl/cli init`
package/dist/cli.cjs CHANGED
@@ -26,11 +26,11 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  // src/cli.ts
27
27
  var import_analyzer = require("@drzl/analyzer");
28
28
  var import_generator_orpc = require("@drzl/generator-orpc");
29
- var import_chalk = __toESM(require("chalk"), 1);
29
+ var import_chalk2 = __toESM(require("chalk"), 1);
30
30
  var import_chokidar = __toESM(require("chokidar"), 1);
31
31
  var import_cli_progress = __toESM(require("cli-progress"), 1);
32
32
  var import_commander = require("commander");
33
- var path2 = __toESM(require("path"), 1);
33
+ var path3 = __toESM(require("path"), 1);
34
34
  var import_ora = __toESM(require("ora"), 1);
35
35
 
36
36
  // src/config.ts
@@ -182,9 +182,84 @@ function computeWatchTargets(cfg, cwd = process.cwd()) {
182
182
  return [...targets];
183
183
  }
184
184
 
185
+ // src/sponsor.ts
186
+ var import_chalk = __toESM(require("chalk"), 1);
187
+ var import_node_fs = require("fs");
188
+ var import_node_path = __toESM(require("path"), 1);
189
+ var CACHE_DIR = import_node_path.default.join(process.cwd(), "node_modules", ".cache", "@drzl");
190
+ var CACHE_FILE = import_node_path.default.join(CACHE_DIR, "sponsor-message.json");
191
+ var DEFAULT_INTERVAL_MS = 1e3 * 60 * 15;
192
+ var shownThisProcess = false;
193
+ var tips = [
194
+ "Pair DRZL watch mode with drizzle-kit to keep schema & API synced.",
195
+ "Templatize your ORPC routers to roll out new endpoints safely.",
196
+ "Need typed validators? Enable the zod, valibot, or arktype generators.",
197
+ "Use output headers to track generated files and trim noisy diffs."
198
+ ];
199
+ var green = (msg) => import_chalk.default.hex("#6ee7b7")(msg);
200
+ var cyan = (msg) => import_chalk.default.cyan(msg);
201
+ var gray = (msg) => import_chalk.default.gray(msg);
202
+ function maybeShowSponsorMessage({
203
+ reason = "generate",
204
+ minIntervalMs = DEFAULT_INTERVAL_MS,
205
+ force = false
206
+ } = {}) {
207
+ const hideViaEnv = process.env.DRZL_HIDE_SPONSOR?.toLowerCase();
208
+ const hideRequested = hideViaEnv === "1" || hideViaEnv === "true";
209
+ if (hideRequested || process.env.CI && !force || shownThisProcess && !force) return;
210
+ try {
211
+ (0, import_node_fs.mkdirSync)(CACHE_DIR, { recursive: true });
212
+ const payload = readCache();
213
+ payload.runs += 1;
214
+ const now = Date.now();
215
+ const shouldShow = force || now - (payload.lastShownAt ?? 0) >= minIntervalMs;
216
+ if (shouldShow) {
217
+ payload.lastShownAt = now;
218
+ payload.lastReason = reason;
219
+ }
220
+ writeCache(payload);
221
+ if (!shouldShow) return;
222
+ shownThisProcess = true;
223
+ const tip = tips[payload.runs % tips.length];
224
+ console.log(
225
+ `
226
+ ${cyan(`\u{1F680} DRZL finished a ${reason} run (#${payload.runs.toLocaleString()}).`)}
227
+
228
+ ${green("\u2728 Sponsors keep DRZL shipping. Consider supporting ongoing dev:")}
229
+ ${green("GitHub Sponsors")} ${gray("\u2192 https://github.com/sponsors/omar-dulaimi")}
230
+
231
+ ${green("Pro tip:")} ${tip}
232
+ `
233
+ );
234
+ } catch {
235
+ }
236
+ }
237
+ function readCache() {
238
+ if (!(0, import_node_fs.existsSync)(CACHE_FILE)) {
239
+ return { runs: 0 };
240
+ }
241
+ try {
242
+ const data = JSON.parse((0, import_node_fs.readFileSync)(CACHE_FILE, "utf8"));
243
+ if (typeof data.runs !== "number") return { runs: 0 };
244
+ return data;
245
+ } catch {
246
+ return { runs: 0 };
247
+ }
248
+ }
249
+ function writeCache(payload) {
250
+ (0, import_node_fs.writeFileSync)(CACHE_FILE, JSON.stringify(payload, null, 2), "utf8");
251
+ }
252
+
185
253
  // src/cli.ts
186
254
  var program = new import_commander.Command();
187
255
  program.name("drzl").description("DRZL - Drizzle Developer Toolkit").version("0.0.1");
256
+ program.addHelpText(
257
+ "afterAll",
258
+ `
259
+ Need a template, adapter, or generator DRZL doesn't ship yet?
260
+ \u2192 DM @omardulaimidev on X: https://x.com/omardulaimidev
261
+ `
262
+ );
188
263
  program.command("analyze").argument("<schema>", "path to drizzle schema (TS)").option("--relations", "include relations", true).option("--validate", "validate constraints", true).option("--out <file>", "write analysis JSON to file").option("--json", "print JSON to stdout (overrides --out)", false).action(async (schema, opts) => {
189
264
  try {
190
265
  const analyzer = new import_analyzer.SchemaAnalyzer(schema);
@@ -201,9 +276,9 @@ program.command("analyze").argument("<schema>", "path to drizzle schema (TS)").o
201
276
  } else if (opts.out) {
202
277
  const fs2 = await import("fs/promises");
203
278
  await fs2.writeFile(opts.out, json, "utf8");
204
- spinner?.succeed(import_chalk.default.green(`Analysis written to ${opts.out} in ${ms}ms`));
279
+ spinner?.succeed(import_chalk2.default.green(`Analysis written to ${opts.out} in ${ms}ms`));
205
280
  } else {
206
- spinner?.succeed(import_chalk.default.green(`Analyzed in ${ms}ms`));
281
+ spinner?.succeed(import_chalk2.default.green(`Analyzed in ${ms}ms`));
207
282
  console.log(json);
208
283
  }
209
284
  process.exit(res.issues.some((i) => i.level === "error") ? 2 : 0);
@@ -213,7 +288,7 @@ program.command("analyze").argument("<schema>", "path to drizzle schema (TS)").o
213
288
  console.log(JSON.stringify({ event: "error", code: "DRZL_CLI_ANALYZE", message: msg }));
214
289
  else
215
290
  console.error(
216
- import_chalk.default.red("Analyze failed (DRZL_CLI_ANALYZE):"),
291
+ import_chalk2.default.red("Analyze failed (DRZL_CLI_ANALYZE):"),
217
292
  msg,
218
293
  "\nTip: run with --json for structured output."
219
294
  );
@@ -225,7 +300,7 @@ program.command("generate").description("Run configured generators (drzl.config.
225
300
  const cfg = await loadConfig(opts.config);
226
301
  if (!cfg) {
227
302
  console.error(
228
- import_chalk.default.red("No config found (DRZL_CFG_001). Create drzl.config.ts or pass --config.")
303
+ import_chalk2.default.red("No config found (DRZL_CFG_001). Create drzl.config.ts or pass --config.")
229
304
  );
230
305
  process.exit(2);
231
306
  return;
@@ -260,8 +335,8 @@ program.command("generate").description("Run configured generators (drzl.config.
260
335
  onProgress: ({ index }) => progress.update(index)
261
336
  });
262
337
  progress.stop();
263
- (0, import_ora.default)().succeed(import_chalk.default.green(`Generated (${g.kind}): ${files.length} files`));
264
- files.forEach((f) => console.log(" -", import_chalk.default.cyan(f)));
338
+ (0, import_ora.default)().succeed(import_chalk2.default.green(`Generated (${g.kind}): ${files.length} files`));
339
+ files.forEach((f) => console.log(" -", import_chalk2.default.cyan(f)));
265
340
  } else if (g.kind === "service") {
266
341
  try {
267
342
  const { ServiceGenerator } = await import("@drzl/generator-service");
@@ -276,15 +351,15 @@ program.command("generate").description("Run configured generators (drzl.config.
276
351
  schemaImportPath: g.schemaImportPath
277
352
  });
278
353
  progress.stop();
279
- (0, import_ora.default)().succeed(import_chalk.default.green(`Generated (service): ${files.length} files`));
280
- files.forEach((f) => console.log(" -", import_chalk.default.cyan(f)));
354
+ (0, import_ora.default)().succeed(import_chalk2.default.green(`Generated (service): ${files.length} files`));
355
+ files.forEach((f) => console.log(" -", import_chalk2.default.cyan(f)));
281
356
  } catch (e) {
282
357
  progress.stop();
283
358
  console.error(
284
- import_chalk.default.red("Service generator missing."),
285
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-service")
359
+ import_chalk2.default.red("Service generator missing."),
360
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-service")
286
361
  );
287
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
362
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
288
363
  process.exit(1);
289
364
  }
290
365
  } else if (g.kind === "zod") {
@@ -300,15 +375,15 @@ program.command("generate").description("Run configured generators (drzl.config.
300
375
  fileSuffix: g.fileSuffix
301
376
  });
302
377
  progress.stop();
303
- (0, import_ora.default)().succeed(import_chalk.default.green(`Generated (zod): ${files.length} files`));
304
- files.forEach((f) => console.log(" -", import_chalk.default.cyan(f)));
378
+ (0, import_ora.default)().succeed(import_chalk2.default.green(`Generated (zod): ${files.length} files`));
379
+ files.forEach((f) => console.log(" -", import_chalk2.default.cyan(f)));
305
380
  } catch (e) {
306
381
  progress.stop();
307
382
  console.error(
308
- import_chalk.default.red("Zod generator missing."),
309
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-zod")
383
+ import_chalk2.default.red("Zod generator missing."),
384
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-zod")
310
385
  );
311
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
386
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
312
387
  process.exit(1);
313
388
  }
314
389
  } else if (g.kind === "valibot") {
@@ -324,15 +399,15 @@ program.command("generate").description("Run configured generators (drzl.config.
324
399
  fileSuffix: g.fileSuffix
325
400
  });
326
401
  progress.stop();
327
- (0, import_ora.default)().succeed(import_chalk.default.green(`Generated (valibot): ${files.length} files`));
328
- files.forEach((f) => console.log(" -", import_chalk.default.cyan(f)));
402
+ (0, import_ora.default)().succeed(import_chalk2.default.green(`Generated (valibot): ${files.length} files`));
403
+ files.forEach((f) => console.log(" -", import_chalk2.default.cyan(f)));
329
404
  } catch (e) {
330
405
  progress.stop();
331
406
  console.error(
332
- import_chalk.default.red("Valibot generator missing."),
333
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-valibot")
407
+ import_chalk2.default.red("Valibot generator missing."),
408
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-valibot")
334
409
  );
335
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
410
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
336
411
  process.exit(1);
337
412
  }
338
413
  } else if (g.kind === "arktype") {
@@ -348,22 +423,25 @@ program.command("generate").description("Run configured generators (drzl.config.
348
423
  fileSuffix: g.fileSuffix
349
424
  });
350
425
  progress.stop();
351
- (0, import_ora.default)().succeed(import_chalk.default.green(`Generated (arktype): ${files.length} files`));
352
- files.forEach((f) => console.log(" -", import_chalk.default.cyan(f)));
426
+ (0, import_ora.default)().succeed(import_chalk2.default.green(`Generated (arktype): ${files.length} files`));
427
+ files.forEach((f) => console.log(" -", import_chalk2.default.cyan(f)));
353
428
  } catch (e) {
354
429
  progress.stop();
355
430
  console.error(
356
- import_chalk.default.red("ArkType generator missing."),
357
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-arktype")
431
+ import_chalk2.default.red("ArkType generator missing."),
432
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-arktype")
358
433
  );
359
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
434
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
360
435
  process.exit(1);
361
436
  }
362
437
  }
363
438
  }
439
+ if (cfg.generators.length) {
440
+ maybeShowSponsorMessage({ reason: "generate" });
441
+ }
364
442
  } catch (e) {
365
443
  console.error(
366
- import_chalk.default.red("Generate failed (DRZL_GEN_001):"),
444
+ import_chalk2.default.red("Generate failed (DRZL_GEN_001):"),
367
445
  e?.message ?? e,
368
446
  "\nTip: check your drzl.config.ts and template path."
369
447
  );
@@ -383,23 +461,24 @@ program.command("generate:orpc").argument("<schema>", "path to drizzle schema (T
383
461
  template: opts.template,
384
462
  includeRelations: !!opts.includeRelations
385
463
  });
386
- console.log(import_chalk.default.green(`Generated:`), files.map((f) => import_chalk.default.cyan(f)).join(", "));
464
+ console.log(import_chalk2.default.green(`Generated:`), files.map((f) => import_chalk2.default.cyan(f)).join(", "));
465
+ maybeShowSponsorMessage({ reason: "generate:orpc" });
387
466
  } catch (e) {
388
- console.error(import_chalk.default.red("Generate orpc failed:"), e?.message ?? e);
467
+ console.error(import_chalk2.default.red("Generate orpc failed:"), e?.message ?? e);
389
468
  process.exit(1);
390
469
  }
391
470
  });
392
471
  program.command("watch").description("Watch schema and regenerate on changes").option("-c, --config <path>", "path to drzl.config").option("--pipeline <name>", "all | analyze | generate-orpc", "all").option("--debounce <ms>", "debounce ms", "200").option("--json", "emit JSON logs", false).option("--poll", "force polling (helps WSL/Docker/remote FS)", false).action(async (opts) => {
393
472
  let cfg = await loadConfig(opts.config);
394
473
  if (!cfg) {
395
- console.error(import_chalk.default.red("No config found. Create drzl.config.ts or pass --config."));
474
+ console.error(import_chalk2.default.red("No config found. Create drzl.config.ts or pass --config."));
396
475
  process.exit(2);
397
476
  return;
398
477
  }
399
- const abs = (p) => path2.resolve(process.cwd(), p);
478
+ const abs = (p) => path3.resolve(process.cwd(), p);
400
479
  const isInside = (child, parent) => {
401
- const rel = path2.relative(parent, child);
402
- return !!rel && !rel.startsWith("..") && !path2.isAbsolute(rel);
480
+ const rel = path3.relative(parent, child);
481
+ return !!rel && !rel.startsWith("..") && !path3.isAbsolute(rel);
403
482
  };
404
483
  const ignoredOutDirs = new Set(computeGeneratorOutputDirs(cfg).map(abs));
405
484
  const currentTargets = new Set(computeWatchTargets(cfg).map(abs));
@@ -478,7 +557,7 @@ program.command("watch").description("Watch schema and regenerate on changes").o
478
557
  })
479
558
  );
480
559
  } else {
481
- console.log(import_chalk.default.green("Analyze complete."));
560
+ console.log(import_chalk2.default.green("Analyze complete."));
482
561
  }
483
562
  return;
484
563
  }
@@ -500,8 +579,8 @@ program.command("watch").description("Watch schema and regenerate on changes").o
500
579
  validation: g.validation
501
580
  });
502
581
  opts.json ? console.log(JSON.stringify({ event: "generate_complete", kind: g.kind, files })) : console.log(
503
- import_chalk.default.green(`Generated (${g.kind}):`),
504
- files.map((f) => import_chalk.default.cyan(f)).join(", ")
582
+ import_chalk2.default.green(`Generated (${g.kind}):`),
583
+ files.map((f) => import_chalk2.default.cyan(f)).join(", ")
505
584
  );
506
585
  newFiles.push(...files);
507
586
  } else if (g.kind === "service") {
@@ -518,16 +597,16 @@ program.command("watch").description("Watch schema and regenerate on changes").o
518
597
  schemaImportPath: g.schemaImportPath
519
598
  });
520
599
  opts.json ? console.log(JSON.stringify({ event: "generate_complete", kind: g.kind, files })) : console.log(
521
- import_chalk.default.green(`Generated (service): ${files.length} files`),
522
- files.map((f) => import_chalk.default.cyan(f)).join(", ")
600
+ import_chalk2.default.green(`Generated (service): ${files.length} files`),
601
+ files.map((f) => import_chalk2.default.cyan(f)).join(", ")
523
602
  );
524
603
  newFiles.push(...files);
525
604
  } catch (e) {
526
605
  console.error(
527
- import_chalk.default.red("Service generator missing."),
528
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-service")
606
+ import_chalk2.default.red("Service generator missing."),
607
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-service")
529
608
  );
530
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
609
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
531
610
  return;
532
611
  }
533
612
  } else if (g.kind === "zod") {
@@ -543,16 +622,16 @@ program.command("watch").description("Watch schema and regenerate on changes").o
543
622
  fileSuffix: g.fileSuffix
544
623
  });
545
624
  opts.json ? console.log(JSON.stringify({ event: "generate_complete", kind: g.kind, files })) : console.log(
546
- import_chalk.default.green(`Generated (zod): ${files.length} files`),
547
- files.map((f) => import_chalk.default.cyan(f)).join(", ")
625
+ import_chalk2.default.green(`Generated (zod): ${files.length} files`),
626
+ files.map((f) => import_chalk2.default.cyan(f)).join(", ")
548
627
  );
549
628
  newFiles.push(...files);
550
629
  } catch (e) {
551
630
  console.error(
552
- import_chalk.default.red("Zod generator missing."),
553
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-zod")
631
+ import_chalk2.default.red("Zod generator missing."),
632
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-zod")
554
633
  );
555
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
634
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
556
635
  return;
557
636
  }
558
637
  } else if (g.kind === "valibot") {
@@ -568,16 +647,16 @@ program.command("watch").description("Watch schema and regenerate on changes").o
568
647
  fileSuffix: g.fileSuffix
569
648
  });
570
649
  opts.json ? console.log(JSON.stringify({ event: "generate_complete", kind: g.kind, files })) : console.log(
571
- import_chalk.default.green(`Generated (valibot): ${files.length} files`),
572
- files.map((f) => import_chalk.default.cyan(f)).join(", ")
650
+ import_chalk2.default.green(`Generated (valibot): ${files.length} files`),
651
+ files.map((f) => import_chalk2.default.cyan(f)).join(", ")
573
652
  );
574
653
  newFiles.push(...files);
575
654
  } catch (e) {
576
655
  console.error(
577
- import_chalk.default.red("Valibot generator missing."),
578
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-valibot")
656
+ import_chalk2.default.red("Valibot generator missing."),
657
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-valibot")
579
658
  );
580
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
659
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
581
660
  return;
582
661
  }
583
662
  } else if (g.kind === "arktype") {
@@ -593,16 +672,16 @@ program.command("watch").description("Watch schema and regenerate on changes").o
593
672
  fileSuffix: g.fileSuffix
594
673
  });
595
674
  opts.json ? console.log(JSON.stringify({ event: "generate_complete", kind: g.kind, files })) : console.log(
596
- import_chalk.default.green(`Generated (arktype): ${files.length} files`),
597
- files.map((f) => import_chalk.default.cyan(f)).join(", ")
675
+ import_chalk2.default.green(`Generated (arktype): ${files.length} files`),
676
+ files.map((f) => import_chalk2.default.cyan(f)).join(", ")
598
677
  );
599
678
  newFiles.push(...files);
600
679
  } catch (e) {
601
680
  console.error(
602
- import_chalk.default.red("ArkType generator missing."),
603
- import_chalk.default.yellow("\nInstall with: npm install @drzl/generator-arktype")
681
+ import_chalk2.default.red("ArkType generator missing."),
682
+ import_chalk2.default.yellow("\nInstall with: npm install @drzl/generator-arktype")
604
683
  );
605
- console.error(import_chalk.default.gray("Error details:"), e?.message ?? e);
684
+ console.error(import_chalk2.default.gray("Error details:"), e?.message ?? e);
606
685
  return;
607
686
  }
608
687
  }
@@ -610,12 +689,16 @@ program.command("watch").description("Watch schema and regenerate on changes").o
610
689
  const added = newFiles.filter((f) => !lastFiles.includes(f));
611
690
  const removed = lastFiles.filter((f) => !newFiles.includes(f));
612
691
  opts.json ? console.log(JSON.stringify({ event: "diff", added, removed })) : (() => {
613
- if (added.length) console.log(import_chalk.default.blue(`Added: ${added.join(", ")}`));
614
- if (removed.length) console.log(import_chalk.default.yellow(`Removed: ${removed.join(", ")}`));
692
+ if (added.length) console.log(import_chalk2.default.blue(`Added: ${added.join(", ")}`));
693
+ if (removed.length) console.log(import_chalk2.default.yellow(`Removed: ${removed.join(", ")}`));
615
694
  })();
695
+ if (newFiles.length && !opts.json) {
696
+ const reason = opts.pipeline && opts.pipeline !== "all" ? `watch:${opts.pipeline}` : "watch";
697
+ maybeShowSponsorMessage({ reason });
698
+ }
616
699
  lastFiles = newFiles;
617
700
  } catch (e) {
618
- opts.json ? console.log(JSON.stringify({ event: "error", message: String(e?.message ?? e) })) : console.error(import_chalk.default.red("Watch pipeline failed:"), e?.message ?? e);
701
+ opts.json ? console.log(JSON.stringify({ event: "error", message: String(e?.message ?? e) })) : console.error(import_chalk2.default.red("Watch pipeline failed:"), e?.message ?? e);
619
702
  }
620
703
  };
621
704
  const debounced = Number(opts.debounce) || 200;
@@ -640,18 +723,18 @@ program.command("watch").description("Watch schema and regenerate on changes").o
640
723
  );
641
724
  } else {
642
725
  console.log(
643
- import_chalk.default.gray(
644
- "Watching:\n " + Array.from(currentTargets).map((p) => path2.relative(process.cwd(), p)).join("\n ")
726
+ import_chalk2.default.gray(
727
+ "Watching:\n " + Array.from(currentTargets).map((p) => path3.relative(process.cwd(), p)).join("\n ")
645
728
  )
646
729
  );
647
730
  }
648
- watcher.on("add", (p) => trigger(p)).on("change", (p) => trigger(p)).on("unlink", (p) => trigger(p)).on("error", (err) => console.error(import_chalk.default.red("Watcher error:"), err));
731
+ watcher.on("add", (p) => trigger(p)).on("change", (p) => trigger(p)).on("unlink", (p) => trigger(p)).on("error", (err) => console.error(import_chalk2.default.red("Watcher error:"), err));
649
732
  await run();
650
733
  });
651
734
  program.command("init").description("Scaffold a drzl.config.ts").option("-y, --yes", "accept defaults").action(async (_opts) => {
652
735
  const fs2 = await import("fs/promises");
653
- const path3 = await import("path");
654
- const target = path3.resolve(process.cwd(), "drzl.config.ts");
736
+ const path4 = await import("path");
737
+ const target = path4.resolve(process.cwd(), "drzl.config.ts");
655
738
  const template = `export default {
656
739
  schema: 'src/db/schema.ts',
657
740
  outDir: 'src/api',
@@ -663,9 +746,9 @@ program.command("init").description("Scaffold a drzl.config.ts").option("-y, --y
663
746
  `;
664
747
  try {
665
748
  await fs2.writeFile(target, template, { flag: "wx" });
666
- console.log(import_chalk.default.green(`Created ${target}`));
749
+ console.log(import_chalk2.default.green(`Created ${target}`));
667
750
  } catch (e) {
668
- console.error(import_chalk.default.red("Init failed:"), e?.message ?? e);
751
+ console.error(import_chalk2.default.red("Init failed:"), e?.message ?? e);
669
752
  process.exit(1);
670
753
  }
671
754
  });