This is a core module for building Darts games and front-end.
It is easy to extend to match own needs.
Check-out Online Playground
npm install darts-scorer-core --save-dev
Depends on the way how you want to use this library, there are two ways of building dependency on it.
- ES6
import dartsScorerCore from 'darts-scorer-core';
- Node / Browser
var dartsScorerCore = require("darts-scorer-core");
// `default` is used by `webpack` to be ready for ES6
// next line is not needed when used in workflow where `webpack` is being used
dartsScorerCore = dartsScorerCore.default || dartsScorerCore;
The rest of the code follows ES6 notation:
let player1 = new dartsScorerCore.Player('Player 1');
let player2 = new dartsScorerCore.Player('Player 2');
let game = new dartsScorerCore.games.Darts501Game([player1, player2]);
game.throw(10);
game.throw(15, 2);
game.throw(20, 3);
console.log('Player 1 points', game.currentPlayerTotalPoints);
game.nextPlayer();
game.throw(1);
game.throw(18, 2);
game.throw(19, 3);
console.log('Player 2 points', game.currentPlayerTotalPoints);
game.nextRound();
Follow the airbnb styleguide.
Requires node ^5.0.0
.
npm install
Run tests & coverage report during development
npm run test:all
Use terminal
to manage files using git commands, for example:
git status
git add .
Use dedicated script to commit changes to git repository:
npm run commit
Push changes to the server:
git push origin master
Check status of the build
When the build is successful and there is at least one bug fix or new feature that is committed since last release than there should be a new npm release as well as new tag and release on GitHub
nvm install stable && nvm current > .nvmrc
npm run upgrade-packages
Test the app before committing
MIT