Contributing to Sprite
Thank you for considering contributing to Sprite! Open-source software thrives thanks to the generous contributions of individuals like you.
Overview
This document is divided into the following sections for your convenience:
Who Can Help?
Everyone can contribute! Programmers can assist with bugs, features, and optimization, while front-end developers, designers, and writers can help with the docs.
Technical Description
A brief overview of the library:
Lib
- Pure ESM with TypeScript
- Node.js development environment
- Jest for testing
- pnpm as the package manager
Docs
- Jekyll / GitHub Pages
- CSS: mix of utility classes and custom CSS
Getting Started
-
Fork the Repository
Fork the repository on GitHub by clicking the “Fork” button in the upper-right corner of the repository page. This will create a copy of the repository in your GitHub account.
-
Clone the Repository
Clone your forked repository to your local machine:
git clone https://github.com/<your-username>/sprite.git
-
Install Dependencies
Navigate to the project root and install dependencies:
cd sprite && pnpm install
-
Test the Project
Run the unit tests:
pnpm test:unit
If the tests pass, you’re ready to start contributing.
Making Changes
-
Create a New Branch
Create a new branch for your changes:
git checkout -b my-new-feature
-
Make Your Changes
Make your changes, following coding standards and best practices.
-
Lint and Format
Format your code with Prettier:
pnpm run format
Lint your code:
pnpm run lint
-
Unit Tests
If your changes add new features, write corresponding unit tests. Unit tests are located in the
test/unit
folder and are run with:pnpm test:unit
-
Integration Tests
Integration tests run in a Docker container to ensure they don’t interfere with local data. Make sure Docker is installed, then run:
docker-compose up
Once the database is established, run integration tests:
pnpm test:integration
Note: Depending on your environment, you may need to run commands with elevated privileges (e.g.,
sudo
).
Pull Requests
A pull request (PR) is a request to incorporate your changes into the main repository.
-
Push Your Changes
Push your changes to your forked repository:
git push origin my-new-feature
-
Create a Pull Request
On GitHub, click “New pull request” on your forked repository page.
-
Describe Your Changes
Provide a detailed description of your changes, including any relevant context.
Review Process
-
Automated Testing
Your PR will go through automated tests to ensure nothing was broken.
-
Code Review
After passing tests, a reviewer from Tragedy Labs will review your PR.
-
Address Feedback
You may receive feedback that needs to be addressed before your PR is merged.
-
Integration
Once approved, your changes will be merged into the main repository.
Coding Standards
-
Follow TypeScript Best Practices
Adhere to the official TypeScript documentation and best practices.
-
Use Consistent Coding Style
Maintain a consistent coding style throughout the project.
-
Write Clean, Readable Code
Write code that is easy to understand and maintain.
Additional Resources
Thank You!
Thank you for contributing to Sprite! Your efforts are greatly appreciated.