trix-ui 0.2.14 → 0.3.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.
Files changed (241) hide show
  1. package/dist/commands/add/analysis.d.ts +4 -4
  2. package/dist/commands/add/analysis.js +56 -56
  3. package/dist/commands/add/command.d.ts +2 -2
  4. package/dist/commands/add/command.js +205 -202
  5. package/dist/commands/add/command.js.map +1 -1
  6. package/dist/commands/add/config.d.ts +2 -2
  7. package/dist/commands/add/config.js +11 -11
  8. package/dist/commands/add/install.d.ts +27 -27
  9. package/dist/commands/add/install.js +80 -80
  10. package/dist/commands/add/package-manager.d.ts +1 -1
  11. package/dist/commands/add/package-manager.js +4 -4
  12. package/dist/commands/add/project-files.d.ts +2 -2
  13. package/dist/commands/add/project-files.js +17 -17
  14. package/dist/commands/add/prompts.d.ts +3 -3
  15. package/dist/commands/add/prompts.js +28 -28
  16. package/dist/commands/add/registry.d.ts +4 -4
  17. package/dist/commands/add/registry.js +6 -6
  18. package/dist/commands/add/types.d.ts +33 -33
  19. package/dist/commands/add/types.js +1 -1
  20. package/dist/commands/add/ui.d.ts +4 -4
  21. package/dist/commands/add/ui.js +55 -55
  22. package/dist/commands/add/validation.d.ts +3 -3
  23. package/dist/commands/add/validation.js +30 -30
  24. package/dist/commands/add-collection.d.ts +1 -1
  25. package/dist/commands/add-collection.js +1 -1
  26. package/dist/commands/add-composite.d.ts +2 -2
  27. package/dist/commands/add-composite.js +205 -201
  28. package/dist/commands/add-composite.js.map +1 -1
  29. package/dist/commands/add-section.d.ts +2 -2
  30. package/dist/commands/add-section.js +205 -201
  31. package/dist/commands/add-section.js.map +1 -1
  32. package/dist/commands/add-wrapper.d.ts +2 -2
  33. package/dist/commands/add-wrapper.js +205 -201
  34. package/dist/commands/add-wrapper.js.map +1 -1
  35. package/dist/commands/add.d.ts +1 -1
  36. package/dist/commands/add.js +1 -1
  37. package/dist/commands/build.d.ts +2 -2
  38. package/dist/commands/build.js +104 -104
  39. package/dist/commands/build.js.map +1 -1
  40. package/dist/commands/doctor.d.ts +2 -2
  41. package/dist/commands/doctor.js +67 -67
  42. package/dist/commands/doctor.js.map +1 -1
  43. package/dist/commands/init/command.d.ts +8 -2
  44. package/dist/commands/init/command.js +186 -114
  45. package/dist/commands/init/command.js.map +1 -1
  46. package/dist/commands/init/config.d.ts +9 -2
  47. package/dist/commands/init/config.js +45 -25
  48. package/dist/commands/init/config.js.map +1 -1
  49. package/dist/commands/init/constants.d.ts +3 -3
  50. package/dist/commands/init/constants.js +105 -105
  51. package/dist/commands/init/dependencies.d.ts +22 -5
  52. package/dist/commands/init/dependencies.js +86 -52
  53. package/dist/commands/init/dependencies.js.map +1 -1
  54. package/dist/commands/init/filesystem.d.ts +7 -1
  55. package/dist/commands/init/filesystem.js +16 -10
  56. package/dist/commands/init/filesystem.js.map +1 -1
  57. package/dist/commands/init/lockfile.d.ts +1 -1
  58. package/dist/commands/init/lockfile.js +1 -1
  59. package/dist/commands/init/package-json.d.ts +17 -6
  60. package/dist/commands/init/package-json.js +28 -18
  61. package/dist/commands/init/package-json.js.map +1 -1
  62. package/dist/commands/init/project.d.ts +15 -3
  63. package/dist/commands/init/project.js +120 -97
  64. package/dist/commands/init/project.js.map +1 -1
  65. package/dist/commands/init/tailwind.d.ts +14 -3
  66. package/dist/commands/init/tailwind.js +141 -33
  67. package/dist/commands/init/tailwind.js.map +1 -1
  68. package/dist/commands/init/templates.d.ts +15 -3
  69. package/dist/commands/init/templates.js +27 -15
  70. package/dist/commands/init/templates.js.map +1 -1
  71. package/dist/commands/init/tsconfig.d.ts +14 -2
  72. package/dist/commands/init/tsconfig.js +561 -273
  73. package/dist/commands/init/tsconfig.js.map +1 -1
  74. package/dist/commands/init/types.d.ts +34 -33
  75. package/dist/commands/init/types.js +1 -1
  76. package/dist/commands/init/ui.d.ts +12 -3
  77. package/dist/commands/init/ui.js +45 -33
  78. package/dist/commands/init/ui.js.map +1 -1
  79. package/dist/commands/init/vite.d.ts +1 -1
  80. package/dist/commands/init/vite.js +17 -27
  81. package/dist/commands/init/vite.js.map +1 -1
  82. package/dist/commands/init.d.ts +1 -1
  83. package/dist/commands/init.js +1 -1
  84. package/dist/commands/list.d.ts +2 -2
  85. package/dist/commands/list.js +69 -62
  86. package/dist/commands/list.js.map +1 -1
  87. package/dist/commands/remove.d.ts +2 -2
  88. package/dist/commands/remove.js +95 -93
  89. package/dist/commands/remove.js.map +1 -1
  90. package/dist/commands/shared/add-collection.d.ts +50 -50
  91. package/dist/commands/shared/add-collection.js +206 -206
  92. package/dist/commands/shared/list-entries.d.ts +6 -6
  93. package/dist/commands/shared/list-entries.js +12 -12
  94. package/dist/commands/shared/name-utils.d.ts +1 -1
  95. package/dist/commands/shared/name-utils.js +13 -13
  96. package/dist/commands/shared/remove-entries.d.ts +16 -16
  97. package/dist/commands/shared/remove-entries.js +41 -41
  98. package/dist/icons/index.d.ts +1 -1
  99. package/dist/icons/index.js +1 -1
  100. package/dist/icons/libraries.d.ts +37 -37
  101. package/dist/icons/libraries.js +34 -34
  102. package/dist/index.d.ts +1 -2
  103. package/dist/index.js +29 -30
  104. package/dist/index.js.map +1 -1
  105. package/dist/lib/config.d.ts +45 -45
  106. package/dist/lib/config.js +97 -97
  107. package/dist/lib/fs.d.ts +82 -76
  108. package/dist/lib/fs.js +299 -302
  109. package/dist/lib/fs.js.map +1 -1
  110. package/dist/lib/highlighter.d.ts +6 -6
  111. package/dist/lib/highlighter.js +7 -7
  112. package/dist/lib/install.d.ts +19 -19
  113. package/dist/lib/install.js +101 -55
  114. package/dist/lib/install.js.map +1 -1
  115. package/dist/lib/lockfile.d.ts +63 -63
  116. package/dist/lib/lockfile.js +179 -173
  117. package/dist/lib/lockfile.js.map +1 -1
  118. package/dist/lib/logger.d.ts +8 -8
  119. package/dist/lib/logger.js +41 -41
  120. package/dist/lib/logger.js.map +1 -1
  121. package/dist/lib/paths.d.ts +14 -14
  122. package/dist/lib/paths.js +41 -31
  123. package/dist/lib/paths.js.map +1 -1
  124. package/dist/lib/registry.d.ts +35 -35
  125. package/dist/lib/registry.js +180 -180
  126. package/dist/schema/index.d.ts +1128 -1128
  127. package/dist/schema/index.js +237 -238
  128. package/dist/schema/index.js.map +1 -1
  129. package/dist/styles/create-style-map.d.ts +4 -4
  130. package/dist/styles/create-style-map.js +68 -68
  131. package/dist/styles/transform-style-map.d.ts +3 -3
  132. package/dist/styles/transform-style-map.js +428 -428
  133. package/dist/styles/transform.d.ts +10 -10
  134. package/dist/styles/transform.js +15 -15
  135. package/dist/utils/index.d.ts +6 -6
  136. package/dist/utils/index.js +5 -5
  137. package/dist/utils/transformers/transform-icons.d.ts +2 -2
  138. package/dist/utils/transformers/transform-icons.js +164 -164
  139. package/dist/utils/transformers/transform-menu.d.ts +2 -2
  140. package/dist/utils/transformers/transform-menu.js +39 -39
  141. package/dist/utils/transformers/transform-render.d.ts +2 -2
  142. package/dist/utils/transformers/transform-render.js +97 -97
  143. package/dist/utils/transformers/types.d.ts +14 -14
  144. package/dist/utils/transformers/types.js +1 -1
  145. package/package.json +69 -69
  146. package/dist/__tests__/contracts/registry.test.d.ts +0 -1
  147. package/dist/__tests__/contracts/registry.test.js +0 -42
  148. package/dist/__tests__/contracts/registry.test.js.map +0 -1
  149. package/dist/__tests__/e2e/cli.test.d.ts +0 -1
  150. package/dist/__tests__/e2e/cli.test.js +0 -67
  151. package/dist/__tests__/e2e/cli.test.js.map +0 -1
  152. package/dist/__tests__/helpers/fs.d.ts +0 -5
  153. package/dist/__tests__/helpers/fs.js +0 -26
  154. package/dist/__tests__/helpers/fs.js.map +0 -1
  155. package/dist/__tests__/integration/commands.integration.test.d.ts +0 -1
  156. package/dist/__tests__/integration/commands.integration.test.js +0 -184
  157. package/dist/__tests__/integration/commands.integration.test.js.map +0 -1
  158. package/dist/commands/__tests__/add-composite.test.d.ts +0 -2
  159. package/dist/commands/__tests__/add-composite.test.js +0 -171
  160. package/dist/commands/__tests__/add-composite.test.js.map +0 -1
  161. package/dist/commands/__tests__/add-entry.mocks.d.ts +0 -23
  162. package/dist/commands/__tests__/add-entry.mocks.js +0 -64
  163. package/dist/commands/__tests__/add-entry.mocks.js.map +0 -1
  164. package/dist/commands/__tests__/add-section.test.d.ts +0 -2
  165. package/dist/commands/__tests__/add-section.test.js +0 -191
  166. package/dist/commands/__tests__/add-section.test.js.map +0 -1
  167. package/dist/commands/__tests__/add-wrapper.test.d.ts +0 -2
  168. package/dist/commands/__tests__/add-wrapper.test.js +0 -171
  169. package/dist/commands/__tests__/add-wrapper.test.js.map +0 -1
  170. package/dist/commands/__tests__/cli-mocks.d.ts +0 -1
  171. package/dist/commands/__tests__/cli-mocks.js +0 -24
  172. package/dist/commands/__tests__/cli-mocks.js.map +0 -1
  173. package/dist/commands/__tests__/doctor.mocks.d.ts +0 -6
  174. package/dist/commands/__tests__/doctor.mocks.js +0 -20
  175. package/dist/commands/__tests__/doctor.mocks.js.map +0 -1
  176. package/dist/commands/__tests__/doctor.test.d.ts +0 -2
  177. package/dist/commands/__tests__/doctor.test.js +0 -80
  178. package/dist/commands/__tests__/doctor.test.js.map +0 -1
  179. package/dist/commands/__tests__/list.mocks.d.ts +0 -8
  180. package/dist/commands/__tests__/list.mocks.js +0 -20
  181. package/dist/commands/__tests__/list.mocks.js.map +0 -1
  182. package/dist/commands/__tests__/list.test.d.ts +0 -2
  183. package/dist/commands/__tests__/list.test.js +0 -60
  184. package/dist/commands/__tests__/list.test.js.map +0 -1
  185. package/dist/commands/__tests__/remove.mocks.d.ts +0 -9
  186. package/dist/commands/__tests__/remove.mocks.js +0 -26
  187. package/dist/commands/__tests__/remove.mocks.js.map +0 -1
  188. package/dist/commands/__tests__/remove.test.d.ts +0 -2
  189. package/dist/commands/__tests__/remove.test.js +0 -116
  190. package/dist/commands/__tests__/remove.test.js.map +0 -1
  191. package/dist/commands/add/__tests__/__mocks__/cli-mocks.d.ts +0 -1
  192. package/dist/commands/add/__tests__/__mocks__/cli-mocks.js +0 -21
  193. package/dist/commands/add/__tests__/__mocks__/cli-mocks.js.map +0 -1
  194. package/dist/commands/add/__tests__/add.mocks.d.ts +0 -19
  195. package/dist/commands/add/__tests__/add.mocks.js +0 -60
  196. package/dist/commands/add/__tests__/add.mocks.js.map +0 -1
  197. package/dist/commands/add/__tests__/add.test.d.ts +0 -2
  198. package/dist/commands/add/__tests__/add.test.js +0 -141
  199. package/dist/commands/add/__tests__/add.test.js.map +0 -1
  200. package/dist/commands/init/__tests__/init.mocks.d.ts +0 -24
  201. package/dist/commands/init/__tests__/init.mocks.js +0 -84
  202. package/dist/commands/init/__tests__/init.mocks.js.map +0 -1
  203. package/dist/commands/init/__tests__/init.test.d.ts +0 -2
  204. package/dist/commands/init/__tests__/init.test.js +0 -283
  205. package/dist/commands/init/__tests__/init.test.js.map +0 -1
  206. package/dist/commands/init/__tests__/tailwind.test.d.ts +0 -1
  207. package/dist/commands/init/__tests__/tailwind.test.js +0 -56
  208. package/dist/commands/init/__tests__/tailwind.test.js.map +0 -1
  209. package/dist/commands/init/__tests__/tsconfig.test.d.ts +0 -1
  210. package/dist/commands/init/__tests__/tsconfig.test.js +0 -108
  211. package/dist/commands/init/__tests__/tsconfig.test.js.map +0 -1
  212. package/dist/commands/init/__tests__/vite.test.d.ts +0 -1
  213. package/dist/commands/init/__tests__/vite.test.js +0 -66
  214. package/dist/commands/init/__tests__/vite.test.js.map +0 -1
  215. package/dist/commands/list-sections.d.ts +0 -2
  216. package/dist/commands/list-sections.js +0 -20
  217. package/dist/commands/list-sections.js.map +0 -1
  218. package/dist/commands/list-wrappers.d.ts +0 -2
  219. package/dist/commands/list-wrappers.js +0 -20
  220. package/dist/commands/list-wrappers.js.map +0 -1
  221. package/dist/commands/remove-section.d.ts +0 -2
  222. package/dist/commands/remove-section.js +0 -37
  223. package/dist/commands/remove-section.js.map +0 -1
  224. package/dist/commands/remove-wrapper.d.ts +0 -2
  225. package/dist/commands/remove-wrapper.js +0 -37
  226. package/dist/commands/remove-wrapper.js.map +0 -1
  227. package/dist/lib/__tests__/config.test.d.ts +0 -1
  228. package/dist/lib/__tests__/config.test.js +0 -49
  229. package/dist/lib/__tests__/config.test.js.map +0 -1
  230. package/dist/lib/__tests__/install.test.d.ts +0 -1
  231. package/dist/lib/__tests__/install.test.js +0 -149
  232. package/dist/lib/__tests__/install.test.js.map +0 -1
  233. package/dist/lib/__tests__/lockfile.test.d.ts +0 -1
  234. package/dist/lib/__tests__/lockfile.test.js +0 -89
  235. package/dist/lib/__tests__/lockfile.test.js.map +0 -1
  236. package/dist/lib/__tests__/paths.test.d.ts +0 -1
  237. package/dist/lib/__tests__/paths.test.js +0 -39
  238. package/dist/lib/__tests__/paths.test.js.map +0 -1
  239. package/dist/lib/__tests__/registry.test.d.ts +0 -1
  240. package/dist/lib/__tests__/registry.test.js +0 -76
  241. package/dist/lib/__tests__/registry.test.js.map +0 -1
