Remove bindings dependency (require the built addon directly because the build output location is well-known and constant)

Add note about a possible error and its solution to the README
Improve .editorconfig
Run tests in CI workflow
This commit is contained in:
Martin Endler
2020-02-23 18:09:39 +01:00
parent 5964da0836
commit dacf2a082f
8 changed files with 46 additions and 20 deletions

View File

@@ -1,7 +1,13 @@
"use strict";
const EventEmitter = require('events');
const pcsclite = require('bindings')('pcsclite');
// pcsclite.node is a Node.js native C++ addon that is compiled during installation
// via node-gyp (see package.json > scripts > install)
// the build output name and directory is constant so we can require it directly
// see https://github.com/nodejs/node-gyp/issues/263, https://github.com/nodejs/node-gyp/issues/631
const pcsclite = require('../build/Release/pcsclite.node');
const { PCSCLite, CardReader } = pcsclite;