@foundrykit/cli 1.0.1 → 1.0.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.
- package/CHANGELOG.md +6 -0
- package/dist/cli.js +77 -128
- package/dist/cli.js.map +1 -1
- package/dist/index.js +77 -128
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/commands/add.ts +120 -78
- package/src/lib/registry.ts +0 -71
package/src/lib/registry.ts
CHANGED
|
@@ -93,12 +93,6 @@ export class RegistryService {
|
|
|
93
93
|
*/
|
|
94
94
|
async getComponent(id: string): Promise<ComponentData> {
|
|
95
95
|
try {
|
|
96
|
-
// Special handling for common utility dependencies
|
|
97
|
-
if (id === 'utils') {
|
|
98
|
-
console.log(chalk.gray(`Creating utils dependency...`));
|
|
99
|
-
return this.createUtilsComponent();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
96
|
const url = `${this.config.registryUrl}/registry/${id}`;
|
|
103
97
|
console.log(chalk.gray(`Fetching component: ${url}`));
|
|
104
98
|
|
|
@@ -106,15 +100,6 @@ export class RegistryService {
|
|
|
106
100
|
|
|
107
101
|
if (!response.ok) {
|
|
108
102
|
if (response.status === 404) {
|
|
109
|
-
// Check if it's a known special dependency
|
|
110
|
-
if (this.isSpecialDependency(id)) {
|
|
111
|
-
console.log(
|
|
112
|
-
chalk.yellow(
|
|
113
|
-
`Special dependency "${id}" will be handled separately`
|
|
114
|
-
)
|
|
115
|
-
);
|
|
116
|
-
return this.createSpecialDependency(id);
|
|
117
|
-
}
|
|
118
103
|
throw new Error(`Component "${id}" not found in registry`);
|
|
119
104
|
}
|
|
120
105
|
throw new Error(
|
|
@@ -136,12 +121,6 @@ export class RegistryService {
|
|
|
136
121
|
return cache.componentData[id];
|
|
137
122
|
}
|
|
138
123
|
|
|
139
|
-
// Check if it's a special dependency that we can handle locally
|
|
140
|
-
if (this.isSpecialDependency(id)) {
|
|
141
|
-
console.log(chalk.yellow(`Creating local version of "${id}"`));
|
|
142
|
-
return this.createSpecialDependency(id);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
124
|
// No cached data, throw error
|
|
146
125
|
throw new Error(
|
|
147
126
|
`Failed to fetch component "${id}": ${error instanceof Error ? error.message : 'Unknown error'}\n` +
|
|
@@ -151,56 +130,6 @@ export class RegistryService {
|
|
|
151
130
|
}
|
|
152
131
|
}
|
|
153
132
|
|
|
154
|
-
/**
|
|
155
|
-
* Check if a dependency is a special/utility dependency
|
|
156
|
-
*/
|
|
157
|
-
private isSpecialDependency(id: string): boolean {
|
|
158
|
-
const specialDeps = ['utils', 'lib', 'helpers', 'cn'];
|
|
159
|
-
return specialDeps.includes(id);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Create a special dependency component
|
|
164
|
-
*/
|
|
165
|
-
private createSpecialDependency(id: string): ComponentData {
|
|
166
|
-
switch (id) {
|
|
167
|
-
case 'utils':
|
|
168
|
-
case 'lib':
|
|
169
|
-
case 'helpers':
|
|
170
|
-
case 'cn':
|
|
171
|
-
return this.createUtilsComponent();
|
|
172
|
-
default:
|
|
173
|
-
throw new Error(`Unknown special dependency: ${id}`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Create a utils component with the cn function
|
|
179
|
-
*/
|
|
180
|
-
private createUtilsComponent(): ComponentData {
|
|
181
|
-
return {
|
|
182
|
-
id: 'utils',
|
|
183
|
-
name: 'Utils',
|
|
184
|
-
category: 'primitives',
|
|
185
|
-
description: 'Utility functions for className merging',
|
|
186
|
-
tags: ['utility', 'helper'],
|
|
187
|
-
packageDependencies: ['clsx', 'tailwind-merge'],
|
|
188
|
-
files: [
|
|
189
|
-
{
|
|
190
|
-
path: 'lib/utils.ts',
|
|
191
|
-
type: 'util',
|
|
192
|
-
content: `import { type ClassValue, clsx } from 'clsx';
|
|
193
|
-
import { twMerge } from 'tailwind-merge';
|
|
194
|
-
|
|
195
|
-
export function cn(...inputs: ClassValue[]) {
|
|
196
|
-
return twMerge(clsx(inputs));
|
|
197
|
-
}
|
|
198
|
-
`,
|
|
199
|
-
},
|
|
200
|
-
],
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
133
|
/**
|
|
205
134
|
* Update the local cache with new component list
|
|
206
135
|
*/
|