Skip to content

Commit

Permalink
fix: clear plugincache
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 3, 2018
1 parent c45f9f1 commit 61ec050
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"author": "Jeff Dickey @jdxcode",
"bugs": "https://github.com/anycli/test/issues",
"dependencies": {
"fancy-test": "^0.6.8",
"fancy-test": "^0.6.10",
"lodash": "^4.17.4"
},
"devDependencies": {
"@anycli/command": "^1.2.0",
"@anycli/config": "^1.0.9",
"@anycli/command": "^1.2.1",
"@anycli/config": "^1.0.14",
"@anycli/tslint": "^0.2.5",
"@anycli/version": "^0.1.19",
"@types/chai": "^4.1.2",
Expand Down
30 changes: 21 additions & 9 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
import {IConfig} from '@anycli/config'
import * as Config from '@anycli/config'
import * as _ from 'lodash'

import {loadConfig} from './load_config'

export default (args: string[] | string | undefined) => ({
async run(ctx: {config: IConfig, expectation: string}) {
if (!ctx.config) ctx.config = loadConfig().run({} as any)
args = _.castArray(args)
let [cmd, ...extra] = args
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`
await ctx.config.runCommand(cmd, extra)
export function command(args: string[] | string | undefined, opts: command.Options = {}) {
return {
async run(ctx: {config: Config.IConfig, expectation: string}) {
if (!ctx.config || opts.resetConfig) {
ctx.config = loadConfig(opts.root).run({} as any)
Config.Plugin.loadedPlugins = {}
}
args = _.castArray(args)
let [cmd, ...extra] = args
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}`
await ctx.config.runCommand(cmd, extra)
}
}
})
}

export namespace command {
export interface Options {
root?: string
resetConfig?: boolean
}
}
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as Config from '@anycli/config'
import {expect, fancy, FancyTypes, NockScope} from 'fancy-test'

import command from './command'
import {command} from './command'
import exit from './exit'
import hook from './hook'
import {loadConfig} from './load_config'
Expand All @@ -19,6 +19,6 @@ export default test
export {
expect,
FancyTypes,
NockScope,
Config,
NockScope,
}
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
lodash "^4.17.4"
tslib "^1.9.0"

"@anycli/command@^1.2.0":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.0.tgz#10692132c097e620f6ff5e9560fb1b6921ae146a"
"@anycli/command@^1.2.1":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@anycli/command/-/command-1.2.1.tgz#026ee48b85c53850bfef28f1a08917f489f110d5"
dependencies:
"@anycli/parser" "^3.2.1"
cli-ux "^3.3.13"
Expand All @@ -35,9 +35,9 @@
lodash "^4.17.4"
read-pkg "^3.0.0"

"@anycli/config@^1.0.9":
version "1.0.9"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.0.9.tgz#09e8e22a1586bb05d2bf4815fafe3d0674356a62"
"@anycli/config@^1.0.14":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@anycli/config/-/config-1.0.14.tgz#2ffbafde6f67ee632e6614c67800d050a9575d9d"
dependencies:
cli-ux "^3.3.13"
debug "^3.1.0"
Expand Down Expand Up @@ -668,9 +668,9 @@ extract-stack@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-1.0.0.tgz#b97acaf9441eea2332529624b732fc5a1c8165fa"

fancy-test@^0.6.8:
version "0.6.8"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-0.6.8.tgz#8f5f335783e8f54bd6261ba1d09b83826333ad11"
fancy-test@^0.6.10:
version "0.6.10"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-0.6.10.tgz#39001bcb117b7067c851dc58da6236a08a49e267"
dependencies:
lodash "^4.17.4"
stdout-stderr "^0.1.6"
Expand Down

0 comments on commit 61ec050

Please sign in to comment.