mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Refactor incorrect tests * Add export-statements to the exported components * Add a base-class for prompt-modules * Externalize the Prompts-type * Externalize the Separator-class * Move the ChoiceOption-type to a new namespace "poll" * Rename the ChoiceOption-type to ChoiceOptions * Add a choice base-type * Move ChoiceType to the poll-namespace * Rename the ChoiceType-type * Reorder the types * Convert types to interfaces * Rename the qeustion-type to "DistinctQuestion" * Add types for representing optional object-keys * Add a type for dynamic question-properties * Fix some question-options * Ad the `filter`-methjod to the QuestionCommon-interface * Move uestionCommon to the poll-namespace * Rename QuestionCommon to Question * Refactor the question-types * Refactor the Questions-type * Rename Questions to QuestionCollection * Rearrange the namespaces * Add a type-option to the Question-interface * Add a ScreenManager-class * Rework visibility of ScreenManager-members * Add a Prompt-class * Force all generic answers to extend Answers * Add an interface for basic prompts * Add a PromptConstrructor type * Add types for the paginator * Rework the event-submission of prompts * Fix the type of the run-callback * Add a generic parameter for the type of answer * Add types for the Checkbox-prompt * Make the type of the checkbox-prompt generic * Add a module for the checkbox-prompt * Fix js-doc * Add missing import * Fix typo * Add types for the confirm-prompt * Remove the generic answer-type * Rework the checkbox-prompt * Add an editor-prompt * Add the Choice-class * Move the choice-class to another directory * Add a separator-interface * Fix the separator-class * Add a choices-class * Add the separator-type * Move the objects to the correct location * Move all external modules to the proper place * Fix the PromptModule interface * Convert all internal components to internal modules * Rework the prompt-type * Make the choices public * Fix the editor-prompt * Move all external modules into the index-file * Move all remaining modules into the index-file * Fix incorrect choices-module * Export the DynamicQuestionProperty * Add a question-map * Fix the choicebase-type * Fix asynchronously fetched question-options * Improve the handling of choices * Add an expand-prompt * Intuitively rework the prompts * Rework the expand-prompt * Add the input-prompt * Add trhe list-prompt * Refactor all prompts * Fix incorrect module-export * Fix the prompt-constructor * Fix the handling of the question-options * Add the number-prompt * Add the password-prompt * Add the rawlist-prompt * Add ui-classes * Add all remaining types * Fix the generic types * Remove unnecessary types * Rework the type-declarations according to tslint * Complete the docs * Order the imports * Add a new author-tag * Increase the major-version * Import all unused files * Fix the AsyncDynamicQuestionProperty * Improve the docs * Remove the poll-namespace * Fix the inquirer-types according to tslint * Fix dependent type-declarations * Remove the index-signature from the choice-class * Fix the constructor of the prompt-ui * Add tests * Simplify the PromptCollection-type * Rearrange the file-header * Add an interface for the bottom-bar options * Make the log-stream public * Complete the docs of the choice-class * Add a validator-type * Add a choice-collection type * Add a Transformer-type * Fix the PromptModule-type * Add all inquirer code-examples * Fix incorrect code * Rework the way to import the example-files * Fix dependent types
136 lines
3.2 KiB
TypeScript
136 lines
3.2 KiB
TypeScript
// Type definitions for yeoman-environment 2.3
|
|
// Project: https://github.com/yeoman/environment, http://yeoman.io
|
|
// Definitions by: c4605 <https://github.com/bolasblack>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 3.3
|
|
|
|
import { EventEmitter } from "events";
|
|
import { Store as MemFsStore } from "mem-fs";
|
|
import * as inquirer from "inquirer";
|
|
import * as Generator from "yeoman-generator";
|
|
|
|
declare class Environment<
|
|
O extends Environment.Options = Environment.Options
|
|
> extends EventEmitter {
|
|
static createEnv<O extends Environment.Options = Environment.Options>(
|
|
args?: string | string[],
|
|
opts?: O,
|
|
adapter?: Environment.Adapter
|
|
): Environment<O>;
|
|
|
|
static enforceUpdate<E extends Environment>(env: E): E;
|
|
|
|
static namespaceToName(namespace: string): string;
|
|
|
|
arguments: string[];
|
|
|
|
options: O;
|
|
|
|
cwd: string;
|
|
|
|
store: Generator.Storage;
|
|
|
|
sharedFs: MemFsStore;
|
|
|
|
lookups: string[];
|
|
|
|
aliases: Environment.Alias[];
|
|
|
|
constructor(
|
|
args?: string | string[],
|
|
opts?: O,
|
|
adapter?: Environment.Adapter
|
|
);
|
|
|
|
alias(match: string | RegExp, value: string): void;
|
|
|
|
create(name: string, options: object): void;
|
|
|
|
error(err: Error | object): Error;
|
|
|
|
findGeneratorsIn(list: string[]): string[];
|
|
|
|
get(namespace: string): Generator | null;
|
|
|
|
getByPath(path: string): Generator | null;
|
|
|
|
getGeneratorNames(): string[];
|
|
|
|
getGeneratorsMeta(): { [namespace: string]: Environment.GeneratorMeta };
|
|
|
|
getNpmPaths(): string[];
|
|
|
|
help(name: string): string;
|
|
|
|
instantiate(
|
|
name: string,
|
|
options: Environment.InstantiateOptions
|
|
): Generator;
|
|
|
|
lookup(cb?: (err: null | Error) => void): void;
|
|
|
|
namespace(filepath: string): string;
|
|
|
|
namespaces(): string[];
|
|
|
|
register(name: string, namespace?: string): string;
|
|
|
|
registerStub(Generator: Generator, namespace: string): this;
|
|
|
|
resolveModulePath(moduleId: string): string;
|
|
|
|
run(done: Environment.RunDone): void;
|
|
run(args: string | string[], done: Environment.RunDone): void;
|
|
run(
|
|
args: string | string[],
|
|
options: object,
|
|
done: Environment.RunDone
|
|
): void;
|
|
|
|
private _tryRegistering(generatorReference: string): void;
|
|
}
|
|
|
|
declare namespace Environment {
|
|
interface Adapter {
|
|
prompt<T>(questions: Adapter.Questions<T>): Promise<T>;
|
|
prompt<T1, T2>(
|
|
questions: Adapter.Questions<T1>,
|
|
cb: (res: T1) => T2
|
|
): Promise<T2>;
|
|
|
|
diff(actual: string, expected: string): string;
|
|
}
|
|
|
|
namespace Adapter {
|
|
type Question<T> = inquirer.DistinctQuestion<T>;
|
|
|
|
type Questions<T> = inquirer.QuestionCollection<T>;
|
|
|
|
type Answers = inquirer.Answers;
|
|
}
|
|
|
|
interface Alias {
|
|
match: RegExp;
|
|
value: string;
|
|
}
|
|
|
|
interface Options {
|
|
cwd?: string;
|
|
[key: string]: any;
|
|
}
|
|
|
|
interface GeneratorMeta {
|
|
resolved: string;
|
|
namespace: string;
|
|
}
|
|
|
|
interface InstantiateOptions {
|
|
arguments: string | string[];
|
|
options: Options;
|
|
}
|
|
|
|
type RunDone = (err: null | Error) => void;
|
|
}
|
|
|
|
export = Environment;
|