Skip to content

Commit

Permalink
fix: async
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 7, 2018
1 parent 0ad48cb commit 4b33a6c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"fancy-test": "^1.0.1"
},
"devDependencies": {
"@anycli/command": "^1.2.14",
"@anycli/config": "^1.3.28",
"@anycli/command": "^1.2.15",
"@anycli/config": "^1.3.39",
"@anycli/errors": "^0.2.1",
"@anycli/tslint": "^0.2.7",
"@types/chai": "^4.1.2",
Expand Down
2 changes: 1 addition & 1 deletion src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {loadConfig} from './load_config'
export function command(args: string[] | string | undefined, opts: loadConfig.Options = {}) {
return {
async run(ctx: {config: Config.IConfig, expectation: string}) {
if (!ctx.config || opts.reset) ctx.config = loadConfig(opts).run({} as any)
if (!ctx.config || opts.reset) ctx.config = await loadConfig(opts).run({} as any)
args = castArray(args)
let [id, ...extra] = args
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`
Expand Down
2 changes: 1 addition & 1 deletion src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {loadConfig} from './load_config'
export default (event?: string, hookOpts: object = {}, options: loadConfig.Options = {}) => ({
async run(ctx: {config: Config.IConfig, expectation: string}) {
if (!event) throw new Error('no hook provided')
if (!ctx.config) ctx.config = loadConfig(options).run({} as any)
if (!ctx.config) ctx.config = await loadConfig(options).run({} as any)
ctx.expectation = ctx.expectation || `runs ${event} hook`
await ctx.config.runHook(event, hookOpts || {})
}
Expand Down
4 changes: 2 additions & 2 deletions src/load_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as Config from '@anycli/config'
*/
export function loadConfig(opts: loadConfig.Options = {}) {
return {
run(ctx: {config: Config.IConfig}) {
ctx.config = Config.load(opts.root || loadConfig.root)
async run(ctx: {config: Config.IConfig}) {
ctx.config = await Config.load(opts.root || loadConfig.root)
return ctx.config
}
}
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# yarn lockfile v1


"@anycli/command@^1.2.14":
version "1.2.14"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.14.tgz#de8e1be33f64143c49242c0deb7bf9a06a826813"
"@anycli/command@^1.2.15":
version "1.2.15"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.15.tgz#4eac9562ebcbcc516f6ac5c98464538f45f51cd5"
dependencies:
"@anycli/parser" "^3.2.6"

"@anycli/config@^1.3.28":
version "1.3.28"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.3.28.tgz#b74e67e9b2d2c2c36282b38a6750c1bda9e3abdd"
"@anycli/config@^1.3.39":
version "1.3.39"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.3.39.tgz#aa089281c3cfd40428885988906d1d19dcfdb437"

"@anycli/errors@^0.2.1":
version "0.2.1"
Expand Down

0 comments on commit 4b33a6c

Please sign in to comment.