Skip to content

๐Ÿค Contribution Guide โ€‹

๐Ÿ“– Introduction โ€‹

Thank you for your interest in contributing to Nuxt I18n Micro! We welcome contributions from the community, whether it's bug fixes, new features, or improvements to the documentation. This guide outlines the steps to help you get started and ensures that your contributions can be easily integrated into the project.

๐Ÿš€ Getting Started โ€‹

1. ๐Ÿ“š Familiarize Yourself with the Project โ€‹

Before making changes, it's a good idea to familiarize yourself with the project's architecture and codebase. Read through the existing documentation and take a look at open issues and pull requests to understand ongoing work and challenges.

2. ๐Ÿด Fork the Repository โ€‹

  • Navigate to the Nuxt I18n Micro repository.
  • Click the "Fork" button in the upper right corner to create a copy of the repository in your GitHub account.

3. ๐Ÿ“ฅ Clone Your Fork โ€‹

Clone the forked repository to your local machine:

bash
git clone https://github.com/<your-username>/nuxt-i18n-micro.git
cd nuxt-i18n-micro

Replace <your-username> with your GitHub username.

4. ๐ŸŒฑ Create a Branch โ€‹

Create a new branch for your work:

bash
git checkout -b feature/your-feature-name

Use descriptive branch names, such as bugfix/fix-translation-error or feature/add-new-locale-support.

๐Ÿ› ๏ธ Local Development Setup โ€‹

๐Ÿ›  Prerequisites โ€‹

Before you begin, ensure that you have the following installed on your machine:

  • Node.js: v16 or later
  • npm: v7 or later

๐Ÿš€ Getting Started โ€‹

1. ๐Ÿ“ฅ Clone the Repository โ€‹

First, you need to clone the nuxt-i18n-micro repository to your local machine.

bash
git clone https://github.com/s00d/nuxt-i18n-micro.git
cd nuxt-i18n-micro

2. ๐Ÿ“ฆ Install Dependencies โ€‹

Next, install the project dependencies using npm.

bash
npm install
npm run prepack && cd playground && npm run prepare && cd ..

3. ๐Ÿ–ฅ๏ธ Run the Development Server โ€‹

To start the development server and work on the module, run the following command:

bash
npm run dev

This command will start the Nuxt development server using the playground directory as the testing environment. You can view the app in your browser by navigating to http://localhost:3000.

4. ๐Ÿ—๏ธ Building the Module โ€‹

To build the module, use the following command:

bash
npm run prepack

This command prepares the module by building the necessary files, stubbing certain components, and ensuring everything is ready for packaging.

5. ๐Ÿงน Linting the Code โ€‹

To ensure your code adheres to the project's coding standards, run the linter:

bash
npm run lint

If there are any issues, you can attempt to automatically fix them using:

bash
npm run lint:fix

6. โœ… Running Tests โ€‹

To run the test suite, use the following command:

bash
npm run test

This will run all the Playwright tests to ensure everything is functioning as expected.

7. ๐Ÿ” Type Checking โ€‹

For TypeScript type checking, run:

bash
npm run typecheck

This checks the type definitions to ensure there are no type errors.

8. ๐Ÿ“š Building and Previewing the Documentation โ€‹

To build and preview the documentation locally, use the following commands:

bash
npm run docs:build
npm run docs:serve

This will build the documentation and serve it locally, allowing you to view it in your browser.

9. ๐ŸŽฎ Running the Playground โ€‹

If you want to test your changes in a sample Nuxt application, the playground directory serves as a sandbox environment. Run the following command to start the playground:

bash
npm run dev:build

You can access the playground app at http://localhost:3000.

๐Ÿ”ง Summary of Common Scripts โ€‹

  • npm run dev: Start the development server using the playground.
  • npm run prepack: Build the module and prepare it for publishing.
  • npm run lint: Run the linter to check for code quality issues.
  • npm run lint:fix: Automatically fix linter issues.
  • npm run test: Run the test suite.
  • npm run typecheck: Check TypeScript types.
  • npm run docs:dev: Start the documentation site in development mode.
  • npm run docs:build: Build the documentation site.
  • npm run docs:serve: Serve the built documentation site locally.
  • npm run dev:build: Build the playground environment.

๐Ÿšง Making Changes โ€‹

1. ๐Ÿ’ป Code โ€‹

  • Make your changes in the codebase according to the projectโ€™s architecture.
  • Follow the existing code style and conventions.
  • If youโ€™re adding a new feature, consider writing tests for it.

2. ๐Ÿงน Run Linting โ€‹

Before committing your changes, ensure that your code adheres to the project's coding standards by running the linter:

bash
npm run lint

Fix any linting errors before proceeding.

3. ๐Ÿงช Test Your Changes โ€‹

Make sure your changes work and do not break any existing functionality:

  • Run all tests to ensure there are no errors:
bash
npm run test
  • If youโ€™re fixing a bug, add tests to cover the fix.

4. ๐Ÿ“ Commit Your Changes โ€‹

To ensure consistency across the project, we use a standardized commit message format. Please follow this format when making commits:

โœ… Commit Message Format โ€‹

Each commit message should be structured as follows:

<type>(<scope>): <short description>

๐Ÿ“‹ Examples: โ€‹

  • fix(router): resolve issue with locale switching
  • feat(seo): add automatic og:locale meta tag generation
  • docs(contribution): update contribution guide with commit message format

๐Ÿ› ๏ธ Commit Types: โ€‹

  • feat: A new feature.
  • fix: A bug fix.
  • docs: Documentation changes or updates.
  • style: Code style or formatting changes (no functional impact).
  • refactor: Code changes that neither fix a bug nor add a feature.
  • test: Adding or updating tests.
  • chore: Miscellaneous tasks, such as updating build scripts or dependencies.

5. ๐Ÿš€ Push to GitHub โ€‹

Push your changes to your fork on GitHub:

bash
git push origin feature/your-feature-name

6. ๐Ÿ”„ Create a Pull Request โ€‹

  • Go to your forked repository on GitHub.
  • Click the "Compare & pull request" button.
  • Ensure your PR targets the main branch of the original repository (s00d/nuxt-i18n-micro).
  • Describe your changes in the PR, and link to any relevant issues.

7. ๐Ÿ•ต๏ธโ€โ™‚๏ธ Await Feedback โ€‹

Once your pull request is submitted, a maintainer will review your changes. Be prepared to make adjustments based on feedback. Once approved, your PR will be merged into the main branch.

๐Ÿ’ก Contribution Tips โ€‹

  • ๐Ÿ“ Documentation: If you add or change a feature, ensure that you update the relevant documentation.
  • ๐Ÿงผ Code Cleanliness: Keep your code clean and follow the project's coding standards.
  • ๐Ÿ’ฌ Respectful Communication: Be respectful and friendly in your communications. We are all working towards the common goal of making Nuxt I18n Micro better.

Released under the MIT License.