Skip to content

Commit b76c52c

Browse files
authored
Merge branch 'main' into fix/update-ja
2 parents b5b3b5c + f8a66e0 commit b76c52c

File tree

118 files changed

+41581
-539
lines changed

Some content is hidden

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

118 files changed

+41581
-539
lines changed

.github/workflows/autofix.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ permissions:
1414

1515
jobs:
1616
code:
17+
name: 🤖 Autofix code
1718
runs-on: ubuntu-latest
1819

1920
steps:
@@ -24,7 +25,7 @@ jobs:
2425
node-version: lts/*
2526

2627
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
27-
name: Install pnpm
28+
name: 🟧 Install pnpm
2829
with:
2930
cache: true
3031

.github/workflows/ci.yml

Lines changed: 60 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ permissions:
2121

2222
jobs:
2323
lint:
24+
name: 🔠 Lint project
2425
runs-on: ubuntu-latest
2526

2627
steps:
@@ -31,13 +32,58 @@ jobs:
3132
node-version: lts/*
3233

3334
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
34-
name: Install pnpm
35+
name: 🟧 Install pnpm
3536
# pnpm cache skipped deliberately as the project is not actually installed here
3637

3738
- name: 🔠 Lint project
3839
run: node scripts/lint.ts
3940

41+
types:
42+
name: 💪 Type check
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
47+
48+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
49+
with:
50+
node-version: lts/*
51+
52+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
53+
name: 🟧 Install pnpm
54+
with:
55+
cache: true
56+
57+
- name: 📦 Install dependencies
58+
run: pnpm install
59+
60+
- name: 💪 Type check
61+
run: pnpm test:types
62+
63+
unit:
64+
name: 🧪 Unit tests
65+
runs-on: ubuntu-latest
66+
67+
steps:
68+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
69+
70+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
71+
with:
72+
node-version: lts/*
73+
74+
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
75+
name: 🟧 Install pnpm
76+
with:
77+
cache: true
78+
79+
- name: 📦 Install dependencies
80+
run: pnpm install
81+
82+
- name: 🧪 Unit tests
83+
run: pnpm test:unit --project unit run --coverage
84+
4085
test:
86+
name: 🧪 Component tests
4187
runs-on: ubuntu-latest
4288

4389
steps:
@@ -48,7 +94,7 @@ jobs:
4894
node-version: lts/*
4995

5096
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
51-
name: Install pnpm
97+
name: 🟧 Install pnpm
5298
with:
5399
cache: true
54100

@@ -58,16 +104,16 @@ jobs:
58104
- name: 🌐 Install browser
59105
run: pnpm playwright install chromium-headless-shell
60106

61-
- name: 💪 Type check
62-
run: pnpm test:types
63-
64-
- name: 🧪 Unit and component tests
65-
run: pnpm vite test run --coverage
107+
- name: 🧪 Component tests
108+
run: pnpm vite test --project nuxt run --coverage
66109

67110
- name: Upload coverage reports to Codecov
68111
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5
112+
env:
113+
CODECOV_TOKEN: 17b4bed9-d407-4ce2-9c10-2ccd4328a1d9
69114

70115
browser:
116+
name: 🖥️ Browser tests
71117
runs-on: ubuntu-latest
72118
container:
73119
image: mcr.microsoft.com/playwright:v1.58.0-noble
@@ -80,7 +126,7 @@ jobs:
80126
node-version: lts/*
81127

82128
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
83-
name: Install pnpm
129+
name: 🟧 Install pnpm
84130
with:
85131
cache: true
86132

@@ -94,6 +140,7 @@ jobs:
94140
run: pnpm test:browser:prebuilt
95141

96142
a11y:
143+
name: ♿ Accessibility audit
97144
runs-on: ubuntu-latest
98145
strategy:
99146
matrix:
@@ -107,15 +154,15 @@ jobs:
107154
node-version: lts/*
108155

109156
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
110-
name: Install pnpm
157+
name: 🟧 Install pnpm
111158
with:
112159
cache: true
113160

114161
- name: 📦 Install dependencies
115162
run: pnpm install
116163

117164
- name: 🏗️ Build project
118-
run: pnpm build
165+
run: NODE_ENV=test pnpm build
119166

120167
- name: ♿ Accessibility audit (Lighthouse - ${{ matrix.mode }} mode)
121168
run: ./scripts/lighthouse-a11y.sh
@@ -124,6 +171,7 @@ jobs:
124171
LIGHTHOUSE_COLOR_MODE: ${{ matrix.mode }}
125172

126173
knip:
174+
name: 🧹 Unused code check
127175
runs-on: ubuntu-latest
128176

129177
steps:
@@ -134,12 +182,12 @@ jobs:
134182
node-version: lts/*
135183

136184
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
137-
name: Install pnpm
185+
name: 🟧 Install pnpm
138186
with:
139187
cache: true
140188

141189
- name: 📦 Install dependencies
142190
run: pnpm install
143191

144-
- name: 🔍 Check for unused code
192+
- name: 🧹 Check for unused code
145193
run: pnpm knip

.github/workflows/lunaria.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ permissions:
1717

1818
jobs:
1919
lunaria-overview:
20-
name: Generate Lunaria Overview
20+
name: 🌝 Generate Lunaria Overview
2121
runs-on: ubuntu-latest
2222

2323
steps:
@@ -33,7 +33,7 @@ jobs:
3333
node-version: lts/*
3434

3535
- uses: pnpm/action-setup@1e1c8eafbd745f64b1ef30a7d7ed7965034c486c
36-
name: Install pnpm
36+
name: 🟧 Install pnpm
3737
with:
3838
cache: true
3939

.github/workflows/provenance.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ permissions:
2020

2121
jobs:
2222
check-provenance:
23+
name: 🔒 Check provenance downgrades
2324
runs-on: ubuntu-slim
2425
steps:
2526
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1

.github/workflows/semantic-pull-requests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
statuses: write # for amannn/action-semantic-pull-request to mark status of analyzed PR
1818
if: github.repository == 'npmx-dev/npmx.dev'
1919
runs-on: ubuntu-slim
20-
name: semantic-pr
20+
name: 🏷️ Validate PR title
2121
steps:
2222
- name: Validate PR title
2323
uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1

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

0 commit comments

Comments
 (0)