Thank you for your interest in contributing to HVV Card! This document provides guidelines and instructions for contributing.
Please be respectful and constructive in all interactions. We welcome contributions from everyone.
- Node.js 20 or higher
- npm
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/hvv-card.git cd hvv-card - Install dependencies:
npm install
- Run tests to verify setup:
npm test
All changes must go through a separate branch and pull request:
fix/- Bug fixes (e.g.,fix/sort-departures-by-actual-time)feat/- New features (e.g.,feat/display-cancelled-departures)docs/- Documentation changesrefactor/- Code refactoring
-
Create a feature branch from
main:git checkout -b feat/your-feature-name
-
Make your changes to
hvv-card.js -
Add or update tests in
tests/hvv-card.test.js -
Run tests locally:
npm test -
Update documentation:
- Update
README.mdif adding new features or options - Add JSDoc comments for new functions
- Update
-
Commit your changes using Conventional Commits:
git commit -m "feat: add new feature description" git commit -m "fix: resolve issue with sorting" git commit -m "docs: update README with new option"
-
Push your branch and create a pull request
We use Conventional Commits for automatic changelog generation:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringtest:- Adding or updating testschore:- Maintenance tasks
Example:
feat: add visual indicator for cancelled departures
Cancelled departures now show with strikethrough text and a
"Cancelled" badge instead of departure time.
Fixes #9
npm testTests are written using Jest with jsdom. See existing tests in tests/hvv-card.test.js for examples.
Key patterns:
- Mock the LitElement base class in
beforeAll - Create card instances with
document.createElement('hvv-card') - Set config with
card.setConfig({ ... }) - Set hass state with
card.hass = { states: { ... } } - Render and check output with
String(card.render())
- All tests pass (
npm test) - Code follows existing style
- Documentation is updated (if applicable)
- Commit messages follow Conventional Commits
- Clearly describe what the PR does
- Reference any related issues (e.g., "Fixes #123")
- Include screenshots for UI changes
- List any breaking changes
Releases are automated using Release Please. When PRs are merged to main:
- Release Please creates/updates a release PR with changelog
- When the release PR is merged, a new GitHub release is created
- Version numbers follow Semantic Versioning
- Check existing issues
- Open a new issue for bugs or feature requests
- Ask questions in issue discussions
By contributing, you agree that your contributions will be licensed under the MIT License.