New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/webpack #2

Merged
merged 7 commits into from Nov 28, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+247 −181
Diff settings

Always

Just for now

Copy path View file
@@ -70,3 +70,7 @@ Icon?
Thumbs.db
packages
build
dist

# Webpack
src/bundle.js
Copy path View file
@@ -0,0 +1,6 @@
{
"compilerOptions": {
"target": "ES6",
"module": "commonjs"
}
}
Copy path View file
@@ -2,7 +2,14 @@
"name": "angular-blackjack",
"version": "0.0.1",
"devDependencies": {
"babel": "^6.1.18",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"css-loader": "^0.23.0",
"del": "^1.1.1",
"file-loader": "^0.8.5",
"gulp": "^3.8.11",
"gulp-concat": "^2.5.0",
"gulp-gh-pages": "^0.5.0",
@@ -12,6 +19,23 @@
"karma": "^0.12.31",
"karma-jasmine": "^0.3.5",
"karma-phantomjs-launcher": "^0.1.4",
"main-bower-files": "^2.5.0"
"main-bower-files": "^2.5.0",
"ng-annotate-loader": "0.0.10",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
},
"dependencies": {
"angular": "^1.4.8",
"angular-hotkeys": "^1.6.0",
"bootstrap": "^3.3.6",
"jquery": "^2.1.4",
"mousetrap": "^1.5.3"
},
"scripts": {
"start": "node_modules/.bin/webpack-dev-server --content-base src",
"build": "NODE_ENV=production node node_modules/.bin/webpack && cp src/index.html dist/index.html"
}
}
Copy path View file
@@ -1,14 +1,7 @@
(function () {
'use strict';

angular
.module('blackjack.card')
.directive('blackjackCard', BlackjackCard)
.controller('BlackjackCardController', BlackjackCardController);
import BlackjackCardController from './card';

BlackjackCard.$inject = ['$window'];

BlackjackCardController.$inject = ['$scope'];
/* @ngInject */
function BlackjackCard($window)
{
@@ -26,58 +19,12 @@
card: '=',
cardIndex: '@'
},
controller: 'BlackjackCardController',
controller: BlackjackCardController,
controllerAs: 'vm',
bindToController: true
};
return directive;

}

/* @ngInject */
function BlackjackCardController($scope){
var vm = this;

vm.rank;
vm.suit;

vm.init = function(){
vm.displayCard();

$scope.$watchCollection('vm.card',function(newC,oldC){
vm.displayCard();
});
};

vm.displayCard = function(){
if(vm.hideValue){
vm.suit = 'back';
vm.rank = '';
}
else {
vm.rank = vm.card.rank;
var cardSuit;
switch (vm.card.suit) {
//'C', 'D', 'S', 'H'
case 'C':
cardSuit = 'suitclubs';
break;
case 'D':
cardSuit = 'suitdiamonds';
break;
case 'H':
cardSuit = 'suithearts';
break;
case 'S':
cardSuit = 'suitspades';
break;
}
vm.suit = cardSuit;
}

vm.cardIndexClass = 'card-index-' + vm.cardIndex;
};

vm.init();
}
})();
export default BlackjackCard;
@@ -1,10 +1,3 @@
(function () {
'use strict';

angular
.module('blackjack.card')
.directive('blackjackHand', BlackjackHand);

/* @ngInject */
function BlackjackHand()
{
@@ -24,4 +17,5 @@
return directive;

}
})();

export default BlackjackHand;
Copy path View file
@@ -0,0 +1,50 @@
BlackjackCardController.$inject = ['$scope'];