@@ -1,27 +1,27 @@
1
- import type { Ora } from "ora";
2
- import type { Lockfile } from "../../lib/lockfile.js";
3
- import type { RegistryIndex } from "../../lib/registry.js";
4
- import type { AddConfig, InstallationResult } from "./types.js";
5
- export interface InstallComponentsOptions {
6
- cwd: string;
7
- config: AddConfig;
8
- registry: RegistryIndex;
9
- lockfile: Lockfile;
10
- components: string[];
11
- conflicts: string[];
12
- force: boolean;
13
- spinner: Ora | null;
14
- }
15
- export declare function installComponents(options: InstallComponentsOptions): Promise<InstallationResult>;
16
- export interface UpdateBarrelFileOptions {
17
- cwd: string;
18
- config: AddConfig;
19
- lockfile: Lockfile;
20
- }
21
- export declare function updateBarrelFile(options: UpdateBarrelFileOptions): Promise<void>;
22
- export interface InstallNpmDependenciesOptions {
23
- cwd: string;
24
- dependencies: Set<string>;
25
- spinner: Ora | null;
26
- }
27
- export declare function installNpmDependencies(options: InstallNpmDependenciesOptions): Promise<void>;
1
+ import type { Ora } from "ora";
2
+ import type { Lockfile } from "../../lib/lockfile.js";
3
+ import type { RegistryIndex } from "../../lib/registry.js";
4
+ import type { AddConfig, InstallationResult } from "./types.js";
5
+ export interface InstallComponentsOptions {
6
+ cwd: string;
7
+ config: AddConfig;
8
+ registry: RegistryIndex;
9
+ lockfile: Lockfile;
10
+ components: string[];
11
+ conflicts: string[];
12
+ force: boolean;
13
+ spinner: Ora | null;
14
+ }
15
+ export declare function installComponents(options: InstallComponentsOptions): Promise<InstallationResult>;
16
+ export interface UpdateBarrelFileOptions {
17
+ cwd: string;
18
+ config: AddConfig;
19
+ lockfile: Lockfile;
20
+ }
21
+ export declare function updateBarrelFile(options: UpdateBarrelFileOptions): Promise<void>;
22
+ export interface InstallNpmDependenciesOptions {
23
+ cwd: string;
24
+ dependencies: Set<string>;
25
+ spinner: Ora | null;
26
+ }
27
+ export declare function installNpmDependencies(options: InstallNpmDependenciesOptions): Promise<void>;
@@ -1,81 +1,81 @@
1
- import path from "node:path";
2
- import { execa } from "execa";
3
- import { installRegistryEntries } from "../../lib/install.js";
4
- import { writeFileSafe } from "../../lib/fs.js";
5
- import { logger } from "../../lib/logger.js";
6
- import { inferScriptExtension } from "./config.js";
7
- import { detectPackageManager } from "./package-manager.js";
8
- export async function installComponents(options) {
9
- const { cwd, config, registry, lockfile, components, conflicts, force, spinner } = options;
10
- const installed = [];
11
- const skipped = [];
12
- const failed = [];
13
- const npmDependencies = new Set();
14
- let currentIndex = 0;
15
- const total = components.length;
16
- for (const componentName of components) {
17
- currentIndex += 1;
18
- try {
19
- if (spinner) {
20
- spinner.text = `Installing ${componentName} (${currentIndex}/${total})...`;
21
- }
22
- const result = await installRegistryEntries({
23
- cwd,
24
- config,
25
- entries: registry.components,
26
- names: [componentName],
27
- lockEntries: lockfile.components,
28
- force,
29
- itemLabel: "component"
30
- });
31
- if (result.installed.length > 0) {
32
- installed.push(...result.installed);
33
- }
34
- if (result.skipped.length > 0) {
35
- skipped.push(...result.skipped);
36
- }
37
- result.npmDependencies.forEach((dep) => npmDependencies.add(dep));
38
- }
39
- catch (error) {
40
- failed.push(componentName);
41
- logger.error(`Failed to install ${componentName}: ${error.message}`);
42
- }
43
- }
44
- return {
45
- installed,
46
- skipped,
47
- failed,
48
- npmDependencies,
49
- conflicts
50
- };
51
- }
52
- export async function updateBarrelFile(options) {
53
- const { cwd, config, lockfile } = options;
54
- const ext = inferScriptExtension(config);
55
- const barrelPath = path.resolve(cwd, config.paths.components, `index.${ext}`);
56
- const components = Object.keys(lockfile.components).sort();
57
- const exports = components
58
- .map((name) => `export { ${name} } from "./${name}"`)
59
- .join("\n");
60
- const content = `// Auto-generated barrel file
61
- // This file exports all components from this directory
62
-
63
- ${exports}
64
- `;
65
- await writeFileSafe(barrelPath, content, true);
66
- }
67
- export async function installNpmDependencies(options) {
68
- const { cwd, dependencies, spinner } = options;
69
- const packageManager = await detectPackageManager(cwd);
70
- const installCmd = packageManager === "npm" ? "install" : "add";
71
- try {
72
- spinner?.start(`Installing ${dependencies.size} npm package${dependencies.size > 1 ? "s" : ""}...`);
73
- await execa(packageManager, [installCmd, ...Array.from(dependencies)], { cwd });
74
- spinner?.succeed("NPM packages installed");
75
- }
76
- catch (error) {
77
- spinner?.fail("Failed to install npm packages");
78
- throw new Error(`Failed to install dependencies: ${error.message}`);
79
- }
80
- }
1
+ import path from "node:path";
2
+ import { execa } from "execa";
3
+ import { installRegistryEntries } from "../../lib/install.js";
4
+ import { writeFileSafe } from "../../lib/fs.js";
5
+ import { logger } from "../../lib/logger.js";
6
+ import { inferScriptExtension } from "./config.js";
7
+ import { detectPackageManager } from "./package-manager.js";
8
+ export async function installComponents(options) {
9
+ const { cwd, config, registry, lockfile, components, conflicts, force, spinner } = options;
10
+ const installed = [];
11
+ const skipped = [];
12
+ const failed = [];
13
+ const npmDependencies = new Set();
14
+ let currentIndex = 0;
15
+ const total = components.length;
16
+ for (const componentName of components) {
17
+ currentIndex += 1;
18
+ try {
19
+ if (spinner) {
20
+ spinner.text = `Installing ${componentName} (${currentIndex}/${total})...`;
21
+ }
22
+ const result = await installRegistryEntries({
23
+ cwd,
24
+ config,
25
+ entries: registry.components,
26
+ names: [componentName],
27
+ lockEntries: lockfile.components,
28
+ force,
29
+ itemLabel: "component"
30
+ });
31
+ if (result.installed.length > 0) {
32
+ installed.push(...result.installed);
33
+ }
34
+ if (result.skipped.length > 0) {
35
+ skipped.push(...result.skipped);
36
+ }
37
+ result.npmDependencies.forEach((dep) => npmDependencies.add(dep));
38
+ }
39
+ catch (error) {
40
+ failed.push(componentName);
41
+ logger.error(`Failed to install ${componentName}: ${error.message}`);
42
+ }
43
+ }
44
+ return {
45
+ installed,
46
+ skipped,
47
+ failed,
48
+ npmDependencies,
49
+ conflicts
50
+ };
51
+ }
52
+ export async function updateBarrelFile(options) {
53
+ const { cwd, config, lockfile } = options;
54
+ const ext = inferScriptExtension(config);
55
+ const barrelPath = path.resolve(cwd, config.paths.components, `index.${ext}`);
56
+ const components = Object.keys(lockfile.components).sort();
57
+ const exports = components
58
+ .map((name) => `export { ${name} } from "./${name}"`)
59
+ .join("\n");
60
+ const content = `// Auto-generated barrel file
61
+ // This file exports all components from this directory
62
+
63
+ ${exports}
64
+ `;
65
+ await writeFileSafe(barrelPath, content, true);
66
+ }
67
+ export async function installNpmDependencies(options) {
68
+ const { cwd, dependencies, spinner } = options;
69
+ const packageManager = await detectPackageManager(cwd);
70
+ const installCmd = packageManager === "npm" ? "install" : "add";
71
+ try {
72
+ spinner?.start(`Installing ${dependencies.size} npm package${dependencies.size > 1 ? "s" : ""}...`);
73
+ await execa(packageManager, [installCmd, ...Array.from(dependencies)], { cwd });
74
+ spinner?.succeed("NPM packages installed");
75
+ }
76
+ catch (error) {
77
+ spinner?.fail("Failed to install npm packages");
78
+ throw new Error(`Failed to install dependencies: ${error.message}`);
79
+ }
80
+ }
81
81
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- export declare function detectPackageManager(cwd: string): Promise<string>;
1
+ export declare function detectPackageManager(cwd: string): Promise<string>;
@@ -1,5 +1,5 @@
1
- import { detect } from "@antfu/ni";
2
- export async function detectPackageManager(cwd) {
3
- return (await detect({ cwd })) || "npm";
4
- }
1
+ import { detect } from "@antfu/ni";
2
+ export async function detectPackageManager(cwd) {
3
+ return (await detect({ cwd })) || "npm";
4
+ }
5
5
  //# sourceMappingURL=package-manager.js.map
