@rxova/brand 1.2.0 → 1.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rxova/brand",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "type": "module",
5
5
  "description": "Design tokens, typefaces and project data for rxova.org",
6
6
  "keywords": [
@@ -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.0",
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": "node --import tsx scripts/pack-smoke.ts",
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/sites.ts CHANGED
@@ -124,13 +124,13 @@ export function getRepo(id: RepoId): (typeof REPOS)[number] {
124
124
  }
125
125
 
126
126
  /**
127
- * The standalone sections of rxova.org, in menu order, beside the project list. Every surface's
128
- * navigation reads this: the site header, the docs header and the shared footer.
127
+ * The standalone sections of rxova.org, in menu order. Every surface's navigation reads this: the
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: 'projects', label: 'Projects', path: '/projects/' },
131
132
  { id: 'blog', label: 'Blog', path: '/blog/' },
132
133
  { id: 'updates', label: 'Updates', path: '/updates/' },
133
- { id: 'about', label: 'About', path: '/about/' },
134
134
  ] as const
135
135
 
136
136
  export type SectionId = (typeof SECTIONS)[number]['id']
package/src/tokens.css CHANGED
@@ -47,8 +47,8 @@
47
47
  --rx-muted: #bbb3a6;
48
48
  --rx-fg: #f4f1ea;
49
49
 
50
- /* Lightened so the accent keeps AA contrast on a dark surface. */
51
- --rx-primary: #9375f5;
50
+ /* Lightened so the accent keeps AA contrast on every dark surface, --rx-tag-bg included (4.9:1). */
51
+ --rx-primary: #9d82f6;
52
52
  --rx-primary-dark: #8159f3;
53
53
  --rx-primary-darker: #6b3df0;
54
54
  --rx-primary-darkest: #5a2fd6;
@@ -79,7 +79,7 @@
79
79
  --rx-muted: #bbb3a6;
80
80
  --rx-fg: #f4f1ea;
81
81
 
82
- --rx-primary: #9375f5;
82
+ --rx-primary: #9d82f6;
83
83
  --rx-primary-dark: #8159f3;
84
84
  --rx-primary-darker: #6b3df0;
85
85
  --rx-primary-darkest: #5a2fd6;
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
- '&lt;a href=&quot;x&quot;&gt;&amp;&apos;&lt;/a&gt;',
17
- )
18
- })
19
-
20
- // The ordering bug this guards is silent: escape `<` before `&` and the
21
- // ampersand introduced by `&lt;` is escaped again, shipping `&amp;lt;`.
22
- it('does not double-escape the ampersands it introduces', () => {
23
- expect(escapeXml('a < b')).toBe('a &lt; b')
24
- expect(escapeXml('Tom & Jerry')).toBe('Tom &amp; 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 &lt;input&gt; &amp; 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
- })
@@ -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(['Blog', 'Updates', 'About'])
154
- for (const section of SECTIONS) {
155
- expect(section.path).toBe(`/${section.id}/`)
156
- }
157
- })
158
- })