Thank you for your interest in contributing to lua-state! This document provides guidelines and information for contributors.
git clone https://github.com/quaternion/node-lua-state.git
cd node-lua-state
npm i
npm run testThis project includes a dev container configuration for a consistent development environment with all necessary tools and dependencies preinstalled.
Prerequisites:
Setup:
-
Clone the repository:
git clone https://github.com/quaternion/node-lua-state.git cd node-lua-state -
Open in VS Code and use Command Palette:
Dev Containers: Reopen in Container
Prerequisites:
- Node.js 18+ - Required runtime
- tar - System tool for extracting archives (or install via npm)
- C++ build environment - For compiling native addons:
- Linux:
build-essential(Ubuntu/Debian) or equivalent - macOS: Xcode Command Line Tools
- Windows: Visual Studio Build Tools
- Linux:
Installation:
-
Clone the repository:
git clone https://github.com/quaternion/node-lua-state.git cd node-lua-state -
Install dependencies and build the native addon:
npm i
This project uses Biome for code formatting and linting:
- Format code:
npm run format - Check code:
npm run lint
All code must pass linting checks before submission.
Run the test suite:
npm run testTests are written using Node.js built-in test runner and cover JavaScript integration with the native addon.
Run performance benchmarks:
npm run benchThis helps ensure changes don't negatively impact performance.
During local development, prefer running:
./bin/lua-state.js install --force [options]rather than npx lua-state install, as npx may trigger duplicate builds. See the README for detailed build options.
-
Fork the repository and create a feature branch:
git checkout -b feature/your-feature-name
-
Make changes following the code style and guidelines
-
Test thoroughly:
- Run
npm run testto ensure all tests pass - Run
npm run lintto check code quality - Run
npm run benchto verify performance
- Run
-
Update documentation if needed (README, types, etc.)
-
Commit with clear, descriptive messages:
git commit -m "feat: add new feature description" -
Push to your fork and create a Pull Request
Follow conventional commit format:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changesstyle:- Code style changesrefactor:- Code refactoringtest:- Test additions/changeschore:- Maintenance tasks
- Use TypeScript for all new code
- Provide proper type annotations
- Type definitions live in
types/and are published with the package.
- Follow the existing code style in
src/ - Use modern C++ features compatible with the target compilers
- Ensure thread-safety for Node.js integration
- This project uses CommonJS; avoid ESM imports unless necessary.
- Follow Node.js best practices
- Handle errors properly with detailed messages
- Write tests for new features
- Test edge cases and error conditions
- Ensure cross-platform compatibility
- Test with different Lua versions when applicable
When reporting bugs:
- Use the issue templates when available
- Include your environment (OS, Node.js version, Lua version)
- Provide minimal reproduction steps
- Include error messages and stack traces
- Report security vulnerabilities privately to the maintainers
- Do not commit sensitive information
- Follow secure coding practices
By contributing, you agree that your contributions will be licensed under the same MIT License as the project.
- Check existing issues and documentation first
- Join discussions in GitHub issues
- Ask questions in pull request comments
Thank you for contributing to lua-state! 🎉