Skip to content

Commit 8d82ca6

Browse files
Merge pull request #13 from RobotlegsJS/improvements
Improvements 🚀
2 parents 82ec6e7 + bdb861a commit 8d82ca6

File tree

21 files changed

+550
-337
lines changed

21 files changed

+550
-337
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea
2+
.nyc_output
23
build
34
lib
45
node_modules

.npmignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea
2+
/.nyc_output
23
/.vscode
34
/coverage
45
/dist
@@ -26,5 +27,6 @@ yarn.lock
2627
.gitignore
2728
.istanbul.yml
2829
.npmignore
30+
.prettierrc
2931
.publishrc
3032
.travis.yml

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 4,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": false,
7+
"trailingComma": "none",
8+
"bracketSpacing": true
9+
}

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
language: node_js
22
node_js:
33
- stable
4+
env:
5+
- CODECLIMATE_REPO_TOKEN=799dc304c4c444478251dbae6dcb20ec4cb68e46daebf2d08886c1dea12305e5
6+
- CODECLIMATE_API_HOST=https://codebeat.co/webhooks/code_coverage CODECLIMATE_REPO_TOKEN=05eace5c-4cc7-45b6-a238-9d60a4c94cb5
47
before_install:
58
- export CHROME_BIN=chromium-browser
69
- export DISPLAY=:99.0
@@ -11,11 +14,8 @@ before_install:
1114
before_script:
1215
- greenkeeper-lockfile-update
1316
script:
14-
- node_modules/karma/bin/karma start karma.conf.js --single-run
17+
- yarn run test
1518
after_script:
1619
- greenkeeper-lockfile-upload
1720
after_success:
1821
- codeclimate-test-reporter < coverage/lcov.info
19-
addons:
20-
code_climate:
21-
repo_token: 799dc304c4c444478251dbae6dcb20ec4cb68e46daebf2d08886c1dea12305e5

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ RobotlegsJS SignalCommandMap Extension
33

