This module is a C++ wrapper around the Zint barcode library. The version of zint that will be used will be determined by the git reference stored in the
zintVersion field of
Source code management
Upon installation of dependencies (
yarn install), a copy of the Zint source repo will be cloned in the Git-ignored
.zint directory, and its relevant C source files are referenced in
binding.gyp, along with
src/binding/main.cpp. The compiled
.zint is created, the same install script will then apply a small number of patches to some Zint source files to adapt it to the following needs:
rendered_dataas a char array to be populated with raw string output.
ps.cto write to the
rendered_databuffer instead of
Utilization of Nan
This project utilizes Nan to make the project backwards-compatible and make bindings future-proof.
Building the project
Builds are created using
Upon installation of dependencies,
node-pre-gyp build will be run, which will compile the project from source.
Building on Windows
npm install --global --production windows-build-tools --vs2017 npm config set msvs_version 2017 –global
This install takes a while, but once it's complete, you can move on to Creating a build below.
Creating a build
To create a packaged build, run:
Tests are written as
*.test.js and utilize Jest.
Both unit and e2e tests are written for this project. To run all tests:
Unit tests are specified in the
__tests__ subdirectories under
To run unit tests:
Test coverage results are sent to Codecov.
e2e tests are specified in the
test/e2e directory. They utilize jest-image-snapshot for comparisons of barcode images in tandem with the helper test method,
To run e2e tests:
Automated builds and CI
GitHub Actions will automatically build and test pull requests. At least one admin PR approval and all status checks are required to merge a PR.
The following status checks are implemented:
- Successful Windows builds (AppVeyor)
- Successful Linux and macOS builds (Travis)
- Sufficient code coverage (threshold >90%)
Upon the successful merge of a PR, CI will create an automated release of the binaries on GitHub (via
node-pre-gyp-github), publish to npm, and push the updated changelog and version bump changes to GitHub.
The package version is automatically updated. Do not change any version references in this project.
All constructive feedback and pull request changes are welcome. For more information on contributing to this project, please see the Contributing Guidelines.