@@ -1,2 +1,2 @@
1
- import type { AddConfig } from "./types.js";
2
- export declare function ensureProjectFiles(cwd: string, config: AddConfig): Promise<void>;
1
+ import type { AddConfig } from "./types.js";
2
+ export declare function ensureProjectFiles(cwd: string, config: AddConfig): Promise<void>;
@@ -1,18 +1,18 @@
1
- import path from "node:path";
2
- import { copyFileSafe, fileExists } from "../../lib/fs.js";
3
- import { resolveTemplatePath } from "../../lib/paths.js";
4
- import { resolveRegistrySource } from "../../lib/registry.js";
5
- import { inferScriptExtension } from "./config.js";
6
- export async function ensureProjectFiles(cwd, config) {
7
- const { templatesPath } = resolveRegistrySource(config, cwd);
8
- const utilsPath = path.resolve(cwd, config.paths.utils);
9
- if (!(await fileExists(utilsPath))) {
10
- const ext = inferScriptExtension(config);
11
- await copyFileSafe(resolveTemplatePath(`lib/utils.${ext}`, templatesPath), utilsPath, true);
12
- }
13
- const stylesPath = path.resolve(cwd, config.paths.styles);
14
- if (!(await fileExists(stylesPath))) {
15
- await copyFileSafe(resolveTemplatePath("styles/globals.css", templatesPath), stylesPath, true);
16
- }
17
- }
1
+ import path from "node:path";
2
+ import { copyFileSafe, fileExists } from "../../lib/fs.js";
3
+ import { resolveTemplatePath } from "../../lib/paths.js";
4
+ import { resolveRegistrySource } from "../../lib/registry.js";
5
+ import { inferScriptExtension } from "./config.js";
6
+ export async function ensureProjectFiles(cwd, config) {
7
+ const { templatesPath } = resolveRegistrySource(config, cwd);
8
+ const utilsPath = path.resolve(cwd, config.paths.utils);
9
+ if (!(await fileExists(utilsPath))) {
10
+ const ext = inferScriptExtension(config);
11
+ await copyFileSafe(resolveTemplatePath(`lib/utils.${ext}`, templatesPath), utilsPath, true);
12
+ }
13
+ const stylesPath = path.resolve(cwd, config.paths.styles);
14
+ if (!(await fileExists(stylesPath))) {
15
+ await copyFileSafe(resolveTemplatePath("styles/globals.css", templatesPath), stylesPath, true);
16
+ }
17
+ }
18
18
  //# sourceMappingURL=project-files.js.map
