-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updated to work with new config/command
- Loading branch information
Showing
12 changed files
with
125 additions
and
1,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
import {IConfig} from '@anycli/config' | ||
import Run from '@anycli/engine' | ||
import * as _ from 'lodash' | ||
|
||
import loadConfig from './load_config' | ||
import {loadConfig} from './load_config' | ||
|
||
export default (args: string[] | string | undefined) => ({ | ||
async run(ctx: {config: IConfig, expectation: string}) { | ||
const run: typeof Run = require('@anycli/engine').default | ||
if (!ctx.config) ctx.config = await loadConfig().run({} as any) | ||
if (!ctx.config) ctx.config = loadConfig().run({} as any) | ||
args = _.castArray(args) | ||
let [cmd, ...extra] = args | ||
ctx.expectation = ctx.expectation || `runs ${args.join(' ')}` | ||
await run(args, ctx) | ||
await ctx.config.runCommand(cmd, extra) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import {IConfig, read} from '@anycli/config' | ||
|
||
export type WithRoot<T> = T & {root: string} | ||
import * as Config from '@anycli/config' | ||
|
||
/** | ||
* loads CLI plugin/multi config | ||
*/ | ||
export const _loadConfig = (opts: {root?: string} = {}) => { | ||
export function loadConfig(root?: string) { | ||
return { | ||
async run(ctx: {config: IConfig}) { | ||
return ctx.config = await read({root: opts.root || loadConfig.root}) | ||
run(ctx: {config: Config.IConfig}) { | ||
return ctx.config = Config.load(root || loadConfig.root) | ||
} | ||
} | ||
} | ||
const loadConfig = _loadConfig as WithRoot<typeof _loadConfig> | ||
export default loadConfig | ||
|
||
export namespace loadConfig { | ||
export let root: string | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"declaration": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"importHelpers": true, | ||
"module": "commonjs", | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"outDir": "./lib", | ||
"pretty": true, | ||
"rootDirs": [ | ||
"./src" | ||
], | ||
"strict": true, | ||
"target": "es2017" | ||
}, | ||
"include": [ | ||
"./src/**/*" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.