Skip to content

Commit

Permalink
make serialport module as optional dependency #221
Browse files Browse the repository at this point in the history
  • Loading branch information
lsongdev committed Aug 20, 2019
1 parent b05089a commit d7c0ca6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion adapter/serial.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const util = require('util');
const EventEmitter = require('events');
const SerialPort = require('serialport');

/**
* SerialPort device
Expand All @@ -14,6 +13,7 @@ function Serial(port, options){
baudRate: 9600,
autoOpen: false
};
const SerialPort = require('serialport');
this.device = new SerialPort(port, options);
this.device.on('close', function() {
self.emit('disconnect', self.device);
Expand Down
20 changes: 11 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "ESC/POS Printer driver for nodejs",
"main": "index.js",
"scripts": {
"test": "mocha"
"test": "mocha",
"start": "node server.js"
},
"repository": {
"type": "git",
Expand All @@ -14,11 +15,7 @@
"escpos",
"printer"
],
"author": {
"name": "Lsong",
"email": "[email protected]",
"url": "https://lsong.org"
},
"author": "Lsong <[email protected]> (https://lsong.org)",
"contributors": [
"Jose Vera <[email protected]>",
"Sébastien Vidal <[email protected]>",
Expand All @@ -33,20 +30,25 @@
},
"homepage": "https://github.com/song940/node-escpos#readme",
"dependencies": {
"qr-image": "*",
"get-pixels": "*",
"iconv-lite": "*",
"mutable-buffer": "^2.0.3"
},
"optionalDependencies": {
"get-pixels": "*",
"serialport": "*",
"qr-image": "*",
"usb": "*",
"serialport": "*",
"node-bluetooth": "*"
},
"devDependencies": {
"mocha": "*"
},
"engines": {
"node": ">=8.x"
},
"directories": {
"doc": "docs",
"example": "examples",
"test": "test"
}
}

0 comments on commit d7c0ca6

Please sign in to comment.