@rxova/brand 1.3.0 → 1.4.0
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/README.md +2 -2
- package/package.json +10 -5
- package/src/feed.ts +27 -27
- package/src/fonts.css +42 -42
- package/src/index.ts +3 -3
- package/src/sites.ts +81 -81
- package/src/tokens.css +4 -4
- package/src/feed.test.ts +0 -93
- package/src/sites.links.test.ts +0 -57
- package/src/sites.test.ts +0 -158
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
4
|
Design tokens, typefaces and project data for every
|
|
5
|
-
<a href="https://rxova.
|
|
5
|
+
<a href="https://rxova.dev">rxova.dev</a> surface.
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
## Why this exists
|
|
11
11
|
|
|
12
|
-
`rxova.
|
|
12
|
+
`rxova.dev` serves one surface per project from a single origin — an Astro
|
|
13
13
|
landing at `/`, plus [overlock](https://github.com/rxova/overlock),
|
|
14
14
|
[journey](https://github.com/rxova/journey),
|
|
15
15
|
[react-inputs](https://github.com/rxova/react-inputs) and
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxova/brand",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Design tokens, typefaces and project data for rxova.
|
|
5
|
+
"description": "Design tokens, typefaces and project data for rxova.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"rxova",
|
|
8
8
|
"design-tokens",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Jonatan Kruszewski <jonakrusze@gmail.com>",
|
|
13
|
-
"homepage": "https://rxova.
|
|
13
|
+
"homepage": "https://rxova.dev",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/rxova/rxova-website.git",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"files": [
|
|
27
27
|
"src",
|
|
28
|
+
"!src/**/*.test.ts",
|
|
28
29
|
"assets",
|
|
29
30
|
"MIGRATION.md"
|
|
30
31
|
],
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@resvg/resvg-js": "^2.6.2",
|
|
44
|
-
"@rxova/repo-tooling": "0.0.1",
|
|
45
45
|
"@types/node": "^26.6.1",
|
|
46
46
|
"@vitest/coverage-v8": "^5.0.1",
|
|
47
47
|
"publint": "^0.3.24",
|
|
@@ -50,9 +50,14 @@
|
|
|
50
50
|
"typescript": "6.0.3",
|
|
51
51
|
"vitest": "^5.0.1"
|
|
52
52
|
},
|
|
53
|
+
"repoConfig": {
|
|
54
|
+
"packSmoke": {
|
|
55
|
+
"load": "never"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
53
58
|
"scripts": {
|
|
54
59
|
"typecheck": "tsc --noEmit",
|
|
55
|
-
"pack:smoke": "
|
|
60
|
+
"pack:smoke": "rxova-repo-config pack-smoke",
|
|
56
61
|
"check:exports": "publint --strict",
|
|
57
62
|
"og": "node --import tsx scripts/generate-og.ts",
|
|
58
63
|
"check:og": "node --import tsx scripts/generate-og.ts --check",
|
package/src/feed.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hand-written RSS 2.0 for the rxova.
|
|
2
|
+
* Hand-written RSS 2.0 for the rxova.dev surfaces that publish a stream (/blog and /updates).
|
|
3
3
|
* No Node-only imports, so it stays importable from an Astro endpoint in any runtime.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/** Escapes text for an XML node or attribute; `&` goes first so entities aren't double-escaped. */
|
|
7
7
|
export const escapeXml = (value: string): string =>
|
|
8
8
|
value
|
|
9
|
-
.replace(/&/g,
|
|
10
|
-
.replace(/</g,
|
|
11
|
-
.replace(/>/g,
|
|
12
|
-
.replace(/"/g,
|
|
13
|
-
.replace(/'/g,
|
|
9
|
+
.replace(/&/g, "&")
|
|
10
|
+
.replace(/</g, "<")
|
|
11
|
+
.replace(/>/g, ">")
|
|
12
|
+
.replace(/"/g, """)
|
|
13
|
+
.replace(/'/g, "'");
|
|
14
14
|
|
|
15
15
|
export interface FeedItem {
|
|
16
|
-
title: string
|
|
16
|
+
title: string;
|
|
17
17
|
/** Absolute URL. Also used as the guid, which is why it must be stable. */
|
|
18
|
-
link: string
|
|
19
|
-
description: string
|
|
20
|
-
pubDate: Date
|
|
18
|
+
link: string;
|
|
19
|
+
description: string;
|
|
20
|
+
pubDate: Date;
|
|
21
21
|
/** Plain author names. Rendered as `<dc:creator>`, not `<author>`. */
|
|
22
|
-
authors?: readonly string[]
|
|
23
|
-
categories?: readonly string[]
|
|
22
|
+
authors?: readonly string[];
|
|
23
|
+
categories?: readonly string[];
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export interface FeedOptions {
|
|
27
|
-
title: string
|
|
28
|
-
description: string
|
|
27
|
+
title: string;
|
|
28
|
+
description: string;
|
|
29
29
|
/** Absolute URL of the page this feed describes. */
|
|
30
|
-
siteUrl: string
|
|
30
|
+
siteUrl: string;
|
|
31
31
|
/** Absolute URL of the feed document itself, for `atom:link rel="self"`. */
|
|
32
|
-
feedUrl: string
|
|
33
|
-
items: readonly FeedItem[]
|
|
32
|
+
feedUrl: string;
|
|
33
|
+
items: readonly FeedItem[];
|
|
34
34
|
/** Defaults to the newest item's date. */
|
|
35
|
-
lastBuildDate?: Date
|
|
35
|
+
lastBuildDate?: Date;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/** RFC 822 date, as RSS 2.0 requires; `toUTCString()` yields exactly that, locale-independent. */
|
|
39
|
-
export const rfc822 = (date: Date): string => date.toUTCString()
|
|
39
|
+
export const rfc822 = (date: Date): string => date.toUTCString();
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
42
|
* A complete RSS 2.0 document; bylines use `dc:creator` because `<author>` must be an email.
|
|
@@ -50,8 +50,8 @@ export function renderFeed({
|
|
|
50
50
|
items,
|
|
51
51
|
lastBuildDate,
|
|
52
52
|
}: FeedOptions): string {
|
|
53
|
-
const newest = items[0]?.pubDate
|
|
54
|
-
const built = lastBuildDate ?? newest
|
|
53
|
+
const newest = items[0]?.pubDate;
|
|
54
|
+
const built = lastBuildDate ?? newest;
|
|
55
55
|
|
|
56
56
|
const entries = items.map((item) => {
|
|
57
57
|
const parts = [
|
|
@@ -64,9 +64,9 @@ export function renderFeed({
|
|
|
64
64
|
` <pubDate>${rfc822(item.pubDate)}</pubDate>`,
|
|
65
65
|
...(item.authors ?? []).map((a) => ` <dc:creator>${escapeXml(a)}</dc:creator>`),
|
|
66
66
|
...(item.categories ?? []).map((c) => ` <category>${escapeXml(c)}</category>`),
|
|
67
|
-
]
|
|
68
|
-
return ` <item>\n${parts.join(
|
|
69
|
-
})
|
|
67
|
+
];
|
|
68
|
+
return ` <item>\n${parts.join("\n")}\n </item>`;
|
|
69
|
+
});
|
|
70
70
|
|
|
71
71
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
72
72
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
|
@@ -76,10 +76,10 @@ export function renderFeed({
|
|
|
76
76
|
<description>${escapeXml(description)}</description>
|
|
77
77
|
<language>en</language>
|
|
78
78
|
<atom:link href="${escapeXml(feedUrl)}" rel="self" type="application/rss+xml" />${
|
|
79
|
-
built ? `\n <lastBuildDate>${rfc822(built)}</lastBuildDate>` :
|
|
79
|
+
built ? `\n <lastBuildDate>${rfc822(built)}</lastBuildDate>` : ""
|
|
80
80
|
}
|
|
81
|
-
${entries.join(
|
|
81
|
+
${entries.join("\n")}
|
|
82
82
|
</channel>
|
|
83
83
|
</rss>
|
|
84
|
-
|
|
84
|
+
`;
|
|
85
85
|
}
|
package/src/fonts.css
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
/* Space Grotesk 400 — latin */
|
|
7
7
|
@font-face {
|
|
8
|
-
font-family:
|
|
8
|
+
font-family: "Space Grotesk";
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
11
11
|
font-display: optional;
|
|
12
|
-
src: url(
|
|
12
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-400-normal.woff2") format("woff2");
|
|
13
13
|
unicode-range:
|
|
14
14
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
15
15
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
|
|
18
18
|
/* Space Grotesk 400 — latin-ext */
|
|
19
19
|
@font-face {
|
|
20
|
-
font-family:
|
|
20
|
+
font-family: "Space Grotesk";
|
|
21
21
|
font-style: normal;
|
|
22
22
|
font-weight: 400;
|
|
23
23
|
font-display: optional;
|
|
24
|
-
src: url(
|
|
25
|
-
format(
|
|
24
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-ext-400-normal.woff2")
|
|
25
|
+
format("woff2");
|
|
26
26
|
unicode-range:
|
|
27
27
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
28
28
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
|
|
32
32
|
/* Space Grotesk 400 — vietnamese */
|
|
33
33
|
@font-face {
|
|
34
|
-
font-family:
|
|
34
|
+
font-family: "Space Grotesk";
|
|
35
35
|
font-style: normal;
|
|
36
36
|
font-weight: 400;
|
|
37
37
|
font-display: optional;
|
|
38
|
-
src: url(
|
|
39
|
-
format(
|
|
38
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-vietnamese-400-normal.woff2")
|
|
39
|
+
format("woff2");
|
|
40
40
|
unicode-range:
|
|
41
41
|
U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
|
|
42
42
|
U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
|
|
45
45
|
/* Space Grotesk 500 — latin */
|
|
46
46
|
@font-face {
|
|
47
|
-
font-family:
|
|
47
|
+
font-family: "Space Grotesk";
|
|
48
48
|
font-style: normal;
|
|
49
49
|
font-weight: 500;
|
|
50
50
|
font-display: optional;
|
|
51
|
-
src: url(
|
|
51
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-500-normal.woff2") format("woff2");
|
|
52
52
|
unicode-range:
|
|
53
53
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
54
54
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
|
|
57
57
|
/* Space Grotesk 500 — latin-ext */
|
|
58
58
|
@font-face {
|
|
59
|
-
font-family:
|
|
59
|
+
font-family: "Space Grotesk";
|
|
60
60
|
font-style: normal;
|
|
61
61
|
font-weight: 500;
|
|
62
62
|
font-display: optional;
|
|
63
|
-
src: url(
|
|
64
|
-
format(
|
|
63
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-ext-500-normal.woff2")
|
|
64
|
+
format("woff2");
|
|
65
65
|
unicode-range:
|
|
66
66
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
67
67
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
|
|
71
71
|
/* Space Grotesk 500 — vietnamese */
|
|
72
72
|
@font-face {
|
|
73
|
-
font-family:
|
|
73
|
+
font-family: "Space Grotesk";
|
|
74
74
|
font-style: normal;
|
|
75
75
|
font-weight: 500;
|
|
76
76
|
font-display: optional;
|
|
77
|
-
src: url(
|
|
78
|
-
format(
|
|
77
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-vietnamese-500-normal.woff2")
|
|
78
|
+
format("woff2");
|
|
79
79
|
unicode-range:
|
|
80
80
|
U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
|
|
81
81
|
U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
|
|
84
84
|
/* Space Grotesk 600 — latin */
|
|
85
85
|
@font-face {
|
|
86
|
-
font-family:
|
|
86
|
+
font-family: "Space Grotesk";
|
|
87
87
|
font-style: normal;
|
|
88
88
|
font-weight: 600;
|
|
89
89
|
font-display: optional;
|
|
90
|
-
src: url(
|
|
90
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-600-normal.woff2") format("woff2");
|
|
91
91
|
unicode-range:
|
|
92
92
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
93
93
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -95,12 +95,12 @@
|
|
|
95
95
|
|
|
96
96
|
/* Space Grotesk 600 — latin-ext */
|
|
97
97
|
@font-face {
|
|
98
|
-
font-family:
|
|
98
|
+
font-family: "Space Grotesk";
|
|
99
99
|
font-style: normal;
|
|
100
100
|
font-weight: 600;
|
|
101
101
|
font-display: optional;
|
|
102
|
-
src: url(
|
|
103
|
-
format(
|
|
102
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-ext-600-normal.woff2")
|
|
103
|
+
format("woff2");
|
|
104
104
|
unicode-range:
|
|
105
105
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
106
106
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
|
@@ -109,12 +109,12 @@
|
|
|
109
109
|
|
|
110
110
|
/* Space Grotesk 600 — vietnamese */
|
|
111
111
|
@font-face {
|
|
112
|
-
font-family:
|
|
112
|
+
font-family: "Space Grotesk";
|
|
113
113
|
font-style: normal;
|
|
114
114
|
font-weight: 600;
|
|
115
115
|
font-display: optional;
|
|
116
|
-
src: url(
|
|
117
|
-
format(
|
|
116
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-vietnamese-600-normal.woff2")
|
|
117
|
+
format("woff2");
|
|
118
118
|
unicode-range:
|
|
119
119
|
U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
|
|
120
120
|
U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
|
@@ -122,11 +122,11 @@
|
|
|
122
122
|
|
|
123
123
|
/* Space Grotesk 700 — latin */
|
|
124
124
|
@font-face {
|
|
125
|
-
font-family:
|
|
125
|
+
font-family: "Space Grotesk";
|
|
126
126
|
font-style: normal;
|
|
127
127
|
font-weight: 700;
|
|
128
128
|
font-display: optional;
|
|
129
|
-
src: url(
|
|
129
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-700-normal.woff2") format("woff2");
|
|
130
130
|
unicode-range:
|
|
131
131
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
132
132
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -134,12 +134,12 @@
|
|
|
134
134
|
|
|
135
135
|
/* Space Grotesk 700 — latin-ext */
|
|
136
136
|
@font-face {
|
|
137
|
-
font-family:
|
|
137
|
+
font-family: "Space Grotesk";
|
|
138
138
|
font-style: normal;
|
|
139
139
|
font-weight: 700;
|
|
140
140
|
font-display: optional;
|
|
141
|
-
src: url(
|
|
142
|
-
format(
|
|
141
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-latin-ext-700-normal.woff2")
|
|
142
|
+
format("woff2");
|
|
143
143
|
unicode-range:
|
|
144
144
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
145
145
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
|
@@ -148,12 +148,12 @@
|
|
|
148
148
|
|
|
149
149
|
/* Space Grotesk 700 — vietnamese */
|
|
150
150
|
@font-face {
|
|
151
|
-
font-family:
|
|
151
|
+
font-family: "Space Grotesk";
|
|
152
152
|
font-style: normal;
|
|
153
153
|
font-weight: 700;
|
|
154
154
|
font-display: optional;
|
|
155
|
-
src: url(
|
|
156
|
-
format(
|
|
155
|
+
src: url("@fontsource/space-grotesk/files/space-grotesk-vietnamese-700-normal.woff2")
|
|
156
|
+
format("woff2");
|
|
157
157
|
unicode-range:
|
|
158
158
|
U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
|
|
159
159
|
U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
|
|
@@ -161,11 +161,11 @@
|
|
|
161
161
|
|
|
162
162
|
/* IBM Plex Mono 400 — latin */
|
|
163
163
|
@font-face {
|
|
164
|
-
font-family:
|
|
164
|
+
font-family: "IBM Plex Mono";
|
|
165
165
|
font-style: normal;
|
|
166
166
|
font-weight: 400;
|
|
167
167
|
font-display: optional;
|
|
168
|
-
src: url(
|
|
168
|
+
src: url("@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
|
|
169
169
|
unicode-range:
|
|
170
170
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
171
171
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -173,12 +173,12 @@
|
|
|
173
173
|
|
|
174
174
|
/* IBM Plex Mono 400 — latin-ext */
|
|
175
175
|
@font-face {
|
|
176
|
-
font-family:
|
|
176
|
+
font-family: "IBM Plex Mono";
|
|
177
177
|
font-style: normal;
|
|
178
178
|
font-weight: 400;
|
|
179
179
|
font-display: optional;
|
|
180
|
-
src: url(
|
|
181
|
-
format(
|
|
180
|
+
src: url("@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-ext-400-normal.woff2")
|
|
181
|
+
format("woff2");
|
|
182
182
|
unicode-range:
|
|
183
183
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
184
184
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
|
@@ -187,11 +187,11 @@
|
|
|
187
187
|
|
|
188
188
|
/* IBM Plex Mono 500 — latin */
|
|
189
189
|
@font-face {
|
|
190
|
-
font-family:
|
|
190
|
+
font-family: "IBM Plex Mono";
|
|
191
191
|
font-style: normal;
|
|
192
192
|
font-weight: 500;
|
|
193
193
|
font-display: optional;
|
|
194
|
-
src: url(
|
|
194
|
+
src: url("@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
|
|
195
195
|
unicode-range:
|
|
196
196
|
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
|
|
197
197
|
U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
@@ -199,12 +199,12 @@
|
|
|
199
199
|
|
|
200
200
|
/* IBM Plex Mono 500 — latin-ext */
|
|
201
201
|
@font-face {
|
|
202
|
-
font-family:
|
|
202
|
+
font-family: "IBM Plex Mono";
|
|
203
203
|
font-style: normal;
|
|
204
204
|
font-weight: 500;
|
|
205
205
|
font-display: optional;
|
|
206
|
-
src: url(
|
|
207
|
-
format(
|
|
206
|
+
src: url("@fontsource/ibm-plex-mono/files/ibm-plex-mono-latin-ext-500-normal.woff2")
|
|
207
|
+
format("woff2");
|
|
208
208
|
unicode-range:
|
|
209
209
|
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
|
|
210
210
|
U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @rxova/brand — the project data behind rxova.
|
|
1
|
+
/** @rxova/brand — the project data behind rxova.dev. Stylesheets are subpath exports (`@rxova/brand/tokens.css`). */
|
|
2
2
|
|
|
3
3
|
export {
|
|
4
4
|
RXOVA_ORIGIN,
|
|
@@ -16,6 +16,6 @@ export {
|
|
|
16
16
|
type ProjectId,
|
|
17
17
|
type RepoId,
|
|
18
18
|
type SectionId,
|
|
19
|
-
} from
|
|
19
|
+
} from "./sites.ts";
|
|
20
20
|
|
|
21
|
-
export { renderFeed, escapeXml, rfc822, type FeedItem, type FeedOptions } from
|
|
21
|
+
export { renderFeed, escapeXml, rfc822, type FeedItem, type FeedOptions } from "./feed.ts";
|
package/src/sites.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The rxova.
|
|
2
|
+
* The rxova.dev site map. Each surface has its own base path, so cross-project links are absolute.
|
|
3
3
|
* Imported from `astro.config.mjs` under Node, so it must never import CSS or a component.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/** Canonical origin. Override for a staging deploy (e.g. https://web.rxova.
|
|
7
|
-
export const RXOVA_ORIGIN = process.env.RXOVA_ORIGIN ??
|
|
6
|
+
/** Canonical origin. Override for a staging deploy (e.g. https://web.rxova.dev). */
|
|
7
|
+
export const RXOVA_ORIGIN = process.env.RXOVA_ORIGIN ?? "https://rxova.dev";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Every rxova project, in display order: the landing's project rail and the docs switcher.
|
|
@@ -12,84 +12,84 @@ export const RXOVA_ORIGIN = process.env.RXOVA_ORIGIN ?? 'https://rxova.org'
|
|
|
12
12
|
*/
|
|
13
13
|
const DEFINITIONS = [
|
|
14
14
|
{
|
|
15
|
-
id:
|
|
16
|
-
label:
|
|
17
|
-
tagline:
|
|
18
|
-
repo:
|
|
19
|
-
npm:
|
|
20
|
-
packages: [
|
|
15
|
+
id: "journey",
|
|
16
|
+
label: "journey",
|
|
17
|
+
tagline: "Declarative journey graphs for non-linear UI flows.",
|
|
18
|
+
repo: "https://github.com/rxova/journey",
|
|
19
|
+
npm: "https://www.npmjs.com/package/@rxova/journey-core",
|
|
20
|
+
packages: ["@rxova/journey-core", "@rxova/journey-react", "@rxova/journey-devtools-bridge"],
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
id:
|
|
24
|
-
label:
|
|
25
|
-
tagline:
|
|
26
|
-
repo:
|
|
27
|
-
npm:
|
|
23
|
+
id: "react-inputs",
|
|
24
|
+
label: "react-inputs",
|
|
25
|
+
tagline: "The tricky React inputs, done right.",
|
|
26
|
+
repo: "https://github.com/rxova/react-inputs",
|
|
27
|
+
npm: "https://www.npmjs.com/package/@rxova/react-inputs",
|
|
28
28
|
packages: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
"@rxova/react-inputs",
|
|
30
|
+
"@rxova/react-intl-currency-input",
|
|
31
|
+
"@rxova/react-rating-input",
|
|
32
|
+
"@rxova/react-otp-input",
|
|
33
|
+
"@rxova/react-password-input",
|
|
34
|
+
"@rxova/react-phone-input",
|
|
35
|
+
"@rxova/react-date-input",
|
|
36
|
+
"@rxova/react-time-input",
|
|
37
|
+
"@rxova/react-tags-input",
|
|
38
|
+
"@rxova/react-file-input",
|
|
39
39
|
],
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
id:
|
|
43
|
-
label:
|
|
44
|
-
tagline:
|
|
45
|
-
repo:
|
|
46
|
-
npm:
|
|
47
|
-
packages: [
|
|
42
|
+
id: "use-everywhere",
|
|
43
|
+
label: "use-everywhere",
|
|
44
|
+
tagline: "State and messages that exist in every tab, window, and worker.",
|
|
45
|
+
repo: "https://github.com/rxova/use-everywhere",
|
|
46
|
+
npm: "https://www.npmjs.com/package/use-everywhere",
|
|
47
|
+
packages: ["use-everywhere", "@use-everywhere/core"],
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
id:
|
|
51
|
-
label:
|
|
52
|
-
tagline:
|
|
53
|
-
repo:
|
|
54
|
-
npm:
|
|
55
|
-
packages: [
|
|
50
|
+
id: "ts-extended-errors",
|
|
51
|
+
label: "ts-extended-errors",
|
|
52
|
+
tagline: "Typed, serializable errors that survive a JSON round trip.",
|
|
53
|
+
repo: "https://github.com/rxova/ts-extended-errors",
|
|
54
|
+
npm: "https://www.npmjs.com/package/ts-extended-errors",
|
|
55
|
+
packages: ["ts-extended-errors"],
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
id:
|
|
59
|
-
label:
|
|
60
|
-
tagline:
|
|
61
|
-
repo:
|
|
62
|
-
npm:
|
|
63
|
-
packages: [
|
|
58
|
+
id: "overlock",
|
|
59
|
+
label: "overlock",
|
|
60
|
+
tagline: "A deterministic gate on test integrity in a git patch.",
|
|
61
|
+
repo: "https://github.com/rxova/overlock",
|
|
62
|
+
npm: "https://www.npmjs.com/package/overlock",
|
|
63
|
+
packages: ["overlock"],
|
|
64
64
|
},
|
|
65
|
-
] as const
|
|
65
|
+
] as const;
|
|
66
66
|
|
|
67
|
-
export type ProjectId = (typeof DEFINITIONS)[number][
|
|
67
|
+
export type ProjectId = (typeof DEFINITIONS)[number]["id"];
|
|
68
68
|
|
|
69
69
|
export interface Project {
|
|
70
|
-
id: ProjectId
|
|
70
|
+
id: ProjectId;
|
|
71
71
|
/** Display name, used in the header, the switcher and the landing cards. */
|
|
72
|
-
label: string
|
|
72
|
+
label: string;
|
|
73
73
|
/** Path the aggregator mounts this project's docs at: always `/packages/<id>/`. */
|
|
74
|
-
mount: `/${string}
|
|
75
|
-
tagline: string
|
|
76
|
-
repo: string
|
|
74
|
+
mount: `/${string}/`;
|
|
75
|
+
tagline: string;
|
|
76
|
+
repo: string;
|
|
77
77
|
/** The package a newcomer should install first. */
|
|
78
|
-
npm: string
|
|
78
|
+
npm: string;
|
|
79
79
|
/** npm package names, most prominent first. */
|
|
80
|
-
packages: string[]
|
|
80
|
+
packages: string[];
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
export const PROJECTS: readonly Project[] = DEFINITIONS.map((project) => ({
|
|
84
84
|
...project,
|
|
85
85
|
mount: `/packages/${project.id}/`,
|
|
86
86
|
packages: [...project.packages],
|
|
87
|
-
}))
|
|
87
|
+
}));
|
|
88
88
|
|
|
89
89
|
export function getProject(id: ProjectId): Project {
|
|
90
|
-
const project = PROJECTS.find((p) => p.id === id)
|
|
91
|
-
if (!project) throw new Error(`[@rxova/brand] unknown project id: ${id}`)
|
|
92
|
-
return project
|
|
90
|
+
const project = PROJECTS.find((p) => p.id === id);
|
|
91
|
+
if (!project) throw new Error(`[@rxova/brand] unknown project id: ${id}`);
|
|
92
|
+
return project;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
/**
|
|
@@ -99,59 +99,59 @@ export function getProject(id: ProjectId): Project {
|
|
|
99
99
|
export const REPOS = [
|
|
100
100
|
...PROJECTS.map((p) => ({ id: p.id, label: p.label, repo: p.repo, project: true as const })),
|
|
101
101
|
{
|
|
102
|
-
id:
|
|
103
|
-
label:
|
|
104
|
-
repo:
|
|
102
|
+
id: "rxova-website",
|
|
103
|
+
label: "Website",
|
|
104
|
+
repo: "https://github.com/rxova/rxova-website",
|
|
105
105
|
project: false as const,
|
|
106
106
|
},
|
|
107
107
|
{
|
|
108
|
-
id:
|
|
109
|
-
label:
|
|
110
|
-
repo:
|
|
108
|
+
id: "brand",
|
|
109
|
+
label: "Brand",
|
|
110
|
+
repo: "https://github.com/rxova/rxova-website/tree/main/packages/brand",
|
|
111
111
|
project: false as const,
|
|
112
112
|
},
|
|
113
|
-
] as const
|
|
113
|
+
] as const;
|
|
114
114
|
|
|
115
|
-
export type RepoId = (typeof REPOS)[number][
|
|
115
|
+
export type RepoId = (typeof REPOS)[number]["id"];
|
|
116
116
|
|
|
117
117
|
/** The ids only, for schema validation — see packages/website-schemas. */
|
|
118
|
-
export const REPO_IDS: readonly RepoId[] = REPOS.map((r) => r.id)
|
|
118
|
+
export const REPO_IDS: readonly RepoId[] = REPOS.map((r) => r.id);
|
|
119
119
|
|
|
120
120
|
export function getRepo(id: RepoId): (typeof REPOS)[number] {
|
|
121
|
-
const found = REPOS.find((r) => r.id === id)
|
|
122
|
-
if (!found) throw new Error(`[@rxova/brand] unknown repo id: ${id}`)
|
|
123
|
-
return found
|
|
121
|
+
const found = REPOS.find((r) => r.id === id);
|
|
122
|
+
if (!found) throw new Error(`[@rxova/brand] unknown repo id: ${id}`);
|
|
123
|
+
return found;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* The standalone sections of rxova.
|
|
127
|
+
* The standalone sections of rxova.dev, in menu order. Every surface's navigation reads this: the
|
|
128
128
|
* site header, the docs header and the shared footer. The site root is the about page, reached by the mark.
|
|
129
129
|
*/
|
|
130
130
|
export const SECTIONS = [
|
|
131
|
-
{ id:
|
|
132
|
-
{ id:
|
|
133
|
-
{ id:
|
|
134
|
-
] as const
|
|
131
|
+
{ id: "projects", label: "Projects", path: "/projects/" },
|
|
132
|
+
{ id: "blog", label: "Blog", path: "/blog/" },
|
|
133
|
+
{ id: "updates", label: "Updates", path: "/updates/" },
|
|
134
|
+
] as const;
|
|
135
135
|
|
|
136
|
-
export type SectionId = (typeof SECTIONS)[number][
|
|
136
|
+
export type SectionId = (typeof SECTIONS)[number]["id"];
|
|
137
137
|
|
|
138
138
|
/** Absolute URL to a project's docs root. */
|
|
139
139
|
export function docsUrl(id: ProjectId): string {
|
|
140
|
-
return `${RXOVA_ORIGIN}${getProject(id).mount}
|
|
140
|
+
return `${RXOVA_ORIGIN}${getProject(id).mount}`;
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/** Absolute URL to a path on the umbrella site, e.g. `/privacy`. */
|
|
144
|
-
export function siteUrl(path =
|
|
145
|
-
return `${RXOVA_ORIGIN}${path.startsWith(
|
|
144
|
+
export function siteUrl(path = "/"): string {
|
|
145
|
+
return `${RXOVA_ORIGIN}${path.startsWith("/") ? path : `/${path}`}`;
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
/**
|
|
149
149
|
* Absolute canonical URL for a page, always with a trailing slash (GitHub Pages 301s `/blog`).
|
|
150
150
|
* Pages only; assets keep their exact path and use `siteUrl`.
|
|
151
151
|
*/
|
|
152
|
-
export function canonicalUrl(path =
|
|
153
|
-
const rooted = path.startsWith(
|
|
154
|
-
return `${RXOVA_ORIGIN}${rooted.endsWith(
|
|
152
|
+
export function canonicalUrl(path = "/"): string {
|
|
153
|
+
const rooted = path.startsWith("/") ? path : `/${path}`;
|
|
154
|
+
return `${RXOVA_ORIGIN}${rooted.endsWith("/") ? rooted : `${rooted}/`}`;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
/**
|
|
@@ -159,6 +159,6 @@ export function canonicalUrl(path = '/'): string {
|
|
|
159
159
|
* Returns `undefined` on a standalone build, where the base is `/`.
|
|
160
160
|
*/
|
|
161
161
|
export function projectFromBase(base: string): ProjectId | undefined {
|
|
162
|
-
const normalised = base.endsWith(
|
|
163
|
-
return PROJECTS.find((p) => p.mount === normalised)?.id
|
|
162
|
+
const normalised = base.endsWith("/") ? base : `${base}/`;
|
|
163
|
+
return PROJECTS.find((p) => p.mount === normalised)?.id;
|
|
164
164
|
}
|
package/src/tokens.css
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
:root,
|
|
7
|
-
:root[data-theme=
|
|
7
|
+
:root[data-theme="light"] {
|
|
8
8
|
color-scheme: light;
|
|
9
9
|
|
|
10
10
|
/* Surfaces, ordered background -> foreground. */
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
--rx-shadow-soft: 0 20px 60px -30px rgb(107 61 240 / 0.35);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
:root[data-theme=
|
|
37
|
+
:root[data-theme="dark"] {
|
|
38
38
|
color-scheme: dark;
|
|
39
39
|
|
|
40
40
|
--rx-bg: #0b0a08;
|
|
@@ -103,9 +103,9 @@
|
|
|
103
103
|
--rx-gradient: linear-gradient(90deg, var(--rx-accent-a), var(--rx-accent-b), var(--rx-accent-c));
|
|
104
104
|
|
|
105
105
|
--rx-font-sans:
|
|
106
|
-
|
|
106
|
+
"Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
107
107
|
--rx-font-mono:
|
|
108
|
-
|
|
108
|
+
"IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
109
109
|
|
|
110
110
|
--rx-radius: 12px;
|
|
111
111
|
--rx-radius-sm: 6px;
|
package/src/feed.test.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest'
|
|
2
|
-
|
|
3
|
-
import { escapeXml, renderFeed, rfc822, type FeedItem } from './feed.ts'
|
|
4
|
-
|
|
5
|
-
const item = (over: Partial<FeedItem> = {}): FeedItem => ({
|
|
6
|
-
title: 'A post',
|
|
7
|
-
link: 'https://rxova.org/blog/a-post/',
|
|
8
|
-
description: 'What it is about.',
|
|
9
|
-
pubDate: new Date('2026-08-03T09:00:00Z'),
|
|
10
|
-
...over,
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
describe('escapeXml', () => {
|
|
14
|
-
it('escapes the five XML entities', () => {
|
|
15
|
-
expect(escapeXml(`<a href="x">&'</a>`)).toBe(
|
|
16
|
-
'<a href="x">&'</a>',
|
|
17
|
-
)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
// The ordering bug this guards is silent: escape `<` before `&` and the
|
|
21
|
-
// ampersand introduced by `<` is escaped again, shipping `&lt;`.
|
|
22
|
-
it('does not double-escape the ampersands it introduces', () => {
|
|
23
|
-
expect(escapeXml('a < b')).toBe('a < b')
|
|
24
|
-
expect(escapeXml('Tom & Jerry')).toBe('Tom & Jerry')
|
|
25
|
-
})
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
describe('rfc822', () => {
|
|
29
|
-
// RSS 2.0 requires RFC 822 dates, not ISO 8601. A reader handed an ISO date
|
|
30
|
-
// either drops the item or dates it "now", and both look like the feed works.
|
|
31
|
-
it('formats as RFC 822, not ISO 8601', () => {
|
|
32
|
-
expect(rfc822(new Date('2026-08-09T09:00:00Z'))).toBe('Sun, 09 Aug 2026 09:00:00 GMT')
|
|
33
|
-
})
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
describe('renderFeed', () => {
|
|
37
|
-
const base = {
|
|
38
|
-
title: 'Rxova Blog',
|
|
39
|
-
description: 'Essays from the Rxova projects.',
|
|
40
|
-
siteUrl: 'https://rxova.org/blog/',
|
|
41
|
-
feedUrl: 'https://rxova.org/blog/rss.xml',
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
it('renders a channel with a self-referencing atom link', () => {
|
|
45
|
-
const xml = renderFeed({ ...base, items: [item()] })
|
|
46
|
-
expect(xml).toContain('<?xml version="1.0" encoding="UTF-8"?>')
|
|
47
|
-
expect(xml).toContain('<title>Rxova Blog</title>')
|
|
48
|
-
expect(xml).toContain(
|
|
49
|
-
'<atom:link href="https://rxova.org/blog/rss.xml" rel="self" type="application/rss+xml" />',
|
|
50
|
-
)
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('uses the entry URL as a permalink guid', () => {
|
|
54
|
-
const xml = renderFeed({ ...base, items: [item()] })
|
|
55
|
-
expect(xml).toContain('<guid isPermaLink="true">https://rxova.org/blog/a-post/</guid>')
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('keeps the order it was given', () => {
|
|
59
|
-
const xml = renderFeed({
|
|
60
|
-
...base,
|
|
61
|
-
items: [item({ title: 'Newer' }), item({ title: 'Older' })],
|
|
62
|
-
})
|
|
63
|
-
expect(xml.indexOf('Newer')).toBeLessThan(xml.indexOf('Older'))
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('dates the build from the newest item when not told otherwise', () => {
|
|
67
|
-
const xml = renderFeed({ ...base, items: [item()] })
|
|
68
|
-
expect(xml).toContain('<lastBuildDate>Mon, 03 Aug 2026 09:00:00 GMT</lastBuildDate>')
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it('omits lastBuildDate for an empty feed rather than emitting an invalid date', () => {
|
|
72
|
-
const xml = renderFeed({ ...base, items: [] })
|
|
73
|
-
expect(xml).not.toContain('lastBuildDate')
|
|
74
|
-
expect(xml).toContain('</channel>')
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
it('renders bylines as dc:creator, never as an email-shaped author', () => {
|
|
78
|
-
const xml = renderFeed({ ...base, items: [item({ authors: ['Jonatan Kruszewski'] })] })
|
|
79
|
-
expect(xml).toContain('<dc:creator>Jonatan Kruszewski</dc:creator>')
|
|
80
|
-
expect(xml).not.toContain('<author>')
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
it('escapes titles that carry markup characters', () => {
|
|
84
|
-
const xml = renderFeed({ ...base, items: [item({ title: 'Why <input> & you' })] })
|
|
85
|
-
expect(xml).toContain('<title>Why <input> & you</title>')
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
it('renders categories from tags', () => {
|
|
89
|
-
const xml = renderFeed({ ...base, items: [item({ categories: ['react', 'intl'] })] })
|
|
90
|
-
expect(xml).toContain('<category>react</category>')
|
|
91
|
-
expect(xml).toContain('<category>intl</category>')
|
|
92
|
-
})
|
|
93
|
-
})
|
package/src/sites.links.test.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Every outbound link in PROJECTS resolves over the network (a well-shaped URL can still 404).
|
|
3
|
-
* npm is checked via the registry, since www.npmjs.com answers 403 to non-browsers.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, expect, it } from 'vitest'
|
|
7
|
-
|
|
8
|
-
import { PROJECTS } from './sites.ts'
|
|
9
|
-
|
|
10
|
-
const TIMEOUT = 15_000
|
|
11
|
-
|
|
12
|
-
/** Retries what is transient (rate limits, 5xx, network) — never a 404. */
|
|
13
|
-
async function status(url: string, method: 'GET' | 'HEAD'): Promise<number> {
|
|
14
|
-
let last = 0
|
|
15
|
-
for (let attempt = 0; attempt < 3; attempt++) {
|
|
16
|
-
try {
|
|
17
|
-
const res = await fetch(url, {
|
|
18
|
-
method,
|
|
19
|
-
redirect: 'follow',
|
|
20
|
-
signal: AbortSignal.timeout(10_000),
|
|
21
|
-
})
|
|
22
|
-
last = res.status
|
|
23
|
-
if (res.status !== 429 && res.status < 500) return res.status
|
|
24
|
-
} catch {
|
|
25
|
-
last = 0
|
|
26
|
-
}
|
|
27
|
-
await new Promise((r) => setTimeout(r, 1_000 * (attempt + 1)))
|
|
28
|
-
}
|
|
29
|
-
return last
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/** Off by default, so a flaky registry cannot fail a pull request; the weekly `links` workflow sets it. */
|
|
33
|
-
const network = process.env.RX_NETWORK_TESTS === '1'
|
|
34
|
-
|
|
35
|
-
const registryUrl = (pkg: string) => `https://registry.npmjs.org/${encodeURIComponent(pkg)}`
|
|
36
|
-
|
|
37
|
-
describe.each(PROJECTS.map((p) => [p.id, p] as const))('%s links', (_, project) => {
|
|
38
|
-
it('links npm to its first package', () => {
|
|
39
|
-
expect(project.npm).toBe(`https://www.npmjs.com/package/${project.packages[0]}`)
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it.runIf(network).each(project.packages)(
|
|
43
|
-
'publishes %s on npm',
|
|
44
|
-
async (pkg) => {
|
|
45
|
-
expect(await status(registryUrl(pkg), 'GET')).toBe(200)
|
|
46
|
-
},
|
|
47
|
-
TIMEOUT * 3,
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
it.runIf(network)(
|
|
51
|
-
'has a public GitHub repo',
|
|
52
|
-
async () => {
|
|
53
|
-
expect(await status(project.repo, 'HEAD')).toBe(200)
|
|
54
|
-
},
|
|
55
|
-
TIMEOUT * 3,
|
|
56
|
-
)
|
|
57
|
-
})
|
package/src/sites.test.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The site map: which projects and repos exist, and the URLs that reach them.
|
|
3
|
-
* Every rxova.org surface reads it — the landing, the docs switcher and the updates repo filter.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { describe, expect, it } from 'vitest'
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
RXOVA_ORIGIN,
|
|
10
|
-
PROJECTS,
|
|
11
|
-
REPOS,
|
|
12
|
-
REPO_IDS,
|
|
13
|
-
SECTIONS,
|
|
14
|
-
getProject,
|
|
15
|
-
getRepo,
|
|
16
|
-
docsUrl,
|
|
17
|
-
siteUrl,
|
|
18
|
-
canonicalUrl,
|
|
19
|
-
projectFromBase,
|
|
20
|
-
type ProjectId,
|
|
21
|
-
} from './sites.ts'
|
|
22
|
-
|
|
23
|
-
describe('PROJECTS', () => {
|
|
24
|
-
it('has no duplicate ids', () => {
|
|
25
|
-
expect(new Set(PROJECTS.map((p) => p.id)).size).toBe(PROJECTS.length)
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
// The aggregator derives `packages/<id>` from the id and only relocates the
|
|
29
|
-
// built tree; a mount that disagrees deploys a page with every asset 404ing.
|
|
30
|
-
it('mounts every project at the path its id derives', () => {
|
|
31
|
-
for (const p of PROJECTS) expect(p.mount).toBe(`/packages/${p.id}/`)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
it('gives every project a tagline, a repo, an npm link and at least one package', () => {
|
|
35
|
-
for (const p of PROJECTS) {
|
|
36
|
-
expect(p.tagline.length).toBeGreaterThan(0)
|
|
37
|
-
expect(p.repo).toMatch(/^https:\/\/github\.com\//)
|
|
38
|
-
expect(p.npm).toMatch(/^https:\/\/www\.npmjs\.com\//)
|
|
39
|
-
expect(p.packages.length).toBeGreaterThan(0)
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
describe('getProject', () => {
|
|
45
|
-
it('finds a project by id', () => {
|
|
46
|
-
expect(getProject('journey').label).toBe('journey')
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('throws rather than returning undefined for an unknown id', () => {
|
|
50
|
-
expect(() => getProject('nope' as ProjectId)).toThrow(/unknown project id: nope/)
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
describe('REPOS', () => {
|
|
55
|
-
// The whole reason REPOS exists: an update about the website or the brand repo
|
|
56
|
-
// has to be representable, and neither ships a package.
|
|
57
|
-
it('covers every project plus the repos that ship no package', () => {
|
|
58
|
-
for (const p of PROJECTS) expect(REPO_IDS).toContain(p.id)
|
|
59
|
-
expect(REPO_IDS).toContain('rxova-website')
|
|
60
|
-
expect(REPO_IDS).toContain('brand')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('marks which entries are projects', () => {
|
|
64
|
-
expect(REPOS.filter((r) => r.project).map((r) => r.id)).toEqual(PROJECTS.map((p) => p.id))
|
|
65
|
-
expect(REPOS.filter((r) => !r.project).map((r) => r.id)).toEqual(['rxova-website', 'brand'])
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('lists projects first, which is the order the repo filter renders', () => {
|
|
69
|
-
const firstNonProject = REPOS.findIndex((r) => !r.project)
|
|
70
|
-
expect(REPOS.slice(0, firstNonProject).every((r) => r.project)).toBe(true)
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('has no duplicate ids and a label and repo for each', () => {
|
|
74
|
-
expect(new Set(REPO_IDS).size).toBe(REPOS.length)
|
|
75
|
-
for (const r of REPOS) {
|
|
76
|
-
expect(r.label.length).toBeGreaterThan(0)
|
|
77
|
-
expect(r.repo).toMatch(/^https:\/\/github\.com\//)
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it('keeps REPO_IDS in step with REPOS', () => {
|
|
82
|
-
expect([...REPO_IDS]).toEqual(REPOS.map((r) => r.id))
|
|
83
|
-
})
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
describe('getRepo', () => {
|
|
87
|
-
it('finds a project repo and a non-project repo alike', () => {
|
|
88
|
-
expect(getRepo('journey').project).toBe(true)
|
|
89
|
-
expect(getRepo('brand').label).toBe('Brand')
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('throws on an unknown id', () => {
|
|
93
|
-
expect(() => getRepo('nope' as never)).toThrow(/unknown repo id: nope/)
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
describe('urls', () => {
|
|
98
|
-
it('builds an absolute docs url', () => {
|
|
99
|
-
expect(docsUrl('journey')).toBe(`${RXOVA_ORIGIN}/packages/journey/`)
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
it('builds a site url from a path with or without a leading slash', () => {
|
|
103
|
-
expect(siteUrl('/privacy')).toBe(`${RXOVA_ORIGIN}/privacy`)
|
|
104
|
-
expect(siteUrl('privacy')).toBe(`${RXOVA_ORIGIN}/privacy`)
|
|
105
|
-
})
|
|
106
|
-
|
|
107
|
-
it('defaults to the origin root', () => {
|
|
108
|
-
expect(siteUrl()).toBe(`${RXOVA_ORIGIN}/`)
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
describe('canonicalUrl', () => {
|
|
113
|
-
// The bug this exists to prevent: /blog answers 301 and only /blog/ answers
|
|
114
|
-
// 200, so a canonical without the slash points a crawler at a redirect.
|
|
115
|
-
it('always ends in a slash, whatever the caller passed', () => {
|
|
116
|
-
expect(canonicalUrl('/blog')).toBe(`${RXOVA_ORIGIN}/blog/`)
|
|
117
|
-
expect(canonicalUrl('/blog/')).toBe(`${RXOVA_ORIGIN}/blog/`)
|
|
118
|
-
expect(canonicalUrl('/updates/repos/journey')).toBe(`${RXOVA_ORIGIN}/updates/repos/journey/`)
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('roots a path that arrives without a leading slash', () => {
|
|
122
|
-
expect(canonicalUrl('blog')).toBe(`${RXOVA_ORIGIN}/blog/`)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
it('defaults to the origin root', () => {
|
|
126
|
-
expect(canonicalUrl()).toBe(`${RXOVA_ORIGIN}/`)
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
// siteUrl builds nav hrefs, where following a redirect costs nothing. Keeping
|
|
130
|
-
// them different is the point; collapsing them would reintroduce the bug.
|
|
131
|
-
it('differs from siteUrl, which does not normalise', () => {
|
|
132
|
-
expect(siteUrl('/blog')).toBe(`${RXOVA_ORIGIN}/blog`)
|
|
133
|
-
expect(canonicalUrl('/blog')).not.toBe(siteUrl('/blog'))
|
|
134
|
-
})
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
describe('projectFromBase', () => {
|
|
138
|
-
it('recognises a mount with and without its trailing slash', () => {
|
|
139
|
-
expect(projectFromBase('/packages/journey/')).toBe('journey')
|
|
140
|
-
expect(projectFromBase('/packages/journey')).toBe('journey')
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
// A standalone docs build has base "/" and belongs to no project. Returning
|
|
144
|
-
// undefined is correct there — the switcher simply omits the current marker.
|
|
145
|
-
it('returns undefined for a base that is not a mount', () => {
|
|
146
|
-
expect(projectFromBase('/')).toBeUndefined()
|
|
147
|
-
expect(projectFromBase('/packages/nope/')).toBeUndefined()
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
describe('SECTIONS', () => {
|
|
152
|
-
it('lists the site sections in menu order, each a page path Pages serves without a redirect', () => {
|
|
153
|
-
expect(SECTIONS.map((s) => s.label)).toEqual(['Projects', 'Blog', 'Updates'])
|
|
154
|
-
for (const section of SECTIONS) {
|
|
155
|
-
expect(section.path).toBe(`/${section.id}/`)
|
|
156
|
-
}
|
|
157
|
-
})
|
|
158
|
-
})
|