Contribution Guide
Relevant source files
The following files were used as context for generating this wiki page:
This guide outlines the technical procedures and standards for contributing to the Nuxt framework. Nuxt is an open-source framework built on Vue.js, and it relies on a monorepo structure to manage its core components, toolkit, and bundler integrations.
Contributions are managed through a structured process involving local environment setup, adherence to commit conventions, and automated release scripts.
Sources: CONTRIBUTING.md:1-5, README.md:16-19
Development Environment Setup
To contribute to the Nuxt framework, developers must set up a local development environment. The project utilizes pnpm with Corepack enabled to manage dependencies across the monorepo.
Setup Workflow
- Fork and Clone: Fork the
nuxt/nuxtrepository and clone it to your local machine. - Environment Requirements: Ensure the latest Node.js version is installed and enable Corepack using
corepack enable. - Install Dependencies: Run
pnpm install --frozen-lockfileto ensure a consistent dependency state. - Initialization: Execute
pnpm dev:prepareto configure the development environment. - Feature Branching: Create a new branch for the contribution using
git checkout -b my-new-branch.
Sources: CONTRIBUTING.md:9-15, README.md:76-78
Development Commands
The following commands are essential for maintaining code quality during development:
| Command | Description |
|---|---|
pnpm dev | Runs the playground for real-time testing. |
pnpm test | Executes the test suite via Vitest. |
pnpm lint | Checks the codebase for linting errors. |
pnpm lint --fix | Automatically repairs fixable linting issues. |
Sources: CONTRIBUTING.md:32-37
Monorepo Architecture
The Nuxt project is organized into several specialized packages. Understanding this structure is critical for scoping contributions and applying correct commit tags.
| Package | Description | Exported Name |
|---|---|---|
packages/kit | Toolkit for authoring Nuxt modules. | @nuxt/kit |
packages/nuxt | The core framework logic. | nuxt |
packages/schema | Type definitions and default configurations. | @nuxt/schema |
packages/vite | Vite-based bundler integration. | @nuxt/vite-builder |
packages/webpack | Webpack-based bundler integration. | @nuxt/webpack-builder |
packages/rspack | Rspack-based bundler integration. | @nuxt/rspack-builder |
Sources: CONTRIBUTING.md:17-23
Contribution Standards
Git Commit Conventions
Nuxt follows the Conventional Commits specification. This ensures that changelogs can be generated automatically and that the scope of changes is clear.
fix:for bug fixes.feat:for new features.docs:for documentation updates.chore:for maintenance or typo fixes.- Scoping: Monorepo commits should be scoped to their package, e.g.,
feat(kit): add utility.
Sources: CONTRIBUTING.md:29-30
AI-Assisted Contributions
Nuxt allows the use of AI tools under two core principles:
- No Delegated Communication: All descriptions and comments must reflect the contributor's own understanding.
- No Delegated Logic: Contributors must fully understand and be able to explain the code they submit.
Automated agents can opt-in to a fast-track process by adding 🤖🤖🤖 to the end of PR or issue titles.
Sources: CONTRIBUTING.md:39-50
Release and Maintenance Automation
The repository includes specialized scripts to manage releases and changelog updates. These scripts automate version bumping, workspace management, and npm publishing.
Release Process Flow
The release script handles both regular and nightly releases. It utilizes GitHub OIDC tokens for trusted publishing to the npm registry.
Sources: scripts/release.ts:89-145
Changelog Automation
The scripts/update-changelog.ts script automates the generation of release notes by parsing commits since the last tag.
Workspace Management Utilities
Internal utilities in scripts/_utils.ts manage package-to-package dependencies within the monorepo.
loadWorkspace(dir): Scans thepackages/directory anddocs/to build a map of available packages.setVersion(name, version, opts): Updates the version of a specific package and optionally updates all internal references to that package in other workspace members.determineBumpType(since): Analyzes commit history to decide if apatch,minor, ormajorversion increase is required based on conventional commit types.
Sources: scripts/_utils.ts:51-112
Summary
Contributors to Nuxt must follow a standardized workflow involving a specific monorepo package structure, conventional commit messages, and a reliance on automated scripts for versioning and publishing. This rigorous structure ensures the stability and consistency of the framework as it evolves.