# πŸ›  Contributing to the Official Strapi Client Welcome to the **Strapi Client** repository. This guide walks you through the steps to get started with contributing to the project, whether you're a maintainer or an external contributor. --- ## πŸ“– Table of Contents - [πŸ“‹ Prerequisites](#-prerequisites) - [πŸ›  Setting Up the Project](#-setting-up-the-project) - [1. Clone the Repository](#1-clone-the-repository) - [2. Install Dependencies](#2-install-dependencies) - [πŸ—οΈ Compiling the Changes](#-compiling-the-changes) - [Build](#build) - [Watch](#watch) - [Output](#output) - [πŸ§ͺ Testing the Changes](#-testing-the-changes) - [Unit Tests](#unit-tests) - [Running Unit Tests](#running-unit-tests) - [Test Coverage](#test-coverage) - [Configuration](#configuration) - [Writing Tests](#writing-tests) - [Mocks](#mocks) - [Demos](#demos) - [Setting Up the Demos](#setting-up-the-demos) - [Run the Demos](#run-the-demos) - [πŸ”Ž Verifying Your Contribution](#-verifying-your-contribution) - [πŸ“ Commit Messages](#-commit-messages) - [πŸŽ‰ You're Ready to Contribute!](#-youre-ready-to-contribute) - [πŸ” Pull Request Reviews](#-pull-request-reviews) - [The Review](#the-review) - [Merging a PR](#merging-a-pr) - [πŸ“š Releases](#-releases) --- ## πŸ“‹ Prerequisites Before you get started, ensure you have the following installed: - **Node.js**: >=20.18.2 <=22.x.x. You can check your Node.js version using: ```bash node -v ``` - **pnpm**: the project requires `pnpm` as the package manager. To install `pnpm`, follow the [official documentation](https://pnpm.io/installation). You can check if pnpm is correctly installed using: ```bash pnpm -v ``` - **Git**: ensure Git is installed and properly configured. --- ## πŸ›  Setting Up the Project Follow these steps to set up the repository locally: ### 1. Clone the Repository Clone the Strapi Client repository to your local machine: **Using git** ```bash git clone https://github.com/strapi/client.git cd client ``` **Using the GitHub command-line tool** ```bash gh repo clone strapi/client cd client ``` ### 2. Install Dependencies Install all required dependencies using `pnpm`: ```bash pnpm install ``` --- ## πŸ—οΈ Compiling the Changes Both commands rely on the project's [rollup configuration](rollup.config.mjs). ### Build Run the following command to build the source code: ```bash pnpm build ``` ### Watch To automatically rebuild the project when changes are detected: ```bash pnpm watch ``` Now, any changes you make to the `src` folder will trigger a rebuild. ### Output The build process outputs the generated artifacts to the `dist` folder. These include: - **Type Definitions**: TypeScript type definitions (`*.d.ts` files). - **Bundles**: JavaScript bundles in the following formats: - **CommonJS (`cjs`)**: useful for Node.js applications or environments requiring CJS modules. - **ES Modules (`mjs`)**: ideal for modern JavaScript, TypeScript, and bundlers like Rollup or Webpack. - **Browser (`iife`)**: minified bundle for direct consumption in browser environments (for use in `