Skip to content

Commit ff3bafc

Browse files
authored
refactor: extract FigmaAPI into standalone package (#71)
* refactor: extract FigmaAPI into standalone package swift-figma-api Replace local FigmaAPI module with external dependency from github.com/DesignPipe/swift-figma-api (0.1.0). Changes: - Remove Sources/FigmaAPI/ and Tests/FigmaAPITests/ (now in swift-figma-api) - Add swift-figma-api 0.1.0 dependency to Package.swift - Update ExFigCLI and ExFigTests to use .product(name:package:) - Update CLAUDE.md: 13→12 modules, add swift-figma-api to dependencies - Update testing-workflow.md: remove FigmaAPITests target * ci: trigger CI run
1 parent 8fc39fa commit ff3bafc

59 files changed

Lines changed: 17 additions & 6331 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/rules/testing-workflow.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Test targets mirror source modules:
1818
| `XcodeExportTests` | iOS export output |
1919
| `AndroidExportTests` | Android export output |
2020
| `FlutterExportTests` | Flutter export output |
21-
| `FigmaAPITests` | API client, endpoints |
2221
| `SVGKitTests` | SVG parsing, code generation |
2322

2423
Run specific tests:

CLAUDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,13 @@ pkl eval --format json <file.pkl> # Package URI requires published package
9797

9898
## Architecture
9999

100-
Thirteen modules in `Sources/`:
100+
Twelve modules in `Sources/`:
101101

102102
| Module | Purpose |
103103
| --------------- | --------------------------------------------------------- |
104104
| `ExFigCLI` | CLI commands, loaders, file I/O, terminal UI |
105105
| `ExFigCore` | Domain models (Color, Image, TextStyle), processors |
106106
| `ExFigConfig` | PKL config parsing, evaluation, type bridging |
107-
| `FigmaAPI` | Figma REST API client, endpoints, response models |
108107
| `ExFig-iOS` | iOS platform plugin (ColorsExporter, IconsExporter, etc.) |
109108
| `ExFig-Android` | Android platform plugin |
110109
| `ExFig-Flutter` | Flutter platform plugin |
@@ -115,7 +114,7 @@ Thirteen modules in `Sources/`:
115114
| `WebExport` | Web/React export (CSS variables, JSX icons) |
116115
| `JinjaSupport` | Shared Jinja2 template rendering across Export modules |
117116

118-
**Data flow:** CLI -> PKL config parsing -> FigmaAPI fetch -> ExFigCore processing -> Platform plugin -> Export module -> File write
117+
**Data flow:** CLI -> PKL config parsing -> FigmaAPI (external) fetch -> ExFigCore processing -> Platform plugin -> Export module -> File write
119118
**Alt data flow (tokens):** CLI -> local .tokens.json file -> TokensFileSource -> ExFigCore models -> W3C JSON export
120119

121120
**Batch mode:** Single `@TaskLocal` via `BatchSharedState` actor — see `ExFigCLI/CLAUDE.md`.
@@ -258,7 +257,7 @@ See `ExFigCLI/CLAUDE.md` (Adding a New Subcommand).
258257

259258
### Adding a Figma API Endpoint
260259

261-
See `FigmaAPI/CLAUDE.md`.
260+
FigmaAPI is now an external package (`swift-figma-api`). See its repository for endpoint patterns.
262261

263262
### Adding a Platform Plugin Exporter
264263

@@ -326,6 +325,7 @@ NooraUI.formatLink("url", useColors: true) // underlined primary
326325
| libpng | 1.6.45+ | PNG decoding |
327326
| swift-custom-dump | 1.3.0+ | Test assertions |
328327
| Noora | 0.54.0+ | Terminal UI design system |
328+
| swift-figma-api | 0.1.0+ | Figma REST API client (async/await, rate limiting) |
329329
| swift-svgkit | 0.1.0+ | SVG parsing, ImageVector/VectorDrawable generation |
330330
| swift-resvg | 0.45.1 | SVG parsing/rendering |
331331
| swift-docc-plugin | 1.4.5+ | DocC documentation |

Package.resolved

Lines changed: 10 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ let package = Package(
2727
.package(url: "https://github.com/mattt/swift-yyjson", from: "0.5.0"),
2828
.package(url: "https://github.com/apple/pkl-swift", from: "0.8.0"),
2929
.package(url: "https://github.com/DesignPipe/swift-svgkit.git", from: "0.1.0"),
30+
.package(url: "https://github.com/DesignPipe/swift-figma-api.git", from: "0.1.0"),
3031
],
3132
targets: [
3233
// Main target
3334
.executableTarget(
3435
name: "ExFigCLI",
3536
dependencies: [
36-
"FigmaAPI",
37+
.product(name: "FigmaAPI", package: "swift-figma-api"),
3738
"ExFigCore",
3839
"ExFigConfig",
3940
"XcodeExport",
@@ -79,15 +80,6 @@ let package = Package(
7980
exclude: ["CLAUDE.md", "AGENTS.md"]
8081
),
8182

82-
// Loads data via Figma REST API
83-
.target(
84-
name: "FigmaAPI",
85-
dependencies: [
86-
"ExFigCore",
87-
],
88-
exclude: ["CLAUDE.md", "AGENTS.md"]
89-
),
90-
9183
// Shared Jinja template rendering utilities
9284
.target(
9385
name: "JinjaSupport",
@@ -200,21 +192,11 @@ let package = Package(
200192

201193
// MARK: - Tests
202194

203-
.testTarget(
204-
name: "FigmaAPITests",
205-
dependencies: [
206-
"FigmaAPI",
207-
.product(name: "CustomDump", package: "swift-custom-dump"),
208-
],
209-
resources: [
210-
.copy("Fixtures/"),
211-
]
212-
),
213195
.testTarget(
214196
name: "ExFigTests",
215197
dependencies: [
216198
"ExFigCLI",
217-
"FigmaAPI",
199+
.product(name: "FigmaAPI", package: "swift-figma-api"),
218200
"ExFig-Flutter",
219201
"ExFig-Web",
220202
.product(name: "CustomDump", package: "swift-custom-dump"),

Sources/FigmaAPI/AGENTS.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

Sources/FigmaAPI/CLAUDE.md

Lines changed: 0 additions & 120 deletions
This file was deleted.

Sources/FigmaAPI/Client.swift

Lines changed: 0 additions & 108 deletions
This file was deleted.

Sources/FigmaAPI/Endpoint/BaseEndpoint.swift

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)