@cloudwick/astral-ui-cli 0.1.1 → 0.2.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
@@ -121,6 +121,7 @@ astral-ui add [component...]
121
121
  | `--all` | `-a` | Add all available components |
122
122
  | `--path <path>` | `-p` | Specify the path to add the component to |
123
123
  | `--silent` | `-s` | Mute output |
124
+ | `--skip-dependencies` | | Skip installing internal component dependencies |
124
125
 
125
126
  #### Examples
126
127
 
@@ -133,6 +134,9 @@ astral-ui add --all
133
134
 
134
135
  # Add a component to a specific directory
135
136
  astral-ui add button --path ./components/custom
137
+
138
+ # Skip installing internal component dependencies
139
+ astral-ui add button --skip-dependencies
136
140
  ```
137
141
 
138
142
  ### `repair-tailwind`
package/dist/index.js CHANGED
@@ -1442,6 +1442,10 @@ var REGISTRY = {
1442
1442
  "class-variance-authority",
1443
1443
  "react"
1444
1444
  ],
1445
+ "internalDependencies": [
1446
+ "adpicon",
1447
+ "button"
1448
+ ],
1445
1449
  "files": [
1446
1450
  {
1447
1451
  "name": "index.ts",
@@ -1468,6 +1472,7 @@ var REGISTRY = {
1468
1472
  "react",
1469
1473
  "class-variance-authority"
1470
1474
  ],
1475
+ "internalDependencies": [],
1471
1476
  "files": [
1472
1477
  {
1473
1478
  "name": "svgObjects.tsx",
@@ -1498,6 +1503,7 @@ var REGISTRY = {
1498
1503
  "class-variance-authority",
1499
1504
  "react"
1500
1505
  ],
1506
+ "internalDependencies": [],
1501
1507
  "files": [
1502
1508
  {
1503
1509
  "name": "index.ts",
@@ -1524,6 +1530,9 @@ var REGISTRY = {
1524
1530
  "class-variance-authority",
1525
1531
  "react"
1526
1532
  ],
1533
+ "internalDependencies": [
1534
+ "avatar"
1535
+ ],
1527
1536
  "files": [
1528
1537
  {
1529
1538
  "name": "index.ts",
@@ -1550,6 +1559,7 @@ var REGISTRY = {
1550
1559
  "class-variance-authority",
1551
1560
  "react"
1552
1561
  ],
1562
+ "internalDependencies": [],
1553
1563
  "files": [
1554
1564
  {
1555
1565
  "name": "index.ts",
@@ -1576,6 +1586,9 @@ var REGISTRY = {
1576
1586
  "class-variance-authority",
1577
1587
  "react"
1578
1588
  ],
1589
+ "internalDependencies": [
1590
+ "adpicon"
1591
+ ],
1579
1592
  "files": [
1580
1593
  {
1581
1594
  "name": "index.ts",
@@ -1607,6 +1620,10 @@ var REGISTRY = {
1607
1620
  "react",
1608
1621
  "@floating-ui/react"
1609
1622
  ],
1623
+ "internalDependencies": [
1624
+ "tooltip",
1625
+ "adpicon"
1626
+ ],
1610
1627
  "files": [
1611
1628
  {
1612
1629
  "name": "index.ts",
@@ -1633,6 +1650,11 @@ var REGISTRY = {
1633
1650
  "class-variance-authority",
1634
1651
  "react"
1635
1652
  ],
1653
+ "internalDependencies": [
1654
+ "ctagroup",
1655
+ "button",
1656
+ "adpicon"
1657
+ ],
1636
1658
  "files": [
1637
1659
  {
1638
1660
  "name": "index.ts",
@@ -1659,6 +1681,7 @@ var REGISTRY = {
1659
1681
  "class-variance-authority",
1660
1682
  "react"
1661
1683
  ],
1684
+ "internalDependencies": [],
1662
1685
  "files": [
1663
1686
  {
1664
1687
  "name": "index.ts",
@@ -1788,6 +1811,9 @@ export const checkmarkClipPath = \`polygon(
1788
1811
  "class-variance-authority",
1789
1812
  "react"
1790
1813
  ],
1814
+ "internalDependencies": [
1815
+ "checkbox"
1816
+ ],
1791
1817
  "files": [
1792
1818
  {
1793
1819
  "name": "index.ts",
@@ -1815,6 +1841,11 @@ export const checkmarkClipPath = \`polygon(
1815
1841
  "react",
1816
1842
  "react-dom"
1817
1843
  ],
1844
+ "internalDependencies": [
1845
+ "adpicon",
1846
+ "dropdown",
1847
+ "tooltip"
1848
+ ],
1818
1849
  "files": [
1819
1850
  {
1820
1851
  "name": "index.ts",
@@ -1845,6 +1876,22 @@ export const checkmarkClipPath = \`polygon(
1845
1876
  "react-datepicker",
1846
1877
  "clsx"
1847
1878
  ],
1879
+ "internalDependencies": [
1880
+ "loader",
1881
+ "adpicon",
1882
+ "emptystate",
1883
+ "badge",
1884
+ "button",
1885
+ "modal",
1886
+ "radio",
1887
+ "textfield",
1888
+ "select",
1889
+ "pagination",
1890
+ "checkbox",
1891
+ "panel",
1892
+ "accordion",
1893
+ "toggle"
1894
+ ],
1848
1895
  "files": [
1849
1896
  {
1850
1897
  "name": "table.tsx",
@@ -1896,6 +1943,9 @@ export const checkmarkClipPath = \`polygon(
1896
1943
  "react",
1897
1944
  "react-datepicker"
1898
1945
  ],
1946
+ "internalDependencies": [
1947
+ "textfield"
1948
+ ],
1899
1949
  "files": [
1900
1950
  {
1901
1951
  "name": "index.ts",
@@ -1928,6 +1978,7 @@ export const checkmarkClipPath = \`polygon(
1928
1978
  "react-dom",
1929
1979
  "@floating-ui/react"
1930
1980
  ],
1981
+ "internalDependencies": [],
1931
1982
  "files": [
1932
1983
  {
1933
1984
  "name": "index.ts",
@@ -2075,6 +2126,9 @@ DropdownItem.displayName = "DropdownItem";`
2075
2126
  "class-variance-authority",