@@ -1,3 +1,3 @@
1
- export declare function confirmInstallation(what: string): Promise<boolean>;
2
- export declare function confirmOverwrite(): Promise<boolean>;
3
- export declare function confirmDependencyInstallation(dependencies: Set<string>): Promise<boolean>;
1
+ export declare function confirmInstallation(what: string): Promise<boolean>;
2
+ export declare function confirmOverwrite(): Promise<boolean>;
3
+ export declare function confirmDependencyInstallation(dependencies: Set<string>): Promise<boolean>;
@@ -1,29 +1,29 @@
1
- import prompts from "prompts";
2
- export async function confirmInstallation(what) {
3
- const { confirmed } = await prompts({
4
- type: "confirm",
5
- name: "confirmed",
6
- message: `Install ${what}?`,
7
- initial: true
8
- });
9
- return confirmed;
10
- }
11
- export async function confirmOverwrite() {
12
- const { overwrite } = await prompts({
13
- type: "confirm",
14
- name: "overwrite",
15
- message: "Overwrite existing components?",
16
- initial: false
17
- });
18
- return overwrite;
19
- }
20
- export async function confirmDependencyInstallation(dependencies) {
21
- const { shouldInstall } = await prompts({
22
- type: "confirm",
23
- name: "shouldInstall",
24
- message: `Install ${dependencies.size} npm package${dependencies.size > 1 ? "s" : ""}?`,
25
- initial: true
26
- });
27
- return shouldInstall;
28
- }
1
+ import prompts from "prompts";
2
+ export async function confirmInstallation(what) {
3
+ const { confirmed } = await prompts({
4
+ type: "confirm",
5
+ name: "confirmed",
6
+ message: `Install ${what}?`,
7
+ initial: true
8
+ });
9
+ return confirmed;
10
+ }
11
+ export async function confirmOverwrite() {
12
+ const { overwrite } = await prompts({
13
+ type: "confirm",
14
+ name: "overwrite",
15
+ message: "Overwrite existing components?",
16
+ initial: false
17
+ });
18
+ return overwrite;
19
+ }
20
+ export async function confirmDependencyInstallation(dependencies) {
21
+ const { shouldInstall } = await prompts({
22
+ type: "confirm",
23
+ name: "shouldInstall",
24
+ message: `Install ${dependencies.size} npm package${dependencies.size > 1 ? "s" : ""}?`,
25
+ initial: true
26
+ });
27
+ return shouldInstall;
28
+ }
29
29
  //# sourceMappingURL=prompts.js.map
