Thank you for considering contributing to @goobits/themes!
- Node.js 18.0.0 or higher
- pnpm (recommended) or npm
- Git
- Fork and clone:
git clone https://github.com/YOUR_USERNAME/theme-engine.git
cd theme-engine- Install dependencies:
pnpm install- Build the package:
pnpm run build- Run tests:
pnpm run test@goobits/themes/
├── core/ # Framework-agnostic theme logic
│ ├── config.ts # Theme configuration
│ ├── types.ts # TypeScript types
│ ├── scheme-registry.ts
│ └── theme-manager.ts
├── svelte/ # Svelte 5 components
│ ├── components/ # Theme components
│ ├── stores/ # Theme stores
│ └── index.ts
├── server/ # SvelteKit server utilities
│ ├── hooks.ts # Server hooks
│ ├── preferences.ts # Cookie handling
│ └── index.ts
├── utils/ # Shared utilities
│ ├── cookies.ts # Cookie management
│ ├── route-themes.ts
│ └── logger.ts
├── themes/ # CSS theme files
│ ├── base/ # Base design tokens
│ └── presets/ # Preset color schemes
└── docs/ # Documentation
Use descriptive branch names:
feat/add-new-scheme- New featuresfix/theme-flash-bug- Bug fixesdocs/improve-readme- Documentationrefactor/cleanup-types- Code refactoring
This project follows standard TypeScript/Svelte conventions:
- Use TypeScript for all code
- Follow existing code style
- Add JSDoc comments for public APIs
- Use meaningful variable names
- Keep functions small and focused
Write clear commit messages:
feat: add ocean color scheme
fix: prevent theme flash on page load
docs: update API reference with new types
refactor: simplify theme store logic
Format: type: description
Types:
feat- New featurefix- Bug fixdocs- Documentation onlyrefactor- Code change that neither fixes a bug nor adds a featuretest- Adding or updating testschore- Maintenance tasks
Test your changes:
- Build the package:
pnpm run build- Link locally:
npm link- In a test SvelteKit project:
npm link @goobits/themes-
Test all theme modes:
- Light mode
- Dark mode
- System mode
-
Test multiple schemes
-
Test SSR (no theme flash)
Add tests for new features:
// Example test
import { test, expect } from 'vitest';
import { createThemeStore } from './theme.svelte';
test('theme store initializes with correct defaults', () => {
const store = createThemeStore(config);
expect(store.theme).toBe('system');
});Run tests:
pnpm run testIf your change affects the public API:
- Update relevant docs in
docs/ - Update README.md if needed
- Add examples if appropriate
- Be concise and clear
- Use code examples
- Link to related docs
- Test all code examples
- Code follows existing style
- All tests pass
- Documentation updated
- Commit messages are clear
- Branch is up to date with main
- Push your branch to your fork
- Create a pull request to
main - Fill out the PR template
- Link related issues
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
How has this been tested?
## Checklist
- [ ] Tests pass
- [ ] Documentation updated
- [ ] Commits are clear- Automated checks - Tests and linting must pass
- Code review - Maintainer will review code
- Feedback - Address any requested changes
- Approval - Maintainer approves PR
- Merge - Maintainer merges to main
- Create CSS file in
themes/presets/ - Add to scheme registry in
core/scheme-registry.ts - Export from
themes/index.css - Document in
docs/custom-themes.md - Add example in README
- Create component in
svelte/components/ - Export from
svelte/index.ts - Add TypeScript types
- Document in
docs/components.md - Add usage example
- Add to appropriate module (core/svelte/server/utils)
- Export from module index
- Add TypeScript types
- Document in
docs/api-reference.md - Add tests
- Reproduce - Confirm the bug exists
- Identify - Find root cause
- Fix - Make minimal changes to fix
- Test - Verify fix works
- Document - Update docs if needed
When fixing a bug, reference the issue:
fix: prevent theme flash on reload (#123)
- Add theme class to SSR template
- Update server hooks to set cookie
- Add tests for SSR rendering
Fixes #123
When reviewing PRs:
- Be constructive and respectful
- Suggest improvements, don't demand
- Explain reasoning for changes
- Approve if good, request changes if not
(For maintainers)
- Update version in
package.json - Update
CHANGELOG.mdwith changes - Read the release version:
THEMES_VERSION=$(node -p "require('./package.json').version") - Create and push the tag:
git tag "v${THEMES_VERSION}" && git push origin "v${THEMES_VERSION}" - Publish to npm:
pnpm publish --access public - Create GitHub release with notes
- Development questions: GitHub Discussions
- Bug reports: GitHub Issues
- General support: See SUPPORT.md
- Be respectful and inclusive
- Welcome newcomers
- Focus on constructive feedback
- Keep discussions on topic
- No harassment or discrimination
By contributing, you agree that your contributions will be licensed under the MIT License.
Your contributions make this project better for everyone. Thank you for taking the time to contribute!