Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add contributing page #729

Merged
merged 18 commits into from
Sep 29, 2023
188 changes: 188 additions & 0 deletions docs/content/1.getting-started/6.contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
---
title: Contributing
description: Learn how to contribute to Nuxt UI.
---

## Overview

Nuxt UI thrives thanks to its fantastic community ❀️, which contributes by submitting issues, creating pull requests, and offering valuable feedback.

Before reporting a bug or reporting a feature, please make sure that you have read through our documentation and existing [issues](https://github.com/nuxt/ui/issues).

## Submitting a Pull Request

### 1. Before You Start

Check if there's an existing issue describing the problem or feature request you're working on. If there is, please leave a comment on the issue to let us know you're working on it.

If there isn't, open a new issue to discuss the problem or feature.

### 2. Local Development Setup

To begin local development, follow these steps:

1. Clone the `nuxt/ui` repository to your local machine:

```sh
git clone https://github.com/nuxt/ui.git
```

2. Install dependencies and prepare the project:

```sh
pnpm install
pnpm run dev:prepare
```

3. To configure your local development environment, use the following commands:

- To work on the **documentation** in the `docs` folder, run:

```sh
pnpm run dev
```

- To test the components located in the `playground` folder within `app.vue`, run:

```sh
pnpm run dev:play
Haythamasalama marked this conversation as resolved.
Show resolved Hide resolved
```

#### IDE Setup

We recommend using VS Code along with the ESLint extension. You can enable auto-fix and formatting when saving your code. Here's how:

```json
{
"editor.codeActionsOnSave": {
"source.fixAll": false,
"source.fixAll.eslint": true
}
}
```

You can also use the `lint` command:

```sh
pnpm run lint # check for linting errors
pnpm run lint:fix # fix linting errors
```

#### No Prettier

Since ESLint is already configured to format the code, there's no need for duplicating functionality with Prettier.

If you have Prettier installed in your editor, we recommend disabling it to avoid conflicts.

#### Type Checking

We use TypeScript for type checking. You can use the `typecheck` command to check for type errors:

```sh
pnpm run typecheck
```

### 3. Commit Conventions

Use Conventional Commits for commit messages with the following format:

```
<type>(optional scope): <description>

[optional body]

[optional footer(s)]
```

#### Types

- `feat` : for new features.
- `fix` : for bug fixes.
- `refactor` : for code changes that are neither bug fixes nor new features.
- `perf` : for code refactoring that improves performance.
- `test` : for code related to automatic testing.
- `style` : for refactoring related to code style (not for CSS).
- `docs` : for changes related to documentation.
- `chore` : for anything else.

#### Scope

Where the change occurred (e.g., `Table`, `Alert`, `Accordion`, etc.).

#### Description

A summary of the changes made.

#### Examples

```
feat(Alert): new component
chore(Table): improve accessibility
docs: migrate to @nuxt/ui-pro
```

### 4. Making the Pull Request

- Follow the guide for creating a pull request and ensure your PR's title adheres to the Commit Convention. Mention any related issues in the PR description.

- Multiple commits are fine; no need to rebase or force push. We'll use `Squash and Merge` when merging.

- Ensure linting and make tests manually before submitting the PR. Avoid making unrelated changes.

### 5. After You've Made a Pull Request

We'll review it promptly. If assigned to a maintainer, they'll review it carefully. Ignore the red text; it's for tracking purposes.

## Project Structure

In this project, you'll find a variety of folders and files that serve different purposes. Here's an overview of the main ones:

- **Documentation - `docs`** :

The documentation is located in the `docs` folder. It's a Nuxt app that uses the `@nuxt/content` module to generate the documentation pages from Markdown files. Here's a breakdown of its structure:

```
docs/
β”œβ”€β”€ components/
β”‚ β”œβ”€β”€ examples/ # Components used in documentation as examples
β”‚ └── themes/ # Components used in the examples page in the theming section
β”œβ”€β”€ content/ # Documentation, separated into categories according to component types
β”‚ β”œβ”€β”€ 1.getting-started/
β”‚ β”‚ β”œβ”€β”€ 1.index.md
β”‚ β”‚ β”œβ”€β”€ 2.installation.md
β”‚ β”‚ β”œβ”€β”€ ... etc
β”‚ β”œβ”€β”€ 2.elements/ # The category of components, which are elements
β”‚ β”‚ β”œβ”€β”€ 1.accordion.md # Docs for a single component (i.e., accordion)
β”‚ β”‚ β”œβ”€β”€ 2.alert.md
β”‚ β”‚ β”œβ”€β”€ ... etc
└── ... etc
```

- **Components - `src`** :

The components are located in the `src` folder. It's separated into categories according to component types. Here's a breakdown of its structure:

```
src/
β”œβ”€β”€ runtime/
β”‚ β”œβ”€β”€ composables/ # Composable functions used in components
β”‚ β”œβ”€β”€ components/ # Components folder, separated into categories according to component types
β”‚ β”‚ β”œβ”€β”€ data/ # The category of components, which are data related
β”‚ β”‚ β”‚ β”œβ”€β”€ table.vue/ # Table component
β”‚ β”‚ β”‚ β”œβ”€β”€ elements/ # Elements category
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ ...etc/
β”‚ β”‚ β”‚ └── ... etc/
β”‚ β”‚ β”œβ”€β”€ plugins/ # Plugins used in components
β”‚ β”‚ β”œβ”€β”€ utils/ # Utility functions used on the components page (e.g., lodash)
β”‚ β”‚ β”œβ”€β”€ types/ # Types used in components
β”‚ β”‚ β”‚ β”œβ”€β”€ accordion.d.ts/ # [componentName].d.ts type used for single component
β”‚ β”‚ β”‚ β”œβ”€β”€ avatar.d.ts/
β”‚ β”‚ β”‚ └── ... etc/
β”‚ β”‚ β”œβ”€β”€ ui.config.ts/ # Configuration file used to apply styles to every component
β”œβ”€β”€ colors.ts/ # Everything related to color functions (e.g., safelistByComponent, generateSafelist)
└── ... etc/ # Other files and folders
```

## Thanks

Thank you again for being interested in this project! You are awesome! ❀️