@@ -1,4 +1,4 @@
1
- import type { RegistryIndex } from "../../lib/registry.js";
2
- import type { ComponentMap } from "./types.js";
3
- export declare function getComponentNames(registry: RegistryIndex): string[];
4
- export declare function createComponentMap(registry: RegistryIndex): ComponentMap;
1
+ import type { RegistryIndex } from "../../lib/registry.js";
2
+ import type { ComponentMap } from "./types.js";
3
+ export declare function getComponentNames(registry: RegistryIndex): string[];
4
+ export declare function createComponentMap(registry: RegistryIndex): ComponentMap;
@@ -1,7 +1,7 @@
1
- export function getComponentNames(registry) {
2
- return registry.components.map((component) => component.name);
3
- }
4
- export function createComponentMap(registry) {
5
- return new Map(registry.components.map((component) => [component.name, component]));
6
- }
1
+ export function getComponentNames(registry) {
2
+ return registry.components.map((component) => component.name);
3
+ }
4
+ export function createComponentMap(registry) {
5
+ return new Map(registry.components.map((component) => [component.name, component]));
6
+ }
7
7
  //# sourceMappingURL=registry.js.map
@@ -1,33 +1,33 @@
1
- import type { TrixUIConfig } from "../../lib/config.js";
2
- import type { RegistryItem } from "../../lib/registry.js";
3
- export interface AddOptions {
4
- force?: boolean;
5
- yes?: boolean;
6
- silent?: boolean;
7
- skipDeps?: boolean;
8
- cwd?: string;
9
- }
10
- export interface InstallationResult {
11
- installed: string[];
12
- skipped: string[];
13
- failed: string[];
14
- npmDependencies: Set<string>;
15
- conflicts: string[];
16
- }
17
- export interface ComponentValidation {
18
- valid: string[];
19
- invalid: string[];
20
- suggestions: string[];
21
- }
22
- export interface DependencyAnalysis {
23
- components: string[];
24
- dependencies: Set<string>;
25
- npmDependencies: Set<string>;
26
- conflicts: string[];
27
- totalToInstall: number;
28
- missingDependencies: string[];
29
- }
30
- export type AddConfig = TrixUIConfig & {
31
- typescript?: boolean;
32
- };
33
- export type ComponentMap = Map<string, RegistryItem>;
1
+ import type { TrixUIConfig } from "../../lib/config.js";
2
+ import type { RegistryItem } from "../../lib/registry.js";
3
+ export interface AddOptions {
4
+ force?: boolean;
5
+ yes?: boolean;
6
+ silent?: boolean;
7
+ skipDeps?: boolean;
8
+ cwd?: string;
9
+ }
10
+ export interface InstallationResult {
11
+ installed: string[];
12
+ skipped: string[];
13
+ failed: string[];
14
+ npmDependencies: Set<string>;
15
+ conflicts: string[];
16
+ }
17
+ export interface ComponentValidation {
18
+ valid: string[];
19
+ invalid: string[];
20
+ suggestions: string[];
21
+ }
22
+ export interface DependencyAnalysis {
23
+ components: string[];
24
+ dependencies: Set<string>;
25
+ npmDependencies: Set<string>;
26
+ conflicts: string[];
27
+ totalToInstall: number;
28
+ missingDependencies: string[];
29
+ }
30
+ export type AddConfig = TrixUIConfig & {
31
+ typescript?: boolean;
32
+ };
33
+ export type ComponentMap = Map<string, RegistryItem>;
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=types.js.map
@@ -1,4 +1,4 @@
1
- import type { AddOptions, DependencyAnalysis, InstallationResult } from "./types.js";
2
- export declare function displayInstallationPlan(analysis: DependencyAnalysis, options: AddOptions): void;
3
- export declare function displayManualInstallInstructions(dependencies: Set<string>, cwd: string): Promise<void>;
4
- export declare function displayResults(result: InstallationResult, options: AddOptions): void;
1
+ import type { AddOptions, DependencyAnalysis, InstallationResult } from "./types.js";
2
+ export declare function displayInstallationPlan(analysis: DependencyAnalysis, options: AddOptions): void;
3
+ export declare function displayManualInstallInstructions(dependencies: Set<string>, cwd: string): Promise<void>;
4
+ export declare function displayResults(result: InstallationResult, options: AddOptions): void;
@@ -1,56 +1,56 @@
1
- import chalk from "chalk";
2
- import { detectPackageManager } from "./package-manager.js";
3
- export function displayInstallationPlan(analysis, options) {
4
- const totalToInstall = options.force
5
- ? analysis.components.length
6
- : analysis.totalToInstall;
7
- console.log("\n" + chalk.bold("Installation Plan:"));
8
- console.log(chalk.gray("\u00c4".repeat(50)));
9
- console.log(`${chalk.cyan("Components to install:")} ${chalk.white(totalToInstall)}`);
10
- if (analysis.dependencies.size > 0) {
11
- console.log(`${chalk.cyan("Additional dependencies:")} ${chalk.white(analysis.dependencies.size)}`);
12
- console.log(chalk.gray(` ${Array.from(analysis.dependencies).join(", ")}`));
13
- }
14
- if (analysis.npmDependencies.size > 0) {
15
- console.log(`${chalk.cyan("NPM packages required:")} ${chalk.white(analysis.npmDependencies.size)}`);
16
- console.log(chalk.gray(` ${Array.from(analysis.npmDependencies).join(", ")}`));
17
- }
18
- if (analysis.missingDependencies.length > 0) {
19
- console.log(`${chalk.red("Missing registry dependencies:")} ${chalk.white(analysis.missingDependencies.length)}`);
20
- console.log(chalk.gray(` ${analysis.missingDependencies.join(", ")}`));
21
- }
22
- if (analysis.conflicts.length > 0 && !options.force) {
23
- console.log(`${chalk.yellow("Conflicts detected:")} ${chalk.white(analysis.conflicts.length)}`);
24
- console.log(chalk.gray(` ${analysis.conflicts.join(", ")}`));
25
- }
26
- console.log(chalk.gray("\u00c4".repeat(50)) + "\n");
27
- }
28
- export async function displayManualInstallInstructions(dependencies, cwd) {
29
- const packageManager = await detectPackageManager(cwd);
30
- const installCmd = packageManager === "npm" ? "install" : "add";
31
- console.log(chalk.yellow("\nPlease install the following dependencies:"));
32
- console.log(chalk.cyan(`${packageManager} ${installCmd} ${Array.from(dependencies).join(" ")}`));
33
- console.log();
34
- }
35
- export function displayResults(result, options) {
36
- console.log("\n" + chalk.bold("Installation Results:"));
37
- console.log(chalk.gray("\u00c4".repeat(50)));
38
- if (result.installed.length > 0) {
39
- console.log(chalk.green(`\u00fb Installed (${result.installed.length}):`));
40
- result.installed.forEach((name) => console.log(chalk.gray(` \u0007 ${name}`)));
41
- }
42
- if (result.skipped.length > 0 && !options.force) {
43
- console.log(chalk.yellow(`? Skipped (${result.skipped.length}):`));
44
- result.skipped.forEach((name) => console.log(chalk.gray(` \u0007 ${name} (already exists)`)));
45
- }
46
- if (result.failed.length > 0) {
47
- console.log(chalk.red(`? Failed (${result.failed.length}):`));
48
- result.failed.forEach((name) => console.log(chalk.gray(` \u0007 ${name}`)));
49
- }
50
- console.log(chalk.gray("\u00c4".repeat(50)));
51
- if (result.installed.length > 0) {
52
- console.log(chalk.green.bold(`\n\u00fb Successfully installed ${result.installed.length} component${result.installed.length !== 1 ? "s" : ""}!`));
53
- }
54
- console.log();
55
- }
1
+ import chalk from "chalk";
2
+ import { detectPackageManager } from "./package-manager.js";
3
+ export function displayInstallationPlan(analysis, options) {
4
+ const totalToInstall = options.force
5
+ ? analysis.components.length
6
+ : analysis.totalToInstall;
7
+ console.log("\n" + chalk.bold("Installation Plan:"));
8
+ console.log(chalk.gray("\u00c4".repeat(50)));
9
+ console.log(`${chalk.cyan("Components to install:")} ${chalk.white(totalToInstall)}`);
10
+ if (analysis.dependencies.size > 0) {
11
+ console.log(`${chalk.cyan("Additional dependencies:")} ${chalk.white(analysis.dependencies.size)}`);
12
+ console.log(chalk.gray(` ${Array.from(analysis.dependencies).join(", ")}`));
13
+ }
14
+ if (analysis.npmDependencies.size > 0) {
15
+ console.log(`${chalk.cyan("NPM packages required:")} ${chalk.white(analysis.npmDependencies.size)}`);
16
+ console.log(chalk.gray(` ${Array.from(analysis.npmDependencies).join(", ")}`));
17
+ }
18
+ if (analysis.missingDependencies.length > 0) {
19
+ console.log(`${chalk.red("Missing registry dependencies:")} ${chalk.white(analysis.missingDependencies.length)}`);
20
+ console.log(chalk.gray(` ${analysis.missingDependencies.join(", ")}`));
21
+ }
22
+ if (analysis.conflicts.length > 0 && !options.force) {
23
+ console.log(`${chalk.yellow("Conflicts detected:")} ${chalk.white(analysis.conflicts.length)}`);
24
+ console.log(chalk.gray(` ${analysis.conflicts.join(", ")}`));
25
+ }
26
+ console.log(chalk.gray("\u00c4".repeat(50)) + "\n");
27
+ }
28
+ export async function displayManualInstallInstructions(dependencies, cwd) {
29
+ const packageManager = await detectPackageManager(cwd);
30
+ const installCmd = packageManager === "npm" ? "install" : "add";
31
+ console.log(chalk.yellow("\nPlease install the following dependencies:"));
32
+ console.log(chalk.cyan(`${packageManager} ${installCmd} ${Array.from(dependencies).join(" ")}`));
33
+ console.log();
34
+ }
35
+ export function displayResults(result, options) {
36
+ console.log("\n" + chalk.bold("Installation Results:"));
37
+ console.log(chalk.gray("\u00c4".repeat(50)));
38
+ if (result.installed.length > 0) {
39
+ console.log(chalk.green(`\u00fb Installed (${result.installed.length}):`));
40
+ result.installed.forEach((name) => console.log(chalk.gray(` \u0007 ${name}`)));
41
+ }
42
+ if (result.skipped.length > 0 && !options.force) {
43
+ console.log(chalk.yellow(`? Skipped (${result.skipped.length}):`));
44
+ result.skipped.forEach((name) => console.log(chalk.gray(` \u0007 ${name} (already exists)`)));
45
+ }
46
+ if (result.failed.length > 0) {
47
+ console.log(chalk.red(`? Failed (${result.failed.length}):`));
48
+ result.failed.forEach((name) => console.log(chalk.gray(` \u0007 ${name}`)));
49
+ }
50
+ console.log(chalk.gray("\u00c4".repeat(50)));
51
+ if (result.installed.length > 0) {
52
+ console.log(chalk.green.bold(`\n\u00fb Successfully installed ${result.installed.length} component${result.installed.length !== 1 ? "s" : ""}!`));
53
+ }
54
+ console.log();
55
+ }
56
56
  //# sourceMappingURL=ui.js.map
