mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
add yeoman-environment (#35174)
This commit is contained in:
135
types/yeoman-environment/index.d.ts
vendored
Normal file
135
types/yeoman-environment/index.d.ts
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
// 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: 2.8
|
||||
|
||||
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.Question<T>;
|
||||
|
||||
type Questions<T> = inquirer.Questions<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;
|
||||
6
types/yeoman-environment/package.json
Normal file
6
types/yeoman-environment/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"rxjs": ">=6.4.0"
|
||||
}
|
||||
}
|
||||
23
types/yeoman-environment/tsconfig.json
Normal file
23
types/yeoman-environment/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"yeoman-environment-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/yeoman-environment/tslint.json
Normal file
1
types/yeoman-environment/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
3
types/yeoman-environment/yeoman-environment-tests.ts
Normal file
3
types/yeoman-environment/yeoman-environment-tests.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import * as Env from "yeoman-environment";
|
||||
|
||||
Env.createEnv();
|
||||
Reference in New Issue
Block a user