Contributing
Thank you for your interest in contributing to package:win32!
This guide provides everything you need to get started and make your contributions effective and rewarding.
We strive to maintain a welcoming and inclusive community, so please read our Code of Conduct before contributing.
๐ Good to Knowโ
- Working on Issues: If you'd like to work on an existing issue, please comment on the issue page to let others know before you begin.
- Proposing New Features: Have an idea for a new feature? Create an issue to discuss it with the community and maintainers before diving in.
๐ How You Can Contributeโ
- ๐ Star Us on GitHub: If you enjoy using this package, a star on GitHub helps support our work.
- ๐ Report Bugs: Found a bug? Let us know on our GitHub Issues page.
- ๐ Improve Documentation: High-quality documentation is crucial. Help us improve it by refining the existing docs or adding new content.
- ๐ฌ Give Feedback: Share your experience using
package:win32, what features you'd like, and what works well on GitHub Discussions. - ๐ข Share
package:win32: Spread the word about this project to reach more users. - ๐ป Contribute to the Codebase: Work on new features or tackle open issues โ all contributions are highly appreciated!
- ๐ฆ Share Your Own Packages: If you've created a package that builds on top
of
package:win32and provides a more Dart-friendly API for a specific Windows API, please share it with us! Our community is growing rapidly, and your package could be useful for many people. We'll be happy to add your package to our packages page and share it with our community.
๐ ๏ธ Setting Up the Environmentโ
โ๏ธ Requirementsโ
- Dart version
3.11or higher - Melos for managing the monorepo
- git-cliff for generating changelogs
- Lefthook for managing Git hooks
If you're planning to contribute to the documentation, you'll also need:
Once your environment is ready, fork the repository, clone it locally, and set up the project.
๐ฅ Cloning the Repositoryโ
Clone your fork of package:win32 to your local machine:
git clone https://github.com/<your-username>/win32.git
๐ฆ Installing Dependenciesโ
Navigate to the project directory and first activate package:melos globally,
then install the dependencies:
dart pub global activate melos
dart pub get
๐งฉ Setting Up Git Hooksโ
This project uses Lefthook to manage Git hooks. Install the hooks by running the following in the project root:
lefthook install
This will set up checks that automatically ensure code quality and consistency before commits.
๐งช Running Testsโ
To run tests for the package:win32, run the following command:
melos run test:win32
We require tests for each feature or bug fix. If you're unsure how to write tests for your changes, feel free to ask on the relevant GitHub issue page.
๐ Contributing to the Documentationโ
Our documentation is built with Docusaurus. To contribute to the documentation, you need to install the dependencies and start the development server:
> cd website
> npm install
> npm start
Now, head over localhost:3000 to see the documentation.
To create a production build of the documentation, you can use the
npm run build command. Then, you can use the npm run serve command to serve
the production build on your local machine.
๐ป Contributing to the package:win32 Itselfโ
If you want to contribute to the package:win32 itself, follow the steps below:
Classic Win32 APIsโ
-
When wrapping a Win32 API, use the Unicode (
'W') wide variants of these APIs, rather than the ANSI ('A') variants. For example: CredWriteW, rather than CredWriteA. -
To create a new API, don't edit the main library files themselves; these get overwritten. Instead, edit the win32_functions.json file and run the
melos run generatecommand to generate the library files:Terminalmelos run generate -
Constants can be auto-generated by including them in the win32_constants.json file and running the
melos run generatecommand, which will generate the corresponding Dart files. -
Structs can be auto-generated by including them in the win32_structs.json file and running the
melos run generatecommand, which will generate the corresponding Dart files. -
There are plenty of good existing patterns to build off in these locations; try to mirror an existing function if you can for consistency!
-
Ideally pull requests for new API submissions include a sample (
examples\directory) and some tests (packages\win32\test\directory).
COM APIsโ
Begin by editing the com_types.json file, specifying the
desired COM interface, and then run the melos run generate command to generate
the relevant classes in the packages\win32\lib\src\com directory.
๐ Committing Your Work and Preparing a Pull Requestโ
To maintain a consistent and clean codebase, we enforce coding standards and use tools to ensure high-quality contributions.
๐จ Coding Styleโ
Please follow the Dart style guide to keep the codebase clean and consistent.
๐ Commit Conventionโ
We use Conventional Commits to structure our commit messages for clarity and uniformity.
Please use the following format for commit messages:
<type>(optional scope): <description>
Examples:
feat: add DragQueryFile APIfix: resolve an issue with the PROPVARIANT struct
Commit messages are validated with a GitHub action, so be sure to use the correct format when making a pull request.
๐งฉ Git Hooksโ
The following hooks run automatically with Lefthook:
-
Pre-Commit Hooks:
analyze: Checks code for style issues.format: Formats code according to Dart guidelines.test_ffi_leak_tracker: Runs tests forpackage:ffi_leak_trackertest_filepicker_windows: Runs tests forpackage:filepicker_windowstest_generator: Runs tests forpackage:generatortest_win32: Runs tests forpackage:win32test_win32_clipboard: Runs tests forpackage:win32_clipboardtest_win32_gamepad: Runs tests forpackage:win32_gamepadtest_win32_registry: Runs tests forpackage:win32_registrytest_win32_runner: Runs tests forpackage:win32_runnertest_winmd: Runs tests forpackage:winmd
-
Commit-msg Hook:
check_commit: Ensures the commit message follows Conventional Commits
๐ Creating a Pull Requestโ
After committing your changes, push them to your fork and create a pull request. When you open a pull request, tests will run automatically, and our maintainers will review it.
Please use the pull request template to provide details about your changes, ensuring a smoother review process.
Thank you for contributing to package:win32! ๐
- ๐ Good to Know
- ๐ How You Can Contribute
- ๐ ๏ธ Setting Up the Environment
- โ๏ธ Requirements
- ๐ฅ Cloning the Repository
- ๐ฆ Installing Dependencies
- ๐งฉ Setting Up Git Hooks
- ๐งช Running Tests
- ๐ Contributing to the Documentation
- ๐ป Contributing to the
package:win32Itself - Classic Win32 APIs
- COM APIs
- ๐ Committing Your Work and Preparing a Pull Request
- ๐จ Coding Style
- ๐ Commit Convention
- ๐งฉ Git Hooks
- ๐ Creating a Pull Request