@mico_fe/ftc-plugin 0.2.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 +159 -0
- package/dist/code.js +3784 -0
- package/dist/index.html +380 -0
- package/install.sh +184 -0
- package/manifest.json +21 -0
- package/package.json +58 -0
- package/uninstall.sh +114 -0
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# MFTC Plugin
|
|
2
|
+
|
|
3
|
+
将 Figma 设计转换为代码的插件。
|
|
4
|
+
|
|
5
|
+
## 🚀 快速安装
|
|
6
|
+
|
|
7
|
+
### 自动安装(推荐)
|
|
8
|
+
|
|
9
|
+
使用一行命令安装(通过 npm CDN):
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/install.sh | bash
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> 💡 脚本会自动下载并安装到 `~/figma-to-code-plugin`
|
|
16
|
+
|
|
17
|
+
或使用 wget:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
wget -qO- https://unpkg.com/@mico_fe/ftc-plugin@latest/install.sh | bash
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
或使用 jsdelivr CDN:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
curl -fsSL https://cdn.jsdelivr.net/npm/@mico_fe/ftc-plugin@latest/install.sh | bash
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### 安装选项
|
|
30
|
+
|
|
31
|
+
**跳过确认,强制覆盖安装:**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/install.sh | bash -s -- -y
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
或:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/install.sh | bash -s -- --force
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**查看帮助:**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/install.sh | bash -s -- --help
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 卸载
|
|
50
|
+
|
|
51
|
+
使用卸载脚本:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/uninstall.sh | bash
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
或手动删除:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
rm -rf ~/figma-to-code-plugin
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
#### 卸载选项
|
|
64
|
+
|
|
65
|
+
**跳过确认,强制卸载:**
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/uninstall.sh | bash -s -- -y
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
或:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/uninstall.sh | bash -s -- --force
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**查看帮助:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
curl -fsSL https://unpkg.com/@mico_fe/ftc-plugin@latest/uninstall.sh | bash -s -- --help
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## 📦 从 npm 安装
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm install -g @mico_fe/ftc-plugin
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🛠️ 开发
|
|
90
|
+
|
|
91
|
+
克隆仓库后,在本地开发:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# 安装依赖
|
|
95
|
+
pnpm install
|
|
96
|
+
|
|
97
|
+
# 开发模式(热重载)
|
|
98
|
+
pnpm dev
|
|
99
|
+
|
|
100
|
+
# 构建开发版本
|
|
101
|
+
pnpm build:dev
|
|
102
|
+
|
|
103
|
+
# 构建生产版本
|
|
104
|
+
pnpm build:prod
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 🔧 在 Figma 中使用
|
|
108
|
+
|
|
109
|
+
### 方法 1: 使用安装脚本(推荐)
|
|
110
|
+
|
|
111
|
+
运行安装脚本后,在 Figma 中:
|
|
112
|
+
|
|
113
|
+
1. 打开 Figma 桌面应用
|
|
114
|
+
2. 菜单:`Plugins > Development > Import plugin from manifest...`
|
|
115
|
+
3. 选择:`~/figma-to-code-plugin/manifest.json`
|
|
116
|
+
|
|
117
|
+
### 方法 2: 开发模式
|
|
118
|
+
|
|
119
|
+
开发时使用本地构建:
|
|
120
|
+
|
|
121
|
+
1. 在项目中运行 `pnpm build:dev` 或 `pnpm dev`
|
|
122
|
+
2. 在 Figma 中导入 `manifest.json`(项目根目录)
|
|
123
|
+
3. 插件会自动加载 `dist/` 目录下的文件
|
|
124
|
+
|
|
125
|
+
## 📁 项目结构
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
apps/plugin/
|
|
129
|
+
├── dist/ # 构建输出目录
|
|
130
|
+
│ ├── code.js # 插件主逻辑
|
|
131
|
+
│ └── index.html # 插件 UI
|
|
132
|
+
├── plugin-src/ # 插件源代码
|
|
133
|
+
│ └── code.ts # 主入口
|
|
134
|
+
├── ui-src/ # UI 源代码
|
|
135
|
+
│ ├── App.tsx # React 应用
|
|
136
|
+
│ └── main.tsx # UI 入口
|
|
137
|
+
├── manifest.json # Figma 插件配置
|
|
138
|
+
├── install.sh # 安装脚本
|
|
139
|
+
└── package.json # 包配置
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 🧪 构建脚本
|
|
143
|
+
|
|
144
|
+
- `pnpm dev` - 开发模式,监听文件变化并自动重新构建
|
|
145
|
+
- `pnpm build:dev` - 构建开发版本
|
|
146
|
+
- `pnpm build:prod` - 构建生产版本(优化和压缩)
|
|
147
|
+
- `pnpm build:main` - 仅构建插件主逻辑
|
|
148
|
+
- `pnpm build:ui:dev` - 仅构建 UI(开发模式)
|
|
149
|
+
- `pnpm build:ui:prod` - 仅构建 UI(生产模式)
|
|
150
|
+
|
|
151
|
+
## 📝 发布
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# 构建生产版本
|
|
155
|
+
pnpm build:prod
|
|
156
|
+
|
|
157
|
+
# 发布到 npm
|
|
158
|
+
npm publish
|
|
159
|
+
```
|