44
[![Gitter chat](https://badges.gitter.im/RobotlegsJS/RobotlegsJS.svg)](https://gitter.im/RobotlegsJS/RobotlegsJS)
55
[![Build Status](https://secure.travis-ci.org/RobotlegsJS/RobotlegsJS-SignalCommandMap.svg?branch=master)](https://travis-ci.org/RobotlegsJS/RobotlegsJS-SignalCommandMap)
6-
[![Code Climate](https://codeclimate.com/github/RobotlegsJS/RobotlegsJS-SignalCommandMap/badges/gpa.svg)](https://codeclimate.com/github/RobotlegsJS/RobotlegsJS-SignalCommandMap)
6+
[![codebeat badge](https://codebeat.co/badges/05eace5c-4cc7-45b6-a238-9d60a4c94cb5)](https://codebeat.co/projects/github-com-robotlegsjs-robotlegsjs-signalcommandmap-master)
77
[![Test Coverage](https://codeclimate.com/github/RobotlegsJS/RobotlegsJS-SignalCommandMap/badges/coverage.svg)](https://codeclimate.com/github/RobotlegsJS/RobotlegsJS-SignalCommandMap/coverage)
88
[![npm version](https://badge.fury.io/js/%40robotlegsjs%2Fsignalcommandmap.svg)](https://badge.fury.io/js/%40robotlegsjs%2Fsignalcommandmap)
99
[![Greenkeeper badge](https://badges.greenkeeper.io/RobotlegsJS/RobotlegsJS-SignalCommandMap.svg)](https://greenkeeper.io/)
10+
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
1011

1112
A port of Robotlegs Extensions SignalCommandMap to TypeScript.

package.json

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,34 @@
55
"main": "lib/index.js",
66
"typings": "lib/index.d.ts",
77
"scripts": {
8-
"test": "karma start --single-run",
9-
"mocha": "mocha test/**/*.test.ts --require ts-node/register",
10-
"autoformat": "tsfmt -r --useTsconfig tsconfig.test.json",
8+
"test": "nyc mocha",
9+
"karma": "karma start --single-run",
10+
"autoformat": "prettier --config .prettierrc --write {src,test}/**/*.ts",
11+
"tslint-check": "tslint-config-prettier-check ./tslint.json",
1112
"clean-up": "rm -rf coverage && rm -rf lib",
1213
"prepublish": "tsc -d && publish-please guard",
1314
"publish-please": "npm run autoformat && npm run clean-up && publish-please"
1415
},
16+
"nyc": {
17+
"include": [
18+
"src/**/*.ts"
19+
],
20+
"exclude": [
21+
"test"
22+
],
23+
"extension": [
24+
".ts"
25+
],
26+
"require": [
27+
"ts-node/register"
28+
],
29+
"reporter": [
30+
"text-summary",
31+
"lcov"
32+
],
33+
"sourceMap": true,
34+
"instrument": true
35+
},
1536
"repository": {
1637
"type": "git",
1738
"url": "git@github.com:RobotlegsJS/RobotlegsJS-SignalCommandMap.git"
@@ -39,13 +60,13 @@
3960
"@robotlegsjs/signals": "^0.0.10"
4061
},
4162
"devDependencies": {
42-
"@types/bluebird": "^3.5.8",
63+
"@types/bluebird": "^3.5.11",
4364
"@types/chai": "^4.0.4",
44-
"@types/mocha": "^2.2.42",
45-
"@types/sinon": "^2.3.3",
65+
"@types/mocha": "^2.2.43",
66+
"@types/sinon": "^2.3.4",
4667
"bluebird": "^3.5.0",
4768
"browserify-versionify": "^1.0.6",
48-
"chai": "^4.1.1",
69+
"chai": "^4.1.2",
4970
"es6-map": "^0.1.5",
5071
"es6-symbol": "^3.1.1",
5172
"glslify": "^6.1.0",
@@ -67,20 +88,23 @@
6788
"karma-sourcemap-loader": "^0.3.7",
6889
"karma-sourcemap-writer": "^0.1.2",
6990
"karma-webpack": "^2.0.4",
70-
"mocha": "^3.5.0",
91+
"mocha": "^3.5.3",
92+
"nyc": "^11.2.1",
93+
"prettier": "^1.7.0",
7194
"publish-please": "^2.3.1",
7295
"reflect-metadata": "^0.1.10",
7396
"remap-istanbul": "^0.9.5",
74-
"rimraf": "^2.6.1",
97+
"rimraf": "^2.6.2",
7598
"sinon": "^3.2.1",
7699
"sinon-chai": "^2.13.0",
77-
"ts-loader": "^2.3.4",
100+
"source-map-support": "^0.4.18",
101+
"ts-loader": "^2.3.7",
78102
"ts-node": "^3.3.0",
79103
"tslint": "^5.7.0",
80-
"typescript": "^2.5.1",
81-
"typescript-formatter": "^6.0.0",
82-
"webpack": "^3.5.5",
83-
"webpack-dev-server": "^2.7.1"
104+
"tslint-config-prettier": "^1.5.0",
105+
"typescript": "^2.5.2",
106+
"webpack": "^3.6.0",
107+
"webpack-dev-server": "^2.8.2"
84108
},
85109
"peerDependencies": {
86110
"reflect-metadata": "^0.1.10"

src/index.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@
88
/**
99
* SignalCommandMap Extension
1010
*/
11-
export { ISignalCommandMap } from "./robotlegs/bender/extensions/signalCommandMap/api/ISignalCommandMap";
12-
export { SignalCommandMap } from "./robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandMap";
13-
export { SignalCommandTrigger } from "./robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger";
14-
export { SignalCommandMapExtension } from "./robotlegs/bender/extensions/signalCommandMap/SignalCommandMapExtension";
11+
export {
12+
ISignalCommandMap
13+
} from "./robotlegs/bender/extensions/signalCommandMap/api/ISignalCommandMap";
14+
export {
15+
SignalCommandMap
16+
} from "./robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandMap";
17+
export {
18+
SignalCommandTrigger
19+
} from "./robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandTrigger";
20+
export {
21+
SignalCommandMapExtension
22+
} from "./robotlegs/bender/extensions/signalCommandMap/SignalCommandMapExtension";

src/robotlegs/bender/extensions/signalCommandMap/SignalCommandMapExtension.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,7 @@ import {
1313
PrioritySignal
1414
} from "@robotlegsjs/signals";
1515

16-
import {
17-
injectable,
18-
IContext,
19-
IExtension,
20-
UID
21-
} from "@robotlegsjs/core";
16+
import { injectable, IContext, IExtension, UID } from "@robotlegsjs/core";
2217

2318
import { ISignalCommandMap } from "./api/ISignalCommandMap";
2419
import { SignalCommandMap } from "./impl/SignalCommandMap";
@@ -31,7 +26,6 @@ injectable()(DeluxeSignal);
3126
injectable()(PrioritySignal);
3227

3328
export class SignalCommandMapExtension implements IExtension {
34-
3529
/*============================================================================*/
3630
/* Private Properties */
3731
/*============================================================================*/
@@ -43,7 +37,10 @@ export class SignalCommandMapExtension implements IExtension {
4337
/*============================================================================*/
4438

4539
public extend(context: IContext): void {
46-
context.injector.bind(ISignalCommandMap).to(SignalCommandMap).inSingletonScope();
40+
context.injector
41+
.bind(ISignalCommandMap)
42+
.to(SignalCommandMap)
43+
.inSingletonScope();
4744
}
4845

4946
public toString(): string {

src/robotlegs/bender/extensions/signalCommandMap/api/ISignalCommandMap.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
// in accordance with the terms of the license agreement accompanying it.
66
// ------------------------------------------------------------------------------
77

8-
import {
9-
ICommandMapper,
10-
ICommandUnmapper
11-
} from "@robotlegsjs/core";
8+
import { ICommandMapper, ICommandUnmapper } from "@robotlegsjs/core";
129

1310
/**
1411
* The Signal Command Map allows you to bind Signals to Commands
1512
*/
1613
export let ISignalCommandMap = Symbol("ISignalCommandMap");
1714
export interface ISignalCommandMap {
18-
1915
/**
2016
* Creates a mapping for a Signal based trigger
2117
* @param signalClass The concrete Signal class

src/robotlegs/bender/extensions/signalCommandMap/impl/SignalCommandMap.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import { SignalCommandTrigger } from "./SignalCommandTrigger";
2525
*/
2626
@injectable()
2727
export class SignalCommandMap implements ISignalCommandMap {
28-
2928
/*============================================================================*/
3029
/* Private Properties */
3130
/*============================================================================*/
@@ -45,12 +44,13 @@ export class SignalCommandMap implements ISignalCommandMap {
4544
/**
4645
* @private
4746
*/
48-
constructor(
49-
@inject(IContext) context: IContext
50-
) {
47+
constructor(@inject(IContext) context: IContext) {
5148
this._injector = context.injector;
5249
this._logger = context.getLogger(this);
53-
this._triggerMap = new CommandTriggerMap(this.getKey, this.createTrigger.bind(this));
50+
this._triggerMap = new CommandTriggerMap(
51+
this.getKey,
52+
this.createTrigger.bind(this)
53+
);
5454
}
5555

5656
/*============================================================================*/
@@ -72,8 +72,10 @@ export class SignalCommandMap implements ISignalCommandMap {
7272
}
7373

7474
public addMappingProcessor(handler: Function): ISignalCommandMap {
75-
if (this._mappingProcessors.indexOf(handler) === -1)
75+
if (this._mappingProcessors.indexOf(handler) === -1) {
7676
this._mappingProcessors.push(handler);
77+
}
78+
7779
return this;
7880
}
7981

@@ -82,7 +84,11 @@ export class SignalCommandMap implements ISignalCommandMap {
8284
/*============================================================================*/
8385

8486
private createTrigger(signalClass: Object): ICommandTrigger {
85-
return new SignalCommandTrigger(this._injector, signalClass, this._mappingProcessors);
87+
return new SignalCommandTrigger(
88+
this._injector,
89+
signalClass,
90+
this._mappingProcessors
91+
);
8692
}
8793

8894
private getTrigger(signalClass: Object): SignalCommandTrigger {

0 commit comments

Comments
 (0)