@transight-design/cli 0.2.1 → 0.2.2

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/dist/index.js +44 -3
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -6,10 +6,16 @@ import { Command as Command6 } from "commander";
6
6
  // src/commands/init.ts
7
7
  import { Command } from "commander";
8
8
  import pc2 from "picocolors";
9
+ import * as p from "@clack/prompts";
9
10
 
10
11
  // src/config.ts
11
12
  var GITHUB_REPO = "traverse-corp/transight-design";
12
13
  var BUNDLE_ITEM = "transight-design";
14
+ var BUNDLE_ITEMS = {
15
+ base: "base",
16
+ essential: "essential",
17
+ all: BUNDLE_ITEM
18
+ };
13
19
  var githubAddress = (item, ref) => {
14
20
  const base = `${GITHUB_REPO}/${item}`;
15
21
  return ref ? `${base}#${ref}` : base;
@@ -49,10 +55,45 @@ var runShadcn = (args, options = {}) => {
49
55
  };
50
56
 
51
57
  // src/commands/init.ts
52
- var initCommand = new Command("init").description("Transight Design System \uC804\uCCB4 \uBC88\uB4E4 \uC124\uCE58 (\uD1A0\uD070\xB7\uD3F0\uD2B8\xB7lib\xB7hooks\xB7\uCEF4\uD3EC\uB10C\uD2B8)").option("--dry-run", "\uC2E4\uD589\uD558\uC9C0 \uC54A\uACE0 \uD638\uCD9C\uD560 \uBA85\uB839\uB9CC \uCD9C\uB825", false).option("--ref <ref>", "GitHub \uB808\uD37C\uB7F0\uC2A4 (\uBE0C\uB79C\uCE58\xB7\uD0DC\uADF8\xB7SHA)").action(async (options) => {
58
+ var BUNDLE_CHOICES = [
59
+ {
60
+ value: "base",
61
+ label: "Base \uCEF4\uD3EC\uB10C\uD2B8\uB9CC",
62
+ hint: "shadcn \uD45C\uC900 base \uCEF4\uD3EC\uB10C\uD2B8 (accordion, button, dialog \uB4F1)"
63
+ },
64
+ {
65
+ value: "essential",
66
+ label: "\uD544\uC218 \uCEF4\uD3EC\uB10C\uD2B8\uB9CC",
67
+ hint: "\uC11C\uBE44\uC2A4 \uCD08\uAE30 \uAD6C\uC131\uC5D0 \uD544\uC694\uD55C \uD575\uC2EC \uD3FC/\uC561\uC158 \uCEF4\uD3EC\uB10C\uD2B8"
68
+ },
69
+ {
70
+ value: "all",
71
+ label: "\uC804\uCCB4 \uCEF4\uD3EC\uB10C\uD2B8",
72
+ hint: "\uD1A0\uD070 + \uD3F0\uD2B8 + lib + hook + \uBAA8\uB4E0 \uCEF4\uD3EC\uB10C\uD2B8"
73
+ }
74
+ ];
75
+ var isBundleKey = (value) => value !== void 0 && value in BUNDLE_ITEMS;
76
+ var initCommand = new Command("init").description("Transight Design System \uBC88\uB4E4 \uC124\uCE58 (base / essential / all \uC911 \uC120\uD0DD)").option("--dry-run", "\uC2E4\uD589\uD558\uC9C0 \uC54A\uACE0 \uD638\uCD9C\uD560 \uBA85\uB839\uB9CC \uCD9C\uB825", false).option("--ref <ref>", "GitHub \uB808\uD37C\uB7F0\uC2A4 (\uBE0C\uB79C\uCE58\xB7\uD0DC\uADF8\xB7SHA)").option(
77
+ "--bundle <name>",
78
+ "\uB300\uD654 \uD504\uB86C\uD504\uD2B8 \uC0DD\uB7B5 \u2014 base | essential | all"
79
+ ).action(async (options) => {
53
80
  console.log(pc2.bold(pc2.cyan("Transight Design System")) + " \u2014 init");
81
+ let bundle = isBundleKey(options.bundle) ? options.bundle : void 0;
82
+ if (!bundle) {
83
+ const selected = await p.select({
84
+ message: "\uC124\uCE58\uD560 \uCEF4\uD3EC\uB10C\uD2B8\uB97C \uC120\uD0DD\uD558\uC138\uC694",
85
+ options: BUNDLE_CHOICES,
86
+ initialValue: "all"
87
+ });
88
+ if (p.isCancel(selected)) {
89
+ p.cancel("\uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.");
90
+ process.exit(0);
91
+ }
92
+ bundle = selected;
93
+ }
94
+ const itemName = BUNDLE_ITEMS[bundle];
54
95
  const code = await runShadcn(
55
- ["add", githubAddress(BUNDLE_ITEM, options.ref)],
96
+ ["add", githubAddress(itemName, options.ref)],
56
97
  { dryRun: options.dryRun }
57
98
  );
58
99
  process.exit(code);
@@ -110,7 +151,7 @@ var resolveComponentPath = (component, override) => {
110
151
  join(process.cwd(), "src", "components", "custom", `${component}.tsx`),
111
152
  join(process.cwd(), "packages", "ui", "src", "components", `${component}.tsx`)
112
153
  ];
113
- return candidates.find((p) => existsSync(p)) ?? null;
154
+ return candidates.find((p2) => existsSync(p2)) ?? null;
114
155
  };
115
156
  var findPresetObjectRange = (source, component) => {
116
157
  const re = /([A-Za-z_$][\w$]*)VariantPresets\s*=\s*\{/g;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transight-design/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Transight Design System CLI — thin wrapper around `shadcn`",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  "access": "public"
22
22
  },
23
23
  "dependencies": {
24
+ "@clack/prompts": "^1.6.0",
24
25
  "commander": "^12.1.0",
25
26
  "picocolors": "^1.1.0"
26
27
  },