Skip to content

Commit

Permalink
fix: update Rollup and emit type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
niklashigi committed May 14, 2019
1 parent 45e1dd0 commit 91fa31e
Show file tree
Hide file tree
Showing 14 changed files with 80 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
dist
.nyc_output
.rpt2_cache
coverage
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
"version": "0.0.0-semantically-released",
"description": "Game controls done right.",
"main": "dist/contro.js",
"types": "dist/index.d.ts",
"jsnext:main": "dist/contro.esm.js",
"module": "dist/contro.esm.js",
"files": [
"dist/contro.esm.js",
"dist/contro.js",
"dist/contro.min.js"
"dist/**/*.d.ts"
],
"scripts": {
"verify": "run-s lint verify:test build",
Expand Down Expand Up @@ -60,8 +61,8 @@
"remark-preset-lint-markdown-style-guide": "^2.1.1",
"remark-preset-lint-recommended": "^3.0.1",
"rimraf": "^2.6.2",
"rollup": "^0.53.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup": "^1.11.3",
"rollup-plugin-typescript2": "^0.21.0",
"semantic-release": "^15.13.12",
"ts-node": "^8.1.0",
"tslint": "^5.8.0",
Expand Down
8 changes: 5 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import typescript from 'rollup-plugin-typescript'
import typescript from 'rollup-plugin-typescript2'

const removeComments = () => ({
transform(source) {
Expand All @@ -9,7 +9,7 @@ const removeComments = () => ({
const year = new Date().getFullYear()

const addBanner = () => ({
transformBundle(source) {
renderChunk(source) {
return `/*!
* Contro
* (c) ${year} Niklas Higi
Expand All @@ -23,7 +23,9 @@ export default {
input: 'src/index.ts',
plugins: [
typescript({
typescript: require('typescript'),
tsconfigOverride: {
compilerOptions: { module: 'es2015' },
},
}),
removeComments(),
addBanner(),
Expand Down
2 changes: 1 addition & 1 deletion src/core/or.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect } from 'chai'
import * as Mocha from 'mocha'
import { store } from '../index'
import store from '../store'
import { Control } from './control'
import { or } from './or'

Expand Down
3 changes: 1 addition & 2 deletions src/core/or.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { store } from '../index'
import { Vector2 } from '../utils/math'
import store from '../store'
import { Control } from './control'

export function or(...controls: Array<Control<any>>): Control<any> {
Expand Down
4 changes: 0 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
export let store = {
preferGamepad: false,
}

export { Mouse } from './inputs/mouse'
export { Keyboard } from './inputs/keyboard'
export { Gamepad } from './inputs/gamepad'
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/gamepad.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import * as Mocha from 'mocha'
import { IGamepad, IGamepadButton, INavigator, IWindow } from '../apis'
import { store } from '../index'
import store from '../store'
import { Vector2 } from '../utils/math'
import { MockEventTarget } from '../utils/mock'
import { Gamepad } from './gamepad'
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/gamepad.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IGamepad, INavigator, IWindow } from '../apis'
import { Control, TriggerControl } from '../core/control'
import { store } from '../index'
import { findButtonNumber, getButtonLabel } from '../maps/gamepad'
import store from '../store'
import { Vector2 } from '../utils/math'

export interface GamepadStick {
Expand Down
4 changes: 2 additions & 2 deletions src/inputs/keyboard.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from 'chai'
import * as Mocha from 'mocha'
import { ICanvas, IDocument } from '../apis'
import { store } from '../index'
import { IDocument } from '../apis'
import store from '../store'
import { Vector2 } from '../utils/math'
import { MockEventTarget } from '../utils/mock'
import { Keyboard } from './keyboard'
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/keyboard.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IDocument } from '../apis'
import { Control, TriggerControl } from '../core/control'
import { store } from '../index'
import { findKeyValue, getKeyLabel } from '../maps/keyboard'
import store from '../store'
import { Vector2 } from '../utils/math'

const arrowKeyTemplates: { [name: string]: [string, string[]] } = {
Expand Down
2 changes: 1 addition & 1 deletion src/inputs/mouse.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ICanvas, IDocument } from '../apis'
import { Control, TriggerControl } from '../core/control'
import { store } from '../index'
import store from '../store'
import { Vector2 } from '../utils/math'

const mouseButtons = ['left', 'middle', 'right']
Expand Down
5 changes: 5 additions & 0 deletions src/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const store = {
preferGamepad: false,
}

export default store
9 changes: 5 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "ES2016",
"target": "es2016",
"noImplicitAny": true,
"declaration": true,
"outDir": "./disto/"
"declaration": true
},
"lib": ["DOM", "ES2015", "ES2016", "ES2016.Array.Include"],
"lib": ["dom"],
"includes": ["src/**/*.ts"],
"exclude": [
"node_modules",
"scripts/**",
"src/**/*.spec.ts"
]
}
94 changes: 52 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@
resolved "https://registry.yarnpkg.com/@types/chai/-/chai-4.1.7.tgz#1b8e33b61a8c09cbe1f85133071baa0dbf9fa71a"
integrity sha512-2Y8uPt0/jwjhQ6EiluT0XCri1Dbplr0ZxfFXUz+ye13gaqE8u5gL5ppao1JrUYr9cIip5S6MvQzBS7Kke7U9VA==

"@types/estree@0.0.39":
version "0.0.39"
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f"
integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==

"@types/events@*":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7"
Expand Down Expand Up @@ -256,6 +261,11 @@
resolved "https://registry.yarnpkg.com/@types/node/-/node-12.0.1.tgz#3dde31f8da274dfeb90e96abf55038fef46285f0"
integrity sha512-7sy7DKVJrCTbaAERJZq/CU12bzdmpjRr321/Ne9QmzhB3iZ//L16Cizcni5hHNbANxDbxwMb9EFoWkM8KPkp0A==

"@types/node@^11.13.9":
version "11.13.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-11.13.10.tgz#4df59e5966b56f512bac98898bcbee5067411f0f"
integrity sha512-leUNzbFTMX94TWaIKz8N15Chu55F9QSH+INKayQr5xpkasBQBRF3qQXfo3/dOnMU/dEIit+Y/SU8HyOjq++GwA==

"@types/normalize-package-data@^2.4.0":
version "2.4.0"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e"
Expand Down Expand Up @@ -296,6 +306,11 @@ abbrev@1, abbrev@~1.1.1:
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==

acorn@^6.1.1:
version "6.1.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f"
integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA==

agent-base@4, agent-base@^4.1.0, agent-base@~4.2.1:
version "4.2.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.2.1.tgz#d89e5999f797875674c07d87f260fc41e83e8ca9"
Expand Down Expand Up @@ -1125,11 +1140,6 @@ compare-func@^1.3.1:
array-ify "^1.0.0"
dot-prop "^3.0.0"

compare-versions@2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/compare-versions/-/compare-versions-2.0.1.tgz#1edc1f93687fd97a325c59f55e45a07db106aca6"
integrity sha1-Htwfk2h/2XoyXFn1XkWgfbEGrKY=

component-emitter@^1.2.1:
version "1.3.0"
resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0"
Expand Down Expand Up @@ -1669,10 +1679,10 @@ esprima@^4.0.0, esprima@~4.0.0:
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==

estree-walker@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.2.1.tgz#bdafe8095383d8414d5dc2ecf4c9173b6db9412e"
integrity sha1-va/oCVOD2EFNXcLs9MkXO225QS4=
estree-walker@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-0.6.0.tgz#5d865327c44a618dde5699f763891ae31f257dae"
integrity sha512-peq1RfVAVzr3PU/jL31RaOjUKLoZJpObQWJJ+LgfcxDUifyLZ1RjPQZTl0pzj2uJ45b7A7XpyppXvxdEqzo4rw==

esutils@^2.0.2:
version "2.0.2"
Expand Down Expand Up @@ -1963,7 +1973,7 @@ from2@^2.1.0, from2@^2.1.1:
inherits "^2.0.1"
readable-stream "^2.0.0"

fs-extra@^7.0.0:
fs-extra@7.0.1, fs-extra@^7.0.0:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9"
integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==
Expand Down Expand Up @@ -3652,7 +3662,7 @@ mimic-fn@^2.0.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==

minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4:
minimatch@3.0.4, minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==
Expand Down Expand Up @@ -4260,7 +4270,7 @@ oauth-sign@~0.9.0:
resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.9.0.tgz#47a7b016baa68b5fa0ecf3dee08a85c679ac6455"
integrity sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==

object-assign@^4.0.1, object-assign@^4.1.0:
object-assign@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
Expand Down Expand Up @@ -5739,6 +5749,13 @@ resolve-url@^0.2.1:
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=

resolve@1.10.0:
version "1.10.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba"
integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg==
dependencies:
path-parse "^1.0.6"

resolve@^1.1.6, resolve@^1.10.0, resolve@^1.3.2:
version "1.10.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18"
Expand Down Expand Up @@ -5781,29 +5798,32 @@ rimraf@2, rimraf@^2.5.2, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2, rimraf@^2.
dependencies:
glob "^7.1.3"

rollup-plugin-typescript@^0.8.1:
version "0.8.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript/-/rollup-plugin-typescript-0.8.1.tgz#2ff7eecc21cf6bb2b43fc27e5b688952ce71924a"
integrity sha1-L/fuzCHPa7K0P8J+W2iJUs5xkko=
rollup-plugin-typescript2@^0.21.0:
version "0.21.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.21.0.tgz#cc61ed756ac6e68cb3c03f7ee78001346243ed54"
integrity sha512-fbUAc2bvWxRrg1GGMYCFVf6aSxq3zvWn0sY2ubzFW9shJNT95ztFbM6GHO4/2rDSCjier7IswQnbr1ySqoLNPw==
dependencies:
compare-versions "2.0.1"
object-assign "^4.0.1"
rollup-pluginutils "^1.3.1"
tippex "^2.1.1"
typescript "^1.8.9"
fs-extra "7.0.1"
resolve "1.10.0"
rollup-pluginutils "2.4.1"
tslib "1.9.3"

rollup-pluginutils@^1.3.1:
version "1.5.2"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz#1e156e778f94b7255bfa1b3d0178be8f5c552408"
integrity sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=
rollup-pluginutils@2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.4.1.tgz#de43ab54965bbf47843599a7f3adceb723de38db"
integrity sha512-wesMQ9/172IJDIW/lYWm0vW0LiKe5Ekjws481R7z9WTRtmO59cqyM/2uUlxvf6yzm/fElFmHUobeQOYz46dZJw==
dependencies:
estree-walker "^0.2.1"
minimatch "^3.0.2"
estree-walker "^0.6.0"
micromatch "^3.1.10"

rollup@^0.53.0:
version "0.53.4"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.53.4.tgz#f92ce56ee1d097ad5b6f13951bc80db5fef18113"
integrity sha512-ErW5cFw5KY/qiyUlPDJ7iBhw51Iro/oyvxETupO85bMg5T7MLlFj3lEDzwjLTOxJAyzWQanUYj/LZHm6aLLm5w==
rollup@^1.11.3:
version "1.11.3"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.11.3.tgz#6f436db2a2d6b63f808bf60ad01a177643dedb81"
integrity sha512-81MR7alHcFKxgWzGfG7jSdv+JQxSOIOD/Fa3iNUmpzbd7p+V19e1l9uffqT8/7YAHgGOzmoPGN3Fx3L2ptOf5g==
dependencies:
"@types/estree" "0.0.39"
"@types/node" "^11.13.9"
acorn "^6.1.1"

run-async@^2.2.0:
version "2.3.0"
Expand Down Expand Up @@ -6493,11 +6513,6 @@ tiny-relative-date@^1.3.0:
resolved "https://registry.yarnpkg.com/tiny-relative-date/-/tiny-relative-date-1.3.0.tgz#fa08aad501ed730f31cc043181d995c39a935e07"
integrity sha512-MOQHpzllWxDCHHaDno30hhLfbouoYlOI8YlMNtvKe1zXbjEVhbcEovQxvZrPvtiYW630GQDoMMarCnjfyfHA+A==

tippex@^2.1.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tippex/-/tippex-2.3.1.tgz#a2fd5b7087d7cbfb20c9806a6c16108c2c0fafda"
integrity sha1-ov1bcIfXy/sgyYBqbBYQjCwPr9o=

tmp@^0.0.33:
version "0.0.33"
resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9"
Expand Down Expand Up @@ -6597,7 +6612,7 @@ ts-node@^8.1.0:
source-map-support "^0.5.6"
yn "^3.0.0"

tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
tslib@1.9.3, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==
Expand Down Expand Up @@ -6655,11 +6670,6 @@ typedarray@^0.0.6:
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=

typescript@^1.8.9:
version "1.8.10"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-1.8.10.tgz#b475d6e0dff0bf50f296e5ca6ef9fbb5c7320f1e"
integrity sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=

typescript@^3.4.5:
version "3.4.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.4.5.tgz#2d2618d10bb566572b8d7aad5180d84257d70a99"
Expand Down

0 comments on commit 91fa31e

Please sign in to comment.