Thank you for your interest in contributing to OpenTwig! This guide will help you get started as a contributor to our open source project.
- Getting Started
- Development Setup
- How to Contribute
- Project Structure
- Code Style Guide
- Testing
- Pull Request Process
- Reporting Bugs
- Suggesting Features
- Community Guidelines
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/opentwig.git cd opentwig - Add upstream remote:
git remote add upstream https://github.com/tufantunc/opentwig.git
- Node.js (v14 or higher)
- npm or yarn
- Git
-
Install dependencies:
npm install
-
Test the CLI tool:
npm start -- --help
-
Create a test config and try building:
npm start -- --init npm start
We welcome various types of contributions:
- Fix issues labeled
bug - Improve error handling
- Fix typos in documentation
- Add new themes
- Implement new CLI commands
- Add support for new image formats
- Enhance existing functionality
- Improve README sections
- Add code comments
- Create tutorials or guides
- Translate documentation
- Create new themes
- Improve existing theme designs
- Add responsive improvements
- Fix accessibility issues
- Add tests
- Improve build process
- Add linting/formatting
- Update dependencies
Look for issues with these labels:
good first issue- Perfect for newcomersdocumentation- Documentation improvementstheme- Theme-related work
opentwig/
├── src/
│ ├── index.js # Main CLI entry point
│ ├── constants.js # App constants
│ └── utils/ # Core utilities
│ ├── buildPage.js # Page building logic
│ ├── generateHTML.js # HTML generation
│ ├── generateOGImage.js # Open Graph images
│ ├── generateQR.js # QR code generation
│ ├── processCSS.js # CSS processing
│ └── ...
├── theme/
│ ├── default/ # Default theme
│ │ ├── index.js # Theme template
│ │ ├── style.css # Theme styles
│ │ └── components/ # Reusable components
│ ├── dark/ # Dark theme
│ ├── minimal/ # Minimal theme
│ ├── colorful/ # Colorful theme
│ └── azure/ # Azure theme
└── dist/ # Generated output (gitignored)
src/index.js: Main CLI entry point, handles argument parsingsrc/utils/buildPage.js: Orchestrates the page building processtheme/*/index.js: Theme-specific HTML templatestheme/*/style.css: Theme-specific CSS stylestheme/*/components/: Reusable component templates
- Use ES6+ features where appropriate
- Follow camelCase for variables and functions
- Use meaningful variable names
- Add JSDoc comments for functions
- Keep functions small and focused
- Use consistent indentation (2 spaces)
- Use semantic class names
- Follow mobile-first responsive design
- Use CSS custom properties for theming
- Optimize for performance
- One function per file when possible
- Keep utility files focused
- Use clear, descriptive filenames
/**
* Generates QR code for the given URL
* @param {string} url - The URL to encode
* @returns {string} SVG QR code string
*/
function generateQRCode(url) {
const qrOptions = {
type: 'svg',
width: 200,
margin: 2
};
return QrCode.generate(url, qrOptions);
}Before submitting a pull request:
-
Test CLI functionality:
npm start -- --init npm start
-
Test different themes:
# Edit config.json to test different themes npm start -
Check output files:
- Verify HTML is valid
- Check CSS renders correctly
- Ensure images are processed properly
-
Test edge cases:
- Empty config
- Missing avatar
- Long text content
- Various image formats
-
Create a branch from main:
git checkout -b feature/your-feature-name
-
Make your changes
-
Test thoroughly
-
Commit with clear messages:
git commit -m "feat: add new theme for better UX" git commit -m "docs: improve setup instructions"
-
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request
- Use descriptive titles
- Link related issues
- Add screenshots for UI changes
- Describe testing performed
- Keep PRs focused and small when possible
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Adding or updating testschore:Maintenance tasks
Found a bug? Help us fix it!
- Check existing issues
- Test with latest version
- Try to reproduce consistently
**Bug Description**
Brief description of the bug
**Steps to Reproduce**
1. Run `npx opentwig --init`
2. Edit config.json with...
3. Run `npx opentwig`
4. See error...
**Expected Behavior**
What should happen instead
**Environment**
- Node.js version:
- Operating System:
- npm version:
**Additional Context**
Screenshots, error messages, etc.We love feature suggestions!
- Check existing issues first
- Describe the use case clearly
- Consider backward compatibility
- Think about implementation complexity
- Be respectful and inclusive
- Welcome newcomers and different skill levels
- Focus on constructive feedback
- Respect different opinions and approaches
- Use GitHub Discussions for questions
- Check existing issues and PRs
- Read documentation thoroughly
- Be patient for responses
Contributors will be:
- Listed in the project README (if desired)
- Mentioned in release notes for significant contributions
- Given priority in code reviews and feedback
Questions? Feel free to:
- Open an issue
- Start a discussion
- Contact maintainers
Thank you for contributing to OpenTwig! 🚀