Code Monkey home page Code Monkey logo

component-skeleton's Introduction

Component Skeleton

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.

PhantomJS

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.

Installation

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.

Basic configuration of the component.json

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')

Grunt commands

Test

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

Install

Installs Component dependencies

$ grunt install

Build

Builds the Component to build/build.js

$ grunt build

Jshint

Runs JSHint against index.js

$ grunt jshint

Watch

Watches index.js and when it detects changes it runs jshint, then install, then build then test automatically.

$ grunt watch

License

MIT

component-skeleton's People

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.