@idealyst/mcp-server 1.0.92 → 1.0.94
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/dist/data/cli-commands.d.ts +2 -0
- package/dist/data/cli-commands.d.ts.map +1 -0
- package/dist/data/cli-commands.js +100 -0
- package/dist/data/cli-commands.js.map +1 -0
- package/dist/data/components/Accordion.d.ts +15 -0
- package/dist/data/components/Accordion.d.ts.map +1 -0
- package/{src/data/components/Accordion.ts → dist/data/components/Accordion.js} +26 -28
- package/dist/data/components/Accordion.js.map +1 -0
- package/dist/data/components/ActivityIndicator.d.ts +15 -0
- package/dist/data/components/ActivityIndicator.d.ts.map +1 -0
- package/{src/data/components/ActivityIndicator.ts → dist/data/components/ActivityIndicator.js} +26 -28
- package/dist/data/components/ActivityIndicator.js.map +1 -0
- package/dist/data/components/Alert.d.ts +15 -0
- package/dist/data/components/Alert.d.ts.map +1 -0
- package/{src/data/components/Alert.ts → dist/data/components/Alert.js} +28 -30
- package/dist/data/components/Alert.js.map +1 -0
- package/dist/data/components/Avatar.d.ts +15 -0
- package/dist/data/components/Avatar.d.ts.map +1 -0
- package/{src/data/components/Avatar.ts → dist/data/components/Avatar.js} +26 -28
- package/dist/data/components/Avatar.js.map +1 -0
- package/dist/data/components/Badge.d.ts +15 -0
- package/dist/data/components/Badge.d.ts.map +1 -0
- package/{src/data/components/Badge.ts → dist/data/components/Badge.js} +16 -15
- package/dist/data/components/Badge.js.map +1 -0
- package/dist/data/components/Breadcrumb.d.ts +15 -0
- package/dist/data/components/Breadcrumb.d.ts.map +1 -0
- package/{src/data/components/Breadcrumb.ts → dist/data/components/Breadcrumb.js} +27 -29
- package/dist/data/components/Breadcrumb.js.map +1 -0
- package/dist/data/components/Button.d.ts +15 -0
- package/dist/data/components/Button.d.ts.map +1 -0
- package/{src/data/components/Button.ts → dist/data/components/Button.js} +18 -17
- package/dist/data/components/Button.js.map +1 -0
- package/dist/data/components/Card.d.ts +15 -0
- package/dist/data/components/Card.d.ts.map +1 -0
- package/{src/data/components/Card.ts → dist/data/components/Card.js} +16 -15
- package/dist/data/components/Card.js.map +1 -0
- package/dist/data/components/Checkbox.d.ts +15 -0
- package/dist/data/components/Checkbox.d.ts.map +1 -0
- package/{src/data/components/Checkbox.ts → dist/data/components/Checkbox.js} +27 -29
- package/dist/data/components/Checkbox.js.map +1 -0
- package/dist/data/components/Chip.d.ts +15 -0
- package/dist/data/components/Chip.d.ts.map +1 -0
- package/{src/data/components/Chip.ts → dist/data/components/Chip.js} +19 -18
- package/dist/data/components/Chip.js.map +1 -0
- package/dist/data/components/Dialog.d.ts +15 -0
- package/dist/data/components/Dialog.d.ts.map +1 -0
- package/{src/data/components/Dialog.ts → dist/data/components/Dialog.js} +18 -17
- package/dist/data/components/Dialog.js.map +1 -0
- package/dist/data/components/Divider.d.ts +15 -0
- package/dist/data/components/Divider.d.ts.map +1 -0
- package/{src/data/components/Divider.ts → dist/data/components/Divider.js} +26 -28
- package/dist/data/components/Divider.js.map +1 -0
- package/dist/data/components/Icon.d.ts +15 -0
- package/dist/data/components/Icon.d.ts.map +1 -0
- package/{src/data/components/Icon.ts → dist/data/components/Icon.js} +26 -28
- package/dist/data/components/Icon.js.map +1 -0
- package/dist/data/components/Image.d.ts +15 -0
- package/dist/data/components/Image.d.ts.map +1 -0
- package/{src/data/components/Image.ts → dist/data/components/Image.js} +29 -31
- package/dist/data/components/Image.js.map +1 -0
- package/dist/data/components/Input.d.ts +15 -0
- package/dist/data/components/Input.d.ts.map +1 -0
- package/{src/data/components/Input.ts → dist/data/components/Input.js} +20 -19
- package/dist/data/components/Input.js.map +1 -0
- package/dist/data/components/List.d.ts +15 -0
- package/dist/data/components/List.d.ts.map +1 -0
- package/{src/data/components/List.ts → dist/data/components/List.js} +18 -17
- package/dist/data/components/List.js.map +1 -0
- package/dist/data/components/Menu.d.ts +15 -0
- package/dist/data/components/Menu.d.ts.map +1 -0
- package/{src/data/components/Menu.ts → dist/data/components/Menu.js} +27 -29
- package/dist/data/components/Menu.js.map +1 -0
- package/dist/data/components/Popover.d.ts +15 -0
- package/dist/data/components/Popover.d.ts.map +1 -0
- package/{src/data/components/Popover.ts → dist/data/components/Popover.js} +28 -30
- package/dist/data/components/Popover.js.map +1 -0
- package/dist/data/components/Pressable.d.ts +15 -0
- package/dist/data/components/Pressable.d.ts.map +1 -0
- package/{src/data/components/Pressable.ts → dist/data/components/Pressable.js} +27 -29
- package/dist/data/components/Pressable.js.map +1 -0
- package/dist/data/components/Progress.d.ts +15 -0
- package/dist/data/components/Progress.d.ts.map +1 -0
- package/{src/data/components/Progress.ts → dist/data/components/Progress.js} +27 -29
- package/dist/data/components/Progress.js.map +1 -0
- package/dist/data/components/RadioButton.d.ts +15 -0
- package/dist/data/components/RadioButton.d.ts.map +1 -0
- package/{src/data/components/RadioButton.ts → dist/data/components/RadioButton.js} +28 -30
- package/dist/data/components/RadioButton.js.map +1 -0
- package/dist/data/components/SVGImage.d.ts +15 -0
- package/dist/data/components/SVGImage.d.ts.map +1 -0
- package/{src/data/components/SVGImage.ts → dist/data/components/SVGImage.js} +27 -29
- package/dist/data/components/SVGImage.js.map +1 -0
- package/dist/data/components/Screen.d.ts +15 -0
- package/dist/data/components/Screen.d.ts.map +1 -0
- package/{src/data/components/Screen.ts → dist/data/components/Screen.js} +27 -29
- package/dist/data/components/Screen.js.map +1 -0
- package/dist/data/components/Select.d.ts +15 -0
- package/dist/data/components/Select.d.ts.map +1 -0
- package/{src/data/components/Select.ts → dist/data/components/Select.js} +30 -32
- package/dist/data/components/Select.js.map +1 -0
- package/dist/data/components/Skeleton.d.ts +15 -0
- package/dist/data/components/Skeleton.d.ts.map +1 -0
- package/{src/data/components/Skeleton.ts → dist/data/components/Skeleton.js} +27 -29
- package/dist/data/components/Skeleton.js.map +1 -0
- package/dist/data/components/Slider.d.ts +15 -0
- package/dist/data/components/Slider.d.ts.map +1 -0
- package/{src/data/components/Slider.ts → dist/data/components/Slider.js} +31 -33
- package/dist/data/components/Slider.js.map +1 -0
- package/dist/data/components/Switch.d.ts +15 -0
- package/dist/data/components/Switch.d.ts.map +1 -0
- package/{src/data/components/Switch.ts → dist/data/components/Switch.js} +28 -30
- package/dist/data/components/Switch.js.map +1 -0
- package/dist/data/components/TabBar.d.ts +15 -0
- package/dist/data/components/TabBar.d.ts.map +1 -0
- package/{src/data/components/TabBar.ts → dist/data/components/TabBar.js} +27 -29
- package/dist/data/components/TabBar.js.map +1 -0
- package/dist/data/components/Table.d.ts +15 -0
- package/dist/data/components/Table.d.ts.map +1 -0
- package/{src/data/components/Table.ts → dist/data/components/Table.js} +29 -31
- package/dist/data/components/Table.js.map +1 -0
- package/dist/data/components/Tabs.d.ts +15 -0
- package/dist/data/components/Tabs.d.ts.map +1 -0
- package/{src/data/components/Tabs.ts → dist/data/components/Tabs.js} +28 -30
- package/dist/data/components/Tabs.js.map +1 -0
- package/dist/data/components/Text.d.ts +15 -0
- package/dist/data/components/Text.d.ts.map +1 -0
- package/{src/data/components/Text.ts → dist/data/components/Text.js} +27 -29
- package/dist/data/components/Text.js.map +1 -0
- package/dist/data/components/TextArea.d.ts +15 -0
- package/dist/data/components/TextArea.d.ts.map +1 -0
- package/{src/data/components/TextArea.ts → dist/data/components/TextArea.js} +31 -33
- package/dist/data/components/TextArea.js.map +1 -0
- package/dist/data/components/Tooltip.d.ts +15 -0
- package/dist/data/components/Tooltip.d.ts.map +1 -0
- package/{src/data/components/Tooltip.ts → dist/data/components/Tooltip.js} +28 -30
- package/dist/data/components/Tooltip.js.map +1 -0
- package/dist/data/components/Video.d.ts +15 -0
- package/dist/data/components/Video.d.ts.map +1 -0
- package/{src/data/components/Video.ts → dist/data/components/Video.js} +31 -33
- package/dist/data/components/Video.js.map +1 -0
- package/dist/data/components/View.d.ts +15 -0
- package/dist/data/components/View.d.ts.map +1 -0
- package/{src/data/components/View.ts → dist/data/components/View.js} +28 -30
- package/dist/data/components/View.js.map +1 -0
- package/dist/data/components/index.d.ts +37 -0
- package/dist/data/components/index.d.ts.map +1 -0
- package/{src/data/components/index.ts → dist/data/components/index.js} +37 -38
- package/dist/data/components/index.js.map +1 -0
- package/dist/data/framework-guides.d.ts +2 -0
- package/dist/data/framework-guides.d.ts.map +1 -0
- package/{src/data/framework-guides.ts → dist/data/framework-guides.js} +307 -8
- package/dist/data/framework-guides.js.map +1 -0
- package/dist/data/icon-guide.d.ts +2 -0
- package/dist/data/icon-guide.d.ts.map +1 -0
- package/{src/data/icon-guide.ts → dist/data/icon-guide.js} +1 -0
- package/dist/data/icon-guide.js.map +1 -0
- package/dist/data/icons.json +7452 -0
- package/dist/data/navigation-guides.d.ts +2 -0
- package/dist/data/navigation-guides.d.ts.map +1 -0
- package/{src/data/navigation-guides.ts → dist/data/navigation-guides.js} +7 -10
- package/dist/data/navigation-guides.js.map +1 -0
- package/dist/generated/types.json +2556 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -0
- package/dist/tools/get-types.d.ts +26 -0
- package/dist/tools/get-types.d.ts.map +1 -0
- package/dist/tools/get-types.js +123 -0
- package/dist/tools/get-types.js.map +1 -0
- package/package.json +10 -5
- package/ARCHITECTURE.md +0 -313
- package/TYPE-SYSTEM.md +0 -397
- package/scripts/extract-types.ts +0 -71
- package/scripts/type-extractor.ts +0 -286
- package/scripts/validate-examples.ts +0 -142
- package/src/data/cli-commands.ts +0 -103
- package/src/data/icons.json +0 -7452
- package/src/index.ts +0 -653
- package/src/tools/get-types.ts +0 -169
- package/test-client.js +0 -86
- package/tsconfig.examples.json +0 -14
- package/tsconfig.json +0 -20
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type Extractor Utility
|
|
3
|
-
*
|
|
4
|
-
* Uses TypeScript Compiler API (via ts-morph) to extract type information
|
|
5
|
-
* from @idealyst packages at build time.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Project, SourceFile, InterfaceDeclaration, TypeAliasDeclaration, EnumDeclaration } from 'ts-morph';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
import * as fs from 'fs';
|
|
11
|
-
import { fileURLToPath } from 'url';
|
|
12
|
-
|
|
13
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = path.dirname(__filename);
|
|
15
|
-
|
|
16
|
-
export interface PropInfo {
|
|
17
|
-
name: string;
|
|
18
|
-
type: string;
|
|
19
|
-
required: boolean;
|
|
20
|
-
description?: string;
|
|
21
|
-
default?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface ComponentTypeInfo {
|
|
25
|
-
name: string;
|
|
26
|
-
propsInterface: string;
|
|
27
|
-
props: PropInfo[];
|
|
28
|
-
typeDefinition: string;
|
|
29
|
-
relatedTypes: Record<string, string>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ThemeTypeInfo {
|
|
33
|
-
name: string;
|
|
34
|
-
definition: string;
|
|
35
|
-
values?: string[];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export class TypeExtractor {
|
|
39
|
-
private project: Project;
|
|
40
|
-
private componentsPath: string;
|
|
41
|
-
private themePath: string;
|
|
42
|
-
private navigationPath: string;
|
|
43
|
-
|
|
44
|
-
constructor() {
|
|
45
|
-
this.project = new Project({
|
|
46
|
-
tsConfigFilePath: path.join(__dirname, '../tsconfig.json'),
|
|
47
|
-
skipAddingFilesFromTsConfig: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Resolve paths to the actual packages in the monorepo
|
|
51
|
-
const monorepoRoot = path.resolve(__dirname, '../../..');
|
|
52
|
-
this.componentsPath = path.join(monorepoRoot, 'packages/components/src');
|
|
53
|
-
this.themePath = path.join(monorepoRoot, 'packages/theme/src');
|
|
54
|
-
this.navigationPath = path.join(monorepoRoot, 'packages/navigation/src');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Extract component type information
|
|
59
|
-
*/
|
|
60
|
-
extractComponentTypes(componentName: string): ComponentTypeInfo | null {
|
|
61
|
-
const typesFilePath = path.join(
|
|
62
|
-
this.componentsPath,
|
|
63
|
-
componentName,
|
|
64
|
-
'types.ts'
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
if (!fs.existsSync(typesFilePath)) {
|
|
68
|
-
console.warn(`Types file not found for ${componentName}: ${typesFilePath}`);
|
|
69
|
-
return null;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const sourceFile = this.project.addSourceFileAtPath(typesFilePath);
|
|
73
|
-
|
|
74
|
-
// Find the main props interface (e.g., ButtonProps)
|
|
75
|
-
const propsInterfaceName = `${componentName}Props`;
|
|
76
|
-
const propsInterface = sourceFile.getInterface(propsInterfaceName);
|
|
77
|
-
|
|
78
|
-
if (!propsInterface) {
|
|
79
|
-
console.warn(`Props interface not found: ${propsInterfaceName}`);
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const props = this.extractPropsFromInterface(propsInterface);
|
|
84
|
-
const relatedTypes = this.extractRelatedTypes(sourceFile);
|
|
85
|
-
|
|
86
|
-
return {
|
|
87
|
-
name: componentName,
|
|
88
|
-
propsInterface: propsInterfaceName,
|
|
89
|
-
props,
|
|
90
|
-
typeDefinition: propsInterface.getText(),
|
|
91
|
-
relatedTypes,
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Extract props from an interface
|
|
97
|
-
*/
|
|
98
|
-
private extractPropsFromInterface(interfaceDecl: InterfaceDeclaration): PropInfo[] {
|
|
99
|
-
const props: PropInfo[] = [];
|
|
100
|
-
|
|
101
|
-
for (const prop of interfaceDecl.getProperties()) {
|
|
102
|
-
const name = prop.getName();
|
|
103
|
-
const type = prop.getType().getText();
|
|
104
|
-
const required = !prop.hasQuestionToken();
|
|
105
|
-
|
|
106
|
-
// Extract JSDoc comments for description
|
|
107
|
-
const jsDocs = prop.getJsDocs();
|
|
108
|
-
const description = jsDocs.length > 0
|
|
109
|
-
? jsDocs[0].getDescription().trim()
|
|
110
|
-
: undefined;
|
|
111
|
-
|
|
112
|
-
props.push({
|
|
113
|
-
name,
|
|
114
|
-
type,
|
|
115
|
-
required,
|
|
116
|
-
description,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return props;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Extract related type definitions from a source file
|
|
125
|
-
*/
|
|
126
|
-
private extractRelatedTypes(sourceFile: SourceFile): Record<string, string> {
|
|
127
|
-
const types: Record<string, string> = {};
|
|
128
|
-
|
|
129
|
-
// Extract type aliases
|
|
130
|
-
for (const typeAlias of sourceFile.getTypeAliases()) {
|
|
131
|
-
const name = typeAlias.getName();
|
|
132
|
-
const definition = typeAlias.getText();
|
|
133
|
-
types[name] = definition;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Extract enums
|
|
137
|
-
for (const enumDecl of sourceFile.getEnums()) {
|
|
138
|
-
const name = enumDecl.getName();
|
|
139
|
-
const definition = enumDecl.getText();
|
|
140
|
-
types[name] = definition;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Extract other interfaces
|
|
144
|
-
for (const interfaceDecl of sourceFile.getInterfaces()) {
|
|
145
|
-
const name = interfaceDecl.getName();
|
|
146
|
-
if (!name.endsWith('Props')) {
|
|
147
|
-
const definition = interfaceDecl.getText();
|
|
148
|
-
types[name] = definition;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
return types;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Extract theme types (Size, Intent, Color, etc.)
|
|
157
|
-
*/
|
|
158
|
-
extractThemeTypes(): Record<string, ThemeTypeInfo> {
|
|
159
|
-
const themeTypes: Record<string, ThemeTypeInfo> = {};
|
|
160
|
-
|
|
161
|
-
// Extract Size type
|
|
162
|
-
const sizeFile = path.join(this.themePath, 'theme/size.ts');
|
|
163
|
-
if (fs.existsSync(sizeFile)) {
|
|
164
|
-
const sourceFile = this.project.addSourceFileAtPath(sizeFile);
|
|
165
|
-
const sizeType = sourceFile.getTypeAlias('Size');
|
|
166
|
-
if (sizeType) {
|
|
167
|
-
const definition = sizeType.getText();
|
|
168
|
-
const values = this.extractUnionValues(sizeType);
|
|
169
|
-
themeTypes.Size = { name: 'Size', definition, values };
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Extract Intent type
|
|
174
|
-
const intentFile = path.join(this.themePath, 'theme/intent.ts');
|
|
175
|
-
if (fs.existsSync(intentFile)) {
|
|
176
|
-
const sourceFile = this.project.addSourceFileAtPath(intentFile);
|
|
177
|
-
const intentType = sourceFile.getTypeAlias('Intent');
|
|
178
|
-
if (intentType) {
|
|
179
|
-
const definition = intentType.getText();
|
|
180
|
-
const values = this.extractUnionValues(intentType);
|
|
181
|
-
themeTypes.Intent = { name: 'Intent', definition, values };
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Extract Color types
|
|
186
|
-
const colorFile = path.join(this.themePath, 'theme/color.ts');
|
|
187
|
-
if (fs.existsSync(colorFile)) {
|
|
188
|
-
const sourceFile = this.project.addSourceFileAtPath(colorFile);
|
|
189
|
-
|
|
190
|
-
const palletType = sourceFile.getTypeAlias('Pallet');
|
|
191
|
-
if (palletType) {
|
|
192
|
-
const definition = palletType.getText();
|
|
193
|
-
const values = this.extractUnionValues(palletType);
|
|
194
|
-
themeTypes.Pallet = { name: 'Pallet', definition, values };
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const shadeType = sourceFile.getTypeAlias('Shade');
|
|
198
|
-
if (shadeType) {
|
|
199
|
-
const definition = shadeType.getText();
|
|
200
|
-
const values = this.extractUnionValues(shadeType);
|
|
201
|
-
themeTypes.Shade = { name: 'Shade', definition, values };
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const colorType = sourceFile.getTypeAlias('Color');
|
|
205
|
-
if (colorType) {
|
|
206
|
-
const definition = colorType.getText();
|
|
207
|
-
themeTypes.Color = { name: 'Color', definition };
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return themeTypes;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Extract values from a union type
|
|
216
|
-
*/
|
|
217
|
-
private extractUnionValues(typeAlias: TypeAliasDeclaration): string[] {
|
|
218
|
-
const type = typeAlias.getType();
|
|
219
|
-
if (type.isUnion()) {
|
|
220
|
-
return type.getUnionTypes().map(t => {
|
|
221
|
-
const text = t.getText();
|
|
222
|
-
// Remove quotes from string literals
|
|
223
|
-
return text.replace(/^["']|["']$/g, '');
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
return [];
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Extract navigation types
|
|
231
|
-
*/
|
|
232
|
-
extractNavigationTypes(): Record<string, string> {
|
|
233
|
-
const navTypes: Record<string, string> = {};
|
|
234
|
-
|
|
235
|
-
const typesFile = path.join(this.navigationPath, 'routing/types.ts');
|
|
236
|
-
if (fs.existsSync(typesFile)) {
|
|
237
|
-
const sourceFile = this.project.addSourceFileAtPath(typesFile);
|
|
238
|
-
|
|
239
|
-
// Extract all type aliases and interfaces
|
|
240
|
-
for (const typeAlias of sourceFile.getTypeAliases()) {
|
|
241
|
-
navTypes[typeAlias.getName()] = typeAlias.getText();
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
for (const interfaceDecl of sourceFile.getInterfaces()) {
|
|
245
|
-
navTypes[interfaceDecl.getName()] = interfaceDecl.getText();
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return navTypes;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Get all available components
|
|
254
|
-
*/
|
|
255
|
-
getAvailableComponents(): string[] {
|
|
256
|
-
if (!fs.existsSync(this.componentsPath)) {
|
|
257
|
-
return [];
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const entries = fs.readdirSync(this.componentsPath, { withFileTypes: true });
|
|
261
|
-
return entries
|
|
262
|
-
.filter(entry => entry.isDirectory())
|
|
263
|
-
.filter(entry => {
|
|
264
|
-
const typesFile = path.join(this.componentsPath, entry.name, 'types.ts');
|
|
265
|
-
return fs.existsSync(typesFile);
|
|
266
|
-
})
|
|
267
|
-
.map(entry => entry.name);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Extract all component types
|
|
272
|
-
*/
|
|
273
|
-
extractAllComponents(): Record<string, ComponentTypeInfo> {
|
|
274
|
-
const components = this.getAvailableComponents();
|
|
275
|
-
const result: Record<string, ComponentTypeInfo> = {};
|
|
276
|
-
|
|
277
|
-
for (const componentName of components) {
|
|
278
|
-
const typeInfo = this.extractComponentTypes(componentName);
|
|
279
|
-
if (typeInfo) {
|
|
280
|
-
result[componentName] = typeInfo;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return result;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Validate Examples Script
|
|
5
|
-
*
|
|
6
|
-
* Validates all example TypeScript files against the actual component types
|
|
7
|
-
* to ensure they are type-correct and will compile.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Project, Diagnostic } from 'ts-morph';
|
|
11
|
-
import * as path from 'path';
|
|
12
|
-
import * as fs from 'fs';
|
|
13
|
-
import chalk from 'chalk';
|
|
14
|
-
import { fileURLToPath } from 'url';
|
|
15
|
-
|
|
16
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
-
const __dirname = path.dirname(__filename);
|
|
18
|
-
|
|
19
|
-
interface ValidationResult {
|
|
20
|
-
file: string;
|
|
21
|
-
success: boolean;
|
|
22
|
-
errors: string[];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function main() {
|
|
26
|
-
console.log('🔍 Validating TypeScript examples...\n');
|
|
27
|
-
|
|
28
|
-
const project = new Project({
|
|
29
|
-
tsConfigFilePath: path.join(__dirname, '../tsconfig.examples.json'),
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const examplesDir = path.join(__dirname, '../examples');
|
|
33
|
-
|
|
34
|
-
if (!fs.existsSync(examplesDir)) {
|
|
35
|
-
console.log(chalk.yellow('⚠️ No examples directory found. Skipping validation.'));
|
|
36
|
-
process.exit(0);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Find all example files
|
|
40
|
-
const exampleFiles = findExampleFiles(examplesDir);
|
|
41
|
-
|
|
42
|
-
if (exampleFiles.length === 0) {
|
|
43
|
-
console.log(chalk.yellow('⚠️ No example files found. Skipping validation.'));
|
|
44
|
-
process.exit(0);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
console.log(`Found ${exampleFiles.length} example files\n`);
|
|
48
|
-
|
|
49
|
-
// Add all example files to the project
|
|
50
|
-
for (const filePath of exampleFiles) {
|
|
51
|
-
project.addSourceFileAtPath(filePath);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Get diagnostics (type errors)
|
|
55
|
-
const diagnostics = project.getPreEmitDiagnostics();
|
|
56
|
-
|
|
57
|
-
const results: ValidationResult[] = [];
|
|
58
|
-
|
|
59
|
-
// Group diagnostics by file
|
|
60
|
-
const diagnosticsByFile = new Map<string, Diagnostic[]>();
|
|
61
|
-
for (const diagnostic of diagnostics) {
|
|
62
|
-
const sourceFile = diagnostic.getSourceFile();
|
|
63
|
-
if (sourceFile) {
|
|
64
|
-
const filePath = sourceFile.getFilePath();
|
|
65
|
-
if (!diagnosticsByFile.has(filePath)) {
|
|
66
|
-
diagnosticsByFile.set(filePath, []);
|
|
67
|
-
}
|
|
68
|
-
diagnosticsByFile.get(filePath)!.push(diagnostic);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Create results for each file
|
|
73
|
-
for (const filePath of exampleFiles) {
|
|
74
|
-
const relativePath = path.relative(process.cwd(), filePath);
|
|
75
|
-
const fileDiagnostics = diagnosticsByFile.get(filePath) || [];
|
|
76
|
-
|
|
77
|
-
const errors = fileDiagnostics.map(diagnostic => {
|
|
78
|
-
const message = diagnostic.getMessageText();
|
|
79
|
-
const line = diagnostic.getLineNumber();
|
|
80
|
-
return `Line ${line}: ${typeof message === 'string' ? message : message.getMessageText()}`;
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
results.push({
|
|
84
|
-
file: relativePath,
|
|
85
|
-
success: errors.length === 0,
|
|
86
|
-
errors,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Print results
|
|
91
|
-
let hasErrors = false;
|
|
92
|
-
|
|
93
|
-
for (const result of results) {
|
|
94
|
-
if (result.success) {
|
|
95
|
-
console.log(chalk.green('✅'), result.file);
|
|
96
|
-
} else {
|
|
97
|
-
hasErrors = true;
|
|
98
|
-
console.log(chalk.red('❌'), result.file);
|
|
99
|
-
for (const error of result.errors) {
|
|
100
|
-
console.log(chalk.red(' '), error);
|
|
101
|
-
}
|
|
102
|
-
console.log();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
console.log('\n📊 Summary:');
|
|
107
|
-
const successCount = results.filter(r => r.success).length;
|
|
108
|
-
const failCount = results.filter(r => !r.success).length;
|
|
109
|
-
|
|
110
|
-
console.log(` ${chalk.green('✅ Passed:')} ${successCount}`);
|
|
111
|
-
console.log(` ${chalk.red('❌ Failed:')} ${failCount}`);
|
|
112
|
-
|
|
113
|
-
if (hasErrors) {
|
|
114
|
-
console.log(chalk.red('\n❌ Validation failed. Please fix the type errors above.'));
|
|
115
|
-
process.exit(1);
|
|
116
|
-
} else {
|
|
117
|
-
console.log(chalk.green('\n✅ All examples are type-correct!'));
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function findExampleFiles(dir: string): string[] {
|
|
122
|
-
const files: string[] = [];
|
|
123
|
-
|
|
124
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
125
|
-
|
|
126
|
-
for (const entry of entries) {
|
|
127
|
-
const fullPath = path.join(dir, entry.name);
|
|
128
|
-
|
|
129
|
-
if (entry.isDirectory()) {
|
|
130
|
-
files.push(...findExampleFiles(fullPath));
|
|
131
|
-
} else if (entry.name.endsWith('.tsx') || entry.name.endsWith('.ts')) {
|
|
132
|
-
files.push(fullPath);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return files;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
main().catch(error => {
|
|
140
|
-
console.error(chalk.red('❌ Validation script failed:'), error);
|
|
141
|
-
process.exit(1);
|
|
142
|
-
});
|
package/src/data/cli-commands.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export const cliCommands: Record<string, any> = {
|
|
2
|
-
init: {
|
|
3
|
-
description: "Initialize a new Idealyst workspace with monorepo structure",
|
|
4
|
-
usage: "idealyst init <workspace-name> [options]",
|
|
5
|
-
options: [
|
|
6
|
-
{
|
|
7
|
-
flag: "workspace-name",
|
|
8
|
-
description: "Name for the new workspace (required)",
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
flag: "--git",
|
|
12
|
-
description: "Initialize git repository (default: true)",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
flag: "--install",
|
|
16
|
-
description: "Install dependencies after creation (default: true)",
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
examples: [
|
|
20
|
-
"idealyst init my-app",
|
|
21
|
-
"idealyst init my-company-workspace --no-git",
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
create: {
|
|
26
|
-
description: "Create a new package within the Idealyst workspace",
|
|
27
|
-
usage: "idealyst create <name> --type <type> [options]",
|
|
28
|
-
options: [
|
|
29
|
-
{
|
|
30
|
-
flag: "name",
|
|
31
|
-
description: "Name for the new package (required)",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
flag: "--type",
|
|
35
|
-
description: "Package type: web | native | api | database | shared (required)",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
flag: "--app-name",
|
|
39
|
-
description: "Display name for native app (required for native type)",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
flag: "--with-trpc",
|
|
43
|
-
description: "Include tRPC setup (for web/native)",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
flag: "--no-trpc",
|
|
47
|
-
description: "Exclude tRPC setup (for web/native)",
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
examples: [
|
|
51
|
-
"idealyst create web --type web --with-trpc",
|
|
52
|
-
"idealyst create mobile --type native --app-name \"My App\" --with-trpc",
|
|
53
|
-
"idealyst create api --type api",
|
|
54
|
-
"idealyst create database --type database",
|
|
55
|
-
"idealyst create shared --type shared",
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
dev: {
|
|
60
|
-
description: "Start development server for a package",
|
|
61
|
-
usage: "cd packages/<name> && yarn dev",
|
|
62
|
-
options: [
|
|
63
|
-
{
|
|
64
|
-
flag: "--port",
|
|
65
|
-
description: "Port number for dev server (web only)",
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
examples: [
|
|
69
|
-
"cd packages/web && yarn dev",
|
|
70
|
-
"cd packages/native && yarn dev",
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
build: {
|
|
75
|
-
description: "Build a package for production",
|
|
76
|
-
usage: "cd packages/<name> && yarn build",
|
|
77
|
-
options: [],
|
|
78
|
-
examples: [
|
|
79
|
-
"cd packages/web && yarn build",
|
|
80
|
-
"cd packages/api && yarn build",
|
|
81
|
-
],
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
test: {
|
|
85
|
-
description: "Run tests for packages",
|
|
86
|
-
usage: "yarn test [options]",
|
|
87
|
-
options: [
|
|
88
|
-
{
|
|
89
|
-
flag: "--watch",
|
|
90
|
-
description: "Run tests in watch mode",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
flag: "--coverage",
|
|
94
|
-
description: "Generate coverage report",
|
|
95
|
-
},
|
|
96
|
-
],
|
|
97
|
-
examples: [
|
|
98
|
-
"yarn test",
|
|
99
|
-
"yarn test:watch",
|
|
100
|
-
"yarn test:coverage",
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
};
|