Skip to content

Commit c5668a1

Browse files
committed
Better test and document design-tokens subcommand
I've got an example figma file to use to demonstrate and test against. lukasoppermann/design-tokens#238 In the documentation I list out the problems (mostly the result of lack of API support from Figma).
1 parent f3de599 commit c5668a1

File tree

8 files changed

+18953
-14
lines changed

8 files changed

+18953
-14
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/target
22
/node_modules
3-
/example-file.json
43
/private

Makefile

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
1+
.DEFAULT_GOAL := all
2+
3+
example-figma-files = \
4+
example-figma-files/design-tokens-for-figma.json
5+
6+
example-output-files = \
7+
src/design_tokens/example-output.json
8+
19
# https://www.figma.com/file/2MQ759R5kJtzQn4qSHuqR7/Design-Tokens-for-Figma
2-
example-file.json :
10+
example-figma-files/design-tokens-for-figma.json :
311
curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
412
'https://api.figma.com/v1/files/2MQ759R5kJtzQn4qSHuqR7' \
513
| jq > $@
614

15+
src/design_tokens/example-output.json : example-figma-files/design-tokens-for-figma.json
16+
cargo run -- design-tokens < $< > $@
17+
718
.PHONY : all
8-
all : example-file.json
19+
all : $(example-figma-files) $(example-output-files)
920

1021
.PHONY : clean
1122
clean :
12-
rm -f example-file.json
23+
rm -f $(example-figma-files) $(example-output-files)
1324

1425
.PHONY : cleanAll
1526
cleanAll : clean

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ An experiment to see what can be achieved with the
66
All commands require an API file to be provided on `stdin`.
77

88
```bash
9-
cargo run --release -- design-tokens < example-file.json
9+
cargo run -- design-tokens < example-figma-files/design-tokens-for-figma.json
1010
# or
11-
curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" https://api.figma.com/v1/files/2MQ759R5kJtzQn4qSHuqR7 | cargo run --release -- design-tokens
11+
curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" https://api.figma.com/v1/files/2MQ759R5kJtzQn4qSHuqR7 | cargo run -- design-tokens
1212
```
1313

1414
## Design tokens
@@ -23,3 +23,5 @@ cargo run --release -- design-tokens < example-file.json
2323
Due to limitations with the Figma API, I do not recommend this subcommand. Some
2424
basic information cannot be obtained through the API such as colour token values
2525
or font information. I do recommend the plugin.
26+
27+
[Read more](src/design_tokens/README.md)

0 commit comments

Comments
 (0)