Development of gerber-parser
has moved to tracespace/tracespace!
A printed circuit board Gerber and drill file parser. Implemented as a Node transform stream that takes a Gerber text stream and emits objects to be consumed by some sort of PCB plotter.
$ npm install gerber-parser
var fs = require("fs");
var gerberParser = require("gerber-parser");
var parser = gerberParser();
parser.on("warning", function(w) {
console.warn("warning at line " + w.line + ": " + w.message);
});
fs.createReadStream("/path/to/gerber/file.gbr")
.pipe(parser)
.on("data", function(obj) {
console.log(JSON.stringify(obj));
});
To run in the browser, this module should be bundled with a tool like browserify or webpack.
See API.md
Tests are written in Mocha and run in Node and a variety of browsers with Zuul and Open Sauce. All PRs should be accompanied by unit tests, with ideally one feature / bugfix per PR. Code is linted with ESLint.
Code is deployed on tags via TravisCI and code coverage is tracked with Coveralls.
$ npm test
- runs Node unit tests, calculates coverage, and runs the lint
task$ npm run coverage
- print the coverage report of the last test run$ npm run coverage:html
- generate an html report for the last test run$ npm run lint
- lints code$ npm run test:watch
- runs unit tests and re-runs on changes$ npm run test:browser
- runs tests in a local browser$ npm run test:sauce
- runs tests in Sauce Labs on multiple browsers
$ npm run ci
- Script for CI server to run
npm test
and sends coverage report to CoverallsThe module is published to npm automatically by Travis if the commit is tagged (and tests pass). To deploy:
$ npm version ...
- Use the npm version command to bump the version and tag the commit$ git push --tags
- Push the tag to trigger a build