Contributing to Importy โ
Thank you for your interest in contributing to Importy! This guide will help you get started with contributing to the project.
๐ค Ways to Contribute โ
There are many ways you can contribute to Importy:
- ๐ Report bugs and issues
- ๐ก Suggest new features or improvements
- ๐ Improve documentation
- ๐งช Write tests and improve test coverage
- ๐ง Fix bugs and implement features
- ๐จ Improve user experience and CLI design
- ๐ Add examples and use cases
๐ Getting Started โ
Prerequisites โ
- Node.js: Version 18.0.0 or higher
- pnpm: Package manager (recommended)
- Git: For version control
Development Setup โ
Fork the repository on GitHub
Clone your fork locally:
bashgit clone https://github.com/YOUR_USERNAME/Importy.git cd Importy
Install dependencies:
bashpnpm install
Build the project:
bashpnpm run build
Run tests to ensure everything works:
bashpnpm test
Create a feature branch:
bashgit checkout -b feature/your-feature-name
Project Structure โ
Importy/
โโโ src/ # Source code
โ โโโ index.ts # Main entry point
โ โโโ cli.ts # CLI interface
โ โโโ analyzer.ts # Core analysis logic
โ โโโ utils/ # Utility functions
โโโ tests/ # Test files
โ โโโ programmatic.test.ts
โ โโโ cli.test.ts
โโโ docs/ # Documentation site
โโโ demo-project/ # Demo project for testing
โโโ scripts/ # Build and release scripts
โโโ dist/ # Built output
๐งช Testing โ
Running Tests โ
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run specific test file
npx vitest run tests/programmatic.test.ts
Test Types โ
- Programmatic Tests: Test the core JavaScript API
- CLI Tests: Test command-line interface functionality
- Integration Tests: Test end-to-end workflows
Writing Tests โ
When adding new features, please include tests:
import { describe, it, expect } from 'vitest';
import { analyzeImports } from '../src/analyzer';
describe('analyzeImports', () => {
it('should detect React hooks', () => {
const result = analyzeImports('./test-project', 'react');
expect(result.components.useState).toBeDefined();
});
});
๐ง Development Workflow โ
Code Quality โ
We use several tools to maintain code quality:
# Lint code
pnpm run lint
# Format code
pnpm run format
# Type check
pnpm run check
# Fix all issues
pnpm run check:fix
Commit Guidelines โ
We follow Conventional Commits:
feat: add support for Vue.js imports
fix: handle parsing errors gracefully
docs: update installation guide
test: add tests for CLI options
refactor: simplify file filtering logic
Types:
feat
: New featurefix
: Bug fixdocs
: Documentation changestest
: Adding or updating testsrefactor
: Code refactoringperf
: Performance improvementschore
: Maintenance tasks
Pull Request Process โ
Ensure tests pass:
bashpnpm test pnpm run check
Update documentation if needed
Create a pull request with:
- Clear title and description
- Reference to related issues
- Screenshots for UI changes
- Test coverage information
Respond to feedback and make requested changes
Ensure CI passes before requesting final review
๐ Bug Reports โ
When reporting bugs, please include:
Required Information โ
- Version: Importy version (
importy --version
) - Node.js Version: (
node --version
) - Operating System: (Windows, macOS, Linux)
- Command Used: Exact command that caused the issue
- Expected Behavior: What should have happened
- Actual Behavior: What actually happened
Bug Report Template โ
**Bug Description**
A clear description of the bug.
**Steps to Reproduce**
1. Run `importy --dir ./src --lib react`
2. See error
**Expected Result**
Should analyze React imports successfully.
**Actual Result**
Error: Cannot read property 'components' of undefined
**Environment**
- Importy version: 0.1.1
- Node.js version: 18.17.0
- OS: macOS 13.5
**Additional Context**
Any additional information or screenshots.
๐ก Feature Requests โ
We welcome feature suggestions! Please include:
Feature Request Template โ
**Feature Description**
A clear description of the feature you'd like to see.
**Use Case**
Why would this feature be useful? What problem does it solve?
**Proposed Solution**
How do you think this should work?
**Alternatives Considered**
Any alternative solutions you've considered.
**Additional Context**
Any additional information, mockups, or examples.
๐ Documentation โ
Documentation Site โ
The documentation site uses VitePress:
# Start development server
pnpm run docs:dev
# Build documentation
pnpm run docs:build
# Preview built docs
pnpm run docs:preview
Writing Documentation โ
When contributing to docs:
- Use clear, concise language
- Include practical examples
- Test all code examples
- Follow the existing structure
- Add relevant links and cross-references
Documentation Structure โ
- Guide: Getting started and tutorials
- API: Technical reference
- Examples: Practical use cases
- Contributing: This guide
๐๏ธ Development Guidelines โ
Code Style โ
- TypeScript: Use TypeScript for all source code
- ESM: Use ES modules (import/export)
- Async/Await: Prefer async/await over promises
- Error Handling: Always handle errors gracefully
- Types: Use strict TypeScript types
Performance โ
- Async Processing: Use worker threads for CPU-intensive tasks
- Memory Efficiency: Be mindful of memory usage for large codebases
- Benchmarking: Include performance tests for critical paths
Compatibility โ
- Node.js: Support Node.js 18+
- Cross-platform: Ensure Windows, macOS, and Linux compatibility
- Backward Compatibility: Avoid breaking changes in minor versions
๐ข Release Process โ
Releases are automated through GitHub Actions:
- Version Bump: Use conventional commits to trigger releases
- Testing: All tests must pass
- Documentation: Ensure docs are up to date
- Changelog: Update automatically generated
- npm Publish: Automatic publication to npm
Manual Release (Maintainers Only) โ
# Patch release
pnpm run release:patch
# Minor release
pnpm run release:minor
# Major release
pnpm run release:major
๐ค Getting Help โ
Community Support โ
- ๐ฌ GitHub Discussions - Ask questions and share ideas
- ๐ Issue Tracker - Report bugs and request features
Development Questions โ
For development-related questions:
- Check existing issues and discussions
- Search the documentation
- Ask in GitHub Discussions
๐ Checklist for Contributors โ
Before submitting your contribution:
- [ ] Tests pass locally (
pnpm test
) - [ ] Code quality checks pass (
pnpm run check
) - [ ] Documentation updated if needed
- [ ] Commit messages follow conventional format
- [ ] PR description explains the changes
- [ ] Breaking changes are documented
๐ฏ Good First Issues โ
Looking for a way to contribute? Check out issues labeled:
good first issue
: Perfect for newcomershelp wanted
: Community help neededdocumentation
: Documentation improvementsenhancement
: New features and improvements
๐ Code of Conduct โ
Please note that this project is released with a Code of Conduct. By participating in this project, you agree to abide by its terms.
๐ Recognition โ
Contributors are recognized in:
- GitHub Contributors: Automatic recognition
- Release Notes: Major contributors mentioned
- Documentation: Contributors page (coming soon)
๐ Contact โ
- Project Maintainer: Taras Shevchuk
- Email: Available in GitHub profile
- Social: Links available in GitHub profile
Thank you for contributing to Importy! Your contributions help make the JavaScript/TypeScript ecosystem better for everyone. ๐