|
| 1 | +# Contributing to binance-api-node |
| 2 | + |
| 3 | +Thank you for your interest in contributing to binance-api-node! This document provides guidelines and instructions for contributing to the project. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. Fork the repository |
| 8 | +2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/binance-api-node.git` |
| 9 | +3. Install dependencies: `npm install` |
| 10 | +4. Create a new branch for your feature or fix: `git checkout -b feature/your-feature-name` |
| 11 | + |
| 12 | +## Development Setup |
| 13 | + |
| 14 | +This project uses: |
| 15 | +- **Babel** for transpiling ES6+ code to CommonJS |
| 16 | +- **AVA** for testing |
| 17 | +- **ESLint** for linting |
| 18 | +- **Prettier** for code formatting |
| 19 | + |
| 20 | +## Available Scripts |
| 21 | + |
| 22 | +The following npm scripts are available for development and testing: |
| 23 | + |
| 24 | +### Building |
| 25 | + |
| 26 | +- `npm run build` - Removes the `dist` folder and transpiles the `src` directory to `dist` using Babel |
| 27 | +- `npm run prepare` - Automatically runs the build script (triggered on npm install) |
| 28 | + |
| 29 | +### Testing |
| 30 | + |
| 31 | +- `npm test` - Runs all tests (AVA tests + browser tests) |
| 32 | +- `npm run test:ava` - Runs AVA tests with a 10-second timeout and verbose output |
| 33 | +- `npm run test:browser` - Runs all browser tests (signature, crypto, and WebSocket tests) |
| 34 | +- `npm run test:browser:signature` - Runs browser signature tests specifically |
| 35 | +- `npm run test:browser:websocket` - Runs WebSocket tests in the browser environment |
| 36 | +- `npm run test:browser:crypto` - Runs cryptography tests in the browser environment |
| 37 | +- `npm run static-tests` - Runs static tests only |
| 38 | + |
| 39 | +### Code Quality |
| 40 | + |
| 41 | +- `npm run lint` - Lints the `src` directory using ESLint |
| 42 | +- `npm run prettier` - Formats code in `src` and `test` directories |
| 43 | +- `npm run prettier:check` - Checks code formatting without making changes |
| 44 | +- `npm run typecheck` - Runs TypeScript type checking without emitting files |
| 45 | + |
| 46 | +### Coverage |
| 47 | + |
| 48 | +- `npm run cover` - Runs tests with coverage using nyc |
| 49 | +- `npm run report` - Generates coverage report and sends it to Coveralls |
| 50 | + |
| 51 | +### CI |
| 52 | + |
| 53 | +- `npm run ci` - Runs the full CI pipeline (lint, prettier check, and all tests) |
| 54 | + |
| 55 | +## Making Changes |
| 56 | + |
| 57 | +1. Make your changes in the `src` directory |
| 58 | +2. Add tests for any new functionality in the `test` directory |
| 59 | +3. Run `npm run lint` to ensure code quality |
| 60 | +4. Run `npm run prettier` to format your code |
| 61 | +5. Run `npm test` to ensure all tests pass |
| 62 | +6. Commit your changes with a clear commit message |
| 63 | + |
| 64 | +## Code Style |
| 65 | + |
| 66 | +This project uses ESLint and Prettier to maintain consistent code style. Before submitting a PR: |
| 67 | + |
| 68 | +1. Run `npm run prettier` to format your code |
| 69 | +2. Run `npm run lint` to check for linting errors |
| 70 | +3. Fix any issues that arise |
| 71 | + |
| 72 | +## Testing Guidelines |
| 73 | + |
| 74 | +- Write tests for all new features and bug fixes |
| 75 | +- Ensure all tests pass before submitting a PR |
| 76 | +- Tests should be placed in the `test` directory |
| 77 | +- Browser-specific tests go in `test/browser` |
| 78 | +- Use AVA's timeout option for tests that make API calls |
| 79 | + |
| 80 | +## Pull Request Process |
| 81 | + |
| 82 | +1. Update the README.md if you're adding new features or changing functionality |
| 83 | +2. Ensure all tests pass and code is properly formatted |
| 84 | +3. Update the documentation if necessary |
| 85 | +4. Submit a pull request with a clear description of your changes |
| 86 | +5. Reference any related issues in your PR description |
| 87 | + |
| 88 | +## Testing with API Keys |
| 89 | + |
| 90 | +Some tests require Binance API keys. You can: |
| 91 | +- Create a `.env` file in the root directory |
| 92 | +- Add your API keys: |
| 93 | + ``` |
| 94 | + BINANCE_API_KEY=your_api_key_here |
| 95 | + BINANCE_API_SECRET=your_api_secret_here |
| 96 | + ``` |
| 97 | +- Never commit your `.env` file or API keys to the repository |
| 98 | + |
| 99 | +## Questions? |
| 100 | + |
| 101 | +If you have questions about contributing, feel free to: |
| 102 | +- Open an issue for discussion |
| 103 | +- Check existing issues and pull requests for similar topics |
| 104 | +- Review the [README](README.md) for API documentation and usage examples |
| 105 | + |
| 106 | +## License |
| 107 | + |
| 108 | +By contributing to binance-api-node, you agree that your contributions will be licensed under the MIT License. |
0 commit comments