@rxova/brand 0.13.1 → 0.14.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/assets/og/ts-extended-errors.png +0 -0
- package/package.json +1 -1
- package/src/sites.links.test.ts +62 -0
- package/src/sites.ts +11 -1
|
Binary file
|
package/package.json
CHANGED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every outbound link in PROJECTS resolves.
|
|
3
|
+
*
|
|
4
|
+
* sites.test.ts checks the shape of these URLs, and a well-shaped URL can still
|
|
5
|
+
* 404: ts-extended-errors shipped with an npm link to `@rxova/ts-extended-errors`
|
|
6
|
+
* after the package had been published unscoped as `ts-extended-errors`. Only
|
|
7
|
+
* asking the network catches that, so this file does.
|
|
8
|
+
*
|
|
9
|
+
* npm is checked through the registry, not www.npmjs.com, which answers 403 to
|
|
10
|
+
* anything that is not a browser. The npm link is pinned to the first package
|
|
11
|
+
* below, so checking the packages checks the link.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { describe, expect, it } from 'vitest'
|
|
15
|
+
|
|
16
|
+
import { PROJECTS } from './sites.ts'
|
|
17
|
+
|
|
18
|
+
const TIMEOUT = 15_000
|
|
19
|
+
|
|
20
|
+
/** Retries what is transient (rate limits, 5xx, network) — never a 404. */
|
|
21
|
+
async function status(url: string, method: 'GET' | 'HEAD'): Promise<number> {
|
|
22
|
+
let last = 0
|
|
23
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
24
|
+
try {
|
|
25
|
+
const res = await fetch(url, {
|
|
26
|
+
method,
|
|
27
|
+
redirect: 'follow',
|
|
28
|
+
signal: AbortSignal.timeout(10_000),
|
|
29
|
+
})
|
|
30
|
+
last = res.status
|
|
31
|
+
if (res.status !== 429 && res.status < 500) return res.status
|
|
32
|
+
} catch {
|
|
33
|
+
last = 0
|
|
34
|
+
}
|
|
35
|
+
await new Promise((r) => setTimeout(r, 1_000 * (attempt + 1)))
|
|
36
|
+
}
|
|
37
|
+
return last
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const registryUrl = (pkg: string) => `https://registry.npmjs.org/${pkg.replace('/', '%2f')}`
|
|
41
|
+
|
|
42
|
+
describe.each(PROJECTS.map((p) => [p.id, p] as const))('%s links', (_, project) => {
|
|
43
|
+
it('links npm to its first package', () => {
|
|
44
|
+
expect(project.npm).toBe(`https://www.npmjs.com/package/${project.packages[0]}`)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it.each(project.packages)(
|
|
48
|
+
'publishes %s on npm',
|
|
49
|
+
async (pkg) => {
|
|
50
|
+
expect(await status(registryUrl(pkg), 'GET')).toBe(200)
|
|
51
|
+
},
|
|
52
|
+
TIMEOUT * 3,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
it(
|
|
56
|
+
'has a public GitHub repo',
|
|
57
|
+
async () => {
|
|
58
|
+
expect(await status(project.repo, 'HEAD')).toBe(200)
|
|
59
|
+
},
|
|
60
|
+
TIMEOUT * 3,
|
|
61
|
+
)
|
|
62
|
+
})
|
package/src/sites.ts
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
/** Canonical origin. Override for a staging deploy (e.g. https://web.rxova.org). */
|
|
15
15
|
export const RXOVA_ORIGIN = process.env.RXOVA_ORIGIN ?? 'https://rxova.org'
|
|
16
16
|
|
|
17
|
-
export type ProjectId =
|
|
17
|
+
export type ProjectId =
|
|
18
|
+
'overlock' | 'journey' | 'react-inputs' | 'use-everywhere' | 'ts-extended-errors'
|
|
18
19
|
|
|
19
20
|
export interface Project {
|
|
20
21
|
id: ProjectId
|
|
@@ -78,6 +79,15 @@ export const PROJECTS: readonly Project[] = [
|
|
|
78
79
|
npm: 'https://www.npmjs.com/package/use-everywhere',
|
|
79
80
|
packages: ['use-everywhere', '@use-everywhere/core'],
|
|
80
81
|
},
|
|
82
|
+
{
|
|
83
|
+
id: 'ts-extended-errors',
|
|
84
|
+
label: 'ts-extended-errors',
|
|
85
|
+
mount: '/packages/ts-extended-errors/',
|
|
86
|
+
tagline: 'Typed, serializable errors that survive a JSON round trip.',
|
|
87
|
+
repo: 'https://github.com/rxova/ts-extended-errors',
|
|
88
|
+
npm: 'https://www.npmjs.com/package/ts-extended-errors',
|
|
89
|
+
packages: ['ts-extended-errors'],
|
|
90
|
+
},
|
|
81
91
|
] as const
|
|
82
92
|
|
|
83
93
|
export function getProject(id: ProjectId): Project {
|