-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
154 lines (119 loc) ยท 7.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
.DEFAULT_GOAL := all
# My unchanged copy of https://www.figma.com/community/file/946837271092540314
gov-uk-figma-file = WwTlihidmAqp0bky272vd9
example-figma-files = \
example-figma-files/design-tokens-for-figma.json \
example-figma-files/gov-uk-design-system.json \
example-figma-files/gov-uk-design-system-components/get-started-page.svg \
example-figma-files/gov-uk-design-system-components/button.svg \
example-figma-files/gov-uk-design-system-components/cookie-banner.svg \
example-figma-files/gov-uk-design-system-components/footer.svg \
example-figma-files/gov-uk-design-system-components/header.svg \
example-figma-files/gov-uk-design-system-components/tag.svg
example-output-files = \
src/design_tokens/example-output.json \
src/typescript_props/example-output.ts \
example-figma-files/gov-uk-design-system-components/get-started-page.json \
example-figma-files/gov-uk-design-system-components/get-started-page.html \
example-figma-files/gov-uk-design-system-components/button.json \
example-figma-files/gov-uk-design-system-components/button.html \
example-figma-files/gov-uk-design-system-components/cookie-banner.json \
example-figma-files/gov-uk-design-system-components/cookie-banner.html \
example-figma-files/gov-uk-design-system-components/footer.json \
example-figma-files/gov-uk-design-system-components/footer.html \
example-figma-files/gov-uk-design-system-components/header.json \
example-figma-files/gov-uk-design-system-components/header.html \
example-figma-files/gov-uk-design-system-components/tag.json \
example-figma-files/gov-uk-design-system-components/tag.html
definition-files = \
definitions.kt \
definitions.swift \
typescript/index.d.ts
example-figma-files/design-tokens-for-figma.json :
curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/files/2MQ759R5kJtzQn4qSHuqR7' \
| jq > $@
example-figma-files/gov-uk-design-system.json :
curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/files/$(gov-uk-figma-file)' \
| jq > $@
example-figma-files/gov-uk-design-system-components/get-started-page.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐ Get Started")' < $< > $@
example-figma-files/gov-uk-design-system-components/button.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐๏ธ Styles and Components").children[] | select(.name == "Button")' < $< > $@
example-figma-files/gov-uk-design-system-components/cookie-banner.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐๏ธ Styles and Components").children[] | select(.name == "Cookie banner")' < $< > $@
example-figma-files/gov-uk-design-system-components/footer.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐๏ธ Styles and Components").children[] | select(.name == "Footer")' < $< > $@
example-figma-files/gov-uk-design-system-components/header.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐๏ธ Styles and Components").children[] | select(.name == "Header")' < $< > $@
example-figma-files/gov-uk-design-system-components/tag.json : example-figma-files/gov-uk-design-system.json
jq '.document.children[] | select(.name == "๐๏ธ Styles and Components").children[] | select(.id == "147:17")' < $< > $@
example-figma-files/gov-uk-design-system-components/get-started-page.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=756:127&format=svg&svg_include_id=true' \
| jq '.images["756:127"]' -r) > $@
example-figma-files/gov-uk-design-system-components/button.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=213:6&format=svg&svg_include_id=true' \
| jq '.images["213:6"]' -r) > $@
example-figma-files/gov-uk-design-system-components/cookie-banner.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=18330:13859&format=svg&svg_include_id=true' \
| jq '.images["18330:13859"]' -r) > $@
example-figma-files/gov-uk-design-system-components/footer.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=19792:14489&format=svg&svg_include_id=true' \
| jq '.images["19792:14489"]' -r) > $@
example-figma-files/gov-uk-design-system-components/header.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=20226:12488&format=svg&svg_include_id=true' \
| jq '.images["20226:12488"]' -r) > $@
example-figma-files/gov-uk-design-system-components/tag.svg :
curl -s $$(curl -sH "X-Figma-Token: ${FIGMA_TOKEN}" \
'https://api.figma.com/v1/images/$(gov-uk-figma-file)?ids=147:17&format=svg&svg_include_id=true' \
| jq '.images["147:17"]' -r) > $@
src/design_tokens/example-output.json : example-figma-files/design-tokens-for-figma.json
cargo run --release -- design-tokens < $< > $@
src/typescript_props/example-output.ts : example-figma-files/gov-uk-design-system.json
cargo run --release -- typescript-props < $< > $@
example-figma-files/gov-uk-design-system-components/get-started-page.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 756:127 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
example-figma-files/gov-uk-design-system-components/button.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 213:6 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
example-figma-files/gov-uk-design-system-components/cookie-banner.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 18330:13859 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
example-figma-files/gov-uk-design-system-components/footer.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 19792:14489 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
example-figma-files/gov-uk-design-system-components/header.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 20226:12488 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
example-figma-files/gov-uk-design-system-components/tag.html : example-figma-files/gov-uk-design-system.json
cargo run --release -- to-html 147:17 < $< \
| sed 's/px "GDS Transport Website"/px "GDS Transport Website",arial,sans-serif/g' > $@
definitions.kt :
typeshare . --lang=kotlin --output-file=$@
definitions.swift :
typeshare . --lang=swift --output-file=$@
typescript/index.d.ts :
typeshare . --lang=typescript --output-file=$@
.PHONY : all
all : $(example-figma-files) $(example-output-files) $(definition-files)
.PHONY : clean
clean : cleanOutput cleanDownloads cleanDefinitions
.PHONY : cleanDownloads
cleanDownloads :
rm -f $(example-figma-files)
.PHONY : cleanOutput
cleanOutput :
rm -f $(example-output-files)
.PHONY : cleanDefinitions
cleanDefinitions :
rm -f $(definition-files)
.PHONY : cleanAll
cleanAll : clean
git clean -fXd