Skip to content
This repository has been archived by the owner on Oct 10, 2019. It is now read-only.

mcous/gerber-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

05aa729 · Oct 10, 2019
May 24, 2018
May 24, 2018
Jul 26, 2016
Jul 26, 2016
May 24, 2018
Jul 26, 2016
Feb 28, 2016
Sep 9, 2015
Oct 10, 2019
May 24, 2018

Repository files navigation

repository deprecated

Development of gerber-parser has moved to tracespace/tracespace!

gerber parser

npm Travis Coveralls David David

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.

how to

$ 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.

api

See API.md

developing and contributing

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.

build scripts

  • $ 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
    • Sauce Labs account required
    • Local .zuulrc required
  • $ npm run ci - Script for CI server to run
    • Runs npm test and sends coverage report to Coveralls
    • If not a PR, runs browser tests in Sauce
    • Not designed to (and won't) run locally

deploying

The module is published to npm automatically by Travis if the commit is tagged (and tests pass). To deploy:

  1. $ npm version ... - Use the npm version command to bump the version and tag the commit
  2. $ git push --tags - Push the tag to trigger a build