-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdata.ts
153 lines (140 loc) · 3.46 KB
/
data.ts
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
import * as fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import { dirname, join } from 'pathe';
import type {
APIIconResponse,
APIResponse,
AxesObject,
FontObjectV1,
FontObjectV2,
FontObjectVariable,
FontObjectVariableDirect,
Licenses,
} from './types';
/**
* This returns a version of the Google Fonts Developer API.
* {@link https://developers.google.com/fonts/docs/developer_api}
*/
const APIDirect = JSON.parse(
fs.readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../data/api-response.json'),
'utf8',
),
) as APIResponse[];
/**
* This returns a parsed version of the Google Fonts CSS API (v1) for all Google Fonts.
* {@link https://developers.google.com/fonts/docs/getting_started}
*/
const APIv1 = JSON.parse(
fs.readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../data/google-fonts-v1.json',
),
'utf8',
),
) as FontObjectV1;
/**
* This returns a parsed version of the Google Fonts CSS API (v1) for all Google Fonts.
* {@link https://developers.google.com/fonts/docs/css2}
*/
const APIv2 = JSON.parse(
fs.readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../data/google-fonts-v2.json',
),
'utf8',
),
) as FontObjectV2;
/**
* This returns a response from the Google Fonts API for all icons.
* {@link https://fonts.google.com/icons}
*/
const APIIconDirect = JSON.parse(
fs.readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../data/icons-response.json',
),
'utf8',
),
) as APIIconResponse[];
/**
* This returns a parsed version of the Google Fonts API for icons using the CSS API v2.
* {@link https://fonts.google.com/icons}
*/
const APIIconStatic = JSON.parse(
fs.readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../data/icons-static.json'),
'utf8',
),
) as FontObjectV2;
/**
* This returns a parsed version of the Google Fonts API for icons that are variable.
* {@link https://fonts.google.com/icons}
*/
const APIIconVariable = JSON.parse(
fs.readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../data/icons-variable.json',
),
'utf8',
),
) as FontObjectVariable;
/**
* This returns a scraped version of the Google Fonts Variable Fonts page.
* {@link https://fonts.google.com/variablefonts}
*/
const APIVariableDirect = JSON.parse(
fs.readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
'../data/variable-response.json',
),
'utf8',
),
) as FontObjectVariableDirect[];
/**
* This returns a parsed version of the Google Fonts CSS API (Variable) for all Google Fonts.
* {@link https://fonts.google.com/variablefonts}
*/
const APIVariable = JSON.parse(
fs.readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../data/variable.json'),
'utf8',
),
) as FontObjectVariable;
/**
* This returns a parsed version of the Google Fonts Attribution page.
* {@link https://fonts.google.com/attribution}
*/
const APILicense = JSON.parse(
fs.readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../data/licenses.json'),
'utf8',
),
) as Licenses;
/**
* This returns the axis registry of the supported Google Font variable axes.
* {@link https://github.com/googlefonts/axisregistry}
*/
const APIRegistry = JSON.parse(
fs.readFileSync(
join(dirname(fileURLToPath(import.meta.url)), '../data/axis-registry.json'),
'utf8',
),
) as AxesObject[];
export {
APIDirect,
APIIconDirect,
APIIconStatic,
APIIconVariable,
APILicense,
APIRegistry,
APIv1,
APIv2,
APIVariable,
APIVariableDirect,
};