Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 6ce0cdd

Browse files
committed
fix: allow custom hooks
1 parent 602b999 commit 6ce0cdd

File tree

4 files changed

+12
-663
lines changed

4 files changed

+12
-663
lines changed

package.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
"chai": "^4.1.2",
1616
"concurrently": "^3.5.1",
1717
"debug": "^3.1.0",
18-
"eslint": "^4.17.0",
19-
"eslint-config-anycli": "^1.3.2",
2018
"fancy-test": "^1.0.1",
2119
"globby": "^7.1.1",
2220
"mocha": "^5.0.0",
@@ -38,7 +36,7 @@
3836
"repository": "anycli/config",
3937
"scripts": {
4038
"build": "rm -rf lib && tsc",
41-
"lint": "concurrently -p command \"eslint .\" \"tsc -p test --noEmit\" \"tslint -p test\"",
39+
"lint": "concurrently -p command \"tsc -p test --noEmit\" \"tslint -p test\"",
4240
"posttest": "yarn run lint",
4341
"prepublishOnly": "yarn run build",
4442
"test": "mocha --forbid-only \"test/**/*.test.ts\""

src/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class Config extends Plugin.Plugin implements IConfig {
150150

151151
async runHook<T extends Hooks, K extends keyof T>(event: K, opts: T[K]) {
152152
debug('start %s hook', event)
153-
await super.runHook<T, K>(event, {...opts || {} as any, config: this})
153+
await super.runHook<T, K>(event, {...opts as any || {}, config: this})
154154
debug('done %s hook', event)
155155
}
156156

src/hooks.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as Config from '.'
22

33
export interface Hooks {
4+
[event: string]: object
45
init: {argv: string[]}
56
prerun: {
67
Command: Config.Command.Class

0 commit comments

Comments
 (0)