figma-to-code-agent 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/QUICKSTART.md +12 -42
- package/README.md +17 -7
- package/dist/cli.js +3 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.3.2] - 2026-02-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Rename CLI bin from `figma-to-code` to `figma-to-code-agent` to avoid npm naming conflict
|
|
7
|
+
- Update all docs and help text to use `npx figma-to-code-agent`
|
|
8
|
+
|
|
9
|
+
## [0.3.1] - 2026-02-12
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Update README and QUICKSTART for npm package usage (`npx figma-to-code`)
|
|
13
|
+
- Add `files`, `engines`, `prepublishOnly` to package.json for cleaner npm publish
|
|
14
|
+
- Fix all 62 ESLint errors and warnings
|
|
15
|
+
|
|
3
16
|
## [0.3.0] - 2026-02-12
|
|
4
17
|
|
|
5
18
|
### Added
|
package/QUICKSTART.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# Quick Start
|
|
2
2
|
|
|
3
|
-
## 1. Install
|
|
3
|
+
## 1. Install
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
|
|
7
|
-
cd figma-to-code-agent
|
|
8
|
-
npm install
|
|
9
|
-
npm run build
|
|
6
|
+
npm install -g figma-to-code-agent
|
|
10
7
|
```
|
|
11
8
|
|
|
9
|
+
Or skip install and use `npx figma-to-code-agent` directly.
|
|
10
|
+
|
|
12
11
|
## 2. Get Your Figma Token
|
|
13
12
|
|
|
14
13
|
1. Go to [Figma API Settings](https://www.figma.com/developers/api#access-tokens)
|
|
@@ -31,7 +30,7 @@ Node ID format: `100-200` (use hyphen, not colon)
|
|
|
31
30
|
|
|
32
31
|
```bash
|
|
33
32
|
# React component
|
|
34
|
-
|
|
33
|
+
npx figma-to-code-agent \
|
|
35
34
|
--token YOUR_FIGMA_TOKEN \
|
|
36
35
|
--file ABC123DEF456 \
|
|
37
36
|
--node 100-200 \
|
|
@@ -39,7 +38,7 @@ node dist/cli.js \
|
|
|
39
38
|
--output ./output
|
|
40
39
|
|
|
41
40
|
# Vue component
|
|
42
|
-
|
|
41
|
+
npx figma-to-code-agent \
|
|
43
42
|
--token YOUR_FIGMA_TOKEN \
|
|
44
43
|
--file ABC123DEF456 \
|
|
45
44
|
--node 100-200 \
|
|
@@ -51,7 +50,7 @@ Or use environment variable:
|
|
|
51
50
|
|
|
52
51
|
```bash
|
|
53
52
|
export FIGMA_TOKEN="your-token"
|
|
54
|
-
|
|
53
|
+
npx figma-to-code-agent --file ABC123DEF456 --node 100-200 --output ./output
|
|
55
54
|
```
|
|
56
55
|
|
|
57
56
|
## 5. Preview in Browser
|
|
@@ -59,7 +58,7 @@ node dist/cli.js --file ABC123DEF456 --node 100-200 --output ./output
|
|
|
59
58
|
Add `--preview` to instantly open the result in your browser:
|
|
60
59
|
|
|
61
60
|
```bash
|
|
62
|
-
|
|
61
|
+
npx figma-to-code-agent \
|
|
63
62
|
--token YOUR_FIGMA_TOKEN \
|
|
64
63
|
--file ABC123DEF456 \
|
|
65
64
|
--node 100-200 \
|
|
@@ -75,7 +74,7 @@ This copies the generated files to the built-in test app, starts a Vite dev serv
|
|
|
75
74
|
By default, generates `.jsx` / `.vue`. Add `--typescript` for `.tsx` output:
|
|
76
75
|
|
|
77
76
|
```bash
|
|
78
|
-
|
|
77
|
+
npx figma-to-code-agent \
|
|
79
78
|
--token YOUR_FIGMA_TOKEN \
|
|
80
79
|
--file ABC123DEF456 \
|
|
81
80
|
--node 100-200 \
|
|
@@ -128,7 +127,7 @@ For smarter component naming and code optimization, add an LLM provider:
|
|
|
128
127
|
|
|
129
128
|
```bash
|
|
130
129
|
# AWS Bedrock
|
|
131
|
-
|
|
130
|
+
npx figma-to-code-agent \
|
|
132
131
|
--token YOUR_FIGMA_TOKEN \
|
|
133
132
|
--file ABC123DEF456 \
|
|
134
133
|
--framework react \
|
|
@@ -138,7 +137,7 @@ node dist/cli.js \
|
|
|
138
137
|
--output ./output
|
|
139
138
|
|
|
140
139
|
# OpenAI
|
|
141
|
-
LLM_API_KEY="sk-..."
|
|
140
|
+
LLM_API_KEY="sk-..." npx figma-to-code-agent \
|
|
142
141
|
--token YOUR_FIGMA_TOKEN \
|
|
143
142
|
--file ABC123DEF456 \
|
|
144
143
|
--framework react \
|
|
@@ -166,33 +165,4 @@ The tool auto-retries with backoff. If persistent, wait a minute and try again.
|
|
|
166
165
|
Check that the `assets/` folder was generated alongside your component. Image paths are relative imports.
|
|
167
166
|
|
|
168
167
|
**Preview not working**
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
cd test-app/test-react && npm install
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
## Try the Pre-built Examples
|
|
175
|
-
|
|
176
|
-
The `test-app/` directory contains pre-generated components from the 4 examples shown in the README. You can preview them directly without a Figma token:
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# React examples
|
|
180
|
-
cd test-app/test-react
|
|
181
|
-
npm install
|
|
182
|
-
npx vite --open
|
|
183
|
-
|
|
184
|
-
# Vue examples
|
|
185
|
-
cd test-app/test-vue
|
|
186
|
-
npm install
|
|
187
|
-
npx vite --open
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Edit `src/main.jsx` (or `src/main.js` for Vue) to switch between components:
|
|
191
|
-
|
|
192
|
-
```jsx
|
|
193
|
-
// Try different pages:
|
|
194
|
-
import { Component } from './Component.jsx' // MIUI12
|
|
195
|
-
import { Homepage } from './Homepage.jsx' // World Peas Homepage
|
|
196
|
-
import { ShoppingCart } from './ShoppingCart.jsx' // Shopping Cart
|
|
197
|
-
import { ProductPage } from './ProductPage.jsx' // Product Page
|
|
198
|
-
```
|
|
168
|
+
The `--preview` flag requires the built-in test-app. If installed globally, it should work out of the box. If using npx, the test-app is included in the package.
|
package/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Convert Figma designs to production-ready React/Vue components. Supports CSS Modules, Tailwind, and plain CSS.
|
|
4
4
|
|
|
5
5
|
> 📖 New here? Check the [Quick Start Guide](QUICKSTART.md) for step-by-step setup.
|
|
6
|
-
>
|
|
7
|
-
> 🖥️ Want to see it in action? Run the examples in [test-app/](test-app/) — pre-generated React and Vue components ready to preview.
|
|
8
6
|
|
|
9
7
|
## Examples
|
|
10
8
|
|
|
@@ -43,14 +41,23 @@ Convert Figma designs to production-ready React/Vue components. Supports CSS Mod
|
|
|
43
41
|
- 👁️ Figma layer filtering (hidden layers, mask shapes)
|
|
44
42
|
- 🤖 Optional AI enhancements (semantic naming, component splitting, code optimization)
|
|
45
43
|
|
|
46
|
-
##
|
|
44
|
+
## Install
|
|
47
45
|
|
|
48
46
|
```bash
|
|
49
|
-
npm install
|
|
50
|
-
|
|
47
|
+
npm install -g figma-to-code-agent
|
|
48
|
+
```
|
|
51
49
|
|
|
50
|
+
Or use directly with npx (no install needed):
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx figma-to-code-agent --token YOUR_FIGMA_TOKEN --file FILE_KEY --node NODE_ID --output ./output
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```bash
|
|
52
59
|
# Generate React component
|
|
53
|
-
|
|
60
|
+
npx figma-to-code-agent \
|
|
54
61
|
--token YOUR_FIGMA_TOKEN \
|
|
55
62
|
--file FILE_KEY \
|
|
56
63
|
--node NODE_ID \
|
|
@@ -58,7 +65,7 @@ node dist/cli.js \
|
|
|
58
65
|
--output ./output
|
|
59
66
|
|
|
60
67
|
# Generate and preview in browser
|
|
61
|
-
|
|
68
|
+
npx figma-to-code-agent \
|
|
62
69
|
--token YOUR_FIGMA_TOKEN \
|
|
63
70
|
--file FILE_KEY \
|
|
64
71
|
--node NODE_ID \
|
|
@@ -133,6 +140,9 @@ src/
|
|
|
133
140
|
## Development
|
|
134
141
|
|
|
135
142
|
```bash
|
|
143
|
+
git clone https://github.com/lewiscutey/figma-to-code-agent.git
|
|
144
|
+
cd figma-to-code-agent
|
|
145
|
+
npm install
|
|
136
146
|
npm run build # Compile TypeScript
|
|
137
147
|
npm test # Run all tests (129 tests)
|
|
138
148
|
npm run lint # ESLint
|
package/dist/cli.js
CHANGED
|
@@ -45,7 +45,7 @@ async function main() {
|
|
|
45
45
|
Figma-to-Code AI Agent
|
|
46
46
|
|
|
47
47
|
Usage:
|
|
48
|
-
figma-to-code --token <token> --file <fileKey> [options]
|
|
48
|
+
figma-to-code-agent --token <token> --file <fileKey> [options]
|
|
49
49
|
|
|
50
50
|
Options:
|
|
51
51
|
--token <token> Figma API token (required)
|
|
@@ -70,8 +70,8 @@ Options:
|
|
|
70
70
|
--help Show this help message
|
|
71
71
|
|
|
72
72
|
Example:
|
|
73
|
-
figma-to-code --token abc123 --file xyz789 --framework react --output ./src/components
|
|
74
|
-
figma-to-code --token abc123 --file xyz789 --framework react --preview
|
|
73
|
+
figma-to-code-agent --token abc123 --file xyz789 --framework react --output ./src/components
|
|
74
|
+
figma-to-code-agent --token abc123 --file xyz789 --framework react --preview
|
|
75
75
|
`);
|
|
76
76
|
process.exit(0);
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "figma-to-code-agent",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "AI Agent that converts Figma designs to production-ready code with optional LLM enhancements",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"figma-to-code": "dist/cli.js"
|
|
8
|
+
"figma-to-code-agent": "dist/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|