Skip to content

Commit 028de72

Browse files
authored
Merge branch 'main' into fix/#1074
2 parents 3360030 + 299a877 commit 028de72

155 files changed

Lines changed: 10583 additions & 1887 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: mirror
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- '*'
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
mirror:
15+
name: 🕸️ Mirror to Tangled
16+
runs-on: ubuntu-24.04-arm
17+
18+
steps:
19+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
20+
with:
21+
fetch-depth: 0
22+
23+
- name: 🔑 Configure SSH
24+
env:
25+
TANGLED_SSH_KEY: ${{ secrets.TANGLED_SSH_KEY }}
26+
run: |
27+
mkdir -p ~/.ssh
28+
echo "$TANGLED_SSH_KEY" > ~/.ssh/id_ed25519
29+
chmod 600 ~/.ssh/id_ed25519
30+
ssh-keyscan -t ed25519 tangled.org >> ~/.ssh/known_hosts 2>/dev/null
31+
32+
- name: ⬆︎ Push to Tangled
33+
run: |
34+
git remote add tangled git@tangled.org:npmx.dev/npmx.dev
35+
git push tangled main --force
36+
git push tangled --tags --force

.lighthouserc.cjs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@ module.exports = {
3535
chromePath: findChrome(),
3636
puppeteerScript: './lighthouse-setup.cjs',
3737
settings: {
38-
onlyCategories: ['accessibility'],
38+
onlyCategories: process.env.LH_PERF ? ['performance'] : ['accessibility'],
3939
skipAudits: ['valid-source-maps'],
4040
},
4141
},
4242
assert: {
43-
assertions: {
44-
'categories:accessibility': ['error', { minScore: 1 }],
45-
},
43+
assertions: process.env.LH_PERF
44+
? {
45+
'cumulative-layout-shift': ['error', { maxNumericValue: 0 }],
46+
}
47+
: {
48+
'categories:accessibility': ['error', { minScore: 1 }],
49+
},
4650
},
4751
upload: {
4852
target: 'temporary-public-storage',

CONTRIBUTING.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ This focus helps guide our project decisions as a community and what we choose t
5454
- [Unit tests](#unit-tests)
5555
- [Component accessibility tests](#component-accessibility-tests)
5656
- [Lighthouse accessibility tests](#lighthouse-accessibility-tests)
57+
- [Lighthouse performance tests](#lighthouse-performance-tests)
5758
- [End to end tests](#end-to-end-tests)
5859
- [Test fixtures (mocking external APIs)](#test-fixtures-mocking-external-apis)
5960
- [Submitting changes](#submitting-changes)
@@ -114,6 +115,7 @@ pnpm test:unit # Unit tests only
114115
pnpm test:nuxt # Nuxt component tests
115116
pnpm test:browser # Playwright E2E tests
116117
pnpm test:a11y # Lighthouse accessibility audits
118+
pnpm test:perf # Lighthouse performance audits (CLS)
117119
```
118120

119121
### Project structure
@@ -641,18 +643,38 @@ pnpm test:a11y:prebuilt
641643

642644
# Or run a single color mode manually
643645
pnpm build:test
644-
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse-a11y.sh
646+
LIGHTHOUSE_COLOR_MODE=dark ./scripts/lighthouse.sh
645647
```
646648

647649
This requires Chrome or Chromium to be installed. The script will auto-detect common installation paths. Results are printed to the terminal and saved in `.lighthouseci/`.
648650

649651
#### Configuration
650652

651-
| File | Purpose |
652-
| ---------------------------- | --------------------------------------------------------- |
653-
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
654-
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
655-
| `scripts/lighthouse-a11y.sh` | Shell wrapper that runs the audit for a given color mode |
653+
| File | Purpose |
654+
| ----------------------- | --------------------------------------------------------- |
655+
| `.lighthouserc.cjs` | Lighthouse CI config (URLs, assertions, Chrome path) |
656+
| `lighthouse-setup.cjs` | Puppeteer script for color mode + client-side API mocking |
657+
| `scripts/lighthouse.sh` | Shell wrapper that runs the audit for a given color mode |
658+
659+
### Lighthouse performance tests
660+
661+
The project also runs Lighthouse performance audits to enforce zero Cumulative Layout Shift (CLS). These run separately from the accessibility audits and test the same set of URLs.
662+
663+
#### How it works
664+
665+
The same `.lighthouserc.cjs` config is shared between accessibility and performance audits. When the `LH_PERF` environment variable is set, the config switches from the `accessibility` category to the `performance` category and asserts that CLS is exactly 0.
666+
667+
#### Running locally
668+
669+
```bash
670+
# Build + run performance audit
671+
pnpm test:perf
672+
673+
# Or against an existing test build
674+
pnpm test:perf:prebuilt
675+
```
676+
677+
Unlike the accessibility audits, performance audits do not run in separate light/dark modes.
656678

657679
### End to end tests
658680

app/components/AppFooter.vue

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,9 @@ const showModal = () => modalRef.value?.showModal?.()
2323
<LinkBase :to="{ name: 'privacy' }">
2424
{{ $t('privacy_policy.title') }}
2525
</LinkBase>
26-
<LinkBase to="https://docs.npmx.dev">
27-
{{ $t('footer.docs') }}
28-
</LinkBase>
29-
<LinkBase to="https://repo.npmx.dev">
30-
{{ $t('footer.source') }}
31-
</LinkBase>
32-
<LinkBase to="https://social.npmx.dev">
33-
{{ $t('footer.social') }}
34-
</LinkBase>
35-
<LinkBase to="https://chat.npmx.dev">
36-
{{ $t('footer.chat') }}
37-
</LinkBase>
38-
3926
<button
4027
type="button"
41-
class="group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"
28+
class="cursor-pointer group inline-flex gap-x-1 items-center justify-center underline-offset-[0.2rem] underline decoration-1 decoration-fg/30 font-mono text-fg hover:(decoration-accent text-accent) focus-visible:(decoration-accent text-accent) transition-colors duration-200"
4229
@click.prevent="showModal"
4330
aria-haspopup="dialog"
4431
>
@@ -102,6 +89,18 @@ const showModal = () => modalRef.value?.showModal?.()
10289
</li>
10390
</ul>
10491
</Modal>
92+
<LinkBase to="https://docs.npmx.dev">
93+
{{ $t('footer.docs') }}
94+
</LinkBase>
95+
<LinkBase to="https://repo.npmx.dev">
96+
{{ $t('footer.source') }}
97+
</LinkBase>
98+
<LinkBase to="https://social.npmx.dev">
99+
{{ $t('footer.social') }}
100+
</LinkBase>
101+
<LinkBase to="https://chat.npmx.dev">
102+
{{ $t('footer.chat') }}
103+
</LinkBase>
105104
</div>
106105
</div>
107106
<BuildEnvironment v-if="!isHome" footer />

app/components/BuildEnvironment.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ const { footer = false, buildInfo: buildInfoProp } = defineProps<{
66
buildInfo?: BuildInfo
77
}>()
88
9-
const { locale } = useI18n()
109
const appConfig = useAppConfig()
1110
const buildInfo = computed(() => buildInfoProp || appConfig.buildInfo)
11+
const buildTime = computed(() => new Date(buildInfo.value.time))
1212
</script>
1313

1414
<template>
@@ -18,7 +18,7 @@ const buildInfo = computed(() => buildInfoProp || appConfig.buildInfo)
1818
style="animation-delay: 0.05s"
1919
>
2020
<i18n-t keypath="built_at" scope="global">
21-
<NuxtTime :datetime="buildInfo.time" :locale="locale" relative />
21+
<DateTime :datetime="buildTime" year="numeric" month="short" day="numeric" />
2222
</i18n-t>
2323
<span>&middot;</span>
2424
<LinkBase

app/components/Code/Viewer.vue

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,31 @@ watch(
5757
},
5858
{ immediate: true },
5959
)
60+
61+
// Use Nuxt's `navigateTo` for the rendered import links
62+
function handleImportLinkNavigate() {
63+
if (!codeRef.value) return
64+
65+
const anchors = codeRef.value.querySelectorAll('a.import-link')
66+
anchors.forEach(anchor => {
67+
// NOTE: We do not need to remove previous listeners because we re-create the entire HTML content on each html update
68+
anchor.addEventListener('click', event => {
69+
const href = anchor.getAttribute('href')
70+
if (href) {
71+
event.preventDefault()
72+
navigateTo(href)
73+
}
74+
})
75+
})
76+
}
77+
78+
watch(
79+
() => props.html,
80+
() => {
81+
nextTick(handleImportLinkNavigate)
82+
},
83+
{ immediate: true },
84+
)
6085
</script>
6186

6287
<template>

app/components/Compare/PackageSelector.vue

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,17 @@ function handleKeydown(e: KeyboardEvent) {
9292
}
9393
}
9494
95+
const { start, stop } = useTimeoutFn(() => {
96+
isInputFocused.value = false
97+
}, 200)
98+
9599
function handleBlur() {
96-
useTimeoutFn(() => {
97-
isInputFocused.value = false
98-
}, 200)
100+
start()
101+
}
102+
103+
function handleFocus() {
104+
stop()
105+
isInputFocused.value = true
99106
}
100107
</script>
101108

@@ -151,7 +158,7 @@ function handleBlur() {
151158
size="medium"
152159
class="w-full min-w-25 ps-7"
153160
aria-autocomplete="list"
154-
@focus="isInputFocused = true"
161+
@focus="handleFocus"
155162
@blur="handleBlur"
156163
@keydown="handleKeydown"
157164
/>
@@ -178,13 +185,13 @@ function handleBlur() {
178185
:aria-label="$t('compare.no_dependency.add_column')"
179186
@click="addPackage(NO_DEPENDENCY_ID)"
180187
>
181-
<div class="text-sm text-accent italic flex items-center gap-2">
188+
<span class="text-sm text-accent italic flex items-center gap-2 block">
182189
<span class="i-carbon:clean w-4 h-4" aria-hidden="true" />
183190
{{ $t('compare.no_dependency.typeahead_title') }}
184-
</div>
185-
<div class="text-xs text-fg-muted truncate mt-0.5">
191+
</span>
192+
<span class="text-xs text-fg-muted truncate mt-0.5">
186193
{{ $t('compare.no_dependency.typeahead_description') }}
187-
</div>
194+
</span>
188195
</ButtonBase>
189196

190197
<div v-if="isSearching" class="px-4 py-3 text-sm text-fg-muted">
@@ -196,10 +203,10 @@ function handleBlur() {
196203
class="block w-full text-start"
197204
@click="addPackage(result.name)"
198205
>
199-
<div class="font-mono text-sm text-fg">{{ result.name }}</div>
200-
<div v-if="result.description" class="text-xs text-fg-muted truncate mt-0.5">
206+
<span class="font-mono text-sm text-fg block">{{ result.name }}</span>
207+
<span v-if="result.description" class="text-xs text-fg-muted truncate mt-0.5">
201208
{{ result.description }}
202-
</div>
209+
</span>
203210
</ButtonBase>
204211
</div>
205212
</Transition>

app/components/Header/AccountMenu.client.vue

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function openAuthModal() {
5656
</script>
5757

5858
<template>
59-
<div ref="accountMenuRef" class="relative flex min-w-24 justify-end">
59+
<div ref="accountMenuRef" class="relative flex min-w-28 justify-end">
6060
<ButtonBase
6161
type="button"
6262
:aria-expanded="isOpen"
@@ -65,7 +65,7 @@ function openAuthModal() {
6565
class="border-none"
6666
>
6767
<!-- Stacked avatars when connected -->
68-
<div
68+
<span
6969
v-if="hasAnyConnection"
7070
class="flex items-center"
7171
:class="hasBothConnections ? '-space-x-2' : ''"
@@ -103,7 +103,7 @@ function openAuthModal() {
103103
>
104104
<span class="i-carbon-cloud w-3 h-3 text-fg-muted" aria-hidden="true" />
105105
</span>
106-
</div>
106+
</span>
107107

108108
<!-- "connect" text when not connected -->
109109
<span v-if="!hasAnyConnection" class="font-mono text-sm">
@@ -163,10 +163,10 @@ function openAuthModal() {
163163
>
164164
<span class="i-carbon-terminal w-4 h-4 text-fg-muted" aria-hidden="true" />
165165
</span>
166-
<div class="flex-1 min-w-0">
167-
<div class="font-mono text-sm text-fg truncate">~{{ npmUser }}</div>
168-
<div class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli') }}</div>
169-
</div>
166+
<span class="flex-1 min-w-0">
167+
<span class="font-mono text-sm text-fg truncate block">~{{ npmUser }}</span>
168+
<span class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli') }}</span>
169+
</span>
170170
<span
171171
v-if="operationCount > 0"
172172
class="px-1.5 py-0.5 font-mono text-xs rounded"
@@ -206,10 +206,12 @@ function openAuthModal() {
206206
>
207207
<span class="i-carbon-cloud w-4 h-4 text-fg-muted" aria-hidden="true" />
208208
</span>
209-
<div class="flex-1 min-w-0">
210-
<div class="font-mono text-sm text-fg truncate">@{{ atprotoUser.handle }}</div>
211-
<div class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere') }}</div>
212-
</div>
209+
<span class="flex-1 min-w-0">
210+
<span class="font-mono text-sm text-fg truncate block"
211+
>@{{ atprotoUser.handle }}</span
212+
>
213+
<span class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere') }}</span>
214+
</span>
213215
</button>
214216
</div>
215217

@@ -236,16 +238,16 @@ function openAuthModal() {
236238
/>
237239
<span v-else class="i-carbon-terminal w-4 h-4 text-fg-muted" aria-hidden="true" />
238240
</span>
239-
<div class="flex-1 min-w-0">
240-
<div class="font-mono text-sm text-fg">
241+
<span class="flex-1 min-w-0">
242+
<span class="font-mono text-sm text-fg block">
241243
{{
242244
isNpmConnecting
243245
? $t('account_menu.connecting')
244246
: $t('account_menu.connect_npm_cli')
245247
}}
246-
</div>
247-
<div class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli_desc') }}</div>
248-
</div>
248+
</span>
249+
<span class="text-xs text-fg-subtle">{{ $t('account_menu.npm_cli_desc') }}</span>
250+
</span>
249251
</button>
250252

251253
<button
@@ -258,12 +260,12 @@ function openAuthModal() {
258260
<span class="w-8 h-8 rounded-full bg-bg-muted flex items-center justify-center">
259261
<span class="i-carbon-cloud w-4 h-4 text-fg-muted" aria-hidden="true" />
260262
</span>
261-
<div class="flex-1 min-w-0">
262-
<div class="font-mono text-sm text-fg">
263+
<span class="flex-1 min-w-0">
264+
<span class="font-mono text-sm text-fg block">
263265
{{ $t('account_menu.connect_atmosphere') }}
264-
</div>
265-
<div class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere_desc') }}</div>
266-
</div>
266+
</span>
267+
<span class="text-xs text-fg-subtle">{{ $t('account_menu.atmosphere_desc') }}</span>
268+
</span>
267269
</button>
268270
</div>
269271
</div>

app/components/Header/AccountMenu.server.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="relative flex min-w-24 justify-end">
2+
<div class="relative flex min-w-28 justify-end">
33
<div
44
class="inline-flex gap-x-1 items-center justify-center font-mono border border-border rounded-md text-sm px-4 py-2 bg-transparent text-fg border-none"
55
>

0 commit comments

Comments
 (0)