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

Commit

Permalink
fix: allow custom hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 5, 2018
1 parent 602b999 commit 6ce0cdd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 663 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"chai": "^4.1.2",
"concurrently": "^3.5.1",
"debug": "^3.1.0",
"eslint": "^4.17.0",
"eslint-config-anycli": "^1.3.2",
"fancy-test": "^1.0.1",
"globby": "^7.1.1",
"mocha": "^5.0.0",
Expand All @@ -38,7 +36,7 @@
"repository": "anycli/config",
"scripts": {
"build": "rm -rf lib && tsc",
"lint": "concurrently -p command \"eslint .\" \"tsc -p test --noEmit\" \"tslint -p test\"",
"lint": "concurrently -p command \"tsc -p test --noEmit\" \"tslint -p test\"",
"posttest": "yarn run lint",
"prepublishOnly": "yarn run build",
"test": "mocha --forbid-only \"test/**/*.test.ts\""
Expand Down
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class Config extends Plugin.Plugin implements IConfig {

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

Expand Down
1 change: 1 addition & 0 deletions src/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as Config from '.'

export interface Hooks {
[event: string]: object
init: {argv: string[]}
prerun: {
Command: Config.Command.Class
Expand Down
Loading

0 comments on commit 6ce0cdd

Please sign in to comment.