Skip to content

Commit 062d397

Browse files
authored
Merge branch 'main' into fix/fallback-missing-plural
2 parents 07ba078 + d8a30b4 commit 062d397

74 files changed

Lines changed: 40222 additions & 300 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
run: pnpm install
118118

119119
- name: 🏗️ Build project
120-
run: pnpm build
120+
run: NODE_ENV=test pnpm build
121121

122122
- name: ♿ Accessibility audit (Lighthouse - ${{ matrix.mode }} mode)
123123
run: ./scripts/lighthouse-a11y.sh

CONTRIBUTING.md

Lines changed: 82 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ Thank you for your interest in contributing! ❤️ This document provides guide
88
99
## Goals
1010

11-
We want to create 'a fast, modern browser for the npm registry.' This means, among other things:
11+
The goal of [npmx.dev](https://npmx.dev) is to build a fast, modern and open-source browser for the npm registry, prioritizing speed, simplicity and a community-driven developer experience.
1212

13-
- We don't aim to replace the [npmjs.com](https://www.npmjs.com/) registry, just provide a better UI and DX.
14-
- Layout shift, flakiness, slowness is The Worst. We need to continually iterate to create the most performant, best DX possible.
15-
- We want to provide information in the best way. We don't want noise, cluttered display, or confusing UI. If in doubt: choose simplicity.
13+
### Core values
14+
15+
- Speed
16+
- Simplicity
17+
- Community-first
18+
19+
### Target audience
20+
21+
npmx is built for open-source developers, by open-source developers.
22+
23+
Our goal is to create tools and capabilities that solve real problems for package maintainers and power users, while also providing a great developer experience for everyone who works in the JavaScript ecosystem.
24+
25+
This focus helps guide our project decisions as a community and what we choose to build.
1626

1727
## Table of Contents
1828

@@ -42,6 +52,7 @@ We want to create 'a fast, modern browser for the npm registry.' This means, amo
4252
- [Unit tests](#unit-tests)
4353
- [Component accessibility tests](#component-accessibility-tests)
4454
- [End to end tests](#end-to-end-tests)
55+
- [Test fixtures (mocking external APIs)](#test-fixtures-mocking-external-apis)
4556
- [Submitting changes](#submitting-changes)
4657
- [Before submitting](#before-submitting)
4758
- [Pull request process](#pull-request-process)
@@ -148,6 +159,10 @@ To help with this, the project uses `oxfmt` to handle formatting via a pre-commi
148159

149160
If you want to get ahead of any formatting issues, you can also run `pnpm lint:fix` before committing to fix formatting across the whole project.
150161

162+
### npmx name
163+
164+
When displaying the project name anywhere in the UI, use `npmx` in all lowercase letters.
165+
151166
### TypeScript
152167

153168
- We care about good types – never cast things to `any` 💪
@@ -482,6 +497,69 @@ pnpm test:browser:ui # Run with Playwright UI
482497

483498
Make sure to read about [Playwright best practices](https://playwright.dev/docs/best-practices) and don't rely on classes/IDs but try to follow user-replicable behaviour (like selecting an element based on text content instead).
484499

500+
### Test fixtures (mocking external APIs)
501+
502+
E2E tests use a fixture system to mock external API requests, ensuring tests are deterministic and don't hit real APIs. This is handled at two levels:
503+
504+
**Server-side mocking** (`modules/fixtures.ts` + `modules/runtime/server/cache.ts`):
505+
506+
- Intercepts all `$fetch` calls during SSR
507+
- Serves pre-recorded fixture data from `test/fixtures/`
508+
- Enabled via `NUXT_TEST_FIXTURES=true` or Nuxt test mode
509+
510+
**Client-side mocking** (`test/e2e/test-utils.ts`):
511+
512+
- Uses Playwright's route interception to mock browser requests
513+
- All test files import from `./test-utils` instead of `@nuxt/test-utils/playwright`
514+
- Throws a clear error if an unmocked external request is detected
515+
516+
#### Fixture files
517+
518+
Fixtures are stored in `test/fixtures/` with this structure:
519+
520+
```
521+
test/fixtures/
522+
├── npm-registry/
523+
│ ├── packuments/ # Package metadata (vue.json, @nuxt/kit.json)
524+
│ ├── search/ # Search results (vue.json, nuxt.json)
525+
│ └── orgs/ # Org package lists (nuxt.json)
526+
├── npm-api/
527+
│ └── downloads/ # Download stats
528+
└── users/ # User package lists
529+
```
530+
531+
#### Adding new fixtures
532+
533+
1. **Generate fixtures** using the script:
534+
535+
```bash
536+
pnpm generate:fixtures vue lodash @nuxt/kit
537+
```
538+
539+
2. **Or manually create** a JSON file in the appropriate directory
540+
541+
#### Environment variables
542+
543+
| Variable | Purpose |
544+
| --------------------------------- | ---------------------------------- |
545+
| `NUXT_TEST_FIXTURES=true` | Enable server-side fixture mocking |
546+
| `NUXT_TEST_FIXTURES_VERBOSE=true` | Enable detailed fixture logging |
547+
548+
#### When tests fail due to missing fixtures
549+
550+
If a test fails with an error like:
551+
552+
```
553+
UNMOCKED EXTERNAL API REQUEST DETECTED
554+
API: npm registry
555+
URL: https://registry.npmjs.org/some-package
556+
```
557+
558+
You need to either:
559+
560+
1. Add a fixture file for that package/endpoint
561+
2. Update the mock handlers in `test/e2e/test-utils.ts` (client) or `modules/runtime/server/cache.ts` (server)
562+
485563
## Submitting changes
486564

487565
### Before submitting

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
The goal of [npmx.dev](https://npmx.dev) is to build a fast, modern browser for the npm registry.
1717

18-
We're not replacing the [npmjs.com](https://www.npmjs.com/) registry, but instead providing an elevated developer experience through a fast, modern UI.
18+
We're not replacing the [npm](https://www.npmjs.com/) registry, but instead providing an elevated developer experience through a fast, modern UI.
1919

2020
What npmx offers:
2121

2222
- **Speed** – Fast searching, filtering, and navigation.
2323
- **Simplicity** – Get the information you need when you need it in an intuitive UI.
24-
- **Compatibility** – Replace `npmjs.com` with `xnpmjs.com` or `npmx.dev` in any URL and it just works.
24+
- **URL Compatibility** – Replace `npmjs.com` with `xnpmjs.com` or `npmx.dev` in any URL and it just works.
2525
- **Enhanced admin experience** – Manage your packages, teams, and organizations from the browser, powered by your local npm CLI.
2626

2727
## Shortcuts

app/components/Header/ConnectorModal.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,8 @@ function handleDisconnect() {
8181
<form v-else class="space-y-4" @submit.prevent="handleConnect">
8282
<!-- Contributor-only notice -->
8383
<div class="p-3 bg-amber-500/10 border border-amber-500/30 rounded-lg">
84-
<div class="space-y-2">
85-
<span
86-
class="inline-block px-2 py-0.5 text-xs font-bold uppercase tracking-wider bg-amber-500/20 text-amber-400 rounded"
87-
>
84+
<div>
85+
<span class="inline-block text-xs font-bold uppercase tracking-wider text-fg rounded">
8886
{{ $t('connector.modal.contributor_badge') }}
8987
</span>
9088
<p class="text-sm text-fg-muted">
@@ -94,7 +92,7 @@ function handleDisconnect() {
9492
href="https://github.com/npmx-dev/npmx.dev/blob/main/CONTRIBUTING.md#local-connector-cli"
9593
target="_blank"
9694
rel="noopener noreferrer"
97-
class="text-amber-400 hover:underline"
95+
class="text-blue-400 hover:underline"
9896
>
9997
{{ $t('connector.modal.contributor_link') }}
10098
</a>
@@ -213,7 +211,7 @@ function handleDisconnect() {
213211
role="alert"
214212
class="p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
215213
>
216-
<p class="font-mono text-sm text-fg font-bold">
214+
<p class="inline-block text-xs font-bold uppercase tracking-wider text-fg rounded">
217215
{{ $t('connector.modal.warning') }}
218216
</p>
219217
<p class="text-sm text-fg-muted">

app/components/Modal.client.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ defineExpose({
2525
<dialog
2626
ref="dialogRef"
2727
closedby="any"
28-
class="w-full bg-bg border border-border rounded-lg shadow-xl max-h-[90vh] overflow-y-auto overscroll-contain m-0 m-auto p-6 text-white"
28+
class="w-full bg-bg border border-border rounded-lg shadow-xl max-h-[90vh] overflow-y-auto overscroll-contain m-0 m-auto p-6 text-fg"
2929
:aria-labelledby="modalTitleId"
3030
v-bind="$attrs"
3131
>

app/composables/useAtproto.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import type { UserSession } from '#shared/schemas/userSession'
2-
31
export function useAtproto() {
42
const {
53
data: user,
64
pending,
75
clear,
8-
} = useFetch<UserSession | null>('/api/auth/session', {
6+
} = useFetch('/api/auth/session', {
97
server: false,
108
immediate: !import.meta.test,
119
})

i18n/locales/es-419.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
2+
"built_at": "generado {0}",
3+
"alt_logo": "logo de npmx",
24
"connector": {
35
"modal": {
46
"connected_hint": "Ahora puedes administrar paquetes y organizaciones desde la interfaz web.",

0 commit comments

Comments
 (0)