@@ -1,3 +1,3 @@
1
- import type { RegistryIndex } from "../../lib/registry.js";
2
- import type { ComponentValidation } from "./types.js";
3
- export declare function validateComponents(components: string[], registry: RegistryIndex): ComponentValidation;
1
+ import type { RegistryIndex } from "../../lib/registry.js";
2
+ import type { ComponentValidation } from "./types.js";
3
+ export declare function validateComponents(components: string[], registry: RegistryIndex): ComponentValidation;
@@ -1,31 +1,31 @@
1
- import { createComponentMap, getComponentNames } from "./registry.js";
2
- export function validateComponents(components, registry) {
3
- const valid = [];
4
- const invalid = [];
5
- const suggestions = [];
6
- const componentMap = createComponentMap(registry);
7
- const availableComponents = getComponentNames(registry);
8
- for (const component of components) {
9
- const trimmed = component.trim();
10
- if (!trimmed) {
11
- continue;
12
- }
13
- if (componentMap.has(trimmed)) {
14
- valid.push(trimmed);
15
- continue;
16
- }
17
- invalid.push(trimmed);
18
- const lower = trimmed.toLowerCase();
19
- const similar = availableComponents.filter((name) => {
20
- const candidate = name.toLowerCase();
21
- return candidate.includes(lower) || lower.includes(candidate);
22
- });
23
- suggestions.push(...similar);
24
- }
25
- return {
26
- valid,
27
- invalid,
28
- suggestions: [...new Set(suggestions)]
29
- };
30
- }
1
+ import { createComponentMap, getComponentNames } from "./registry.js";
2
+ export function validateComponents(components, registry) {
3
+ const valid = [];
4
+ const invalid = [];
5
+ const suggestions = [];
6
+ const componentMap = createComponentMap(registry);
7
+ const availableComponents = getComponentNames(registry);
8
+ for (const component of components) {
9
+ const trimmed = component.trim();
10
+ if (!trimmed) {
11
+ continue;
12
+ }
13
+ if (componentMap.has(trimmed)) {
14
+ valid.push(trimmed);
15
+ continue;
16
+ }
17
+ invalid.push(trimmed);
18
+ const lower = trimmed.toLowerCase();
19
+ const similar = availableComponents.filter((name) => {
20
+ const candidate = name.toLowerCase();
21
+ return candidate.includes(lower) || lower.includes(candidate);
22
+ });
23
+ suggestions.push(...similar);
24
+ }
25
+ return {
26
+ valid,
27
+ invalid,
28
+ suggestions: [...new Set(suggestions)]
29
+ };
30
+ }
31
31
  //# sourceMappingURL=validation.js.map
@@ -1 +1 @@
1
- export * from "./shared/add-collection.js";
1
+ export * from "./shared/add-collection.js";
@@ -1,2 +1,2 @@
1
- export * from "./shared/add-collection.js";
1
+ export * from "./shared/add-collection.js";
2
2
  //# sourceMappingURL=add-collection.js.map