You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository demonstrates building a small native Node.js addon with `node-addon-api` and provides a JavaScript wrapper with Promise and callback-compatible interfaces.
5
+
`@ssxv/node-printer` is an N-API native addon exposing a small set of printing APIs to Node.js. The project started as a Windows (Winspool) proof-of-concept and has been extended to include POSIX (CUPS) support so the addon can be built and used on both Windows and Linux systems.
6
6
7
-
Documentation is under the `docs/` folder. Start at `docs/index.md` for an overview and links.
- Unit tests are mock-driven and deterministic; unit tests load a JS mock for the native binding so they run on non-Windows CI.
38
-
- Integration/native tests are gated. To run integration tests on Windows set `RUN_INTEGRATION=1` in the environment and ensure a test printer is available.
39
-
40
-
Prebuilds and publishing
41
-
- To provide painless installs for Windows users, publish prebuilt binaries (per Node ABI and architecture) and keep the `install` script in `package.json` as `prebuild-install || node-gyp rebuild` so installations prefer prebuilt binaries and fall back to source builds.
42
-
- CI should build and attach prebuild artifacts to GitHub Releases for each supported Node.js version and architecture you want to support.
54
+
Prebuilt binaries & publishing
55
+
- The repository includes a workflow `.github/workflows/prebuild-and-publish.yml` which builds prebuilt binaries on Windows and Linux runners for supported Node.js versions and uploads them as release artifacts. The install flow prefers prebuilt binaries and falls back to source builds using the `install` script in `package.json` (`prebuild-install || node-gyp rebuild`).
56
+
- If you maintain a package registry release, ensure CI publishes prebuilt artifacts for all target Node.js versions and architectures you intend to support.
43
57
44
-
Documentation
45
-
-Start here: `docs/index.md`
46
-
-Architecture & data flow: `docs/ARCHITECTURE.md`
47
-
-Type definitions: `types/index.d.ts`
58
+
Build notes & troubleshooting
59
+
-Windows: Visual Studio Build Tools (MSVC) + Python are required to compile the native addon. Follow the Node.js native build tooling docs for setting up `node-gyp` on Windows.
60
+
-Linux: `libcups2-dev` (or the distribution equivalent) is required to build the POSIX/CUPS native sources. On Debian/Ubuntu: `sudo apt-get install libcups2-dev build-essential python3`.
61
+
-If `prebuild-install` cannot find a compatible prebuilt binary during `npm install`, the package will fall back to a source build and you will need the platform build toolchain installed.
48
62
49
-
Notes
50
-
- This PoC implements Windows (Winspool) functionality only. POSIX/CUPS support is planned separately.
51
-
- Consider adding `"os": ["win32"]` to `package.json` to restrict installs to Windows if appropriate.
63
+
Notes on driver option parsing (CUPS)
64
+
- The POSIX implementation retrieves driver/option information from libcups. Historically the project used deprecated PPD helper APIs; the codebase has been migrated to use non-deprecated libcups APIs and, where available, `cupsCopyDestInfo`-style calls to gather richer printer driver metadata. Builds against older libcups that lack newer APIs will fall back to a conservative mapping of the destination options (name → value).
0 commit comments