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

Commit

Permalink
Merge pull request #2 from tracespace/beta-release
Browse files Browse the repository at this point in the history
Beta release
  • Loading branch information
mcous authored Jul 25, 2016
2 parents 2217c1e + 403e076 commit 6083d66
Show file tree
Hide file tree
Showing 34 changed files with 585 additions and 397 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
node_modules
public/*.js
public/*.css
public/stats.html
coverage
.nyc_output
17 changes: 17 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
sudo: false
language: node_js
node_js:
- '6'
script: npm test && npm run build
after_success: npm run coverage:ci
deploy:
provider: script
skip_cleanup: true
script: npm run deploy
on:
repo: tracespace/viewer
tags: true
all_branches: true
env:
global:
secure: M/MgaJEOmT7Vg8p2MAiNKzGpAPgNZJtUKHEGcv6vm55TfXQ+7BwZYjr2xU+A+LvqMSU1aQEZWnX7TeD94YZExmEIptrgz9Q1D3E4UXPEMY3ojJp9jRnuJQghe6TzBV62ERrAK+aYpb2+ONHfIfmV54+gSj3aT/kTzQeR5Uv83yItZJ1WhaDQgvUTbMiORt+6yQl8GE0uG6VAam0uPQ4e6xdFVQLA2uVXKwsDDkBuMydhDFCT8CUgPE2dvTu+WU5d00mmP56AmUbncVvw3E3GfhYMW+CaqsWiNb3cpNwcb/afiUTf48fal8oAUYvPJtecydQ9b4fCtqTHpUCYoch/dcaeiM/cLKC4CSYvgxAyRybDxsCQJlixgT7YLf9fETnKvTCDz9sz5MzZmBGtVgGe4CjnGH3aeiE7lwlEaHui/dnHlz6XLB+FucUbClNxCcnGvA3uB50lrAzkj9jxBnvAnS+sljTK/AAz1nu/8GHZK8xOlOEmEWdVGNgPPmOzCF1t0EsB5gRURLBWGGAQXferB/dqnTRyjKI/H/0cUsYNHdMv1G4sJB1I3weuYtZMbkVqqycVP0TLKG0/5a/TDhZgOpd05Q10fjdRrC/wU7guNINHV8Qes08Bx2kcQk55GC/R42edasWZ89JrR3NvaUesNsR33CZGMoAzpcQ3uOwXTUA=
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,51 @@
# tracespace pcb viewer
# tracespace viewer (beta)

[![Travis](https://img.shields.io/travis/tracespace/viewer.svg?style=flat-square)](https://travis-ci.org/tracespace/viewer)
[![Coveralls](https://img.shields.io/coveralls/tracespace/viewer.svg?style=flat-square)](https://coveralls.io/github/tracespace/viewer)
[![GitHub stars](https://img.shields.io/github/stars/tracespace/viewer.svg?style=flat-square&label=%E2%AD%90&maxAge=2592000)](https://github.com/tracespace/viewer)
[![GitHub issues](https://img.shields.io/github/issues/tracespace/viewer.svg?style=flat-square&maxAge=2592000)](https://github.com/tracespace/viewer/issues)
[![Travis](https://img.shields.io/travis/tracespace/viewer/master.svg?style=flat-square)](https://travis-ci.org/tracespace/viewer)
[![Coveralls](https://img.shields.io/coveralls/tracespace/viewer/master.svg?style=flat-square)](https://coveralls.io/github/tracespace/viewer)
[![David](https://img.shields.io/david/tracespace/viewer.svg?style=flat-square)](https://david-dm.org/tracespace/viewer)
[![David devDependences](https://img.shields.io/david/dev/tracespace/viewer.svg?style=flat-square)](https://david-dm.org/tracespace/viewer#info=devDependencies)

[![GitHub stars](https://img.shields.io/github/stars/tracespace/viewer.svg?style=social&label=Star&maxAge=2592000?style=flat-square)](https://github.com/tracespace/viewer)
Probably the best printed circuit board viewer on the internet

[http://viewer.tracespace.io](viewer.tracespace.io)

Probably the best printed circuit board viewer on the internet.
<http://viewer.tracespace.io>

## about

This particular PCB viewer takes your gerber and drill files and gives you individual layer renders as well as very fancy renders of what your completed boards are going to look like. It does this all locally using the [gerber-to-svg](https://github.com/mcous/gerber-to-svg) module, so nothing gets sent to any server. Also, because the renders are SVGs, they're super easy to save and show off.
This particular PCB viewer takes your Gerber and drill files and gives you individual layer renders as well as very fancy renders of what your completed boards are going to look like.

Using awesome new web technologies, the tracespace viewer also works offline and saves your renders locally. Pretty cool.
The tracespace viewer accomplishes all this locally (nothing gets sent to any server!) by converting your files to SVGs. Thanks to the "Scalable" and "Vector" in "SVG", the renders are easy to examine and quite accurate.

## motivation

Because you should always check your design files for problems! Existing Gerber viewers are good, but tend not to give you a full picture of what your board will look like, meaning you can miss important details (shout out to [OSH Park](https://oshpark.com) for super cool renders by default). Gerber files (i.e. your PCB manufacturing files) are vector image files, so it makes sense to convert them into a web-friendly vector format. And an offline-enabled web-app means you don't have to worry about downloading or updating any software, and you'll still always have your the viewer available.
Because you should always check your design files for problems! Existing Gerber viewers are good, but tend not to give you a full picture of what your board will look like, meaning you can miss important details (shout out to [OSH Park](https://oshpark.com) for super cool renders by default). Gerber files (i.e. your PCB manufacturing files) are vector image files, so it makes sense to convert them into a scalable, web-friendly vector format.

## issues

See something that doesn't look right? [Open an issue!](https://github.com/tracespace/viewer/issues) Screenshots and Gerber files help if you're able to. If you're not comfortable publicly posting your designs, you can also email [email protected] with your issue.
See something that doesn't look right? [Open an issue!](https://github.com/tracespace/viewer/issues) Screenshots and Gerber files help if you're able to. If you're not comfortable publicly posting your designs, you can also email <[email protected]> with your issue.

If you're technically inclined, PR's are always welcome!

## contributing

This site is written in ES2015 and uses [babel](https://babeljs.io/) and [webpack](http://webpack.github.io/) to run in your browser. The state layer is build using [redux](http://rackt.github.io/redux/) and the view layer is built with [deku](http://dekujs.github.io/deku/index.html). Rendering is accomplished with [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API), [gerber-to-svg](https://github.com/mcous/gerber-to-svg), and the [tracespace pcb stackup builder](https://github.com/tracespace/pcb-stackup). Local data is stored in [indexedDB](https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API).
This site is written in [ES2040](https://github.com/ahdinosaur/es2040) and uses [babel](https://babeljs.io/) and [webpack](http://webpack.github.io/) to build for the browser. The state layer is build using [redux](http://rackt.github.io/redux/) and the view layer is built with [deku](https://github.com/anthonyshort/deku). Rendering is accomplished with [web workers](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API), [gerber-to-svg](https://github.com/mcous/gerber-to-svg), and the [tracespace pcb stackup builder](https://github.com/tracespace/pcb-stackup-core).

Tests are run with [ava](https://github.com/avajs/ava) and code is linted with [eslint](http://eslint.org/). Please make sure any PRs are accompanied by unit tests. We use [travis](https://travis-ci.org/) as our CI server.

Tests are run with [mocha](http://mochajs.org/) and code is linted with [eslint](http://eslint.org/). Please make sure any PRs are accompanied by unit tests. We use [travis](https://travis-ci.org/) as our CI server and run browser tests with [sauce labs](https://saucelabs.com/opensauce/) and [zuul](https://github.com/defunctzombie/zuul).
This app is hosted on [GitHub Pages](https://pages.github.com/).

### build scripts

Nothing fancy here, just npm scripts. See [package.json](package.json) for the full list. These are the important ones:
Nothing fancy here, just npm scripts. See [package.json](https://github.com/tracespace/viewer/blob/master/package.json) for the full list. These are the important ones:

* `$ npm start` - starts an HMR dev server at [localhost:8080](http://localhost:8080)
* `$ npm test` - run tests
* `$ npm run test:watch` - run tests on code changes
* `$ npm run test:browser` - run tests locally in a browser of your choosing
* `$ npm run test:sauce` - run the tests on sauce (sauce credentials in [.zuulrc](https://github.com/defunctzombie/zuul/wiki/Zuulrc) required)
* `$ npm run deploy` - builds and deploys the site (credentials required)

### deploying

The site is deployed 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
92 changes: 92 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// build configs
'use strict'

const path = require('path')
const webpack = require('webpack')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const Visualizer = require('webpack-visualizer-plugin')

// postcss plugins
const postcssImport = require('postcss-import')
const cssnext = require('postcss-cssnext')

const resolve = (file) => path.resolve(__dirname, file)

const ENTRY = resolve('../src/index.js')
const OUT = resolve('../public')
const JS_OUT = 'bundle.js'
const CSS_OUT = 'bundle.css'

const PROD_PLUGIN_OPTS = {
'process.env': {NODE_ENV: JSON.stringify('production')}
}

const BASE_CONFIG = {
devtool: '#source-map',
entry: [ENTRY],
output: {
path: OUT,
filename: JS_OUT,
library: 'app',
publicPath: '/'
},
postcss: (wpContext) => [
postcssImport({addDependencyTo: wpContext}),
cssnext
],
module: {}
}

module.exports = {
create(plugins = [], loaders = []) {
const config = Object.assign({}, BASE_CONFIG)

config.plugins = plugins.map((factory) => factory())
config.module.loaders = loaders

return config
},

plugin: {
prodEnv: () => new webpack.DefinePlugin(PROD_PLUGIN_OPTS),
occurrence: () => new webpack.optimize.OccurrenceOrderPlugin(),
dedupe: () => new webpack.optimize.DedupePlugin(),
uglifyJs: () => new webpack.optimize.UglifyJsPlugin(),
extractCss: () => new ExtractTextPlugin(CSS_OUT),
visualizeBundle: () => new Visualizer(),
hmr: () => new webpack.HotModuleReplacementPlugin(),
noErrors: () => new webpack.NoErrorsPlugin()
},

loader: {
worker: {
test: /\worker\.js$/,
exclude: /node_modules/,
loader: 'worker'
},

babel: {
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2040']
}
},

css: {
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader'
},

cssExtracted: {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader!postcss-loader')
},

markdown: {
test: /\.md$/,
loader: 'html!markdown'
}
}
}
34 changes: 27 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@
"main": "src/index.js",
"scripts": {
"start": "node server.js",
"lint": "eslint 'src/**/*.js' 'test/**/*.js'",
"prebuild": "rm -f public/*.js public/*.map public/*.css public/stats.html",
"build": "webpack",
"lint": "eslint '*.js' 'config/*.js' 'src/**/*.js' 'test/**/*.js'",
"test": "nyc --all --include='src/**/*.js' ava --verbose",
"test:watch": "ava --watch",
"test:browser": "echo 'script not implemented' && exit 1",
"test:sauce": "echo 'script not implemented' && exit 1",
"posttest": "npm run lint",
"deploy": "echo 'script not implemented' && exit 1",
"coverage": "nyc report",
"coverage:html": "nyc report --reporter=html"
"coverage:html": "nyc report --reporter=html",
"coverage:ci": "nyc report --reporter=text-lcov | coveralls",
"ci:gitconfig:name": "git config --global user.name 'tracespace bot'",
"ci:gitconfig:email": "git config --global user.email '[email protected]'",
"ci:gitconfig": "npm run ci:gitconfig:name && npm run ci:gitconfig:email",
"predeploy": "if [ \"$CI\" = \"true\" ]; then npm run ci:gitconfig; fi",
"deploy": "gh-pages -x -r https://[email protected]/tracespace/viewer.git -d public -m \"Build $TRAVIS_BUILD_NUMBER\""
},
"repository": {
"type": "git",
Expand All @@ -28,20 +33,32 @@
"engines": {
"node": ">=6.0.0"
},
"private": true,
"devDependencies": {
"amp-has-class": "^1.0.3",
"ava": "^0.15.2",
"babel-core": "^6.11.4",
"babel-loader": "^6.2.4",
"babel-preset-es2040": "^1.1.1",
"eslint": "^2.9.0",
"coveralls": "^2.11.11",
"css-loader": "^0.23.1",
"eslint": "^3.1.1",
"express": "^4.13.4",
"extract-text-webpack-plugin": "^1.0.1",
"gh-pages": "^0.11.0",
"html-loader": "^0.4.3",
"jsdom": "^9.4.1",
"markdown-loader": "^0.1.7",
"nyc": "^7.0.0",
"postcss-cssnext": "^2.7.0",
"postcss-import": "^8.1.2",
"postcss-loader": "^0.9.1",
"sinon": "^1.17.4",
"style-loader": "^0.13.1",
"webpack": "^1.13.0",
"webpack-dev-middleware": "^1.6.1",
"webpack-hot-middleware": "^2.10.0",
"webpack-visualizer-plugin": "^0.1.5",
"worker-loader": "^0.7.0"
},
"dependencies": {
Expand All @@ -50,11 +67,12 @@
"deku": "^2.0.0-rc16",
"filereader-stream": "^1.0.0",
"gerber-to-svg": "^2.0.1",
"is-svg-element": "github:tracespace/is-svg-element#v1.0.1",
"lodash.omit": "^4.3.0",
"lodash.set": "^4.2.0",
"lodash.uniqueid": "^4.0.0",
"lodash.without": "^4.2.0",
"pcb-stackup-core": "^1.0.0",
"pcb-stackup-core": "^2.0.0",
"raf": "^3.2.0",
"randomcolor": "^0.4.4",
"redux": "^3.5.2",
Expand All @@ -63,6 +81,8 @@
"redux-throttle": "^0.1.1",
"reselect": "^2.5.1",
"shortid": "^2.2.6",
"tachyons": "^4.0.4",
"tachyons-z-index": "^1.0.0",
"viewbox": "^1.0.0",
"whats-that-gerber": "^2.0.1"
}
Expand Down
1 change: 1 addition & 0 deletions public/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
viewer.tracespace.io
Loading

0 comments on commit 6083d66

Please sign in to comment.