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

Commit

Permalink
feat: added loadPlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Feb 2, 2018
1 parent 4ba8f7c commit 57a85d7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/command.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as Parser from '@anycli/parser'

import {IConfig} from './config'
import {IPlugin} from './plugin'

export interface ICommandBase {
_base: string
Expand All @@ -23,7 +22,7 @@ export interface ICachedCommand extends ICommandBase {

export interface IConvertToCachedOptions {
id?: string
plugin?: IPlugin
pluginName?: string
}

export interface ICommand<T = any> extends ICommandBase {
Expand Down
12 changes: 11 additions & 1 deletion src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import {IConfig} from './config'
import {IPlugin} from './plugin'
import {ITopic} from './topic'

export interface LoadPluginOptions {
type: 'core' | 'user' | 'link' | 'dev'
root?: string
name?: string
config?: IConfig
tag?: string
useCache?: boolean
loadDevPlugins?: boolean
}

export interface IEngine {
readonly config: IConfig
readonly plugins: IPlugin[]
Expand All @@ -23,5 +33,5 @@ export interface IEngine {

load(config: IConfig): Promise<void>

getPluginCommands(plugin: IPlugin): Promise<ICachedCommand[]>
loadPlugin(opts: LoadPluginOptions): Promise<IPlugin>
}
7 changes: 6 additions & 1 deletion src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ export interface IPlugin {
root: string
tag?: string
config: IConfig
commands: ICachedCommand[]
manifest: IPluginManifest
topics: ITopic[]
plugins: IPlugin[]
hooks: {[k: string]: string[]}
}

export interface IPluginManifest {
version: string
commands: ICachedCommand[]
}

0 comments on commit 57a85d7

Please sign in to comment.