Contribution Guidelines
Relevant source files
The following files were used as context for generating this wiki page:
The nuxt-i18n-micro project focuses on performance, small bundle sizes, and low runtime costs for internationalization in Nuxt 3. Contributors must prioritize reusable logic within @i18n-micro/utils and the core packages over duplicating functionality within framework-specific packages.
Sources: AGENTS.md:14-16, README.md:15-18
Environment Setup
The repository requires Node.js ≥ 20 for published packages and Node.js ≥ 22.12 for running local Vitest 5 tests. You must use pnpm@9.14.2 as the workspace package manager; do not use npm or yarn.
Sources: AGENTS.md:21-23
First-Time Build Sequence
Building the project follows a strict order because the Nuxt module imports other workspace packages from their dist/ directories. You must run these commands in order:
pnpm install
pnpm --filter "./packages/**" --filter "!./packages/*/playground" run build
pnpm run dev:prepare
pnpm --filter "./packages/*/playground" run build
Sources: AGENTS.md:27-32
The diagram below illustrates the build dependency flow:
The build order ensures that dev:prepare can resolve package entrypoints and that test:unit does not fail due to missing virtual configuration modules.
Sources: AGENTS.md:34-42
Project Architecture
The monorepo separates concerns into specific packages and directories. Use the following table to locate relevant files for changes:
| Goal | Primary Location |
|---|---|
| Nuxt module options / build hooks | src/module.ts |
| Nuxt runtime (plugins, composables) | src/runtime/ |
| Shared types | packages/types/src/ |
| Shared domain logic (Plural/Format) | packages/core/src/ |
| Locale route generation | packages/route-strategy/ |
| User documentation | docs/ |
Sources: AGENTS.md:52-64
Feature Implementation Order
When implementing new features, follow this specific sequence to maintain consistency across the workspace:
- Types: Define interfaces in
packages/types. - Utils: Add reusable helpers in
packages/utils. - Core: Implement domain logic in
packages/core. - Runtime: Bind logic to the Nuxt runtime or framework packages.
- Docs: Update API reference and guides.
- Tests: Add unit and E2E tests.
Sources: AGENTS.md:66
Development Workflow
Coding Standards
- Use interfaces for object shapes.
- Export public types from
packages/types. - Use Conventional Commits (
feat(scope):,fix(scope):). - Match existing Oxlint and Oxfmt styles.
- Do not invent parallel helpers if they exist in
coreorutils.
Sources: AGENTS.md:92-106
Standard Commands
| Action | Command |
|---|---|
| Start Nuxt Playground | pnpm run dev |
| Lint / Format | pnpm run lint / pnpm run format |
| Run All Tests | pnpm run test |
| Build Specific Package | pnpm --filter @i18n-micro/NAME build |
| Regenerate API Docs | pnpm run docs:generate |
Sources: AGENTS.md:70-82
Documentation and Auditing
The project uses automated scripts to keep documentation in sync with the codebase.
Documentation Generation
The docs:generate command derives Markdown content from TypeScript sources using vue-docgen-api for components and TypeDoc for composables. It updates the following:
- Module options tables.
- Injected helper methods index.
- Package API surfaces.
- Performance budget tables.
Sources: scripts/src/commands/docs-generate.ts:250-255, scripts/src/commands/docs-generate.ts:330-350
Documentation Audit
The docs-audit command validates that the documentation reflects the current state of the code. It detects:
- Undocumented module options.
- Stale options that no longer exist in types.
- Dead links in the VitePress sidebar or navigation.
- Unlinked or orphaned pages.
Sources: scripts/src/commands/docs-audit.ts:108-115, scripts/src/commands/docs-audit.ts:168-175
Performance Benchmarking
Performance is a core priority. Changes affecting the runtime or build process should be verified using the performance suite. The benchmark compares nuxt-i18n-micro against a baseline and @nuxtjs/i18n.
Performance Metrics
- Build Time: Total time for
nuxi build. - Bundle Size: Code vs. translations vs. total assets.
- Runtime Load: RPS (Requests Per Second) and latency measured via Artillery.
- Memory: Peak RSS during build and load.
Sources: scripts/src/perf/report.ts:77-85, README.md:37-45
Versioning and Releases
Versioning is managed at the workspace level. Do not manually edit the version field in the root package.json or the CHANGELOG.md.
Workspace Package Bumps
- Change files in
packages/<name>/. - Bump one patch for the affected package.
- Rebuild the package so
dist/matches the source. - Commit the source, version change, and
dist/together. - Do not bump versions on every intermediate commit in a PR.
Sources: AGENTS.md:85-90
Strategy Guidelines
When working on @i18n-micro/route-strategy, maintain the following standards:
- Deterministic: Output must be stable for the same inputs.
- Framework-Agnostic: Logic must not depend on Nuxt or Vue Router runtime; it operates on
NuxtPageobjects. - Immutable: Avoid unnecessary deep clones and preserve performance.
Summary
Contributing to nuxt-i18n-micro requires adherence to a specific build sequence and a commitment to performance optimization. Documentation must be generated and audited using the provided scripts to ensure accuracy. By centralizing types and utilities, the project maintains a lightweight footprint across multiple framework bindings.