@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
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @auto-engineer/design-system-importer@0.
|
|
2
|
+
> @auto-engineer/design-system-importer@0.5.0 build /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
|
|
3
3
|
> tsc && tsx ../../scripts/fix-esm-imports.ts && cp -r src/utils/templates dist/utils/
|
|
4
4
|
|
|
5
5
|
Fixed ESM imports in dist/
|
package/.turbo/turbo-format.log
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @auto-engineer/design-system-importer@0.
|
|
3
|
+
> @auto-engineer/design-system-importer@0.5.0 format /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
|
|
4
4
|
> prettier --write "**/*.{js,ts,json,md,yml,yaml}" --ignore-path ../../.prettierignore
|
|
5
5
|
|
|
6
|
-
CHANGELOG.md[2K[1G[90mCHANGELOG.md[39m
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
src/
|
|
11
|
-
src/
|
|
12
|
-
src/
|
|
6
|
+
CHANGELOG.md[2K[1G[90mCHANGELOG.md[39m 27ms (unchanged)
|
|
7
|
+
DEBUG.md[2K[1G[90mDEBUG.md[39m 5ms (unchanged)
|
|
8
|
+
package.json[2K[1G[90mpackage.json[39m 15ms (unchanged)
|
|
9
|
+
README.md[2K[1G[90mREADME.md[39m 35ms (unchanged)
|
|
10
|
+
src/cli-manifest.ts[2K[1G[90msrc/cli-manifest.ts[39m 8ms (unchanged)
|
|
11
|
+
src/commands/import-design-system.ts[2K[1G[90msrc/commands/import-design-system.ts[39m 28ms (unchanged)
|
|
12
|
+
src/FigmaComponentsBuilder.ts[2K[1G[90msrc/FigmaComponentsBuilder.ts[39m 26ms (unchanged)
|
|
13
|
+
src/index.ts[2K[1G[90msrc/index.ts[39m 13ms (unchanged)
|
|
14
|
+
src/utils/FilterLoader.ts[2K[1G[90msrc/utils/FilterLoader.ts[39m 10ms (unchanged)
|
|
13
15
|
tsconfig.json[2K[1G[90mtsconfig.json[39m 1ms (unchanged)
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @auto-engineer/design-system-importer@0.
|
|
3
|
+
> @auto-engineer/design-system-importer@0.5.0 lint /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
|
|
4
4
|
> eslint 'src/**/*.ts' --max-warnings 0 --config ../../eslint.config.ts
|
|
5
5
|
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @auto-engineer/design-system-importer@0.5.0 test /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
|
|
4
|
+
> vitest run
|
|
5
|
+
|
|
6
|
+
[?25l
|
|
7
|
+
[1m[46m RUN [49m[22m [36mv3.2.4 [39m[90m/Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer[39m
|
|
8
|
+
|
|
9
|
+
No test files found, exiting with code 0
|
|
10
|
+
|
|
11
|
+
[31m[2minclude: [22m[33m**/*.specs.{js,ts}[39m[39m
|
|
12
|
+
[31m[2mexclude: [22m[33m**/.tmp/**[2m, [22m**/node_modules/**[2m, [22m**/dist/**[39m[39m
|
|
13
|
+
[31m[39m
|
|
14
|
+
[?25h
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @auto-engineer/design-system-importer@0.5.0 type-check /Users/sam/WebstormProjects/top/auto-engineer/packages/design-system-importer
|
|
4
|
+
> tsc --noEmit
|
|
5
|
+
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @auto-engineer/design-system-importer
|
|
2
2
|
|
|
3
|
+
## 0.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- • All cli commands now use commands and emit events on the bus
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @auto-engineer/message-bus@0.4.0
|
|
13
|
+
|
|
3
14
|
## 0.4.8
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/DEBUG.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Debug Logging - Design System Importer
|
|
2
|
+
|
|
3
|
+
This package uses the [debug](https://www.npmjs.com/package/debug) library for conditional logging.
|
|
4
|
+
|
|
5
|
+
## Available Debug Namespaces
|
|
6
|
+
|
|
7
|
+
- `design-importer:command` - Command handling
|
|
8
|
+
- `design-importer:handler` - Import handler operations
|
|
9
|
+
- `design-importer:filter` - Filter loading and application
|
|
10
|
+
- `design-importer:result` - Result generation
|
|
11
|
+
- `design-importer:builder` - Figma component builder
|
|
12
|
+
- `design-importer:builder:api` - Figma API calls
|
|
13
|
+
- `design-importer:builder:components` - Component extraction
|
|
14
|
+
- `design-importer:builder:tree` - Tree walking operations
|
|
15
|
+
|
|
16
|
+
## Enabling Debug Output
|
|
17
|
+
|
|
18
|
+
Set the `DEBUG` environment variable to enable logging:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Enable all design-importer logging
|
|
22
|
+
DEBUG=design-importer:* pnpm import:design-system
|
|
23
|
+
|
|
24
|
+
# Enable specific namespace
|
|
25
|
+
DEBUG=design-importer:builder:api pnpm import:design-system
|
|
26
|
+
|
|
27
|
+
# Enable builder operations
|
|
28
|
+
DEBUG=design-importer:builder:* pnpm import:design-system
|
|
29
|
+
|
|
30
|
+
# Enable all logging
|
|
31
|
+
DEBUG=* pnpm import:design-system
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Debug Command Handling
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
DEBUG=design-importer:command pnpm import:design-system
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Output example:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
design-importer:command Handling ImportDesignSystemCommand
|
|
46
|
+
design-importer:command Output directory: ./output
|
|
47
|
+
design-importer:command Strategy: WITH_COMPONENT_SETS
|
|
48
|
+
design-importer:command Filter path: ./filters/custom-filter.js
|
|
49
|
+
design-importer:command Request ID: req-123
|
|
50
|
+
design-importer:command Correlation ID: corr-456
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Debug Figma API Operations
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
DEBUG=design-importer:builder:api pnpm import:design-system
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Output example:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
design-importer:builder:api Fetching Figma file: file-key-123
|
|
63
|
+
design-importer:builder:api Using strategy: WITH_COMPONENT_SETS
|
|
64
|
+
design-importer:builder:api Making API request to Figma
|
|
65
|
+
design-importer:builder:api Response received, status: 200
|
|
66
|
+
design-importer:builder:api File document received, starting tree walk
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Debug Component Extraction
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
DEBUG=design-importer:builder:components pnpm import:design-system
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Output example:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
design-importer:builder:components Extracting component sets from Figma
|
|
79
|
+
design-importer:builder:components Found 15 component sets
|
|
80
|
+
design-importer:builder:components Processing component set: Button
|
|
81
|
+
design-importer:builder:components Variants: 8
|
|
82
|
+
design-importer:builder:components Properties: size, variant, state
|
|
83
|
+
design-importer:builder:components Processing component set: Input
|
|
84
|
+
design-importer:builder:components Variants: 6
|
|
85
|
+
design-importer:builder:components Properties: size, state, type
|
|
86
|
+
design-importer:builder:components Extracted 45 unique component instances
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Debug Tree Walking
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
DEBUG=design-importer:builder:tree pnpm import:design-system
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Output example:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
design-importer:builder:tree Starting tree walk from document root
|
|
99
|
+
design-importer:builder:tree Visiting node: Page 1 (type: PAGE)
|
|
100
|
+
design-importer:builder:tree Has 5 children
|
|
101
|
+
design-importer:builder:tree Visiting node: Header Component (type: COMPONENT)
|
|
102
|
+
design-importer:builder:tree -> Found new instance: Header
|
|
103
|
+
design-importer:builder:tree Description: present
|
|
104
|
+
design-importer:builder:tree Thumbnail: present
|
|
105
|
+
design-importer:builder:tree Visiting node: Button Instance (type: INSTANCE)
|
|
106
|
+
design-importer:builder:tree -> Instance already tracked: Button
|
|
107
|
+
design-importer:builder:tree Tree walk complete
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Debug Filter Operations
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
DEBUG=design-importer:filter pnpm import:design-system
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Output example:
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
design-importer:filter Loading custom filter from: ./filters/custom-filter.js
|
|
120
|
+
design-importer:filter FilterLoader instance created
|
|
121
|
+
design-importer:filter Creating temporary file for filter
|
|
122
|
+
design-importer:filter Temp file: /tmp/filter-12345.mjs
|
|
123
|
+
design-importer:filter Importing filter module
|
|
124
|
+
design-importer:filter Filter function loaded successfully
|
|
125
|
+
design-importer:filter Applying filter to component: Button
|
|
126
|
+
design-importer:filter Filter result: include
|
|
127
|
+
design-importer:filter Applying filter to component: InternalComponent
|
|
128
|
+
design-importer:filter Filter result: exclude
|
|
129
|
+
design-importer:filter Cleaning up FilterLoader
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Debug Result Handling
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
DEBUG=design-importer:result pnpm import:design-system
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Output example:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
design-importer:result Import completed successfully
|
|
142
|
+
design-importer:result Returning success event: DesignSystemImported
|
|
143
|
+
design-importer:result Output directory: ./output
|
|
144
|
+
design-importer:result Components processed: 45
|
|
145
|
+
design-importer:result Files generated: 3
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Common Use Cases
|
|
149
|
+
|
|
150
|
+
### Debug Full Import Process
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
DEBUG=design-importer:* pnpm import:design-system
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Debug Figma Operations Only
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
DEBUG=design-importer:builder:* pnpm import:design-system
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Debug with Filter Details
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
DEBUG=design-importer:filter,design-importer:builder:components pnpm import:design-system
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Debug API and Tree Walking
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
DEBUG=design-importer:builder:api,design-importer:builder:tree pnpm import:design-system
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Save Debug Output
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
DEBUG=design-importer:* pnpm import:design-system 2> design-import-debug.log
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Environment Variables
|
|
181
|
+
|
|
182
|
+
Required for Figma API access:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
FIGMA_ACCESS_TOKEN=your-figma-token
|
|
186
|
+
FIGMA_FILE_ID=your-file-id
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Tips
|
|
190
|
+
|
|
191
|
+
- Use `DEBUG=design-importer:builder:*` to see all Figma operations
|
|
192
|
+
- Monitor API calls with `DEBUG=design-importer:builder:api`
|
|
193
|
+
- Track component processing with `DEBUG=design-importer:builder:components`
|
|
194
|
+
- Combine with other packages: `DEBUG=design-importer:*,ia:*`
|
|
195
|
+
- Filter verbose output: `DEBUG=design-importer:*,-design-importer:builder:tree`
|
package/README.md
CHANGED
|
@@ -1,48 +1,75 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @auto-engineer/design-system-importer
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Import your team's design system to build consistent, on-brand apps. Plugin for the Auto Engineer CLI that syncs shared styles, components, and tokens from design tools or code.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
This is a plugin for the Auto Engineer CLI. Install both the CLI and this plugin:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @auto-engineer/cli
|
|
11
|
+
npm install @auto-engineer/design-system-importer
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Configuration
|
|
15
|
+
|
|
16
|
+
Add this plugin to your `auto.config.ts`:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
export default {
|
|
20
|
+
plugins: [
|
|
21
|
+
'@auto-engineer/design-system-importer',
|
|
22
|
+
// ... other plugins
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Commands
|
|
28
|
+
|
|
29
|
+
This plugin provides the following commands:
|
|
30
|
+
|
|
31
|
+
- `import:design-system` - Import a design system from Figma
|
|
5
32
|
|
|
6
33
|
## Available Importers
|
|
7
34
|
|
|
8
|
-
- **Figma** – Import components directly from Figma. Use our [Auto plugin]() to export design tokens
|
|
35
|
+
- **Figma** – Import components directly from Figma. Use our [Auto plugin]() to export design tokens.
|
|
9
36
|
- **Code** – _(coming soon)_ Import tokens and components from an existing codebase.
|
|
10
|
-
- **NPM Package** – _(coming soon)_
|
|
37
|
+
- **NPM Package** – _(coming soon)_ Import a published design system as a dependency.
|
|
11
38
|
|
|
12
39
|
## Figma Importer
|
|
13
40
|
|
|
14
|
-
|
|
41
|
+
Import your design system directly from Figma and integrate it into your local project.
|
|
15
42
|
|
|
16
43
|
### Prerequisites
|
|
17
44
|
|
|
18
|
-
-
|
|
19
|
-
-
|
|
45
|
+
- Figma Personal Access Token
|
|
46
|
+
- Professional Figma Plan (or higher)
|
|
20
47
|
|
|
21
48
|
### Setup
|
|
22
49
|
|
|
23
|
-
1.
|
|
50
|
+
1. Generate a personal access token
|
|
24
51
|
Follow [these instructions](https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens) from Figma.
|
|
25
52
|
|
|
26
|
-
2.
|
|
53
|
+
2. Get your design system file ID
|
|
27
54
|
Open your Figma file and copy the part of the URL after `/design/`.
|
|
28
55
|
|
|
29
|
-
3.
|
|
56
|
+
3. Configure environment variables
|
|
30
57
|
- `FIGMA_PERSONAL_TOKEN` – The token from your Figma account
|
|
31
58
|
- `FIGMA_FILE_ID` – The ID of the design file (found in the Figma URL after `/design/`)
|
|
32
59
|
|
|
33
|
-
4.
|
|
34
|
-
Right-click anywhere →
|
|
60
|
+
4. Publish your components in Figma
|
|
61
|
+
Right-click anywhere → Actions → Search for "Publish changes to library".
|
|
35
62
|
|
|
36
|
-
>
|
|
63
|
+
> (Optional) If you're using a public design system, you may need to move the file into one of your own Figma projects first.
|
|
37
64
|
|
|
38
|
-
5.
|
|
65
|
+
5. Export tokens with the Auto plugin
|
|
39
66
|
- Install the [Auto plugin]()
|
|
40
67
|
- Run it inside your Figma file
|
|
41
|
-
- Click
|
|
68
|
+
- Click "Export Tokens"
|
|
42
69
|
- Save the exported file inside the `.context` folder of your output directory
|
|
43
70
|
|
|
44
|
-
6.
|
|
71
|
+
6. Run the importer
|
|
45
72
|
|
|
46
73
|
```bash
|
|
47
|
-
|
|
74
|
+
auto import:design-system
|
|
48
75
|
```
|
|
@@ -6,6 +6,7 @@ export interface FigmaComponent {
|
|
|
6
6
|
export type FilterFunctionType = (components: FigmaComponent[]) => FigmaComponent[];
|
|
7
7
|
export declare class FigmaComponentsBuilder {
|
|
8
8
|
components: FigmaComponent[];
|
|
9
|
+
constructor();
|
|
9
10
|
withFigmaComponents(): Promise<this>;
|
|
10
11
|
withFigmaComponentSets(): Promise<this>;
|
|
11
12
|
withFilteredNamesForShadcn(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FigmaComponentsBuilder.d.ts","sourceRoot":"","sources":["../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FigmaComponentsBuilder.d.ts","sourceRoot":"","sources":["../src/FigmaComponentsBuilder.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,CAAC;AAUpF,qBAAa,sBAAsB;IACjC,UAAU,EAAE,cAAc,EAAE,CAAM;;IAO5B,mBAAmB;IA8CnB,sBAAsB;IA2D5B,0BAA0B,IAAI,IAAI;IAwClC,UAAU,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI;IAYtC,yBAAyB;IAwH/B,KAAK;CASN"}
|