@auto-engineer/design-system-importer 0.4.8 → 0.5.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/.turbo/turbo-build.log +1 -1
- package/.turbo/turbo-format.log +10 -8
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +14 -12
- package/.turbo/turbo-type-check.log +5 -4
- package/CHANGELOG.md +11 -0
- package/DEBUG.md +195 -0
- package/README.md +45 -18
- package/dist/FigmaComponentsBuilder.d.ts +1 -0
- package/dist/FigmaComponentsBuilder.d.ts.map +1 -1
- package/dist/FigmaComponentsBuilder.js +138 -26
- package/dist/FigmaComponentsBuilder.js.map +1 -1
- package/dist/cli-manifest.d.ts +3 -0
- package/dist/cli-manifest.d.ts.map +1 -0
- package/dist/cli-manifest.js +17 -0
- package/dist/cli-manifest.js.map +1 -0
- package/dist/commands/import-design-system.d.ts +8 -1
- package/dist/commands/import-design-system.d.ts.map +1 -1
- package/dist/commands/import-design-system.js +88 -5
- package/dist/commands/import-design-system.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +104 -17
- package/dist/index.js.map +1 -1
- package/dist/utils/FilterLoader.d.ts.map +1 -1
- package/dist/utils/FilterLoader.js +84 -4
- package/dist/utils/FilterLoader.js.map +1 -1
- package/package.json +5 -6
- package/src/FigmaComponentsBuilder.ts +162 -29
- package/src/cli-manifest.ts +18 -0
- package/src/commands/import-design-system.ts +101 -5
- package/src/index.ts +125 -16
- package/src/utils/FilterLoader.ts +85 -4
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,51 +1,113 @@
|
|
|
1
1
|
import * as dotenv from 'dotenv';
|
|
2
2
|
import * as Figma from 'figma-api';
|
|
3
|
+
import createDebug from 'debug';
|
|
4
|
+
const debug = createDebug('design-system-importer:figma-builder');
|
|
5
|
+
const debugComponents = createDebug('design-system-importer:figma-builder:components');
|
|
6
|
+
const debugFilters = createDebug('design-system-importer:figma-builder:filters');
|
|
7
|
+
const debugAPI = createDebug('design-system-importer:figma-builder:api');
|
|
8
|
+
const debugTree = createDebug('design-system-importer:figma-builder:tree');
|
|
3
9
|
dotenv.config();
|
|
10
|
+
debug('Initializing FigmaComponentsBuilder module');
|
|
11
|
+
// Add timeout wrapper for Figma API calls
|
|
12
|
+
const withTimeout = (promise, timeoutMs = 10000) => {
|
|
13
|
+
return Promise.race([
|
|
14
|
+
promise,
|
|
15
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error(`Figma API request timed out after ${timeoutMs}ms`)), timeoutMs)),
|
|
16
|
+
]);
|
|
17
|
+
};
|
|
4
18
|
const figmaApi = new Figma.Api({
|
|
5
19
|
personalAccessToken: process.env.FIGMA_PERSONAL_TOKEN,
|
|
6
20
|
});
|
|
21
|
+
debug('Figma API initialized with personal access token');
|
|
7
22
|
export class FigmaComponentsBuilder {
|
|
8
23
|
constructor() {
|
|
9
24
|
this.components = [];
|
|
25
|
+
debug('FigmaComponentsBuilder instance created');
|
|
26
|
+
debugComponents('Initial components array: empty');
|
|
10
27
|
}
|
|
11
28
|
async withFigmaComponents() {
|
|
29
|
+
debugAPI('Fetching Figma components from file: %s', process.env.FIGMA_FILE_ID);
|
|
30
|
+
if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
|
|
31
|
+
process.env.FIGMA_FILE_ID?.trim() === '' ||
|
|
32
|
+
process.env.FIGMA_PERSONAL_TOKEN === undefined ||
|
|
33
|
+
process.env.FIGMA_FILE_ID === undefined) {
|
|
34
|
+
debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
|
|
35
|
+
console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
12
38
|
try {
|
|
39
|
+
debugAPI('Making API call to getFileComponents...');
|
|
13
40
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
14
|
-
const response = await figmaApi.getFileComponents({ file_key: process.env.FIGMA_FILE_ID });
|
|
41
|
+
const response = await withTimeout(figmaApi.getFileComponents({ file_key: process.env.FIGMA_FILE_ID }), 10000);
|
|
42
|
+
debugAPI('API response received');
|
|
15
43
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
16
44
|
if (response.meta.components.length > 0) {
|
|
17
45
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
18
|
-
|
|
46
|
+
debugComponents('Found %d components in Figma file', response.meta.components.length);
|
|
19
47
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
20
|
-
this.components = response.meta.components.map((component) =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
48
|
+
this.components = response.meta.components.map((component) => {
|
|
49
|
+
debugComponents('Processing component: %s', component.name);
|
|
50
|
+
return {
|
|
51
|
+
name: component.name,
|
|
52
|
+
description: component.description,
|
|
53
|
+
thumbnail: component.thumbnail_url,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
debugComponents('Successfully mapped %d components', this.components.length);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
debugComponents('No components found in Figma file');
|
|
25
60
|
}
|
|
26
61
|
}
|
|
27
62
|
catch (e) {
|
|
28
|
-
|
|
63
|
+
debugAPI('ERROR: Failed to fetch Figma components: %O', e);
|
|
64
|
+
console.error('Failed to fetch Figma components:', e);
|
|
29
65
|
}
|
|
66
|
+
debugComponents('withFigmaComponents complete, total components: %d', this.components.length);
|
|
30
67
|
return this;
|
|
31
68
|
}
|
|
32
69
|
async withFigmaComponentSets() {
|
|
70
|
+
debugAPI('Fetching Figma component sets from file: %s', process.env.FIGMA_FILE_ID);
|
|
71
|
+
if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
|
|
72
|
+
process.env.FIGMA_FILE_ID?.trim() === '' ||
|
|
73
|
+
process.env.FIGMA_PERSONAL_TOKEN === undefined ||
|
|
74
|
+
process.env.FIGMA_FILE_ID === undefined) {
|
|
75
|
+
debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
|
|
76
|
+
console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
33
79
|
try {
|
|
80
|
+
debugAPI('Making API call to getFileComponentSets...');
|
|
34
81
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
35
|
-
const response = await figmaApi.getFileComponentSets({ file_key: process.env.FIGMA_FILE_ID });
|
|
82
|
+
const response = await withTimeout(figmaApi.getFileComponentSets({ file_key: process.env.FIGMA_FILE_ID }), 10000);
|
|
83
|
+
debugAPI('API response received');
|
|
36
84
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
37
85
|
if (response.meta.component_sets.length > 0) {
|
|
86
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
87
|
+
debugComponents('Found %d component sets in Figma file', response.meta.component_sets.length);
|
|
38
88
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
39
|
-
this.components = response.meta.component_sets.map((component) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
89
|
+
this.components = response.meta.component_sets.map((component) => {
|
|
90
|
+
debugComponents('Processing component set: %s', component.name);
|
|
91
|
+
const mapped = {
|
|
92
|
+
name: component.name,
|
|
93
|
+
description: component.description ?? 'N/A',
|
|
94
|
+
thumbnail: component.thumbnail_url ?? 'N/A',
|
|
95
|
+
};
|
|
96
|
+
debugComponents(' - Description: %s', mapped.description.substring(0, 50));
|
|
97
|
+
debugComponents(' - Has thumbnail: %s', mapped.thumbnail !== 'N/A');
|
|
98
|
+
return mapped;
|
|
99
|
+
});
|
|
100
|
+
debugComponents('Successfully mapped %d component sets', this.components.length);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
debugComponents('No component sets found in Figma file');
|
|
44
104
|
}
|
|
45
105
|
}
|
|
46
106
|
catch (e) {
|
|
47
|
-
|
|
107
|
+
debugAPI('ERROR: Failed to fetch Figma component sets: %O', e);
|
|
108
|
+
console.error('Failed to fetch Figma component sets:', e);
|
|
48
109
|
}
|
|
110
|
+
debugComponents('withFigmaComponentSets complete, total components: %d', this.components.length);
|
|
49
111
|
return this;
|
|
50
112
|
}
|
|
51
113
|
// extractBracketedComponents(item: FigmaComponent): FigmaComponent | null {
|
|
@@ -58,66 +120,108 @@ export class FigmaComponentsBuilder {
|
|
|
58
120
|
// this.components = this.components.map(this.extractBracketedComponents).filter(Boolean) as FigmaComponent[];
|
|
59
121
|
// }
|
|
60
122
|
withFilteredNamesForShadcn() {
|
|
123
|
+
debugFilters('Applying Shadcn name filter to %d components', this.components.length);
|
|
124
|
+
const originalCount = this.components.length;
|
|
61
125
|
this.components = this.components
|
|
62
126
|
.map((comp) => {
|
|
63
|
-
if (!comp?.name)
|
|
127
|
+
if (!comp?.name) {
|
|
128
|
+
debugFilters('Skipping component with no name');
|
|
64
129
|
return null;
|
|
130
|
+
}
|
|
65
131
|
let str = comp.name.trim();
|
|
132
|
+
debugFilters('Processing component name: %s', str);
|
|
66
133
|
if (str.includes('/')) {
|
|
134
|
+
const original = str;
|
|
67
135
|
str = str.split('/')[0].trim();
|
|
136
|
+
debugFilters(' Split by /: %s -> %s', original, str);
|
|
68
137
|
}
|
|
69
138
|
else {
|
|
139
|
+
const original = str;
|
|
70
140
|
str = str.split(' ')[0].trim();
|
|
141
|
+
debugFilters(' Split by space: %s -> %s', original, str);
|
|
71
142
|
}
|
|
72
143
|
if (str.length > 0) {
|
|
73
|
-
|
|
144
|
+
const capitalized = str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
|
|
145
|
+
const final = capitalized.toLowerCase();
|
|
146
|
+
debugFilters(' Normalized: %s -> %s', str, final);
|
|
147
|
+
return {
|
|
148
|
+
...comp,
|
|
149
|
+
name: final,
|
|
150
|
+
};
|
|
74
151
|
}
|
|
75
152
|
else {
|
|
153
|
+
debugFilters(' Empty string after processing, skipping');
|
|
76
154
|
return null;
|
|
77
155
|
}
|
|
78
|
-
return {
|
|
79
|
-
...comp,
|
|
80
|
-
name: str.toLowerCase(),
|
|
81
|
-
};
|
|
82
156
|
})
|
|
83
157
|
.filter((c) => Boolean(c));
|
|
158
|
+
debugFilters('Shadcn filter complete: %d -> %d components', originalCount, this.components.length);
|
|
84
159
|
}
|
|
85
160
|
withFilter(filter) {
|
|
161
|
+
debugFilters('Applying custom filter function to %d components', this.components.length);
|
|
162
|
+
const originalCount = this.components.length;
|
|
86
163
|
try {
|
|
87
164
|
this.components = filter(this.components);
|
|
165
|
+
debugFilters('Custom filter applied successfully: %d -> %d components', originalCount, this.components.length);
|
|
88
166
|
}
|
|
89
167
|
catch (e) {
|
|
168
|
+
debugFilters('ERROR: Failed to apply custom filter: %O', e);
|
|
90
169
|
console.error('Error applying custom filter:', e);
|
|
91
170
|
}
|
|
92
171
|
}
|
|
93
172
|
async withAllFigmaInstanceNames() {
|
|
173
|
+
debugAPI('Fetching all Figma instance names from file: %s', process.env.FIGMA_FILE_ID);
|
|
174
|
+
if (process.env.FIGMA_PERSONAL_TOKEN?.trim() === '' ||
|
|
175
|
+
process.env.FIGMA_FILE_ID?.trim() === '' ||
|
|
176
|
+
process.env.FIGMA_PERSONAL_TOKEN === undefined ||
|
|
177
|
+
process.env.FIGMA_FILE_ID === undefined) {
|
|
178
|
+
debugAPI('Missing Figma credentials. FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID not set');
|
|
179
|
+
console.warn('Skipping Figma import: Missing FIGMA_PERSONAL_TOKEN or FIGMA_FILE_ID in environment');
|
|
180
|
+
return this;
|
|
181
|
+
}
|
|
94
182
|
try {
|
|
95
183
|
/// ----
|
|
96
184
|
const usedComponentMap = new Map();
|
|
185
|
+
debugTree('Created component map for tracking unique instances');
|
|
186
|
+
debugAPI('Making API call to getFile with depth: 1...');
|
|
97
187
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
98
|
-
const { document } = await figmaApi.getFile({
|
|
188
|
+
const { document } = await withTimeout(figmaApi.getFile({
|
|
99
189
|
file_key: process.env.FIGMA_FILE_ID,
|
|
100
190
|
depth: 1,
|
|
101
|
-
});
|
|
102
|
-
|
|
191
|
+
}), 10000);
|
|
192
|
+
debugAPI('File document received, starting tree walk');
|
|
193
|
+
// eslint-disable-next-line complexity
|
|
194
|
+
function walkTree(node, depth = 0) {
|
|
195
|
+
const indent = ' '.repeat(depth);
|
|
196
|
+
debugTree('%sVisiting node: %s (type: %s)', indent, node.name, node.type);
|
|
103
197
|
if (node.type === 'INSTANCE' && Boolean(node.name)) {
|
|
104
198
|
if (!usedComponentMap.has(node.name)) {
|
|
199
|
+
debugTree('%s -> Found new instance: %s', indent, node.name);
|
|
105
200
|
usedComponentMap.set(node.name, {
|
|
106
201
|
name: node.name,
|
|
107
202
|
description: node.description ?? '',
|
|
108
203
|
thumbnail: node.thumbnail_url ?? '',
|
|
109
204
|
});
|
|
205
|
+
debugTree('%s Description: %s', indent, node.description ? 'present' : 'empty');
|
|
206
|
+
debugTree('%s Thumbnail: %s', indent, node.thumbnail_url ? 'present' : 'missing');
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
debugTree('%s -> Instance already tracked: %s', indent, node.name);
|
|
110
210
|
}
|
|
111
211
|
}
|
|
112
212
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
113
213
|
if (node.children) {
|
|
214
|
+
debugTree('%s Has %d children', indent, node.children.length);
|
|
114
215
|
for (const child of node.children) {
|
|
115
|
-
walkTree(child);
|
|
216
|
+
walkTree(child, depth + 1);
|
|
116
217
|
}
|
|
117
218
|
}
|
|
118
219
|
}
|
|
220
|
+
debugTree('Starting tree walk from document root');
|
|
119
221
|
walkTree(document);
|
|
222
|
+
debugTree('Tree walk complete');
|
|
120
223
|
this.components = Array.from(usedComponentMap.values());
|
|
224
|
+
debugComponents('Extracted %d unique component instances', this.components.length);
|
|
121
225
|
/// ----
|
|
122
226
|
// const components = []
|
|
123
227
|
// // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
@@ -164,11 +268,19 @@ export class FigmaComponentsBuilder {
|
|
|
164
268
|
// }
|
|
165
269
|
}
|
|
166
270
|
catch (e) {
|
|
167
|
-
|
|
271
|
+
debugAPI('ERROR: Failed to fetch Figma instance names: %O', e);
|
|
272
|
+
console.error('Failed to fetch Figma instance names:', e);
|
|
168
273
|
}
|
|
274
|
+
debugComponents('withAllFigmaInstanceNames complete, total components: %d', this.components.length);
|
|
169
275
|
return this;
|
|
170
276
|
}
|
|
171
277
|
build() {
|
|
278
|
+
debug('Building final component list');
|
|
279
|
+
debugComponents('Returning %d components', this.components.length);
|
|
280
|
+
if (this.components.length > 0) {
|
|
281
|
+
debugComponents('First component: %s', this.components[0].name);
|
|
282
|
+
debugComponents('Last component: %s', this.components[this.components.length - 1].name);
|
|
283
|
+
}
|
|
172
284
|
return this.components;
|
|
173
285
|
}
|
|
174
286
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigmaComponentsBuilder.js","sourceRoot":"","sources":["../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"FigmaComponentsBuilder.js","sourceRoot":"","sources":["../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AACnC,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,MAAM,KAAK,GAAG,WAAW,CAAC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M,YAAY,EAAE,WAe1B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const CLI_MANIFEST = {
|
|
2
|
+
category: '@auto-engineer/design-system-importer',
|
|
3
|
+
commands: {
|
|
4
|
+
'import:design-system': {
|
|
5
|
+
handler: () => import('./commands/import-design-system.js'),
|
|
6
|
+
description: 'Import Figma design system',
|
|
7
|
+
usage: 'import:design-system <src> <mode> [filter]',
|
|
8
|
+
examples: ['$ auto import:design-system ./.context WITH_COMPONENT_SETS ./shadcn-filter.ts'],
|
|
9
|
+
args: [
|
|
10
|
+
{ name: 'src', description: 'Source directory for design system', required: true },
|
|
11
|
+
{ name: 'mode', description: 'Import mode (e.g., WITH_COMPONENT_SETS)', required: true },
|
|
12
|
+
{ name: 'filter', description: 'Optional filter file', required: false },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=cli-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-manifest.js","sourceRoot":"","sources":["../src/cli-manifest.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,QAAQ,EAAE,uCAAuC;IACjD,QAAQ,EAAE;QACR,sBAAsB,EAAE;YACtB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,iCAAiC,CAAC;YACxD,WAAW,EAAE,4BAA4B;YACzC,KAAK,EAAE,4CAA4C;YACnD,QAAQ,EAAE,CAAC,+EAA+E,CAAC;YAC3F,IAAI,EAAE;gBACJ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,oCAAoC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAClF,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,yCAAyC,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACxF,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE,QAAQ,EAAE,KAAK,EAAE;aACzE;SACF;KACF;CACF,CAAC"}
|
|
@@ -12,6 +12,13 @@ export type DesignSystemImportFailedEvent = Event<'DesignSystemImportFailed', {
|
|
|
12
12
|
error: string;
|
|
13
13
|
outputDir: string;
|
|
14
14
|
}>;
|
|
15
|
-
export declare function handleImportDesignSystemCommand(command: ImportDesignSystemCommand): Promise<DesignSystemImportedEvent | DesignSystemImportFailedEvent>;
|
|
16
15
|
export declare const importDesignSystemCommandHandler: CommandHandler<ImportDesignSystemCommand>;
|
|
16
|
+
interface CliArgs {
|
|
17
|
+
_: string[];
|
|
18
|
+
strategy?: 'WITH_COMPONENTS' | 'WITH_COMPONENT_SETS' | 'WITH_ALL_FIGMA_INSTANCES';
|
|
19
|
+
filter?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
declare const _default: (commandOrArgs: ImportDesignSystemCommand | CliArgs) => Promise<void>;
|
|
23
|
+
export default _default;
|
|
17
24
|
//# sourceMappingURL=import-design-system.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/import-design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAyC,cAAc,EAA2B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"import-design-system.d.ts","sourceRoot":"","sources":["../../src/commands/import-design-system.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,EAAyC,cAAc,EAA2B,MAAM,UAAU,CAAC;AAS1G,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAC7C,oBAAoB,EACpB;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,OAAO,cAAc,CAAC;IACvC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CACF,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,KAAK,CAC3C,sBAAsB,EACtB;IACE,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,KAAK,CAC/C,0BAA0B,EAC1B;IACE,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CACF,CAAC;AAkFF,eAAO,MAAM,gCAAgC,EAAE,cAAc,CAAC,yBAAyB,CAatF,CAAC;AAGF,UAAU,OAAO;IACf,CAAC,EAAE,MAAM,EAAE,CAAC;IACZ,QAAQ,CAAC,EAAE,iBAAiB,GAAG,qBAAqB,GAAG,0BAA0B,CAAC;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;wCAcoC,yBAAyB,GAAG,OAAO;AAAxE,wBAoCE"}
|
|
@@ -1,28 +1,52 @@
|
|
|
1
1
|
import { importDesignSystemComponentsFromFigma, ImportStrategy } from '../index.js';
|
|
2
2
|
import { FilterLoader } from '../utils/FilterLoader.js';
|
|
3
|
+
import createDebug from 'debug';
|
|
4
|
+
const debug = createDebug('design-system-importer:command');
|
|
5
|
+
const debugFilter = createDebug('design-system-importer:command:filter');
|
|
6
|
+
const debugHandler = createDebug('design-system-importer:command:handler');
|
|
7
|
+
const debugResult = createDebug('design-system-importer:command:result');
|
|
3
8
|
// Handler
|
|
4
|
-
|
|
9
|
+
// eslint-disable-next-line complexity
|
|
10
|
+
async function handleImportDesignSystemCommandInternal(command) {
|
|
5
11
|
const { outputDir, strategy, filterPath } = command.data;
|
|
12
|
+
debug('Handling ImportDesignSystemCommand');
|
|
13
|
+
debug(' Output directory: %s', outputDir);
|
|
14
|
+
debug(' Strategy: %s', strategy ?? 'default');
|
|
15
|
+
debug(' Filter path: %s', filterPath ?? 'none');
|
|
16
|
+
debug(' Request ID: %s', command.requestId);
|
|
17
|
+
debug(' Correlation ID: %s', command.correlationId ?? 'none');
|
|
6
18
|
try {
|
|
7
19
|
const resolvedStrategy = strategy ? ImportStrategy[strategy] : ImportStrategy.WITH_COMPONENT_SETS;
|
|
20
|
+
debugHandler('Resolved strategy: %s', resolvedStrategy);
|
|
8
21
|
let filterFn;
|
|
9
22
|
let loader;
|
|
10
23
|
if (typeof filterPath === 'string' && filterPath.trim().length > 0) {
|
|
24
|
+
debugFilter('Loading custom filter from: %s', filterPath);
|
|
11
25
|
try {
|
|
12
26
|
loader = new FilterLoader();
|
|
27
|
+
debugFilter('FilterLoader instance created');
|
|
13
28
|
filterFn = await loader.loadFilter(filterPath);
|
|
29
|
+
debugFilter('Filter function loaded successfully');
|
|
14
30
|
}
|
|
15
31
|
catch (e) {
|
|
32
|
+
debugFilter('ERROR: Failed to load filter from %s: %O', filterPath, e);
|
|
16
33
|
console.warn(`Could not import filter from ${filterPath}. Skipping custom filter.`, e);
|
|
17
34
|
}
|
|
18
35
|
finally {
|
|
19
|
-
if (loader)
|
|
36
|
+
if (loader) {
|
|
37
|
+
debugFilter('Cleaning up FilterLoader');
|
|
20
38
|
loader.cleanup();
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
41
|
}
|
|
42
|
+
else {
|
|
43
|
+
debugFilter('No filter path provided, proceeding without custom filter');
|
|
44
|
+
}
|
|
45
|
+
debugHandler('Calling importDesignSystemComponentsFromFigma...');
|
|
23
46
|
await importDesignSystemComponentsFromFigma(outputDir, resolvedStrategy, filterFn);
|
|
47
|
+
debugHandler('Import completed successfully');
|
|
24
48
|
console.log(`Design system files processed to ${outputDir}`);
|
|
25
|
-
|
|
49
|
+
const successEvent = {
|
|
26
50
|
type: 'DesignSystemImported',
|
|
27
51
|
data: {
|
|
28
52
|
outputDir,
|
|
@@ -31,11 +55,16 @@ export async function handleImportDesignSystemCommand(command) {
|
|
|
31
55
|
requestId: command.requestId,
|
|
32
56
|
correlationId: command.correlationId,
|
|
33
57
|
};
|
|
58
|
+
debugResult('Returning success event: DesignSystemImported');
|
|
59
|
+
debugResult(' Output directory: %s', outputDir);
|
|
60
|
+
return successEvent;
|
|
34
61
|
}
|
|
35
62
|
catch (error) {
|
|
36
63
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
64
|
+
debugHandler('ERROR: Design system import failed: %O', error);
|
|
65
|
+
debugResult('Error message: %s', errorMessage);
|
|
37
66
|
console.error('Error importing design system:', error);
|
|
38
|
-
|
|
67
|
+
const failureEvent = {
|
|
39
68
|
type: 'DesignSystemImportFailed',
|
|
40
69
|
data: {
|
|
41
70
|
error: errorMessage,
|
|
@@ -45,18 +74,72 @@ export async function handleImportDesignSystemCommand(command) {
|
|
|
45
74
|
requestId: command.requestId,
|
|
46
75
|
correlationId: command.correlationId,
|
|
47
76
|
};
|
|
77
|
+
debugResult('Returning failure event: DesignSystemImportFailed');
|
|
78
|
+
debugResult(' Error: %s', errorMessage);
|
|
79
|
+
debugResult(' Output directory: %s', outputDir);
|
|
80
|
+
return failureEvent;
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
83
|
export const importDesignSystemCommandHandler = {
|
|
51
84
|
name: 'ImportDesignSystem',
|
|
52
85
|
handle: async (command) => {
|
|
53
|
-
|
|
86
|
+
debug('CommandHandler executing for ImportDesignSystem');
|
|
87
|
+
const result = await handleImportDesignSystemCommandInternal(command);
|
|
54
88
|
if (result.type === 'DesignSystemImported') {
|
|
89
|
+
debug('Command handler completed: success');
|
|
55
90
|
console.log('Design system imported successfully');
|
|
56
91
|
}
|
|
57
92
|
else {
|
|
93
|
+
debug('Command handler completed: failure - %s', result.data.error);
|
|
58
94
|
console.error(`Failed: ${result.data.error}`);
|
|
59
95
|
}
|
|
60
96
|
},
|
|
61
97
|
};
|
|
98
|
+
// Type guard to check if it's an ImportDesignSystemCommand
|
|
99
|
+
function isImportDesignSystemCommand(obj) {
|
|
100
|
+
return (typeof obj === 'object' &&
|
|
101
|
+
obj !== null &&
|
|
102
|
+
'type' in obj &&
|
|
103
|
+
'data' in obj &&
|
|
104
|
+
obj.type === 'ImportDesignSystem');
|
|
105
|
+
}
|
|
106
|
+
// Default export for CLI usage
|
|
107
|
+
export default async (commandOrArgs) => {
|
|
108
|
+
let command;
|
|
109
|
+
if (isImportDesignSystemCommand(commandOrArgs)) {
|
|
110
|
+
command = commandOrArgs;
|
|
111
|
+
}
|
|
112
|
+
else if ('outputDir' in commandOrArgs) {
|
|
113
|
+
// Handle message bus format
|
|
114
|
+
const args = commandOrArgs;
|
|
115
|
+
command = {
|
|
116
|
+
type: 'ImportDesignSystem',
|
|
117
|
+
data: {
|
|
118
|
+
outputDir: args.outputDir ?? '.context',
|
|
119
|
+
strategy: args.strategy,
|
|
120
|
+
filterPath: args.filterPath,
|
|
121
|
+
},
|
|
122
|
+
timestamp: new Date(),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
// Handle traditional CLI args format
|
|
127
|
+
command = {
|
|
128
|
+
type: 'ImportDesignSystem',
|
|
129
|
+
data: {
|
|
130
|
+
outputDir: commandOrArgs._?.[0] ?? '.context',
|
|
131
|
+
strategy: commandOrArgs._?.[1],
|
|
132
|
+
filterPath: commandOrArgs._?.[2],
|
|
133
|
+
},
|
|
134
|
+
timestamp: new Date(),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const result = await handleImportDesignSystemCommandInternal(command);
|
|
138
|
+
if (result.type === 'DesignSystemImported') {
|
|
139
|
+
console.log('Design system imported successfully');
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
console.error(`Failed: ${result.data.error}`);
|
|
143
|
+
}
|
|
144
|
+
};
|
|
62
145
|
//# sourceMappingURL=import-design-system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-design-system.js","sourceRoot":"","sources":["../../src/commands/import-design-system.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qCAA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,CAAC,CAA4C;gBACzE,UAAU,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACjC;YACD,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,uCAAuC,CAAC,OAAO,CAAC,CAAC;IACtE,IAAI,MAAM,CAAC,IAAI,KAAK,sBAAsB,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;IACrD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,WAAW,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type FilterFunctionType } from './FigmaComponentsBuilder';
|
|
|
2
2
|
export declare function generateDesignSystemMarkdown(inputDir: string, outputDir: string): Promise<void>;
|
|
3
3
|
export * from './commands/import-design-system';
|
|
4
4
|
export type { FilterFunctionType } from './FigmaComponentsBuilder';
|
|
5
|
+
export { CLI_MANIFEST } from './cli-manifest';
|
|
5
6
|
export declare function copyDesignSystemDocsAndUserPreferences(inputDir: string, outputDir: string): Promise<void>;
|
|
6
7
|
export declare function generateMarkdownFromComponents(components: {
|
|
7
8
|
name: string;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAA0B,KAAK,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AA2D3F,wBAAsB,4BAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BrG;AAED,cAAc,iCAAiC,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAwB9C,wBAAsB,sCAAsC,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4C/G;AAoCD,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAAE,GACrE,MAAM,CAiBR;AAED,oBAAY,cAAc;IACxB,eAAe,oBAAoB;IACnC,mBAAmB,wBAAwB;IAC3C,wBAAwB,6BAA6B;CACtD;AAED,wBAAsB,qCAAqC,CACzD,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,cAAmD,EAC7D,QAAQ,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAqEf"}
|