From 044e48a9f914c609a5eeae718bffd6b9d2b9c976 Mon Sep 17 00:00:00 2001 From: chenghan Date: Tue, 21 Jul 2026 13:05:52 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=98=9F=E7=81=AB=E4=BC=A0=E7=81=AF?= =?UTF-8?q?=EF=BC=8C=E9=A6=96=E9=A1=B5=E7=95=99=E8=BE=89=20=C2=B7=20add=20?= =?UTF-8?q?Star=20CTA,=20CONTRIBUTING.md,=20and=20CODE=5FOF=5FCONDUCT.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CODE_OF_CONDUCT.md | 55 ++++++++++++++++++++++++++++++ CONTRIBUTING.md | 83 ++++++++++++++++++++++++++++++++++++++++++++++ README.md | 6 +++- README.zh-CN.md | 6 +++- 4 files changed, 148 insertions(+), 2 deletions(-) create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..94768a4 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,55 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior: + +- The use of sexualized language or imagery, and sexual attention or + advances of any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email + address, without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at the repository's issue tracker. +All complaints will be reviewed and investigated promptly and fairly. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..55fa29c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,83 @@ +# Contributing to light-ocr + +Thank you for your interest in contributing! `light-ocr` is an open-source OCR engine for Node.js and C++, and we welcome issues, pull requests, and feedback of all kinds. + +## Getting started + +### Prerequisites + +- **CMake 3.30+** and a C++17 compiler (MSVC 2022, Clang 15+, GCC 13+) +- **Node.js 22 or 24** (for the Node.js binding) +- **npm** (for building and testing the npm package) + +### Build from source + +```bash +# Clone and initialize submodules +git clone https://github.com/arcships/light-ocr.git +cd light-ocr + +# Configure and build the C++ core +cmake --preset default +cmake --build --preset default + +# Build the Node.js addon +cd bindings/node +npm install +npm run build +``` + +See [Build and release](docs/build-and-release.md) for detailed platform-specific setup. + +### Run tests + +```bash +# C++ core tests +ctest --preset default + +# Node.js binding tests +cd bindings/node +npm test +``` + +## How to contribute + +### Reporting bugs + +Open an issue and include: + +- **Platform**: OS, architecture (e.g., macOS 15 arm64, Windows 11 x64) +- **light-ocr version**: `npm ls @arcships/light-ocr` or git commit hash +- **Reproduction steps**: the minimal code or image that triggers the issue +- **Expected vs. actual behavior** + +### Proposing features + +Start with an issue describing the problem you want to solve before sending a pull request. This helps us discuss the approach and avoid wasted effort. + +### Pull requests + +1. Create a branch from `main` with a descriptive name (e.g., `fix/tiled-crash`, `feat/wasm-backend`). +2. Make focused changes — one concern per PR. +3. Add or update tests that cover your change. +4. Ensure `ctest --preset default` and `npm test` pass. +5. Follow the existing code style. +6. Update relevant documentation if your change affects the public API. + +### Commit style + +We use [Conventional Commits](https://www.conventionalcommits.org/): + +``` +feat(core): 飞鸿踏雪,瓦丝初成 · add WASM backend +fix(node): 云开见月,死锁自解 · resolve engine close deadlock +docs: 笔落惊风,案卷生辉 · update acceleration docs +``` + +## Need help? + +Ask a question in [Discussions](https://github.com/arcships/light-ocr/discussions) or open an issue — we're happy to help! + +## License + +By contributing, you agree that your contributions will be licensed under the [Apache License 2.0](LICENSE). diff --git a/README.md b/README.md index ba10739..5e95ae2 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ await engine.close(); - **Application-friendly execution.** Recognition runs off the JavaScript main thread and supports queues, cancellation, and explicit cleanup. - **Small text in large images.** An optional `tiled` mode preserves small and dense text in high-resolution images. +> ⭐ **Like light-ocr?** Give it a star — it helps others discover the project and keeps us motivated! + ## Platform acceleration The npm package provides the following four builds. The default `createEngine()` call uses Auto mode: @@ -96,4 +98,6 @@ C++ projects build the static library from source and link the `light_ocr::core` ## Community and license -Issues and pull requests are welcome. `light-ocr` is available under the [Apache License 2.0](LICENSE). +Issues and pull requests are welcome — see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. All participants are expected to follow our [Code of Conduct](CODE_OF_CONDUCT.md). + +`light-ocr` is available under the [Apache License 2.0](LICENSE). diff --git a/README.zh-CN.md b/README.zh-CN.md index f50e4f3..37f575f 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -49,6 +49,8 @@ await engine.close(); - **适合应用内调用。**识别任务在 JavaScript 主线程之外执行,并支持队列、取消和明确释放资源。 - **识别大图中的小字。**可选的 `tiled` 模式可以保留高分辨率图片中的小字和密集文字。 +> ⭐ **觉得 light-ocr 有用?** 点个 Star,让更多人发现这个项目! + ## 平台加速 npm 包提供以下四个平台版本。默认的 `createEngine()` 使用 Auto 模式: @@ -94,4 +96,6 @@ C++ 项目从源码构建静态库,并链接 `light_ocr::core` CMake target。 ## 社区与协议 -欢迎提交 issue 和 pull request。`light-ocr` 使用 [Apache License 2.0](LICENSE)。 +欢迎提交 issue 和 pull request — 请先阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 了解贡献指南。所有参与者须遵守[行为准则](CODE_OF_CONDUCT.md)。 + +`light-ocr` 使用 [Apache License 2.0](LICENSE)。