@foundrykit/cli 2.0.12 ā 3.1.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 +94 -6
- package/dist/cli.js +2327 -671
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2327 -671
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/schema.json +60 -0
- package/.turbo/turbo-type-check.log +0 -4
- package/CHANGELOG.md +0 -254
- package/docs/DEPENDENCY_RESOLUTION.md +0 -201
- package/postcss.config.mjs +0 -6
- package/src/commands/add.ts +0 -1069
- package/src/commands/doctor.ts +0 -130
- package/src/commands/init.ts +0 -928
- package/src/commands/list.ts +0 -167
- package/src/commands/update.ts +0 -323
- package/src/index.ts +0 -34
- package/src/lib/constants.ts +0 -42
- package/src/lib/registry.ts +0 -627
- package/tests/dependency-resolution.test.ts +0 -579
- package/tsconfig.json +0 -11
- package/tsconfig.lint.json +0 -8
- package/tsup.config.ts +0 -16
package/src/commands/list.ts
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* List command for FoundryKit CLI
|
|
3
|
-
* Displays available components from the registry
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type { ComponentCategory, ComponentMeta } from '@foundrykit/types';
|
|
7
|
-
import chalk from 'chalk';
|
|
8
|
-
import { Command } from 'commander';
|
|
9
|
-
import { REGISTRY_CATEGORY_ORDER } from '../lib/constants.js';
|
|
10
|
-
import { getRegistry } from '../lib/registry.js';
|
|
11
|
-
|
|
12
|
-
interface ListOptions {
|
|
13
|
-
category?: string;
|
|
14
|
-
search?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function listCommand() {
|
|
18
|
-
return new Command('list')
|
|
19
|
-
.description('List all available FoundryKit components and blocks')
|
|
20
|
-
.option(
|
|
21
|
-
'-c, --category <category>',
|
|
22
|
-
'filter by category (primitives, components, blocks, animations)'
|
|
23
|
-
)
|
|
24
|
-
.option('-s, --search <term>', 'search components by name or description')
|
|
25
|
-
.action(async (options: ListOptions) => {
|
|
26
|
-
try {
|
|
27
|
-
console.log(chalk.blue('š¦ Available FoundryKit components:'));
|
|
28
|
-
|
|
29
|
-
const registry = getRegistry();
|
|
30
|
-
|
|
31
|
-
// Validate category if provided
|
|
32
|
-
if (options.category) {
|
|
33
|
-
const validCategories = REGISTRY_CATEGORY_ORDER as readonly string[];
|
|
34
|
-
if (!validCategories.includes(options.category)) {
|
|
35
|
-
console.error(chalk.red(`Invalid category: ${options.category}`));
|
|
36
|
-
console.log(
|
|
37
|
-
chalk.gray(`Valid categories: ${validCategories.join(', ')}`)
|
|
38
|
-
);
|
|
39
|
-
process.exit(1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Fetch components from registry
|
|
44
|
-
console.log(chalk.gray('Fetching from registry...'));
|
|
45
|
-
const components = await registry.getComponents(
|
|
46
|
-
options.category,
|
|
47
|
-
options.search
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
if (components.length === 0) {
|
|
51
|
-
console.log(
|
|
52
|
-
chalk.yellow('\nNo components found matching your criteria.')
|
|
53
|
-
);
|
|
54
|
-
if (options.search) {
|
|
55
|
-
console.log(chalk.gray(`Search term: "${options.search}"`));
|
|
56
|
-
}
|
|
57
|
-
if (options.category) {
|
|
58
|
-
console.log(chalk.gray(`Category: ${options.category}`));
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Group and display components
|
|
64
|
-
displayComponents(components);
|
|
65
|
-
|
|
66
|
-
// Show usage hints
|
|
67
|
-
console.log(chalk.cyan('\nš” Usage:'));
|
|
68
|
-
console.log(
|
|
69
|
-
chalk.gray(' foundrykit add # Interactive mode')
|
|
70
|
-
);
|
|
71
|
-
console.log(
|
|
72
|
-
chalk.gray(' foundrykit add <id> # Add specific component')
|
|
73
|
-
);
|
|
74
|
-
console.log(chalk.gray(' foundrykit add button # Example'));
|
|
75
|
-
} catch (error) {
|
|
76
|
-
console.error(chalk.red('ā Failed to fetch component registry:'));
|
|
77
|
-
console.error(
|
|
78
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
79
|
-
);
|
|
80
|
-
process.exit(1);
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Display components grouped by category
|
|
87
|
-
*/
|
|
88
|
-
function displayComponents(components: ComponentMeta[]): void {
|
|
89
|
-
// Group components by category
|
|
90
|
-
const grouped = components.reduce(
|
|
91
|
-
(acc, component) => {
|
|
92
|
-
if (!acc[component.category]) {
|
|
93
|
-
acc[component.category] = [];
|
|
94
|
-
}
|
|
95
|
-
acc[component.category].push(component);
|
|
96
|
-
return acc;
|
|
97
|
-
},
|
|
98
|
-
{} as Record<ComponentCategory, ComponentMeta[]>
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
// Display in category order
|
|
102
|
-
const knownCategories = new Set<ComponentCategory>(
|
|
103
|
-
REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]
|
|
104
|
-
);
|
|
105
|
-
const categoryOrder: ComponentCategory[] = [
|
|
106
|
-
...(REGISTRY_CATEGORY_ORDER as readonly ComponentCategory[]),
|
|
107
|
-
...(Object.keys(grouped).filter(
|
|
108
|
-
category => !knownCategories.has(category as ComponentCategory)
|
|
109
|
-
) as ComponentCategory[]),
|
|
110
|
-
];
|
|
111
|
-
|
|
112
|
-
for (const category of categoryOrder) {
|
|
113
|
-
const items = grouped[category];
|
|
114
|
-
if (!items || items.length === 0) continue;
|
|
115
|
-
|
|
116
|
-
console.log(`\n${chalk.cyan.bold(category.toUpperCase())}`);
|
|
117
|
-
console.log(chalk.gray('ā'.repeat(40)));
|
|
118
|
-
|
|
119
|
-
for (const item of items) {
|
|
120
|
-
// Component name and ID
|
|
121
|
-
console.log(
|
|
122
|
-
`${chalk.green('ā')} ${chalk.bold(item.name)} ${chalk.gray(
|
|
123
|
-
`(${item.id})`
|
|
124
|
-
)}`
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
// Description
|
|
128
|
-
console.log(` ${chalk.gray(item.description)}`);
|
|
129
|
-
|
|
130
|
-
// Tags
|
|
131
|
-
if (item.tags && item.tags.length > 0) {
|
|
132
|
-
console.log(
|
|
133
|
-
` ${chalk.blue(item.tags.map(tag => `#${tag}`).join(' '))}`
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// Dependencies
|
|
138
|
-
if (item.registryDependencies && item.registryDependencies.length > 0) {
|
|
139
|
-
console.log(
|
|
140
|
-
` ${chalk.yellow('Requires:')} ${item.registryDependencies.join(
|
|
141
|
-
', '
|
|
142
|
-
)}`
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Package dependencies
|
|
147
|
-
if (item.packageDependencies && item.packageDependencies.length > 0) {
|
|
148
|
-
console.log(
|
|
149
|
-
` ${chalk.magenta('NPM packages:')} ${item.packageDependencies.join(
|
|
150
|
-
', '
|
|
151
|
-
)}`
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
console.log();
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Show summary
|
|
160
|
-
const total = components.length;
|
|
161
|
-
const byCategory = Object.entries(grouped)
|
|
162
|
-
.map(([cat, items]) => `${items.length} ${cat}`)
|
|
163
|
-
.join(', ');
|
|
164
|
-
|
|
165
|
-
console.log(chalk.gray('ā'.repeat(40)));
|
|
166
|
-
console.log(chalk.gray(`Total: ${total} components (${byCategory})`));
|
|
167
|
-
}
|
package/src/commands/update.ts
DELETED
|
@@ -1,323 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import type { InstalledComponent } from '@foundrykit/types';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
|
-
import { Command } from 'commander';
|
|
5
|
-
import fs from 'fs-extra';
|
|
6
|
-
import inquirer from 'inquirer';
|
|
7
|
-
import { getRegistry } from '../lib/registry.js';
|
|
8
|
-
import {
|
|
9
|
-
type AddOptions,
|
|
10
|
-
addSingleComponent,
|
|
11
|
-
hasConflictingFiles,
|
|
12
|
-
} from './add.js';
|
|
13
|
-
|
|
14
|
-
interface UpdateOptions extends AddOptions {
|
|
15
|
-
opt?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function updateCommand() {
|
|
19
|
-
return new Command('update')
|
|
20
|
-
.description('Update installed components')
|
|
21
|
-
.argument('[id]', 'Component or block ID (omit to update all installed)')
|
|
22
|
-
.option(
|
|
23
|
-
'-o, --opt',
|
|
24
|
-
'interactively select which components to update, showing available upgrades'
|
|
25
|
-
)
|
|
26
|
-
.option('-f, --force', 'bypass cache and fetch fresh data from registry')
|
|
27
|
-
.option('-p, --path <path>', 'Custom installation path')
|
|
28
|
-
.action(async (id: string | undefined, options: UpdateOptions) => {
|
|
29
|
-
if (id) {
|
|
30
|
-
// Update single named component
|
|
31
|
-
try {
|
|
32
|
-
console.log(chalk.blue(`š Updating ${id}...`));
|
|
33
|
-
await addSingleComponent(id, {
|
|
34
|
-
...options,
|
|
35
|
-
overwrite: true,
|
|
36
|
-
force: true,
|
|
37
|
-
});
|
|
38
|
-
} catch (error) {
|
|
39
|
-
console.error(chalk.red(`ā Failed to update ${id}:`));
|
|
40
|
-
console.error(
|
|
41
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
42
|
-
);
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Load installed components from config
|
|
49
|
-
const configPath = path.join(process.cwd(), 'foundrykit.config.json');
|
|
50
|
-
if (!fs.existsSync(configPath)) {
|
|
51
|
-
console.error(
|
|
52
|
-
chalk.red(
|
|
53
|
-
'ā FoundryKit not initialized. Run "foundrykit init" first.'
|
|
54
|
-
)
|
|
55
|
-
);
|
|
56
|
-
process.exit(1);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const config = await fs.readJson(configPath);
|
|
60
|
-
const installed: Record<string, InstalledComponent> =
|
|
61
|
-
config.installedComponents ?? {};
|
|
62
|
-
const installedFoundryKitPackages =
|
|
63
|
-
await getInstalledFoundryKitPackageVersions();
|
|
64
|
-
|
|
65
|
-
for (const [pkgId, version] of Object.entries(
|
|
66
|
-
installedFoundryKitPackages
|
|
67
|
-
)) {
|
|
68
|
-
installed[pkgId] = {
|
|
69
|
-
id: pkgId,
|
|
70
|
-
version,
|
|
71
|
-
installedAt:
|
|
72
|
-
installed[pkgId]?.installedAt ?? new Date().toISOString(),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
let installedIds = Object.keys(installed);
|
|
77
|
-
|
|
78
|
-
if (installedIds.length === 0) {
|
|
79
|
-
// No tracking data yet ā fall back to scanning the filesystem
|
|
80
|
-
console.log(
|
|
81
|
-
chalk.gray(
|
|
82
|
-
'No install tracking found. Scanning filesystem for installed components...'
|
|
83
|
-
)
|
|
84
|
-
);
|
|
85
|
-
const registry = getRegistry();
|
|
86
|
-
let allComponents: Awaited<ReturnType<typeof registry.getComponents>>;
|
|
87
|
-
try {
|
|
88
|
-
allComponents = await registry.getComponents();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
console.error(chalk.red('ā Failed to fetch registry:'));
|
|
91
|
-
console.error(
|
|
92
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
93
|
-
);
|
|
94
|
-
process.exit(1);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
for (const component of allComponents) {
|
|
98
|
-
try {
|
|
99
|
-
const componentData = await registry.getComponent(component.id);
|
|
100
|
-
if (await hasConflictingFiles(componentData, options)) {
|
|
101
|
-
installed[component.id] = {
|
|
102
|
-
id: component.id,
|
|
103
|
-
version: null,
|
|
104
|
-
installedAt: new Date().toISOString(),
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
} catch {
|
|
108
|
-
// skip unfetchable components
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
installedIds = Object.keys(installed);
|
|
113
|
-
|
|
114
|
-
if (installedIds.length === 0) {
|
|
115
|
-
console.log(
|
|
116
|
-
chalk.yellow(
|
|
117
|
-
'No installed components found. Use "foundrykit add" to install components.'
|
|
118
|
-
)
|
|
119
|
-
);
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
console.log(
|
|
124
|
-
chalk.gray(
|
|
125
|
-
`Found ${installedIds.length} installed component(s) via filesystem scan.`
|
|
126
|
-
)
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (options.opt) {
|
|
131
|
-
// --opt: fetch registry versions, show which have updates, let user pick
|
|
132
|
-
console.log(
|
|
133
|
-
chalk.blue(
|
|
134
|
-
`š Checking for updates across ${installedIds.length} installed component(s)...`
|
|
135
|
-
)
|
|
136
|
-
);
|
|
137
|
-
|
|
138
|
-
const registry = getRegistry();
|
|
139
|
-
const withUpdates: Array<{
|
|
140
|
-
id: string;
|
|
141
|
-
installed: string | null;
|
|
142
|
-
latest: string | null;
|
|
143
|
-
}> = [];
|
|
144
|
-
const upToDate: string[] = [];
|
|
145
|
-
|
|
146
|
-
for (const compId of installedIds) {
|
|
147
|
-
try {
|
|
148
|
-
const data = await registry.getComponent(compId, options.force);
|
|
149
|
-
const installedVersion =
|
|
150
|
-
installedFoundryKitPackages[compId] ??
|
|
151
|
-
installed[compId]?.version ??
|
|
152
|
-
null;
|
|
153
|
-
const latestVersion = data.version ?? null;
|
|
154
|
-
|
|
155
|
-
const hasUpdate =
|
|
156
|
-
latestVersion !== null &&
|
|
157
|
-
installedVersion !== null &&
|
|
158
|
-
compareVersions(latestVersion, installedVersion) > 0;
|
|
159
|
-
|
|
160
|
-
const unknownVersion =
|
|
161
|
-
installedVersion === null || latestVersion === null;
|
|
162
|
-
|
|
163
|
-
if (hasUpdate || unknownVersion) {
|
|
164
|
-
withUpdates.push({
|
|
165
|
-
id: compId,
|
|
166
|
-
installed: installedVersion,
|
|
167
|
-
latest: latestVersion,
|
|
168
|
-
});
|
|
169
|
-
} else {
|
|
170
|
-
upToDate.push(compId);
|
|
171
|
-
}
|
|
172
|
-
} catch {
|
|
173
|
-
// If we can't fetch, still offer the option to re-install
|
|
174
|
-
withUpdates.push({
|
|
175
|
-
id: compId,
|
|
176
|
-
installed: installed[compId]?.version ?? null,
|
|
177
|
-
latest: null,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (upToDate.length > 0) {
|
|
183
|
-
console.log(
|
|
184
|
-
chalk.gray(`\nā Already up to date: ${upToDate.join(', ')}`)
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
if (withUpdates.length === 0) {
|
|
189
|
-
console.log(chalk.green('\nā
All components are up to date.'));
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const choices = withUpdates.map(
|
|
194
|
-
({ id: compId, installed: inst, latest }) => {
|
|
195
|
-
let versionLabel: string;
|
|
196
|
-
if (inst === null && latest === null) {
|
|
197
|
-
versionLabel = chalk.gray('(version unknown)');
|
|
198
|
-
} else if (latest === null) {
|
|
199
|
-
versionLabel = chalk.gray(
|
|
200
|
-
`(installed: ${inst} ā registry version unknown)`
|
|
201
|
-
);
|
|
202
|
-
} else if (inst === null) {
|
|
203
|
-
versionLabel = chalk.cyan(
|
|
204
|
-
`(latest: ${latest} ā install version not tracked)`
|
|
205
|
-
);
|
|
206
|
-
} else {
|
|
207
|
-
versionLabel = chalk.cyan(`(${inst} ā ${latest})`);
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
name: `${compId} ${versionLabel}`,
|
|
211
|
-
value: compId,
|
|
212
|
-
checked: true,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
|
|
217
|
-
const { selectedIds } = await inquirer.prompt([
|
|
218
|
-
{
|
|
219
|
-
type: 'checkbox',
|
|
220
|
-
name: 'selectedIds',
|
|
221
|
-
message: 'Select components to update:',
|
|
222
|
-
choices,
|
|
223
|
-
pageSize: 20,
|
|
224
|
-
},
|
|
225
|
-
]);
|
|
226
|
-
|
|
227
|
-
if (selectedIds.length === 0) {
|
|
228
|
-
console.log(chalk.yellow('No components selected.'));
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
await runUpdates(selectedIds, options);
|
|
233
|
-
} else {
|
|
234
|
-
// No flag: update everything
|
|
235
|
-
console.log(
|
|
236
|
-
chalk.blue(
|
|
237
|
-
`š Updating all ${installedIds.length} installed component(s)...`
|
|
238
|
-
)
|
|
239
|
-
);
|
|
240
|
-
await runUpdates(installedIds, options);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
async function getInstalledFoundryKitPackageVersions(): Promise<
|
|
246
|
-
Record<string, string>
|
|
247
|
-
> {
|
|
248
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
249
|
-
if (!fs.existsSync(packageJsonPath)) {
|
|
250
|
-
return {};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const packageJson = await fs.readJson(packageJsonPath);
|
|
254
|
-
const dependencies = {
|
|
255
|
-
...packageJson.dependencies,
|
|
256
|
-
...packageJson.devDependencies,
|
|
257
|
-
...packageJson.optionalDependencies,
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
return Object.fromEntries(
|
|
261
|
-
Object.entries(dependencies)
|
|
262
|
-
.filter(([name]) => name.startsWith('@foundrykit/'))
|
|
263
|
-
.map(([name, version]) => [
|
|
264
|
-
name.replace('@foundrykit/', ''),
|
|
265
|
-
normalizeVersionSpec(String(version)),
|
|
266
|
-
])
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function compareVersions(latest: string, installed: string): number {
|
|
271
|
-
const latestParts = normalizeVersionSpec(latest).split('.').map(Number);
|
|
272
|
-
const installedParts = normalizeVersionSpec(installed).split('.').map(Number);
|
|
273
|
-
const length = Math.max(latestParts.length, installedParts.length);
|
|
274
|
-
|
|
275
|
-
for (let index = 0; index < length; index++) {
|
|
276
|
-
const diff = (latestParts[index] ?? 0) - (installedParts[index] ?? 0);
|
|
277
|
-
if (diff !== 0) return diff;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return 0;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function normalizeVersionSpec(version: string): string {
|
|
284
|
-
if (version === 'workspace:*' || version === '*' || version === 'latest') {
|
|
285
|
-
return '0';
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return (
|
|
289
|
-
version
|
|
290
|
-
.replace(/^[^\d]*/, '')
|
|
291
|
-
.split('-')[0]
|
|
292
|
-
?.replace(/[^\d.]/g, '') || '0'
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
async function runUpdates(ids: string[], options: AddOptions): Promise<void> {
|
|
297
|
-
let failed = 0;
|
|
298
|
-
for (const compId of ids) {
|
|
299
|
-
try {
|
|
300
|
-
console.log(chalk.blue(`\nš Updating ${compId}...`));
|
|
301
|
-
await addSingleComponent(compId, {
|
|
302
|
-
...options,
|
|
303
|
-
overwrite: true,
|
|
304
|
-
force: true,
|
|
305
|
-
});
|
|
306
|
-
} catch (error) {
|
|
307
|
-
console.error(chalk.red(`ā Failed to update ${compId}:`));
|
|
308
|
-
console.error(
|
|
309
|
-
chalk.red(error instanceof Error ? error.message : String(error))
|
|
310
|
-
);
|
|
311
|
-
failed++;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (failed > 0) {
|
|
316
|
-
console.log(chalk.yellow(`\nā ${failed} component(s) failed to update.`));
|
|
317
|
-
process.exit(1);
|
|
318
|
-
} else {
|
|
319
|
-
console.log(
|
|
320
|
-
chalk.green(`\nā
${ids.length} component(s) updated successfully!`)
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { readFileSync } from 'node:fs';
|
|
4
|
-
import { dirname, join } from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import { Command } from 'commander';
|
|
7
|
-
import { addCommand } from './commands/add.js';
|
|
8
|
-
import { doctorCommand } from './commands/doctor.js';
|
|
9
|
-
import { initCommand } from './commands/init.js';
|
|
10
|
-
import { listCommand } from './commands/list.js';
|
|
11
|
-
import { updateCommand } from './commands/update.js';
|
|
12
|
-
|
|
13
|
-
// Get package.json version
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = dirname(__filename);
|
|
16
|
-
const packageJson = JSON.parse(
|
|
17
|
-
readFileSync(join(__dirname, '..', 'package.json'), 'utf-8')
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
const program = new Command();
|
|
21
|
-
|
|
22
|
-
program
|
|
23
|
-
.name('foundrykit')
|
|
24
|
-
.description('FoundryKit CLI - Component library management tool')
|
|
25
|
-
.version(packageJson.version);
|
|
26
|
-
|
|
27
|
-
// Add commands
|
|
28
|
-
program.addCommand(initCommand());
|
|
29
|
-
program.addCommand(listCommand());
|
|
30
|
-
program.addCommand(addCommand());
|
|
31
|
-
program.addCommand(updateCommand());
|
|
32
|
-
program.addCommand(doctorCommand());
|
|
33
|
-
|
|
34
|
-
program.parse();
|
package/src/lib/constants.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants for FoundryKit CLI
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
// CLI version - update this when publishing new versions
|
|
6
|
-
// This should match the version in package.json
|
|
7
|
-
export const CLI_VERSION = '1.0.16';
|
|
8
|
-
|
|
9
|
-
// Default registry URL
|
|
10
|
-
export const DEFAULT_REGISTRY_URL = 'https://foundry.umiflow.com';
|
|
11
|
-
export const NPM_REGISTRY_URL = 'https://registry.npmjs.org';
|
|
12
|
-
|
|
13
|
-
// Cache settings
|
|
14
|
-
export const CACHE_TTL = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
|
|
15
|
-
export const CACHE_DIR = '.foundrykit';
|
|
16
|
-
export const CACHE_FILE = 'registry-cache.json';
|
|
17
|
-
|
|
18
|
-
export const REGISTRY_CATEGORY_ORDER = [
|
|
19
|
-
'primitives',
|
|
20
|
-
'components',
|
|
21
|
-
'blocks',
|
|
22
|
-
'animations',
|
|
23
|
-
'maps',
|
|
24
|
-
'hooks',
|
|
25
|
-
'packages',
|
|
26
|
-
] as const;
|
|
27
|
-
|
|
28
|
-
export const FOUNDRYKIT_PACKAGE_ALIASES = [
|
|
29
|
-
'animation',
|
|
30
|
-
'blocks',
|
|
31
|
-
'cli',
|
|
32
|
-
'components',
|
|
33
|
-
'eslint-config',
|
|
34
|
-
'hooks',
|
|
35
|
-
'maps',
|
|
36
|
-
'prettier-config',
|
|
37
|
-
'primitives',
|
|
38
|
-
'tailwind',
|
|
39
|
-
'typescript-config',
|
|
40
|
-
'types',
|
|
41
|
-
'utils',
|
|
42
|
-
] as const;
|