Thank you for your interest in contributing to Nexus IoC! This document provides guidelines and instructions for contributing to the project.
- Code of Conduct
- Getting Started
- Development Workflow
- Coding Standards
- Commit Guidelines
- Versioning and Publishing
- Pull Request Process
- Testing Guidelines
- Documentation
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
- Node.js 18.x or higher
- npm 9.x or higher
- Git
-
Fork the repository
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/ioc.git cd ioc -
Install dependencies:
npm ci
-
Build all packages:
npm run build:all
-
Run tests to verify setup:
npx lerna run test --stream
Use descriptive branch names following this pattern:
feature/issue-XX-short-description- New featuresfix/issue-XX-short-description- Bug fixesdocs/issue-XX-short-description- Documentation updatesrefactor/issue-XX-short-description- Code refactoringperf/issue-XX-short-description- Performance improvementstest/issue-XX-short-description- Test updates
-
Create a new branch from
main:git checkout -b feature/issue-XX-your-feature
-
Make your changes following our Coding Standards
-
Run linting and formatting:
npx biome check --write . -
Run tests:
npx lerna run test --stream -
Build packages:
npm run build:all
We use Biome for linting and formatting. The configuration is in biome.json.
Key style rules:
- Use tabs for indentation (width: 2)
- Maximum line length: 100 characters
- Use double quotes for strings
- Always use semicolons
- Use trailing commas in multi-line structures
- Use arrow parentheses always:
(x) => x
- Use strict mode TypeScript
- Prefer
constoverlet, never usevar - Avoid
anytype - useunknownor proper types - Use interfaces for object shapes
- Document public APIs with JSDoc comments
- Use meaningful variable and function names
packages/
├── ioc/ # Core IoC container
├── testing/ # Testing utilities
├── cli/ # CLI tools
└── shared/ # Shared interfaces
Each package should have:
src/- Source code__test__/- Test filesdist/- Compiled output (gitignored)README.md- Package documentation
We follow Conventional Commits specification.
<type>(<scope>): <subject>
<body>
<footer>
feat- New featurefix- Bug fixdocs- Documentation changesstyle- Code style changes (formatting, etc.)refactor- Code refactoringperf- Performance improvementstest- Test updatesbuild- Build system changesci- CI/CD changeschore- Other changes
The scope should be the package name:
ioc- @nexus-ioc/coretesting- @nexus-ioc/testingcli- @nexus-ioc/clishared- @nexus-ioc/sharedci- CI/CD changes
feat(ioc): add support for async providers
fix(testing): resolve mock cleanup issue in TestingContainer
docs(cli): update README with new generate commands
perf(ioc): optimize dependency resolution algorithm- Subject line max 100 characters
- Body lines max 100 characters
- Use imperative mood: "add" not "added"
- Reference issues:
Closes #123orRelated to #456
We provide Commitizen for interactive commit messages:
npm run commitThis will guide you through creating a properly formatted commit message.
🎉 Good news! Versioning and publishing are fully automated when your PR is merged to main.
- You commit using conventional commit format (e.g.,
feat:,fix:) - PR is merged to
mainbranch - CI automatically:
- Analyzes your commits
- Determines version bump (major/minor/patch)
- Updates package.json versions
- Generates CHANGELOG.md
- Creates git tags
- Publishes to NPM
- Creates GitHub releases
feat:→ Minor version bump (0.x.0)fix:→ Patch version bump (0.0.x)BREAKING CHANGE:→ Major version bump (x.0.0)docs:,chore:,style:→ No version bump
# Your commit
git commit -m "feat(core): add lazy loading support"
# After merge to main:
# @nexus-ioc/core: 0.4.2 → 0.5.0 ✅
# Automatically published to NPM ✅📚 For detailed information, see docs/VERSIONING.md
- ✅ All tests pass locally
- ✅ Code is properly formatted (
npx biome check --write .) - ✅ No linting errors
- ✅ Coverage maintained or improved
- ✅ Documentation updated
- ✅ Commits follow conventional commit format
- ✅ No need to update versions or CHANGELOG - automated!
- Push your branch to your fork
- Create a Pull Request against
mainbranch - Fill out the PR template completely
- Link related issues
- Wait for CI checks to pass
- Request review from maintainers
- ✅ Descriptive title following commit convention
- ✅ Completed PR template
- ✅ All CI checks passing
- ✅ No merge conflicts
- ✅ At least one approval from maintainers
- ✅ Coverage check passed (no coverage decrease)
Our CI pipeline runs the following checks:
Stage 1: Unit Tests & Coverage
- Linting (Biome)
- Unit tests with coverage
- Build all packages
Stage 2: Coverage Protection
- Compare coverage with main branch
- Block PR if coverage decreases
Stage 3: Build Validation
- Test builds on Node.js 18, 20, 22
- Verify package imports
Stage 4: PR Validation
- Create comprehensive validation comment
describe('Feature Name', () => {
describe('Specific Functionality', () => {
it('should do something specific', () => {
// Arrange
const input = ...;
// Act
const result = ...;
// Assert
expect(result).toBe(...);
});
});
});- @nexus-ioc/core: 80% lines, 80% statements, 70% functions, 80% branches
- @nexus-ioc/testing: 80% lines, 80% statements, 70% functions, 80% branches
- @nexus-ioc/cli: 70% lines, 70% statements, 60% functions, 70% branches
# Run all tests
npx lerna run test --stream
# Run tests with coverage
npx lerna run test:coverage --stream
# Run tests for specific package
cd packages/ioc && npm test
# Run tests in watch mode
cd packages/ioc && npm run test:watch- Use JSDoc for public APIs
- Include examples in JSDoc
- Document parameters and return types
- Explain complex logic with comments
Update package README.md when:
- Adding new features
- Changing public APIs
- Adding new configuration options
- Updating usage examples
Update CHANGELOG.md following Keep a Changelog format:
## [Unreleased]
### Added
- New feature description
### Changed
- Changed feature description
### Fixed
- Bug fix descriptionIf you have questions, please:
- Check existing issues and discussions
- Create a new issue with the
questionlabel - Join our community discussions
By contributing, you agree that your contributions will be licensed under the project's MIT License.
Thank you for contributing to Nexus IoC! 🚀