/* @ngInject */
function BlackjackCardController($scope){
var vm = this;

vm.rank;
vm.suit;

vm.init = function(){
vm.displayCard();

$scope.$watchCollection('vm.card',function(newC,oldC){
vm.displayCard();
});
};

vm.displayCard = function(){
if(vm.hideValue){
vm.suit = 'back';
vm.rank = '';
}
else {
vm.rank = vm.card.rank;
var cardSuit;
switch (vm.card.suit) {
//'C', 'D', 'S', 'H'
case 'C':
cardSuit = 'suitclubs';
break;
case 'D':
cardSuit = 'suitdiamonds';
break;
case 'H':
cardSuit = 'suithearts';
break;
case 'S':
cardSuit = 'suitspades';
break;
}
vm.suit = cardSuit;
}

vm.cardIndexClass = 'card-index-' + vm.cardIndex;
};

vm.init();
}

export default BlackjackCardController;
Copy path View file

This file was deleted.

Oops, something went wrong.
Copy path View file
@@ -1,11 +1,3 @@
(function () {
'use strict';

angular
.module('blackjack.card')
.factory('CardService', CardService);


function CardService(){
var service = {
newDeck: newDeck,
@@ -92,4 +84,4 @@

}

})();
export default CardService;
Copy path View file
@@ -0,0 +1,13 @@
import angular from 'angular';
import BlackjackCard from './card.directive';
import CardService from './card.service';
import BlackjackHand from './card.hand.directive';

let cardModule = angular.module('blackjack.card', []);

cardModule
.directive('blackjackCard', BlackjackCard)
.factory('CardService', CardService)
.directive('blackjackHand', BlackjackHand);

export default cardModule;

This file was deleted.

Oops, something went wrong.
@@ -1,10 +1,3 @@
(function () {
'use strict';

angular
.module('blackjack.dealer')
.factory('DealerService', DealerService);

DealerService.$inject =['$timeout','GameService'];

function DealerService($timeout, GameService){
@@ -119,9 +112,6 @@
return service;

////////////////



}

})();
export default DealerService;
Copy path View file
@@ -0,0 +1,9 @@
import angular from 'angular';
import DealerService from './dealer.service';

let dealerModule = angular.module('blackjack.dealer', []);

dealerModule
.factory('DealerService', DealerService);

export default dealerModule;
Copy path View file
@@ -1,10 +1,3 @@
(function(){
'use strict';

angular
.module('blackjack.game')
.controller('GameController',GameController);

GameController.$inject = ['$timeout','PlayerService', 'CardService', 'GameService', 'DealerService', 'hotkeys'];

function GameController($timeout, PlayerService, CardService, GameService, DealerService, hotkeys){
@@ -237,4 +230,6 @@

game.init();
}
})();

export default GameController;

Copy path View file
@@ -1,16 +1,14 @@
(function(){
'use strict';
import GameController from './game.controller';
import template from './game.directive.html';

angular
.module('blackjack.game')
.directive('blackjackGame', blackjackGame);

function blackjackGame(){
let GameDirective =
function (){
return {
restrict: 'E',
templateUrl: 'app/game/game.directive.html',
controller: 'GameController',
template: template,
controller: GameController,
controllerAs: 'game'
}
}
})();
};

export default GameDirective;
Copy path View file

This file was deleted.

Oops, something went wrong.
Copy path View file
@@ -1,10 +1,3 @@
(function(){
'use strict';

angular
.module('blackjack.game')
.factory('GameService', GameService);

function GameService(){
var service = {
handValue: handValue,
@@ -63,4 +56,5 @@

return service;
}
})();

export default GameService;
Copy path View file
@@ -0,0 +1,11 @@
import angular from 'angular';
import GameDirective from './game.directive';
import GameService from './game.service';

let gameModule = angular.module('blackjack.game', []);

gameModule
.directive('blackjackGame', GameDirective)
.factory('GameService', GameService);

export default gameModule;
Copy path View file
@@ -0,0 +1,9 @@
import angular from 'angular';
import PlayerService from './player.service';

let playerModule = angular.module('blackjack.player', []);

playerModule
.factory('PlayerService', PlayerService);

export default playerModule;

This file was deleted.

Oops, something went wrong.
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.