Skip to content

bogwro/darts-scorer-core

Repository files navigation

darts-scorer-core

Build Status Code Coverage Documentation Coverage npm Dependency Status devDependency Status semantic-release

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

Online Implementation

Implementation's Source Code

Installation

npm install darts-scorer-core --save-dev

Example Usage

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();

Contributing

Follow the airbnb styleguide.

Requires node ^5.0.0.

npm install 

QA

Run tests & coverage report during development

npm run test:all

Manage files

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

Upgrade Node version

nvm install stable && nvm current > .nvmrc

Upgrade packages

npm run upgrade-packages

Test the app before committing

License

MIT