Welcome Contributors!
Thank you for your interest in contributing to Create Zustand CLI! This guide will help you get started with contributing to the project.Getting Started
Prerequisites
Before you begin, ensure you have:- Node.js 14 or higher installed
- npm or yarn package manager
- Git installed and configured
- A GitHub account
Setting Up Your Development Environment
- Fork the repository on GitHub by clicking the “Fork” button
-
Clone your fork locally:
-
Add the upstream remote to stay updated with the main repository:
-
Install dependencies:
-
Link the CLI locally for testing:
Making Changes
Creating a Branch
Always create a new branch for your changes:feature/add-config-validationfix/template-path-resolutiondocs/update-readmerefactor/improve-error-handling
Code Standards
Follow these coding standards to maintain consistency:JavaScript/Node.js Style
- Use ES6+ features and syntax
- Use meaningful variable and function names
- Keep functions small and focused on a single responsibility
- Use async/await instead of callbacks when possible
- Add comments for complex logic
Formatting
- Use 2 spaces for indentation
- Use semicolons
- Use double quotes for strings
- Keep lines under 80 characters when reasonable
Consider setting up Prettier for automatic formatting:
File Organization
- Main CLI logic:
bin/create-zustand-store.mjs - Templates:
templates/directory - Keep templates simple and focused
- Use clear placeholder naming (e.g.,
__STORE_NAME__)
Testing Your Changes
-
Test the CLI interactively:
-
Test different configurations:
- JavaScript and TypeScript
- With and without persistence
- Different initial states (simple, nested, arrays)
- Various action configurations
- Custom store paths
-
Test edge cases:
- Invalid JSON input
- Empty inputs
- Special characters in names
- Very long inputs
-
Verify the generated files:
- Check syntax correctness
- Test in a real React project
- Verify TypeScript types compile without errors
Writing Commit Messages
Write clear, descriptive commit messages:- Start with a verb (Add, Fix, Update, Remove, Refactor)
- Use present tense
- Keep the first line under 50 characters
- Add detailed description after a blank line if needed
Submitting Your Contribution
Before Submitting
- Code follows the project’s style guidelines
- All changes have been tested thoroughly
- No unnecessary files are included (node_modules, .env, etc.)
- Commit messages are clear and descriptive
- Documentation is updated if needed
- No console.log statements left in code (unless intentional)
Creating a Pull Request
-
Push your changes to your fork:
- Go to GitHub and navigate to your fork
- Click “Pull Request” button
-
Write a clear PR description including:
- What changes you made
- Why you made these changes
- How to test the changes
- Screenshots (if applicable)
- Related issues (if any)
Pull Request Review Process
After submitting:- Maintainers will review your PR
- You may receive feedback or change requests
- Make requested changes and push to the same branch
- Once approved, your PR will be merged
Be patient! Reviews may take time. Maintainers are often volunteers.
Types of Contributions
You can contribute in many ways:Code Contributions
- New features: Add new CLI options or functionality
- Bug fixes: Fix issues reported in GitHub Issues
- Performance improvements: Optimize existing code
- Refactoring: Improve code structure and readability
Documentation
- Improve README clarity
- Add usage examples
- Fix typos and grammar
- Create tutorials or guides
- Add code comments
Testing
- Test on different operating systems
- Report bugs with detailed reproduction steps
- Test edge cases
- Verify fixes for reported issues
Templates
- Improve existing templates
- Add new template variations
- Optimize generated code quality
- Improve TypeScript type inference
Reporting Issues
Found a bug? Have a feature request?Bug Reports
Include:- Description: Clear summary of the issue
- Steps to reproduce: Exact steps to trigger the bug
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Environment:
- OS (Windows, macOS, Linux)
- Node.js version
- npm/yarn version
- Error messages: Full error output
- Screenshots: If applicable
Feature Requests
Include:- Description: What feature you’d like to see
- Use case: Why this feature would be useful
- Examples: How it would work
- Alternatives: Other solutions you’ve considered
Code of Conduct
Our Standards
- Be respectful and inclusive
- Welcome newcomers
- Accept constructive criticism
- Focus on what’s best for the project
- Show empathy towards others
Unacceptable Behavior
- Harassment or discrimination
- Trolling or insulting comments
- Personal or political attacks
- Publishing others’ private information
- Other unprofessional conduct
Development Tips
Debugging
Add console.log statements during development:Testing Locally
Create a test project in a separate directory:Keeping Your Fork Updated
Regularly sync with the upstream repository:Getting Help
Need help contributing?- Check existing issues and pull requests
- Ask questions in GitHub Discussions (if available)
- Open an issue with the “question” label
- Reach out to maintainers
Recognition
All contributors will be recognized in:- GitHub contributors page
- Project README (for significant contributions)
- Release notes