Thank you for your interest in contributing to @relatiohq/opencloud! This document provides guidelines and instructions for contributing to this project.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Coding Standards
- Testing
- Documentation
- Submitting Changes
- Release Process
This project adheres to a Code of Conduct that all contributors are expected to follow. Please be respectful and professional in all interactions.
- Node.js >= 18
- pnpm >= 10.17.1 (this project uses pnpm as its package manager)
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/relatiocc/opencloud.git cd opencloud - Add the upstream repository:
git remote add upstream https://github.com/relatiocc/opencloud.git
-
Install dependencies:
pnpm install
-
Build the project:
pnpm build
-
Run tests to ensure everything is working:
pnpm test
opencloud/
├── src/ # Source code
│ ├── resources/ # API resource implementations (users, groups, etc.)
│ ├── types/ # TypeScript type definitions
│ ├── errors.ts # Custom error classes
│ ├── http.ts # HTTP client implementation
│ └── index.ts # Main entry point
├── test/ # Test files
│ ├── _utils.ts # Test utilities
│ └── *.test.ts # Test suites
├── docs/ # Generated documentation
├── dist/ # Built output (generated)
└── coverage/ # Test coverage reports (generated)
Always create a new branch for your work:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- for new featuresfix/- for bug fixesdocs/- for documentation changesrefactor/- for code refactoringtest/- for test additions or modifications
- Write your code following our coding standards
- Add tests for any new functionality
- Update documentation if you're changing APIs or adding features
- Run the test suite to ensure everything passes
pnpm build- Build the projectpnpm test- Run tests oncepnpm test:watch- Run tests in watch modepnpm coverage- Generate test coverage reportpnpm typecheck- Run TypeScript type checkingpnpm lint- Run ESLintpnpm lint:format- Check code formattingpnpm format- Format code with Prettierpnpm docs- Generate documentationpnpm docs:watch- Generate documentation in watch mode
- Use TypeScript for all code
- Enable strict type checking
- Avoid
anytypes when possible - Export all public types and interfaces
- Use meaningful variable and function names
This project uses ESLint and Prettier for code style enforcement:
# Check formatting
pnpm lint:format
# Fix formatting issues
pnpm format
# Check linting
pnpm lint- All API resources should have corresponding TypeScript interfaces
- Types should be exported from
src/types/index.ts - Use JSDoc comments for all public APIs
/**
* Fetches user information by user ID.
*
* @param userId - The Roblox user ID
* @returns User information
* @throws {OpenCloudError} If the API request fails
*
* @example
* ```typescript
* const user = await client.users.get("123456789");
* console.log(user.displayName);
* ```
*/
async get(userId: string): Promise<User> {
// Implementation
}- Place tests in the
test/directory - Use descriptive test names that explain what is being tested
- Follow the Arrange-Act-Assert pattern
- Mock external API calls
- Use the utilities in
test/_utils.tsfor common test setup
import { describe, it, expect } from "vitest";
describe("Feature Name", () => {
it("should do something specific", () => {
// Arrange
const input = "test";
// Act
const result = functionToTest(input);
// Assert
expect(result).toBe("expected");
});
});# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Generate coverage report
pnpm coverage- Aim for high test coverage (>80%)
- All new features must include tests
- Bug fixes should include regression tests
- Use JSDoc comments for all public APIs
- Include parameter descriptions, return types, and examples
- Document error cases with
@throws
This project uses TypeDoc to generate documentation:
# Generate documentation
pnpm docs
# Generate documentation in watch mode
pnpm docs:watchFollow the Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Test additions or modificationschore: Maintenance tasks
Examples:
feat(users): add getUserInventory method
fix(http): handle rate limiting correctly
docs: update contributing guidelines
-
Update your branch with the latest changes from upstream:
git fetch upstream git rebase upstream/main
-
Run the full test suite:
pnpm typecheck pnpm lint pnpm test pnpm build -
Push your changes:
git push origin your-branch-name
-
Create a Pull Request on GitHub:
- Provide a clear title and description
- Reference any related issues
- Explain what changes you made and why
- Include screenshots or examples if applicable
-
Address review feedback:
- Respond to all comments
- Make requested changes
- Push additional commits to your branch
Before submitting a PR, ensure:
- Code follows the project's style guidelines
- Tests have been added/updated and pass
- Documentation has been updated
- Type checking passes (
pnpm typecheck) - Linting passes (
pnpm lint) - Build succeeds (
pnpm build) - Commit messages follow conventions
- PR description clearly explains the changes
This project uses semantic-release for automated releases. The release process is handled automatically based on commit messages:
fix:commits trigger patch releases (1.0.x)feat:commits trigger minor releases (1.x.0)BREAKING CHANGE:in commit body triggers major releases (x.0.0)
Contributors don't need to worry about versioning - it's handled automatically when PRs are merged to main.
If you have questions or need help:
- Check existing issues
- Review the documentation
- Open a new issue with your question
Contributors will be recognized in:
- The project's README
- GitHub's contributor graph
Thank you for contributing to @relatiohq/opencloud! 🚀