{"_id":"@dora-ljh/figma-export","_rev":"5-2bc0317fe102b1b41a681881d02e608e","name":"@dora-ljh/figma-export","dist-tags":{"latest":"1.3.0"},"versions":{"1.0.0":{"name":"@dora-ljh/figma-export","version":"1.0.0","keywords":["figma","export","design","batch","cli","image"],"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","_id":"@dora-ljh/figma-export@1.0.0","maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"homepage":"https://github.com/dora-ljh/figma-export#readme","bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"bin":{"figma-export":"src/index.js"},"dist":{"shasum":"633148f66cc157a246f28d80b1357b04c940ffbc","tarball":"https://registry.npmjs.org/@dora-ljh/figma-export/-/figma-export-1.0.0.tgz","fileCount":7,"integrity":"sha512-6APjRgpueibjbIUJ3xgI/j1Ag85mk5jzofqPPVSOX0j/k2rTazRlCZfyvqaHhBTKIlFleXDrRSBXyAofQM+17g==","signatures":[{"sig":"MEUCIQDEOzaQcri2SmP+q2owgHDMoaaB0fTBCbwR+KxgP9R7XgIgaQiXnI1/YtxTN49zPdz8/+YDj077khoSiLb8Om3cwbQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25643},"main":"src/index.js","engines":{"node":">=14.0.0"},"gitHead":"f84e540e7db85df03e0adae9669361f908c552fc","scripts":{"start":"node src/index.js","export":"node src/index.js"},"_npmUser":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"repository":{"url":"git+https://github.com/dora-ljh/figma-export.git","type":"git"},"_npmVersion":"10.9.4","description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","directories":{},"_nodeVersion":"22.22.1","dependencies":{"axios":"^1.7.0","dotenv":"^16.4.0","fs-extra":"^11.2.0","commander":"^12.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/figma-export_1.0.0_1774433383803_0.5102857215618117","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dora-ljh/figma-export","version":"1.0.1","keywords":["figma","export","design","batch","cli","image"],"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","_id":"@dora-ljh/figma-export@1.0.1","maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"homepage":"https://github.com/dora-ljh/figma-export#readme","bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"bin":{"figma-export":"src/index.js"},"dist":{"shasum":"0fdbd012e360de5db6d0a4c236b7fc87d9dcd33e","tarball":"https://registry.npmjs.org/@dora-ljh/figma-export/-/figma-export-1.0.1.tgz","fileCount":7,"integrity":"sha512-1PKRU+zCIWf9S/+ZePEX9SSC0CASp1TT5VBXjDSWor0RZg0xnBdDE5bqDavHma9uvl8TmBn18U3ewYidkvTyfA==","signatures":[{"sig":"MEYCIQCY2v0uZg9lGLDsGvixx2kjsH/+m09iGpNGPWlSc9Or9QIhAMqx663xeHKlZ6nNOF+QZldexzTvmWqPUgt3T5d1lPJs","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":25794},"main":"src/index.js","engines":{"node":">=14.0.0"},"gitHead":"42d73d5e7ce7782ce8005e766065b7653bfbb7da","scripts":{"start":"node src/index.js","export":"node src/index.js"},"_npmUser":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"repository":{"url":"git+https://github.com/dora-ljh/figma-export.git","type":"git"},"_npmVersion":"10.9.4","description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","directories":{},"_nodeVersion":"22.22.1","dependencies":{"axios":"^1.7.0","dotenv":"^16.4.0","fs-extra":"^11.2.0","commander":"^12.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/figma-export_1.0.1_1774433696470_0.08086012732970049","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@dora-ljh/figma-export","version":"1.1.0","keywords":["figma","export","design","batch","cli","image"],"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","_id":"@dora-ljh/figma-export@1.1.0","maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"homepage":"https://github.com/dora-ljh/figma-export#readme","bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"bin":{"figma-export":"src/index.js"},"dist":{"shasum":"71a5f78374364967f70fea1c90f3e46b01ad917f","tarball":"https://registry.npmjs.org/@dora-ljh/figma-export/-/figma-export-1.1.0.tgz","fileCount":8,"integrity":"sha512-PE+8XfDRRjf0BTKdWhaXdMb7YOQf/RzeivsGsbIARsqcQ5gzv/sSteukeVlT0O4gZQrjsIxXtdWa+MzCZcRQ1A==","signatures":[{"sig":"MEYCIQCAaxrmzUQ7tkzRDfFXctxMQ53E8e+pY2FyIxPH8Dws4AIhALP8UywXZ5sa12xHr2Si0iAowdsIQ5bA2Hc80wDUmzO8","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31667},"main":"src/index.js","engines":{"node":">=14.0.0"},"gitHead":"d8650c8bc176db4a90701beae1e38b58c6c451f6","scripts":{"start":"node src/index.js","export":"node src/index.js"},"_npmUser":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"repository":{"url":"git+https://github.com/dora-ljh/figma-export.git","type":"git"},"_npmVersion":"10.9.4","description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","directories":{},"_nodeVersion":"22.22.1","dependencies":{"axios":"^1.7.0","dotenv":"^16.4.0","fs-extra":"^11.2.0","commander":"^12.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/figma-export_1.1.0_1774438226895_0.18599198624954272","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@dora-ljh/figma-export","version":"1.2.0","keywords":["figma","export","design","batch","cli","image"],"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","_id":"@dora-ljh/figma-export@1.2.0","maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"homepage":"https://github.com/dora-ljh/figma-export#readme","bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"bin":{"figma-export":"src/index.js"},"dist":{"shasum":"c8fa41eba8cc1e3955428ad3ec54e1e074b6ad8a","tarball":"https://registry.npmjs.org/@dora-ljh/figma-export/-/figma-export-1.2.0.tgz","fileCount":8,"integrity":"sha512-6ZDwdhLsQa2pPoJbs8npL56V9mwU33k5X/wEiqqYpqL601WTiBMYCeNv93kiQ790xkF6WlMoxPNr0bR7vQLSnQ==","signatures":[{"sig":"MEYCIQC/1qmE1AJDANAHTDbNg2WhqDuR3i/u6JXixbwfaS8prAIhAIUsa5mMDtbCWMCdSmzyZ+UYrZdpbU7UJWX4fkT0C7/e","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32244},"main":"src/index.js","engines":{"node":">=14.0.0"},"gitHead":"d67e7018d19d2cd5926accb05e1a0ea57dc1a31c","scripts":{"start":"node src/index.js","export":"node src/index.js"},"_npmUser":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"repository":{"url":"git+https://github.com/dora-ljh/figma-export.git","type":"git"},"_npmVersion":"10.9.4","description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","directories":{},"_nodeVersion":"22.22.1","dependencies":{"axios":"^1.7.0","dotenv":"^16.4.0","fs-extra":"^11.2.0","commander":"^12.0.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/figma-export_1.2.0_1774439574951_0.28944014835644016","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@dora-ljh/figma-export","version":"1.3.0","description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","main":"src/index.js","bin":{"figma-export":"src/index.js"},"scripts":{"start":"node src/index.js","export":"node src/index.js"},"keywords":["figma","export","design","batch","cli","image"],"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/dora-ljh/figma-export.git"},"homepage":"https://github.com/dora-ljh/figma-export#readme","bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"publishConfig":{"access":"public"},"engines":{"node":">=14.0.0"},"dependencies":{"axios":"^1.7.0","commander":"^12.0.0","dotenv":"^16.4.0","fs-extra":"^11.2.0"},"gitHead":"0500e8be6234f1ef24b54445643eb429772e8e0a","_id":"@dora-ljh/figma-export@1.3.0","_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-uNiHcXQOorA2p3MLbtllRFARCeaXCrhDreyQK6lVuJdH9zmIRVCKor+458BJhhSw9a/G9f0IXfryLN2tSfcIhA==","shasum":"0db152ab3dda100afb724f967498533000a3fa26","tarball":"https://registry.npmjs.org/@dora-ljh/figma-export/-/figma-export-1.3.0.tgz","fileCount":8,"unpackedSize":35408,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDY+GFMtZGriVvRJGED5nezYOt4OnAlfCpWk99EEtnwOAiAWjx8ipWLIIqpl6FaMl4NVsuPf7J35n9vrNhAozIixAw=="}]},"_npmUser":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"directories":{},"maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/figma-export_1.3.0_1774852690123_0.364851398283236"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-25T10:09:43.723Z","modified":"2026-03-30T06:38:10.422Z","1.0.0":"2026-03-25T10:09:43.939Z","1.0.1":"2026-03-25T10:14:56.599Z","1.1.0":"2026-03-25T11:30:27.057Z","1.2.0":"2026-03-25T11:52:55.094Z","1.3.0":"2026-03-30T06:38:10.298Z"},"bugs":{"url":"https://github.com/dora-ljh/figma-export/issues"},"author":{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"},"license":"MIT","homepage":"https://github.com/dora-ljh/figma-export#readme","keywords":["figma","export","design","batch","cli","image"],"repository":{"type":"git","url":"git+https://github.com/dora-ljh/figma-export.git"},"description":"Figma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片","maintainers":[{"name":"dora-ljh","email":"lijihui.wyy@gmail.com"}],"readme":"# figma-export\n\nFigma 设计稿批量导出工具，支持按文件、项目、团队三个维度批量导出设计稿为图片。\n\n## Features\n\n- 🎯 **多层级导出** - 支持按文件 / 项目 / 团队三个维度导出\n- 🔄 **断点续传** - 已下载的 Frame 自动跳过，支持中断后继续\n- 📐 **灵活缩放** - 支持 0.01-4 倍缩放比例\n- 🔁 **自动降级** - 渲染超时时自动降低 scale 重试\n- 📄 **页面过滤** - 可指定只导出特定页面\n- ⚡ **智能并发** - 限制下载并发数，防止带宽争抢\n- 🛡️ **速率限制处理** - 自动处理 Figma API 429 限速\n- 🔧 **错误重试** - 自动重试 5xx 服务器错误\n\n## Installation\n\n```bash\nnpm install -g @dora-ljh/figma-export\n```\n\n## Usage\n\n### 配置 Figma Token\n\n#### 1. 创建个人访问令牌\n\n1. 登录 [Figma](https://www.figma.com)，点击左上角头像，进入 **Settings**\n2. 滚动到 **Personal access tokens** 部分\n3. 点击 **Generate new token**\n4. 输入 Token 名称（如 `figma-export`）\n5. 配置 Token 权限（Scopes），需要勾选以下权限：\n\n| Scope 分类 | 权限 | 用途 |\n|------------|------|------|\n| **Files** | ✅ Read the contents of and render images from files | 获取文件结构、Frame 信息并渲染导出图片 |\n| **Files** | ✅ Read metadata of files | 读取文件元数据 |\n| **Projects** | ✅ Read team project structure | 按项目/团队批量获取文件列表 |\n\n> 如果你只使用 `--file-key` 导出单个文件，只需 **Files** 相关权限。使用 `--project-id` 或 `--team-id` 时需要额外勾选 **Projects** 权限。\n\n6. 点击 **Generate token**，复制生成的 Token（**只会显示一次**，请妥善保存）\n\n#### 2. 配置 Token\n\n提供 Token 有三种方式（任选其一）：\n\n**方式一：命令行参数（推荐一次性使用）**\n\n```bash\nfigma-export --token <your_token> --file-key <file_key>\n```\n\n**方式二：环境变量（推荐长期使用）**\n\n```bash\n# macOS / Linux - 添加到 ~/.bashrc 或 ~/.zshrc\nexport FIGMA_TOKEN=your_figma_personal_access_token\n\n# Windows PowerShell\n$env:FIGMA_TOKEN=\"your_figma_personal_access_token\"\n```\n\n**方式三：.env 文件（推荐项目级使用）**\n\n在运行命令的目录下创建 `.env` 文件：\n\n```\nFIGMA_TOKEN=your_figma_personal_access_token\n```\n\n### 命令行用法\n\n```bash\n# 导出单个文件\nfigma-export --file-key <file_key>\n\n# 导出整个项目\nfigma-export --project-id <project_id>\n\n# 导出整个团队\nfigma-export --team-id <team_id>\n```\n\n### 参数说明\n\n| 参数 | 说明 | 默认值 |\n|------|------|--------|\n| `--token <token>` | Figma 个人访问令牌 | 环境变量 `FIGMA_TOKEN` |\n| `--file-key <key>` | Figma 文件 Key | - |\n| `--project-id <id>` | Figma 项目 ID | - |\n| `--team-id <id>` | Figma 团队 ID | - |\n| `--scale <number>` | 导出缩放比例 (0.01-4) | `0.25` |\n| `--output <path>` | 输出目录 | `./output` |\n| `--page <name...>` | 只导出指定页面（可多次指定） | 全部页面 |\n| `--shard <index/total>` | 分片参数，如 1/3 表示共3片取第1片 | - |\n| `--max-width <number>` | 导出图片最大宽度，超过时自动降低 scale | `3840` |\n| `--max-retries <number>` | API 请求最大重试次数，`0` 为无限重试 | `3` |\n\n> 注意：`--file-key`、`--project-id`、`--team-id` 三者至少提供一个。\n\n### 示例\n\n```bash\n# 导出单个文件，2倍缩放\nfigma-export --file-key abc123 --scale 2\n\n# 导出项目到指定目录\nfigma-export --project-id 12345 --output ./designs\n\n# 只导出指定页面\nfigma-export --file-key abc123 --page \"首页\" --page \"详情页\"\n\n# 高倍缩放导出，限制最大宽度为 3840px\nfigma-export --file-key abc123 --scale 4 --max-width 3840\n\n# 分片导出（适合大团队并行处理）\nfigma-export --team-id 67890 --shard 1/3\n```\n\n### 最大宽度限制\n\n使用 `--max-width` 可以限制导出图片的最大宽度。工具会根据每个 Frame 的原始宽度自动计算合适的 scale，确保导出图片宽度不超过限制，无需下载后再压缩。\n\n例如：一个 1920px 宽的 Frame，`--scale 4` 时导出宽度为 7680px，超过 3840px 限制后会自动降为 `scale=2`（3840÷1920=2），使导出宽度刚好为 3840px。\n\n```bash\n# 默认限制 3840px\nfigma-export --file-key abc123 --scale 4\n\n# 自定义最大宽度\nfigma-export --file-key abc123 --scale 4 --max-width 1920\n```\n\n### 合并分片目录\n\n多人分片下载完成后，将各自的输出目录收集到一起，使用 `merge` 命令合并：\n\n```bash\n# 合并多个分片输出目录\nfigma-export merge -i ./shard1-output ./shard2-output ./shard3-output -o ./merged\n\n# 自定义输出目录（默认 ./merged）\nfigma-export merge -i ./person1 ./person2 -o ./all-designs\n```\n\n| 参数 | 说明 | 默认值 |\n|------|------|--------|\n| `-i, --input <dirs...>` | 输入目录列表（空格分隔） | 必填 |\n| `-o, --output <path>` | 合并输出目录 | `./merged` |\n\n> 合并时会自动跳过已存在且大小相同的文件，支持增量合并。\n\n## 如何获取 File Key / Project ID / Team ID\n\n- **File Key**: Figma 文件 URL 中 `figma.com/file/<file_key>/...` 的部分\n- **Project ID**: 在 Figma 项目页面 URL 中 `figma.com/files/project/<project_id>/...`\n- **Team ID**: 在 Figma 团队页面 URL 中 `figma.com/files/team/<team_id>/...`\n\n## License\n\n[MIT](./LICENSE)\n","readmeFilename":"README.md"}