This module is a C++ wrapper around the Zint barcode library (opens new window). 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 (opens new window), along with
src/binding/main.cpp (opens new window). The compiled
src/index.js (opens new window).
.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 (opens new window) to make the project backwards-compatible and make bindings future-proof.
# Building the project
Builds are created using
node-pre-gyp (opens new window).
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:
# Running tests
Tests are written as
*.test.js and utilize Jest (opens new window).
Both unit and e2e tests are written for this project. To run all tests:
# Unit tests
Unit tests are specified in the
__tests__ subdirectories under
To run unit tests:
Test coverage results are sent to Codecov (opens new window).
# e2e tests
e2e tests are specified in the
test/e2e directory. They utilize jest-image-snapshot (opens new window) for comparisons of barcode images in tandem with the helper test method,
To run e2e tests:
Commit message standards abide by
standard-changelog (opens new window). This module utilizes
commitizen (opens new window) as a devDependency to help developers write their commits, and commit messages are enforced using
commitlint (opens new window).
# 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 (opens new window)), 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 (opens new window).