diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..bb0c3e5 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,11 @@ +import Command = require('./lib/command') +import Seeli = require('./lib/seeli') + +declare const seeli: Seeli & { + Seeli: typeof Seeli + Command: typeof Command + list: string[] + [key: string]: any +} + +export = seeli diff --git a/lib/command/index.d.ts b/lib/command/index.d.ts index 30bfd7b..f413133 100644 --- a/lib/command/index.d.ts +++ b/lib/command/index.d.ts @@ -61,7 +61,7 @@ declare class Command extends Map { * Will be passed the contents return by the command * @return String|undefined Will return the result from the command specific run directive if there is any. */ - run(cmd?: any, depth?: number): Promise; + run(cmd?: any, depth?: number): Promise | undefined; /** * Validates the current data set before running the command diff --git a/lib/seeli.d.ts b/lib/seeli.d.ts index f726b13..2b7264d 100644 --- a/lib/seeli.d.ts +++ b/lib/seeli.d.ts @@ -1,73 +1,22 @@ +import Command = require('./command') + /** * Seeli Entrypoint used for registering and managing commands * @module module:seeli/lib/seeli * @author Eric Satterwhite */ declare class Seeli extends Command { - /** - * Get configuration value - * @param args Arguments to pass to config.get - */ static get(...args: any[]): any; - - /** - * Set configuration value - * @param args Arguments to pass to config.set - */ static set(...args: any[]): any; - - /** - * Colorize text with a specific color - * @param txt Text to colorize - * @param color Color to use - */ static colorize(txt: string, color: string): string; - - /** - * Get the Command class - */ static get Command(): typeof Command; - - /** - * Get the Command class - */ get Command(): typeof Command; - - /** - * Constructor for Seeli class - * @param args Arguments to pass to the constructor - */ constructor(...args: any[]); - - /** - * Colorize text with a specific color - * @param txt Text to colorize - * @param color Color to use - */ colorize(txt: string, color: string): string; - - /** - * Get or set configuration values - * @param args Arguments to pass to config - */ config(...args: any[]): any; - - /** - * Run the Seeli application - */ - run(): void; - - /** - * Reset the Seeli instance - */ + run(...args: any[]): Promise | undefined; reset(): Seeli; - - /** - * Load plugins - * @param args Plugin arguments - */ plugin(...args: any[]): Seeli; } -export = Seeli; - +export = Seeli diff --git a/package.json b/package.json index a9f58a2..2230d80 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ }, "files": [ "index.js", + "index.d.ts", "lib/", "README.md", "LICENSE", @@ -130,5 +131,6 @@ "files": [ "test/**/*.js" ] - } + }, + "types": "./index.d.ts" } diff --git a/test/flag-type.js b/test/flag-type.js index 1a0879e..4ed204a 100644 --- a/test/flag-type.js +++ b/test/flag-type.js @@ -16,7 +16,7 @@ test('flagType', async (t) => { , [{type: [Number, Array]}, 'number', '[Number, Array] === number'] , [{type: String, mask: true}, 'password', 'mask=true === password'] , [{type: String, choices: []}, 'select', 'choices === select'] - , [{type: String, choices: [], multi: true}, 'checkbox', 'choices + multi === checkbox'] // eslint-disable-line max-len + , [{type: String, choices: [], multi: true}, 'checkbox', 'choices + multi === checkbox'] , [{type: Function}, 'input', 'unexpected type === input'] ]