2076
2127
  "react"
2077
2128
  ],
2129
+ "internalDependencies": [
2130
+ "button"
2131
+ ],
2078
2132
  "files": [
2079
2133
  {
2080
2134
  "name": "index.ts",
@@ -2109,6 +2163,12 @@ DropdownItem.displayName = "DropdownItem";`
2109
2163
  "react",
2110
2164
  "class-variance-authority"
2111
2165
  ],
2166
+ "internalDependencies": [
2167
+ "adpicon",
2168
+ "progress",
2169
+ "tooltip",
2170
+ "button"
2171
+ ],
2112
2172
  "files": [
2113
2173
  {
2114
2174
  "name": "storyUtil.tsx",
@@ -2147,6 +2207,7 @@ DropdownItem.displayName = "DropdownItem";`
2147
2207
  "class-variance-authority",
2148
2208
  "react"
2149
2209
  ],
2210
+ "internalDependencies": [],
2150
2211
  "files": [
2151
2212
  {
2152
2213
  "name": "loaderVariants.ts",
@@ -2175,6 +2236,9 @@ DropdownItem.displayName = "DropdownItem";`
2175
2236
  "react-dom",
2176
2237
  "react-focus-on"
2177
2238
  ],
2239
+ "internalDependencies": [
2240
+ "button"
2241
+ ],
2178
2242
  "files": [
2179
2243
  {
2180
2244
  "name": "modalVariants.ts",
@@ -2201,6 +2265,7 @@ DropdownItem.displayName = "DropdownItem";`
2201
2265
  "class-variance-authority",
2202
2266
  "react"
2203
2267
  ],
2268
+ "internalDependencies": [],
2204
2269
  "files": [
2205
2270
  {
2206
2271
  "name": "otpVariants.ts",
@@ -2231,6 +2296,10 @@ DropdownItem.displayName = "DropdownItem";`
2231
2296
  "class-variance-authority",
2232
2297
  "react"
2233
2298
  ],
2299
+ "internalDependencies": [
2300
+ "button",
2301
+ "adpicon"
2302
+ ],
2234
2303
  "files": [
2235
2304
  {
2236
2305
  "name": "paginationVariants.ts",
@@ -2259,6 +2328,10 @@ DropdownItem.displayName = "DropdownItem";`
2259
2328
  "react-dom",
2260
2329
  "react-focus-on"
2261
2330
  ],
2331
+ "internalDependencies": [
2332
+ "button",
2333
+ "adpicon"
2334
+ ],
2262
2335
  "files": [
2263
2336
  {
2264
2337
  "name": "panelVariants.ts",
@@ -2398,6 +2471,10 @@ PanelHeader.displayName = "PanelHeader";`
2398
2471
  "class-variance-authority",
2399
2472
  "react"
2400
2473
  ],
2474
+ "internalDependencies": [
2475
+ "panel",
2476
+ "button"
2477
+ ],
2401
2478
  "files": [
2402
2479
  {
2403
2480
  "name": "panelGroupVariants.ts",
@@ -2493,6 +2570,11 @@ PanelGroup.displayName = "PanelGroup";`
2493
2570
  "dependencies": [
2494
2571
  "react"
2495
2572
  ],
2573
+ "internalDependencies": [
2574
+ "textfield",
2575
+ "button",
2576
+ "adpicon"
2577
+ ],
2496
2578
  "files": [
2497
2579
  {
2498
2580
  "name": "passwordField.tsx",
@@ -2515,6 +2597,7 @@ PanelGroup.displayName = "PanelGroup";`
2515
2597
  "class-variance-authority",
2516
2598
  "react"
2517
2599
  ],
2600
+ "internalDependencies": [],
2518
2601
  "files": [
2519
2602
  {
2520
2603
  "name": "progressVariants.ts",
@@ -2541,6 +2624,7 @@ PanelGroup.displayName = "PanelGroup";`
2541
2624
  "class-variance-authority",
2542
2625
  "react"
2543
2626
  ],
2627
+ "internalDependencies": [],
2544
2628
  "files": [
2545
2629
  {
2546
2630
  "name": "radioVariants.ts",
@@ -2619,6 +2703,9 @@ export const radioLabelVariants = cva(
2619
2703
  "class-variance-authority",
2620
2704
  "react"
2621
2705
  ],
2706
+ "internalDependencies": [
2707
+ "radio"
2708
+ ],
2622
2709
  "files": [
2623
2710
  {
2624
2711
  "name": "radioGroupVariants.ts",
@@ -2646,6 +2733,7 @@ export const radioLabelVariants = cva(
2646
2733
  "react",
2647
2734
  "react-merge-refs"
2648
2735
  ],
2736
+ "internalDependencies": [],
2649
2737
  "files": [
2650
2738
  {
2651
2739
  "name": "utils.ts",
@@ -2678,6 +2766,11 @@ export const radioLabelVariants = cva(
2678
2766
  "react",
2679
2767
  "clsx"
2680
2768
  ],
2769
+ "internalDependencies": [
2770
+ "checkbox",
2771
+ "adpicon",
2772
+ "button"
2773
+ ],
2681
2774
  "files": [
2682
2775
  {
2683
2776
  "name": "utils.ts",
@@ -2708,6 +2801,9 @@ export const radioLabelVariants = cva(
2708
2801
  "class-variance-authority",
2709
2802
  "react"
2710
2803
  ],
2804
+ "internalDependencies": [
2805
+ "adpicon"
2806
+ ],
2711
2807
  "files": [
2712
2808
  {
2713
2809
  "name": "tabsVariants.ts",
@@ -2734,6 +2830,10 @@ export const radioLabelVariants = cva(
2734
2830
  "class-variance-authority",
2735
2831
  "react"
2736
2832
  ],
2833
+ "internalDependencies": [
2834
+ "adpicon",
2835
+ "button"
2836
+ ],
2737
2837
  "files": [
2738
2838
  {
2739
2839
  "name": "textCopyVariants.ts",
@@ -2774,6 +2874,9 @@ export const textCopyVariants = cva(
2774
2874
  "class-variance-authority",
2775
2875
  "react"
2776
2876
  ],
2877
+ "internalDependencies": [
2878
+ "adpicon"
2879
+ ],
2777
2880
  "files": [
2778
2881
  {
2779
2882
  "name": "textFieldVariants.ts",
@@ -2800,6 +2903,9 @@ export const textCopyVariants = cva(
2800
2903
  "class-variance-authority",
2801
2904
  "react"
2802
2905
  ],
2906
+ "internalDependencies": [
2907
+ "adpicon"
2908
+ ],
2803
2909
  "files": [
2804
2910
  {
2805
2911
  "name": "textareaVariants.ts",
@@ -2826,6 +2932,10 @@ export const textCopyVariants = cva(
2826
2932
  "class-variance-authority",
2827
2933
  "react"
2828
2934
  ],
2935
+ "internalDependencies": [
2936
+ "adpicon",
2937
+ "button"
2938
+ ],
2829
2939
  "files": [
2830
2940
  {
2831
2941
  "name": "toastVariants.ts",
@@ -2852,6 +2962,9 @@ export const textCopyVariants = cva(
2852
2962
  "class-variance-authority",
2853
2963
  "react"
2854
2964
  ],
2965
+ "internalDependencies": [
2966
+ "adpicon"
2967
+ ],
2855
2968
  "files": [
2856
2969
  {
2857
2970
  "name": "toggleVariants.ts",
@@ -2879,6 +2992,9 @@ export const textCopyVariants = cva(
2879
2992
  "react",
2880
2993
  "@floating-ui/react"
2881
2994
  ],
2995
+ "internalDependencies": [
2996
+ "adpicon"
2997
+ ],
2882
2998
  "files": [
2883
2999
  {
2884
3000
  "name": "tooltipVariants.ts",
@@ -2905,6 +3021,10 @@ export const textCopyVariants = cva(
2905
3021
  "class-variance-authority",
2906
3022
  "react"
2907
3023
  ],
3024
+ "internalDependencies": [
3025
+ "button",
3026
+ "modal"
3027
+ ],
2908
3028
  "files": [
2909
3029
  {
2910
3030
  "name": "truncateVariants.ts",
@@ -3144,13 +3264,15 @@ var addOptionsSchema = import_zod2.z.object({
3144
3264
  overwrite: import_zod2.z.boolean().default(false),
3145
3265
  all: import_zod2.z.boolean().default(false),
3146
3266
  path: import_zod2.z.string().optional(),
3147
- silent: import_zod2.z.boolean().default(false)
3267
+ silent: import_zod2.z.boolean().default(false),
3268
+ skipDependencies: import_zod2.z.boolean().default(false)
3269
+ // Add option to skip dependencies
3148
3270
  });
3149
3271
  var add = new import_commander2.Command().name("add").description("add a component to your project").argument("[components...]", "the components to add or a url to the component").option("-y, --yes", "skip confirmation prompts", false).option("-o, --overwrite", "overwrite existing files", false).option(
3150
3272
  "-c, --cwd <cwd>",
3151
3273
  "the working directory. defaults to the current directory",
3152
3274
  process.cwd()
3153
- ).option("-a, --all", "add all available components", false).option("-p, --path <path>", "the path to add the component to").option("-s, --silent", "mute output", false).action(async (components, opts) => {
3275
+ ).option("-a, --all", "add all available components", false).option("-p, --path <path>", "the path to add the component to").option("-s, --silent", "mute output", false).option("--skip-dependencies", "skip installing dependencies", false).action(async (components, opts) => {
3154
3276
  try {
3155
3277
  const options = addOptionsSchema.parse(opts);
3156
3278
  const cwd = import_path8.default.resolve(options.cwd);
@@ -3204,8 +3326,25 @@ var add = new import_commander2.Command().name("add").description("add a compone
3204
3326
  );
3205
3327
  }
3206
3328
  const dependenciesToInstall = /* @__PURE__ */ new Set();
3329
+ const installedOrPendingComponents = /* @__PURE__ */ new Set();
3330
+ const componentDependencies = /* @__PURE__ */ new Map();
3331
+ const explicitlyRequestedComponents = new Set(selectedComponents);
3332
+ if (!options.skipDependencies) {
3333
+ selectedComponents = await resolveAllComponentDependencies(
3334
+ selectedComponents,
3335
+ allComponents,
3336
+ componentDependencies
3337
+ );
3338
+ }
3207
3339
  for (const componentName of selectedComponents) {
3208
- const spinner = (0, import_ora2.default)(`Adding ${componentName}...`).start();
3340
+ if (installedOrPendingComponents.has(componentName)) {
3341
+ continue;
3342
+ }
3343
+ installedOrPendingComponents.add(componentName);
3344
+ const isExplicitlyRequested = explicitlyRequestedComponents.has(componentName);
3345
+ const spinner = (0, import_ora2.default)(
3346
+ `Adding ${componentName}${isExplicitlyRequested ? "" : " (dependency)"}`
3347
+ ).start();
3209
3348
  const component = allComponents.find((c) => c.name === componentName);
3210
3349
  if (!component) {
3211
3350
  spinner.fail(`Component ${componentName} not found`);
@@ -3263,7 +3402,7 @@ var add = new import_commander2.Command().name("add").description("add a compone
3263
3402
  continue;
3264
3403
  }
3265
3404
  if (success) {
3266
- spinner.succeed(`Added ${componentName}`);
3405
+ spinner.succeed(`Added ${componentName}${isExplicitlyRequested ? "" : " (dependency)"}`);
3267
3406
  if (dependencies && dependencies.length > 0) {
3268
3407
  dependencies.filter(
3269
3408
  (dep) => !(dep === "@utils" || dep === "@components" || dep.startsWith("@components/") || dep.startsWith("@/") || dep.includes("/lib/"))
@@ -3297,12 +3436,58 @@ var add = new import_commander2.Command().name("add").description("add a compone
3297
3436
  }
3298
3437
  if (!options.silent) {
3299
3438
  console.info(import_chalk4.default.green("\n\u2705 Components added successfully!"));
3439
+ const addedAsDependencies = [...installedOrPendingComponents].filter(
3440
+ (comp) => !explicitlyRequestedComponents.has(comp)
3441
+ );
3442
+ if (addedAsDependencies.length > 0) {
3443
+ console.info(
3444
+ import_chalk4.default.cyan("\nThe following components were automatically added as dependencies:")
3445
+ );
3446
+ addedAsDependencies.forEach((comp) => {
3447
+ const deps = componentDependencies.get(comp) || [];
3448
+ if (deps.length > 0) {
3449
+ const requiredBy = deps.filter(
3450
+ (d) => selectedComponents.includes(d) && (explicitlyRequestedComponents.has(d) || componentDependencies.has(d))
3451
+ );
3452
+ console.info(` - ${comp} (required by: ${requiredBy.join(", ")})`);
3453
+ } else {
3454
+ console.info(` - ${comp}`);
3455
+ }
3456
+ });
3457
+ }
3300
3458
  }
3301
3459
  } catch (error) {
3302
3460
  console.error(import_chalk4.default.red("Error adding components:"), error);
3303
3461
  process.exit(1);
3304
3462
  }
3305
3463
  });
3464
+ async function resolveAllComponentDependencies(componentNames, allComponents, dependencyMap) {
3465
+ const result = /* @__PURE__ */ new Set();
3466
+ const processedComponents = /* @__PURE__ */ new Set();
3467
+ async function processComponent(name, parentComponents = []) {
3468
+ if (processedComponents.has(name)) {
3469
+ return;
3470
+ }
3471
+ processedComponents.add(name);
3472
+ result.add(name);
3473
+ const component = allComponents.find((c) => c.name === name);
3474
+ if (!component) {
3475
+ return;
3476
+ }
3477
+ const internalDependencies = component.internalDependencies;
3478
+ for (const depName of internalDependencies) {
3479
+ if (!dependencyMap.has(depName)) {
3480
+ dependencyMap.set(depName, []);
3481
+ }
3482
+ dependencyMap.get(depName)?.push(name);
3483
+ await processComponent(depName, [...parentComponents, name]);
3484
+ }
3485
+ }
3486
+ for (const componentName of componentNames) {
3487
+ await processComponent(componentName);
3488
+ }
3489
+ return Array.from(result);
3490
+ }
3306
3491
 
3307
3492
  // src/commands/repair-tailwind.ts
3308
3493
  init_cjs_shims();
@@ -3768,7 +3953,7 @@ import { cn } from '@utils';
3768
3953
  var import_gradient_string = __toESM(require("gradient-string"));
3769
3954
  var packageInfo = {
3770
3955
  name: "@cloudwick/astral-ui-cli",
3771
- version: "0.1.1"
3956
+ version: "0.2.0"
3772
3957
  };
3773
3958
  var program = new import_commander5.Command().name(packageInfo.name).description("CLI for installing Astral UI components in any codebase").version(
3774
3959
  packageInfo.version,