A stub/skeleton project for developing Components. Uses Grunt to run jshint on your source file, install dependencies, build your component and then run tests using mocha-phantomjs with chai.
Hard to say if this step is essential, but I found the test runner only works if PhantomJS is installed, is up to date, and is in your $PATH environment var. This may apply only to windows.
Clone the repo to a useful folder, remove the existing remote repo and add your own.
$ git clone [email protected]:CharlotteGore/component-skeleton.git difference-engine-emulator
$ cd difference-engine-emulator
$ git remote rm origin
$ git remote add origin [email protected]:AdaLovelace/difference-engine-emulator.git
$ npm install
If you don't have Grunt cli installed already, you should also do:
$ npm install -g grunt-cli
And if you haven't got Component cli tools already installed you should do:
$ npm install -g component
And you're going to need node and npm installed to do any of this. Obviously.
The component.json in the repo is just a stup. As a minimum, replace
"name": "component-skeleton",
"repo": "charlottegore/component-skeleton",
"description": "Replace this with the description of the module",
with
"name": "difference-engine-emulator",
"repo": "adalovelace/difference-engine-emulator",
"description": "A Javascript emulation of Babbage's Difference Engine. He never finished it, lazy bugger.",
In this example, after pushing up to github, everyone can do...
$ component install adalovelace/difference-engine-emulator
.. and then invoke your module with
var engine = require('difference-engine-emulator')
Runs the tests. In this case, it uses mocha-phantomjs with chai to open the testrunner.html, which loads test.js.
All set up, ready to go... just add tests.
This actually works on Windows, too.
$ grunt test
Installs Component dependencies
$ grunt install
Builds the Component to build/build.js
$ grunt build
Runs JSHint against index.js
$ grunt jshint
Watches index.js and when it detects changes it runs jshint, then install, then build then test automatically.
$ grunt watch
MIT