First off, thank you for considering contributing to the VNPay library! 🎉 Every contribution helps make this project better for everyone.
- Contributing to VNPay
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to lehuygiang28@gmail.com.
The repository is organized as follows:
vnpay/
├── src/ # Source code for the VNPay library
│ ├── configs/ # Configuration interfaces and defaults
│ ├── constants/ # Constants and enumerations
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions
├── docs/ # Documentation (Docusaurus)
│ ├── docs/ # Vietnamese documentation
│ └── i18n/en/ # English documentation
├── test/ # Tests
└── examples/ # Example implementations
-
Fork the repository:
- Click the "Fork" button at the top right of the repository page
-
Clone your fork:
git clone https://github.com/YOUR_USERNAME/vnpay.git cd vnpay -
Install dependencies:
npm install
-
Set up remote:
git remote add upstream https://github.com/lehuygiang28/vnpay.git
-
Start coding! 🎉
-
Commit your changes:
- Commit message must follow the commit message convention
git add . git commit -m "feat: ✨ Add new feature"
The documentation is built with Docusaurus. To run it locally:
-
Navigate to the docs directory:
cd docs -
Install dependencies (if you haven't already):
npm install
-
Start the development server:
npm start
-
Open your browser and visit http://localhost:3000
-
For switching between languages, use the language dropdown in the top navigation bar
- Check the Issues page for open issues
- Look for issues labeled
good first issueif you're new to the project - Comment on an issue to express your interest before starting work
- If you want to work on something that doesn't have an issue yet, create one first to discuss
-
Create a branch:
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix -
Make your changes:
- Write clean, maintainable, and tested code
- Follow the style guide
- Add or update tests as necessary
- Update documentation if needed (both English and Vietnamese)
-
Keep your branch updated:
git fetch upstream git rebase upstream/main
We follow the Conventional Commits specification:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Types include:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the code (formatting, etc.)refactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
Examples:
feat: ✨ Add support for QR code payments
fix: 🐛 Fix amount calculation in refund process
docs: 📝 Update installation instructions
-
Push your changes:
git push origin feature/your-feature-name
-
Create a pull request:
- Go to the repository page
- Click "Pull requests" > "New pull request"
- Select "compare across forks"
- Select your fork and branch
- Click "Create pull request"
-
Fill in the PR template:
- Provide a clear description of the changes
- Include screenshots or examples if applicable
- Reference any related issues
- Make sure all tests pass
- Ensure documentation is updated if necessary
When updating documentation:
- Keep language simple and clear
- Use examples where possible
- Update both English and Vietnamese versions of the documentation
- Follow Markdown best practices
- Preview your changes locally before submitting
This project maintains documentation in both Vietnamese and English:
- Vietnamese documentation is in
docs/docs/ - English documentation is in
docs/i18n/en/docusaurus-plugin-content-docs/current/
When making documentation changes, please update both language versions to keep them in sync.
- Each feature should have its own documentation file
- Follow the existing numbering/naming convention in the docs directory
- Include code examples for all features
- Document any limitations or caveats
- Include links to related sections or external resources where appropriate
-
Run existing tests before making changes:
npm test -
Run specific tests:
npm test -- -t "specific test name"
-
Run tests with coverage report:
npm run test:coverage
- Write tests for all new features and bug fixes
- Mock external APIs and dependencies when testing
- Test both success and error scenarios
- Aim for high test coverage, especially for critical functions
- Structure tests clearly with descriptive names
After submitting a PR:
- Automatic checks will run (linting, tests, etc.)
- Maintainers will review your code
- They may request changes or ask questions
- Address any feedback promptly
- Once approved, a maintainer will merge your PR
The review will focus on:
- Code correctness and quality
- Test coverage
- Documentation completeness
- Adherence to style guides
- Potential edge cases
Please be patient during the review process. Maintainers are volunteers and may take some time to respond.
All TypeScript code must adhere to the TypeScript Style Guide.
Key points:
- Use 2 spaces for indentation
- Use semicolons
- Use single quotes for strings
- Prefer
constoverletwhen possible - Use PascalCase for classes, interfaces, types, and enums
- Use camelCase for variables, functions, and methods
- Add JSDoc comments for public APIs
- Use Markdown for documentation
- Use clear headings and subheadings
- Include code examples with proper syntax highlighting
- Keep sentences concise and clear
- Use numbered lists for sequential steps
- Use bullet points for non-sequential items
The VNPay library follows semantic versioning (SEMVER):
- Major releases (1.0.0, 2.0.0): Incompatible API changes
- Minor releases (1.1.0, 1.2.0): Add functionality in a backward-compatible manner
- Patch releases (1.0.1, 1.0.2): Backward-compatible bug fixes
Contributors don't need to worry about versioning - the maintainers will handle this.
We use labels to categorize issues and PRs:
bug: Something isn't workingdocumentation: Improvements or additions to documentationenhancement: New features or improvementsgood first issue: Good for newcomershelp wanted: Extra attention is neededquestion: Further information is requestedwontfix: This will not be worked on
Thank you for contributing to VNPay! 🚀