tokens-bruecke 2.11.4 → 2.14.3
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/.github/workflows/release.yml +11 -0
- package/CONTRIBUTING.md +75 -0
- package/README.md +60 -32
- package/bin/cli.js +1 -1
- package/declaration.d.ts +5 -0
- package/global.d.ts +2 -8
- package/package.json +2 -2
- package/tsconfig.base.json +11 -6
- package/tsconfig.cli.json +1 -0
- package/webpack.config.cli.js +6 -0
- package/webpack.config.js +6 -0
|
@@ -13,6 +13,8 @@ jobs:
|
|
|
13
13
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
|
14
14
|
steps:
|
|
15
15
|
- uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
16
18
|
|
|
17
19
|
- name: Install pnpm
|
|
18
20
|
uses: pnpm/action-setup@v4
|
|
@@ -46,3 +48,12 @@ jobs:
|
|
|
46
48
|
run: gh release create ${{ github.ref_name }} ./dist/figma-plugin.zip --title "${{ github.ref_name }}" --generate-notes
|
|
47
49
|
env:
|
|
48
50
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
|
|
52
|
+
- name: Update CHANGELOG.md
|
|
53
|
+
run: |
|
|
54
|
+
git config user.name "github-actions[bot]"
|
|
55
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
56
|
+
npx --yes conventional-changelog-cli -p conventionalcommits -i CHANGELOG.md -s -r 1
|
|
57
|
+
git add CHANGELOG.md
|
|
58
|
+
git diff --staged --quiet || git commit -m "docs: update CHANGELOG for ${{ github.ref_name }}"
|
|
59
|
+
git push origin HEAD:main
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Contributing to TokensBrücke
|
|
2
|
+
|
|
3
|
+
Thanks for taking the time to contribute! Here's everything you need to get started.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
**Prerequisites:** Node.js, pnpm
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git clone https://github.com/tokens-bruecke/figma-plugin.git
|
|
13
|
+
cd figma-plugin
|
|
14
|
+
pnpm install
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Development build (watch mode):**
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Load the plugin in Figma: **Plugins → Development → Import plugin from manifest** and point it to `manifest.json`.
|
|
24
|
+
|
|
25
|
+
**Run tests:**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pnpm test
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Project structure
|
|
34
|
+
|
|
35
|
+
| Path | Purpose |
|
|
36
|
+
| ------------- | ---------------------------------------------------- |
|
|
37
|
+
| `src/app/` | Figma plugin UI (React) |
|
|
38
|
+
| `src/cli/` | CLI entry point |
|
|
39
|
+
| `src/common/` | Shared transform logic (used by both plugin and CLI) |
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Making changes
|
|
44
|
+
|
|
45
|
+
1. Fork the repo and create a branch from `main`.
|
|
46
|
+
2. Write code — keep changes focused and minimal.
|
|
47
|
+
3. Add or update tests for any logic in `src/common/`.
|
|
48
|
+
4. Open a pull request against `main`.
|
|
49
|
+
|
|
50
|
+
### Commit style
|
|
51
|
+
|
|
52
|
+
This project uses [Conventional Commits](https://www.conventionalcommits.org/):
|
|
53
|
+
|
|
54
|
+
| Prefix | Effect |
|
|
55
|
+
| ------------------------------ | ------------------ |
|
|
56
|
+
| `feat:` | Minor version bump |
|
|
57
|
+
| `fix:` | Patch version bump |
|
|
58
|
+
| `feat!:` / `BREAKING CHANGE:` | Major version bump |
|
|
59
|
+
| `chore:`, `docs:`, `refactor:` | No release |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Reporting bugs
|
|
64
|
+
|
|
65
|
+
Open a [GitHub issue](https://github.com/tokens-bruecke/figma-plugin/issues) with:
|
|
66
|
+
|
|
67
|
+
- Steps to reproduce
|
|
68
|
+
- Expected vs. actual behavior
|
|
69
|
+
- Plugin version and Figma version
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
By contributing, you agree your changes will be licensed under the project's [MIT License](./LICENSE).
|
package/README.md
CHANGED
|
@@ -15,7 +15,6 @@ The plugin converts Figma variables into design-tokens JSON that are compatible
|
|
|
15
15
|
- [TokensBrücke — Figma plugin](#tokensbrücke--figma-plugin)
|
|
16
16
|
- [What is this plugin for?](#what-is-this-plugin-for)
|
|
17
17
|
- [Table of contents](#table-of-contents)
|
|
18
|
-
- [New version 2.0.0](#new-version-200)
|
|
19
18
|
- [How to use](#how-to-use)
|
|
20
19
|
- [Export and Import](#export-and-import)
|
|
21
20
|
- [Export (Variables → JSON)](#export-variables--json)
|
|
@@ -30,6 +29,7 @@ The plugin converts Figma variables into design-tokens JSON that are compatible
|
|
|
30
29
|
- [Include `.value` string for aliases](#include-value-string-for-aliases)
|
|
31
30
|
- [Include Figma metadata](#include-figma-metadata)
|
|
32
31
|
- [Split collections into separate files](#split-collections-into-separate-files)
|
|
32
|
+
- [Omit collection names](#omit-collection-names)
|
|
33
33
|
- [Use as cli tool](#use-as-cli-tool)
|
|
34
34
|
- [Installation](#installation)
|
|
35
35
|
- [Usage](#usage)
|
|
@@ -42,6 +42,7 @@ The plugin converts Figma variables into design-tokens JSON that are compatible
|
|
|
42
42
|
- [GitLab](#gitlab)
|
|
43
43
|
- [Custom server](#custom-server)
|
|
44
44
|
- [Show output](#show-output)
|
|
45
|
+
- [Plugin window height](#plugin-window-height)
|
|
45
46
|
- [Config autosaving](#config-autosaving)
|
|
46
47
|
- [Styles support](#styles-support)
|
|
47
48
|
- [Typography](#typography)
|
|
@@ -58,19 +59,10 @@ The plugin converts Figma variables into design-tokens JSON that are compatible
|
|
|
58
59
|
- [Variables types conversion](#variables-types-conversion)
|
|
59
60
|
- [Design tokens types](#design-tokens-types)
|
|
60
61
|
- [Scopes lemitations](#scopes-lemitations)
|
|
61
|
-
- [Style Dictionary support](#style-dictionary-support)
|
|
62
|
-
- [Contribution 🚧](#contribution-)
|
|
63
62
|
- [Feedback](#feedback)
|
|
64
63
|
|
|
65
64
|
---
|
|
66
65
|
|
|
67
|
-
## New version 2.0.0
|
|
68
|
-
|
|
69
|
-
In the new version of the plugin all mode variables moved into the `$extensions` / `modes` object.
|
|
70
|
-
This is how Terrazzo (formerly “Cobalt UI”) works with multiple modes. Check it here — [https://terrazzo.app/docs/](https://terrazzo.app/docs/)
|
|
71
|
-
|
|
72
|
-
You can download and install previos version `1.6.1` here — [github.com/tokens-bruecke/figma-plugin/files/13536853/build.zip](https://github.com/tokens-bruecke/figma-plugin/files/13536853/build.zip)
|
|
73
|
-
|
|
74
66
|
## How to use
|
|
75
67
|
|
|
76
68
|
1. Install the plugin from the [Figma Community](https://www.figma.com/community/plugin/1254538877056388290).
|
|
@@ -88,6 +80,7 @@ The plugin supports both **exporting** and **importing** design tokens:
|
|
|
88
80
|
- Click **"Download JSON"** to export your Figma variables as a design tokens JSON file
|
|
89
81
|
- The exported file is compatible with the [Design Tokens specification](https://design-tokens.github.io/community-group/format/)
|
|
90
82
|
- You can also push directly to supported services (JSONBin, GitHub, GitLab, etc.)
|
|
83
|
+
- The exported tokens can be converted into CSS, JS, and other platform formats using tools like [Terrazzo](https://terrazzo.app/docs/) or [Style Dictionary](https://amzn.github.io/style-dictionary/)
|
|
91
84
|
|
|
92
85
|
#### Import (JSON → Variables)
|
|
93
86
|
|
|
@@ -256,6 +249,41 @@ Is `off` by default. When enabled, each Figma variable collection is exported as
|
|
|
256
249
|
|
|
257
250
|
This is useful when you want to keep component-level token files separate (e.g. `button.tokens.json`, `card.tokens.json`).
|
|
258
251
|
|
|
252
|
+
### Omit collection names
|
|
253
|
+
|
|
254
|
+
Is `off` by default. When enabled, the plugin drops the top-level collection name from the output and merges all variables into a single flat namespace (variables are still grouped by the `/` separator in their names).
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
// Without "Omit collection names" (default)
|
|
258
|
+
{
|
|
259
|
+
"Primitives": {
|
|
260
|
+
"color": {
|
|
261
|
+
"primary": { "type": "color", "value": "#000000" }
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"Semantic": {
|
|
265
|
+
"button": {
|
|
266
|
+
"background": { "type": "color", "value": "{color.primary}" }
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// With "Omit collection names"
|
|
272
|
+
{
|
|
273
|
+
"color": {
|
|
274
|
+
"primary": { "type": "color", "value": "#000000" }
|
|
275
|
+
},
|
|
276
|
+
"button": {
|
|
277
|
+
"background": { "type": "color", "value": "{color.primary}" }
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
Alias references are also rewritten so they point to the flat path (the collection prefix is removed).
|
|
283
|
+
|
|
284
|
+
> [!WARNING]
|
|
285
|
+
> If two variables in different collections share the same name, the last one wins and a collision warning is logged to the console. Rename conflicting variables (or keep this option off) to avoid losing values.
|
|
286
|
+
|
|
259
287
|
---
|
|
260
288
|
|
|
261
289
|
## Use as cli tool
|
|
@@ -296,14 +324,15 @@ This will fetch figma variables and export them in `out/tokens.json`
|
|
|
296
324
|
|
|
297
325
|
### Options
|
|
298
326
|
|
|
299
|
-
| Option
|
|
300
|
-
|
|
|
301
|
-
| `--api-key`
|
|
302
|
-
| `--oauth-token`
|
|
303
|
-
| `--file-key`
|
|
304
|
-
| `--output`
|
|
305
|
-
| `--config`
|
|
306
|
-
| `--split-by-collection`
|
|
327
|
+
| Option | Alias | Description | Required |
|
|
328
|
+
| ------------------------- | ----- | ------------------------------------------------------------------------------- | ------------------------------------------------- |
|
|
329
|
+
| `--api-key` | `-a` | Figma personal access token (PAT) | One of `--api-key` or `--oauth-token` is required |
|
|
330
|
+
| `--oauth-token` | `-t` | Figma OAuth token | One of `--api-key` or `--oauth-token` is required |
|
|
331
|
+
| `--file-key` | `-f` | Figma file key | Yes |
|
|
332
|
+
| `--output` | `-o` | Path to output file, or output directory when `--split-by-collection` | Yes |
|
|
333
|
+
| `--config` | `-c` | Path to configuration file | No |
|
|
334
|
+
| `--split-by-collection` | `-s` | Write each collection as a separate `.tokens.json` file in `--output` | No |
|
|
335
|
+
| `--omit-collection-names` | | Drop top-level collection names and merge all variables into one flat namespace | No |
|
|
307
336
|
|
|
308
337
|
> [!TIP]
|
|
309
338
|
> For automated pipelines, `--oauth-token` is preferred over `--api-key`. Personal Access Tokens expire every 90 days and require manual renewal, while OAuth tokens support programmatic refresh for indefinite access.
|
|
@@ -329,7 +358,8 @@ You can use a JSON configuration file to specify the export options for the CLI.
|
|
|
329
358
|
"usePercentageOpacity": false, // Export opacity as percentage (10%) instead of decimal (0.1)
|
|
330
359
|
"colorMode": "hex", // "hex" | "rgba-object" | "rgba-css" | "hsla-object" | "hsla-css";
|
|
331
360
|
"storeStyleInCollection": "none", // Name of one of your collection or "none" to keep them separated
|
|
332
|
-
"splitByCollection": false // Write each collection as a separate .tokens.json file
|
|
361
|
+
"splitByCollection": false, // Write each collection as a separate .tokens.json file
|
|
362
|
+
"omitCollectionNames": false // Drop top-level collection names and merge all variables into one flat namespace
|
|
333
363
|
}
|
|
334
364
|
```
|
|
335
365
|
|
|
@@ -401,6 +431,16 @@ If you want to see the generated JSON, you can enable the `Show output` option.
|
|
|
401
431
|
|
|
402
432
|
---
|
|
403
433
|
|
|
434
|
+
## Plugin window height
|
|
435
|
+
|
|
436
|
+
The plugin window auto-fits the height of its content, but you can adjust it manually using the resizer handle at the bottom of the settings view.
|
|
437
|
+
|
|
438
|
+
- **Drag** the handle up or down to set a custom height. The minimum is `360px` and the maximum is the current content height — you can't grow the window beyond what's actually there.
|
|
439
|
+
- **Double-click** the handle to reset back to auto-fit. The window snaps to match the content height again.
|
|
440
|
+
- Your manual height is preserved while the output preview is open, so you can resize both with and without the preview showing.
|
|
441
|
+
|
|
442
|
+
---
|
|
443
|
+
|
|
404
444
|
## Config autosaving
|
|
405
445
|
|
|
406
446
|
The plugin saves the config automatically. So, you don't need to set it up every time you run the plugin.
|
|
@@ -709,7 +749,7 @@ Unlike design tokens, Figma variables now [support only 4 types](https://www.fig
|
|
|
709
749
|
|
|
710
750
|
## Design tokens types
|
|
711
751
|
|
|
712
|
-
In order to validate types, the plugin uses the [Design Tokens types](https://github.com/
|
|
752
|
+
In order to validate types, the plugin uses the [Design Tokens types](https://github.com/tokens-bruecke/figma-plugin/blob/main/plugin-types.d.ts).
|
|
713
753
|
|
|
714
754
|
---
|
|
715
755
|
|
|
@@ -722,18 +762,6 @@ In order to convert `FONT-WEIGHT` and `OPACITY` types into valid values you shou
|
|
|
722
762
|
|
|
723
763
|
---
|
|
724
764
|
|
|
725
|
-
## Style Dictionary support
|
|
726
|
-
|
|
727
|
-
There is a set of utils for [Style Dictionary](https://github.com/tokens-bruecke/sd-utils).
|
|
728
|
-
|
|
729
|
-
---
|
|
730
|
-
|
|
731
|
-
## Contribution 🚧
|
|
732
|
-
|
|
733
|
-
Comming soon.
|
|
734
|
-
|
|
735
|
-
---
|
|
736
|
-
|
|
737
765
|
## Feedback
|
|
738
766
|
|
|
739
767
|
If you have any questions or suggestions, feel free to [create an issue](https://github.com/tokens-bruecke/figma-plugin/issues)
|