Thank you for your interest in contributing to youtube-link-utils! This document provides guidelines for contributing to this open source project.
By participating in this project, you agree to abide by our Code of Conduct:
- Be respectful and inclusive to all community members
- Use welcoming and inclusive language
- Be respectful of differing viewpoints and experiences
- Gracefully accept constructive criticism
- Focus on what is best for the community
- Show empathy towards other community members
- Node.js (version 16 or higher)
- npm or yarn package manager
- Git version control
- A GitHub account
- Fork the repository on GitHub by clicking the "Fork" button
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/youtube-link-utils.git cd youtube-link-utils - Install dependencies:
npm install
- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name # or git checkout -b fix/issue-description
npm test- Run the test suitenpm run test:watch- Run tests in watch modenpm run build- Build the librarynpm run dev- Build in watch mode for developmentnpm run lint- Check code stylenpm run lint:fix- Auto-fix linting issuesnpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run quality- Run lint and format checksnpm run quality:fix- Auto-fix lint and format issuesnpm run coverage- Run tests with coverage reportnpm run clean- Clean build artifacts
Before creating a bug report, please:
- Check existing issues to avoid duplicates
- Try to reproduce the issue with the latest version
When filing a bug report, include:
- Clear title: Describe the issue concisely
- Steps to reproduce: Detailed steps to recreate the bug
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Environment: Node.js version, browser, operating system
- Code examples: Minimal reproducible example
- Screenshots: If applicable
Feature suggestions are welcome! Please:
- Check if the feature has already been suggested in issues
- Explain the use case and why it would be valuable
- Consider how it fits with the library's scope and goals
- Be open to discussion about implementation approaches
- Consider backward compatibility implications
-
Run tests and ensure they all pass:
npm test -
Run linting and fix any issues:
npm run lint npm run lint:fix # auto-fix when possible -
Check code formatting:
npm run format:check npm run format # auto-fix formatting -
Run quality checks (combines lint and format):
npm run quality npm run quality:fix # auto-fix all issues -
Build the project successfully:
npm run build
-
Update documentation if needed:
- Update README.md for new features
- Update TypeScript type definitions
-
Update CHANGELOG.md: Add your changes under the
[Unreleased]section
- Clear title: Use a descriptive title that explains the change
- Detailed description: Explain what changes you made and why
- Link related issues: Use "Fixes #123", "Closes #123", or "Addresses #123"
- Stay focused: Keep PRs focused on a single feature or fix when possible
- Add tests: Include tests for new functionality or bug fixes
- Update docs: Update relevant documentation
- Mark breaking changes: Clearly indicate any breaking changes
GitHub will automatically populate new pull requests with our template (located at .github/PULL_REQUEST_TEMPLATE.md). The template includes sections for:
- Description: Brief overview of changes
- Type of change: Bug fix, feature, breaking change, etc.
- Related Issue: Link to relevant issues
- Testing: Confirmation of test coverage and execution
- Documentation: Updates to docs and type definitions
- Checklist: Code quality and review items
Please fill out all relevant sections when creating your pull request.
- TypeScript: Use TypeScript for all new code
- Formatting: Follow existing code formatting (Prettier + ESLint)
- Naming: Use meaningful, descriptive variable and function names
- Functions: Keep functions small, focused, and pure when possible
- Types: Provide comprehensive type definitions
- Unit tests: Write tests for all new functionality
- Test coverage: Maintain high test coverage
- Test names: Use descriptive test names that explain the scenario
- Edge cases: Test both success and error cases
- Mocking: Mock external dependencies appropriately (like axios)
- Browser compatibility: Consider testing in different environments
- README.md: Update for new features with usage examples
- Type definitions: Include TypeScript definitions for all public APIs
- Examples: Provide clear usage examples
- Changelog: Document all changes in CHANGELOG.md
Use conventional commit format for clear change history:
type(scope): brief description
[optional longer description]
[optional footer with breaking changes or issue references]
Types:
feat: A new featurefix: A bug fixdocs: Documentation changesstyle: Code style changes (formatting, missing semicolons, etc.)refactor: Code refactoring without changing functionalitytest: Adding or updating tests
Examples:
feat: add playlist URL validation support
fix: handle malformed URLs gracefully in extractYouTubeVideoId
docs: update React hook usage examples
test: add edge cases for URL parsing
refactor: simplify video ID extraction logic
- Browser-first: Designed to work in browsers with Node.js compatibility
- Minimal dependencies: Keep external dependencies to a minimum
- Type safety: Full TypeScript support with comprehensive types
- Tree-shaking: Support for tree-shaking in bundlers
- Peer dependencies: Use peer dependencies for optional features
src/: Source codeutils/: Core utility functionsreact/: React-specific hooks and componentstypes.ts: TypeScript type definitionsconsts.ts: Constants and configuration
tests/: Test files mirroring src structure- Configuration files for build, lint, and test tools
Releases are handled by maintainers following semantic versioning:
- Patch (1.0.1): Bug fixes, minor improvements
- Minor (1.1.0): New features, backward compatible changes
- Major (2.0.0): Breaking changes
The release process includes:
- Update version in package.json
- Update CHANGELOG.md with release notes
- Create git tag
- Publish to npm
- Create GitHub release
If you need help or have questions:
- Check documentation: README.md and code comments
- Search issues: Look for similar questions or problems
- Create an issue: Use the "question" label for general questions
- Discussion: Use GitHub Discussions for broader topics
All contributors will be recognized in our README.md and release notes. We appreciate every contribution, whether it's code, documentation, bug reports, or feature suggestions!
Thank you for helping make youtube-link-utils better! 🎉
This contributing guide is inspired by open source best practices and is designed to create a welcoming environment for all contributors.