@dreamy-ui/cli 2.0.2 → 2.0.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/dist/index.js CHANGED
@@ -19812,6 +19812,8 @@ var processEnvSchema = z.object({
19812
19812
  var addCommandFlagsSchema = z.object({
19813
19813
  force: z.boolean().optional(),
19814
19814
  dryRun: z.boolean().optional(),
19815
+ skipInstall: z.boolean().optional(),
19816
+ skipCodegen: z.boolean().optional(),
19815
19817
  outdir: z.string().optional(),
19816
19818
  all: z.boolean().optional(),
19817
19819
  tsx: z.boolean().optional()
@@ -20004,9 +20006,9 @@ async function tasks(tasks2) {
20004
20006
 
20005
20007
  // src/commands/add.ts
20006
20008
  var debug2 = createDebug("dreamy-ui:add");
20007
- var AddCommand = new Command("add").description("Add components to your project").argument("[components...]", "components to add").option("-d, --dry-run", "Dry run").option("--outdir <dir>", "Output directory to write the components").option("--all", "Add all components").option("-f, --force", "Overwrite existing files").option("--tsx", "Convert to TSX").action(async (selectedComponents, flags) => {
20009
+ var AddCommand = new Command("add").description("Add components to your project").argument("[components...]", "components to add").option("-d, --dry-run", "Dry run").option("--skip-install", "Skip dependency installation").option("--skip-codegen", "Skip running panda codegen").option("--outdir <dir>", "Output directory to write the components").option("--all", "Add all components").option("-f, --force", "Overwrite existing files").option("--tsx", "Convert to TSX").action(async (selectedComponents, flags) => {
20008
20010
  const parsedFlags = addCommandFlagsSchema.parse(flags);
20009
- const { dryRun, force, all, tsx } = parsedFlags;
20011
+ const { dryRun, force, all, tsx, skipInstall, skipCodegen } = parsedFlags;
20010
20012
  const ctx = await getProjectContext({
20011
20013
  cwd: parsedFlags.outdir || process.cwd(),
20012
20014
  tsx
@@ -20116,7 +20118,7 @@ var AddCommand = new Command("add").description("Add components to your project"
20116
20118
  await tasks([
20117
20119
  {
20118
20120
  title: "Installing required dependencies...",
20119
- enabled: !!npmDependencies.length && !dryRun,
20121
+ enabled: !!npmDependencies.length && !dryRun && !skipInstall,
20120
20122
  task: () => installCommand([...npmDependencies, "--silent"], outdir)
20121
20123
  },
20122
20124
  {
@@ -20279,7 +20281,7 @@ var AddCommand = new Command("add").description("Add components to your project"
20279
20281
  },
20280
20282
  {
20281
20283
  title: "Running panda codegen",
20282
- enabled: !dryRun,
20284
+ enabled: !dryRun && !skipCodegen,
20283
20285
  task: async () => {
20284
20286
  await pandaCodegenCommand(process.cwd());
20285
20287
  return "panda codegen finished";
@@ -21395,6 +21397,54 @@ async function updateTsConfig(cwd, framework) {
21395
21397
  return false;
21396
21398
  }
21397
21399
  }
21400
+ async function updatePackageJson(cwd) {
21401
+ try {
21402
+ const packageJsonPath = join$2(cwd, "package.json");
21403
+ if (!existsSync(packageJsonPath)) {
21404
+ p4.log.warn("\u26A0 Could not find package.json to add prepare script");
21405
+ p4.log.info(
21406
+ '\u{1F4A1} Manually add this script to your package.json:\n "prepare": "panda codegen"'
21407
+ );
21408
+ return false;
21409
+ }
21410
+ const content = readFileSync(packageJsonPath, "utf-8");
21411
+ const packageJson = JSON.parse(content);
21412
+ if (packageJson.scripts?.prepare) {
21413
+ if (packageJson.scripts.prepare.includes("panda codegen")) {
21414
+ p4.log.info("\u2298 prepare script already configured with panda codegen");
21415
+ return true;
21416
+ }
21417
+ const shouldUpdate = await p4.confirm({
21418
+ message: "prepare script exists but doesn't include 'panda codegen'. Update it?",
21419
+ initialValue: true
21420
+ });
21421
+ if (p4.isCancel(shouldUpdate) || !shouldUpdate) {
21422
+ p4.log.warn("\u2298 Skipped package.json prepare script update");
21423
+ p4.log.info(
21424
+ "\u{1F4A1} Manually add 'panda codegen' to your prepare script in package.json"
21425
+ );
21426
+ return false;
21427
+ }
21428
+ packageJson.scripts.prepare = `${packageJson.scripts.prepare} && panda codegen`;
21429
+ } else {
21430
+ if (!packageJson.scripts) {
21431
+ packageJson.scripts = {};
21432
+ }
21433
+ packageJson.scripts.prepare = "panda codegen";
21434
+ }
21435
+ await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n", "utf-8");
21436
+ p4.log.success("\u2713 Added prepare script to package.json");
21437
+ return true;
21438
+ } catch (error) {
21439
+ p4.log.error(
21440
+ `\u2717 Failed to update package.json: ${error instanceof Error ? error.message : String(error)}`
21441
+ );
21442
+ p4.log.warn(
21443
+ '\u{1F4A1} Manually add this script to your package.json:\n "prepare": "panda codegen"'
21444
+ );
21445
+ return false;
21446
+ }
21447
+ }
21398
21448
  async function runPandaCodegen(cwd) {
21399
21449
  const s = p4.spinner();
21400
21450
  try {
@@ -21540,6 +21590,7 @@ var InitCommand = new Command("init").description("Initialize Dreamy UI in your
21540
21590
  p4.log.info("\u2298 Skipped dependency installation");
21541
21591
  }
21542
21592
  await createPandaConfig(cwd, framework, isTypeScript);
21593
+ await updatePackageJson(cwd);
21543
21594
  await setupPostCSS(cwd, framework);
21544
21595
  await updateViteConfig(cwd, framework);
21545
21596
  if (framework.type === "react-router") {
@@ -21587,7 +21638,7 @@ var ListCommand = new Command("list").description("List all available components
21587
21638
  process.setMaxListeners(Number.POSITIVE_INFINITY);
21588
21639
  async function run() {
21589
21640
  p4.intro("Dreamy UI CLI \u{1F4AB}");
21590
- const packageJson = await import('./package-5IJ5ICCX.js');
21641
+ const packageJson = await import('./package-QAS4MTCY.js');
21591
21642
  const program = new Command().name("dreamy-ui").description("The official CLI for Dreamy UI projects").version(packageJson.version);
21592
21643
  program.addCommand(InitCommand);
21593
21644
  program.addCommand(AddCommand);
@@ -0,0 +1,94 @@
1
+ import { createRequire } from 'module';
2
+ import './chunk-XML6CAC2.js';
3
+
4
+ createRequire(import.meta.url);
5
+
6
+ // package.json
7
+ var name = "@dreamy-ui/cli";
8
+ var version = "2.0.2";
9
+ var description = "CLI for Dreamy UI";
10
+ var author = "imexoodeex";
11
+ var license = "MIT";
12
+ var type = "module";
13
+ var sideEffects = false;
14
+ var main = "dist/index.js";
15
+ var module$1 = "dist/index.js";
16
+ var types = "dist/index.d.ts";
17
+ var files = [
18
+ "dist",
19
+ "bin"
20
+ ];
21
+ var bin = {
22
+ dreamy: "./bin/index.js"
23
+ };
24
+ var exports$1 = {
25
+ ".": {
26
+ source: "./src/index.ts",
27
+ import: {
28
+ types: "./dist/index.d.ts",
29
+ default: "./dist/index.js"
30
+ }
31
+ },
32
+ "./package.json": "./package.json"
33
+ };
34
+ var scripts = {
35
+ dev: "tsup --watch",
36
+ start: "bun run ./src/index.ts",
37
+ lint: "biome lint ./src",
38
+ build: "tsup",
39
+ "build:dev": "tsup",
40
+ "build:production": "tsup"
41
+ };
42
+ var dependencies = {
43
+ "@clack/prompts": "^0.11.0",
44
+ "@effect/platform": "0.69.28",
45
+ "@visulima/boxen": "^1.0.30",
46
+ "cli-table": "^0.3.11",
47
+ commander: "^13.1.0",
48
+ debug: "^4.4.0",
49
+ "fs-extra": "11.2.0",
50
+ globby: "14.0.2",
51
+ "https-proxy-agent": "^7.0.6",
52
+ "look-it-up": "^2.1.0",
53
+ "node-fetch": "^3.3.2",
54
+ "package-manager-detector": "^1.2.0",
55
+ picocolors: "^1.1.1",
56
+ "pkg-dir": "8.0.0",
57
+ sucrase: "^3.35.0",
58
+ yargs: "17.7.2",
59
+ zod: "^3.23.8"
60
+ };
61
+ var devDependencies = {
62
+ "@types/cli-table": "^0.3.4",
63
+ "@types/debug": "^4.1.12",
64
+ "@types/fs-extra": "11.0.4",
65
+ "@types/node": "22.10.1",
66
+ "@types/yargs": "17.0.33",
67
+ dotenv: "^17.2.3",
68
+ tsup: "^8.4.0",
69
+ typescript: "5.7.2"
70
+ };
71
+ var peerDependencies = {
72
+ typescript: "^5.0.0"
73
+ };
74
+ var package_default = {
75
+ name,
76
+ version,
77
+ description,
78
+ author,
79
+ license,
80
+ type,
81
+ sideEffects,
82
+ main,
83
+ module: module$1,
84
+ types,
85
+ files,
86
+ bin,
87
+ exports: exports$1,
88
+ scripts,
89
+ dependencies,
90
+ devDependencies,
91
+ peerDependencies
92
+ };
93
+
94
+ export { author, bin, package_default as default, dependencies, description, devDependencies, exports$1 as exports, files, license, main, module$1 as module, name, peerDependencies, scripts, sideEffects, type, types, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamy-ui/cli",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "CLI for Dreamy UI",
5
5
  "author": "imexoodeex",
6
6
  "license": "MIT",