Sync with upstream

This commit is contained in:
Hinell
2017-01-14 01:44:18 +03:00
33 changed files with 617 additions and 600 deletions
+7 -3
View File
@@ -17,14 +17,18 @@ declare namespace adal {
clientId: string;
redirectUri?: string;
instance?: string;
cacheLocation?: string;
endpoints?: any; // If you need to send CORS api requests.
popUp?: boolean;
localLoginUrl?: string;
displayCall?: (urlNavigate: string) => any;
postLogoutRedirectUri?: string; // redirect url after succesful logout operation
cacheLocation?: string;
anonymousEndpoints?: string[];
expireOffsetSeconds?: number;
correlationId?: string;
loginResource?: string;
resource?: string;
endpoints?: any; // If you need to send CORS api requests.
extraQueryParameter?: string;
postLogoutRedirectUri?: string; // redirect url after succesful logout operation
}
interface User {
+22
View File
@@ -0,0 +1,22 @@
import {redditHot, hackerHot, wilsonScore} from 'decay';
const upvotes = 42;
const downvotes = 12;
const posted = new Date(2017, 1, 1);
let score: number;
let redditCalculator = redditHot();
score = redditCalculator(upvotes, downvotes, posted);
redditCalculator = redditHot(10000);
score = redditCalculator(upvotes, downvotes, posted);
let hackerCalculator = hackerHot();
score = hackerCalculator(upvotes, posted);
hackerCalculator = hackerHot(1.6);
score = hackerCalculator(upvotes, posted);
let wilsonCalculator = wilsonScore();
score = wilsonCalculator(upvotes, downvotes);
wilsonCalculator = wilsonScore(1.0);
score = wilsonCalculator(upvotes, downvotes);
+52
View File
@@ -0,0 +1,52 @@
// Type definitions for decay 1.0
// Project: https://github.com/clux/decay
// Definitions by: Eric Naeseth <https://github.com/enaeseth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Creates a function to rank posts using Reddit's "hot" algorithm.
* @param decay controls how quickly rankings drop with time
* @return calculator function
*/
export function redditHot(decay?: number): RedditHotFunction;
/**
* Creates a function to rank posts using the Hacker News "hot" algorithm.
* @param gravity controls how quickly rankings drop with time
* @return calculator function
*/
export function hackerHot(gravity?: number): HackerNewsHotFunction;
/**
* Creates a function to rank posts using the Wilson score interval sort (Reddit's "best"
* algorithm).
* @param confidence statistical confidence
* @return calculator function
* @see {@link https://redditblog.com/2009/10/15/reddits-new-comment-sorting-system/ Reddit's writeup}
*/
export function wilsonScore(confidence?: number): WilsonScoreFunction;
/**
* Computes a ranking using Reddit's "hot" algorithm.
* @param upvotes number of upvotes the post has received
* @param downvotes number of upvotes the post has received
* @param date when the post was posted
* @return ranking
*/
export type RedditHotFunction = (upvotes: number, downvotes: number, date: Date) => number;
/**
* Computes a ranking using the Hacker News "hot" algorithm.
* @param votes number of upvotes the post has received
* @param date when the post was posted
* @return ranking
*/
export type HackerNewsHotFunction = (votes: number, date: Date) => number;
/**
* Computes a ranking using the Wilson score (Reddit's "best" algorithm).
* @param upvotes number of upvotes the post has received
* @param downvotes number of upvotes the post has received
* @return ranking
*/
export type WilsonScoreFunction = (upvotes: number, downvotes: number) => number;
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"decay-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+30 -38
View File
@@ -1,50 +1,42 @@
// Type definitions for doT v1.0.1
// Type definitions for doT 1.1
// Project: https://github.com/olado/doT
// Definitions by: ZombieHunter <https://github.com/ZombieHunter>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var doT: doT.doTStatic;
export as namespace doT;
declare namespace doT {
/** Version number */
export const version: string;
interface doTStatic {
/**
* Version number
*/
version: string;
/**
* Default template settings
*/
templateSettings: TemplateSettings;
/** Default template settings */
export const templateSettings: TemplateSettings;
/**
* Compile template
*/
template(tmpl: string, c?: TemplateSettings, def?: Object): Function;
type RenderFunction = (...args: any[]) => string;
/**
* For express
*/
compile(tmpl: string, def?: Object): Function;
}
/** Compile template */
export function template(tmpl: string, c?: TemplateSettings, def?: {}): RenderFunction;
interface TemplateSettings {
evaluate: RegExp;
interpolate: RegExp;
encode: RegExp;
use: RegExp;
useParams: RegExp;
define: RegExp;
defineParams: RegExp;
conditional: RegExp;
iterate: RegExp;
varname: string;
strip: boolean;
append: boolean;
selfcontained: boolean;
}
/** For express */
export function compile(tmpl: string, def?: {}): RenderFunction;
interface TemplateSettings {
evaluate: RegExp;
interpolate: RegExp;
encode: RegExp;
use: RegExp;
useParams: RegExp;
define: RegExp;
defineParams: RegExp;
conditional: RegExp;
iterate: RegExp;
varname: string;
strip: boolean;
append: boolean;
selfcontained: boolean;
}
interface String {
encodeHTML(): string;
declare global {
interface String {
encodeHTML(): string;
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+9 -2
View File
@@ -1,12 +1,13 @@
import dotenv = require('dotenv');
// typically, result will be an Object
let env = dotenv.config({
const env = dotenv.config({
silent: true
});
const dbUrl: string | null = !env ? null : env['DATABASE_URL'];
// ... but it might also be `false`
let result = dotenv.config({
const result = dotenv.config({
path: '.non-existing-env'
});
@@ -17,3 +18,9 @@ dotenv.config({
dotenv.config({
encoding: 'utf8'
});
const parsed = dotenv.parse("ENVIRONMENT=production\nDEBUG=no\n");
const debug: string = parsed['DEBUG'];
const parsedFromBuffer = dotenv.parse(new Buffer("JUSTICE=league\n"));
const justice: string = parsedFromBuffer['JUSTICE'];
+10 -3
View File
@@ -1,15 +1,22 @@
// Type definitions for dotenv 2.0.0
// Type definitions for dotenv 2.0
// Project: https://github.com/motdotla/dotenv
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula/>, Borek Bernard <https://github.com/borekb>
// Definitions by: Jussi Kinnula <https://github.com/jussikinnula/>, Borek Bernard <https://github.com/borekb>, Eric Naeseth <https://github.com/enaeseth>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Parses a string or buffer in the .env file format into an object.
*/
export function parse(src: string | Buffer): {[name: string]: string};
/**
* Loads `.env` into `process.env`.
*
* @param options
* @return Object Object with the parsed keys and values, e.g., 'KEY=value' becomes { KEY: 'value' }
*/
export function config(options?: DotenvOptions): Object | false;
export function config(options?: DotenvOptions): {[name: string]: string} | false;
export interface DotenvOptions {
/**
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+4
View File
@@ -130,3 +130,7 @@ declare namespace GeoJSON {
properties: { href: string; type: string }
}
}
declare module 'geojson' {
export = GeoJSON;
}
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for leaflet-draw 0.4.6
// Type definitions for leaflet-draw 0.4
// Project: https://github.com/Leaflet/Leaflet.draw
// Definitions by: Matt Guest <https://github.com/matt-guest>, Ryan Blace <https://github.com/reblace>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-5
View File
@@ -1,5 +0,0 @@
{
"dependencies": {
"@types/leaflet": "^1.0"
}
}
+3
View File
@@ -6,6 +6,9 @@
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
+6
View File
@@ -0,0 +1,6 @@
{
"extends": "../tslint.json",
"rules": {
"no-empty-interface": false
}
}
+2 -1
View File
@@ -963,7 +963,8 @@ declare namespace L {
position?: ControlPosition;
}
export interface Control {
export class Control extends Class {
constructor (options?: ControlOptions);
getPosition(): ControlPosition;
setPosition(position: ControlPosition): this;
getContainer(): HTMLElement;
+15
View File
@@ -390,3 +390,18 @@ class MyDivIcon extends L.DivIcon {
super();
}
}
let myControlClass = L.Control.extend({});
let myControl = new myControlClass();
L.Control.include({});
L.Control.mergeOptions({});
L.Control.addInitHook(() => {});
export class MyNewControl extends L.Control {
constructor() {
super({
position: 'topleft'
});
}
}
+18 -18
View File
@@ -14,7 +14,7 @@ declare function createPool(config: IPoolConfig): IPool;
declare function createPoolCluster(config?: IPoolClusterConfig): IPoolCluster;
declare function escape(value: any): string;
declare function format(sql: string): string;
declare function format(sql: string, values: Array<any>): string;
declare function format(sql: string, values: any[]): string;
declare function format(sql: string, values: any): string;
interface IMySql {
@@ -24,15 +24,15 @@ interface IMySql {
createPoolCluster(config?: IPoolClusterConfig): IPoolCluster;
escape(value: any): string;
format(sql: string): string;
format(sql: string, values: Array<any>): string;
format(sql: string, values: any[]): string;
format(sql: string, values: any): string;
}
interface IConnectionStatic {
createQuery(sql: string): IQuery;
createQuery(sql: string, callback: (err: IError, ...args: any[]) => void): IQuery;
createQuery(sql: string, values: Array<any>): IQuery;
createQuery(sql: string, values: Array<any>, callback: (err: IError, ...args: any[]) => void): IQuery;
createQuery(sql: string, values: any[]): IQuery;
createQuery(sql: string, values: any[], callback: (err: IError, ...args: any[]) => void): IQuery;
}
interface IConnection {
@@ -67,10 +67,10 @@ interface IConnection {
escape(value: any): string;
escapeId(value: string): string;
escapeId(values: Array<string>): string;
escapeId(values: string[]): string;
format(sql: string): string;
format(sql: string, values: Array<any>): string;
format(sql: string, values: any[]): string;
format(sql: string, values: any): string;
on(ev: string, callback: (...args: any[]) => void): IConnection;
@@ -151,24 +151,24 @@ interface IQuery {
on(ev: string, callback: (...args: any[]) => void): IQuery;
on(ev: 'error', callback: (err: IError) => void): IQuery;
on(ev: 'fields', callback: (fields: any, index: number) => void): IQuery;
on(ev: 'fields', callback: (fields: IFieldInfo[], index: number) => void): IQuery;
on(ev: 'result', callback: (row: any, index: number) => void): IQuery;
on(ev: 'end', callback: () => void): IQuery;
}
interface IQueryFunction {
(sql: string): IQuery;
(sql: string, callback: (err: IError, ...args: any[]) => void): IQuery;
(sql: string, values: Array<any>): IQuery;
(sql: string, values: Array<any>, callback: (err: IError, ...args: any[]) => void): IQuery;
(sql: string, callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
(sql: string, values: any[]): IQuery;
(sql: string, values: any[], callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
(sql: string, values: any): IQuery;
(sql: string, values: any, callback: (err: IError, ...args: any[]) => void): IQuery;
(sql: string, values: any, callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
(options: IQueryOptions): IQuery;
(options: IQueryOptions, callback: (err: IError, ...args: any[]) => void): IQuery;
(options: IQueryOptions, values: Array<any>): IQuery;
(options: IQueryOptions, values: Array<any>, callback: (err: IError, ...args: any[]) => void): IQuery;
(options: IQueryOptions, callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
(options: IQueryOptions, values: any[]): IQuery;
(options: IQueryOptions, values: any[], callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
(options: IQueryOptions, values: any): IQuery;
(options: IQueryOptions, values: any, callback: (err: IError, ...args: any[]) => void): IQuery;
(options: IQueryOptions, values: any, callback: (err: IError, results?: any, fields?: IFieldInfo[]) => void): IQuery;
}
interface IQueryOptions {
@@ -362,7 +362,7 @@ interface IConnectionConfig extends IConnectionOptions {
/**
* List of connection flags to use other than the default ones. It is also possible to blacklist default ones
*/
flags?: Array<string>;
flags?: string[];
/**
* object with ssl parameters or a string containing name of ssl profile
@@ -447,12 +447,12 @@ interface ISslCredentials {
/**
* Either a string or list of strings of PEM encoded CA certificates to trust.
*/
ca?: Array<string>;
ca?: string[];
/**
* Either a string or list of strings of PEM encoded CRLs (Certificate Revocation List)
*/
crl?: Array<string>;
crl?: string[];
/**
* A string describing the ciphers to use or exclude
+2 -1
View File
@@ -318,6 +318,8 @@ declare namespace polymer {
interface PolymerStatic {
Settings: Settings;
isInstance(element: string): boolean;
Base: Base;
dom: DomApiStatic;
(prototype: Base | { new (): Base }): webcomponents.CustomElementConstructor;
@@ -332,4 +334,3 @@ declare namespace polymer {
}
declare var Polymer: polymer.PolymerStatic;
+1
View File
@@ -744,6 +744,7 @@ declare namespace ReactBootstrap {
interface GridProps extends React.HTMLProps<Grid> {
componentClass?: React.ReactType;
fluid?: boolean;
bsClass?: string;
}
type Grid = React.ClassicComponent<GridProps, {}>;
var Grid: React.ClassicComponentClass<GridProps>;
+10 -106
View File
@@ -21,102 +21,6 @@ export = React;
//react-native "extends" react
declare module "react" {
/**
* Represents the completion of an asynchronous operation
* @see lib.es6.d.ts
*/
export interface Promise<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | Promise<TResult>, onrejected?: (reason: any) => TResult | Promise<TResult>): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | Promise<T>): Promise<T>;
// not in lib.es6.d.ts but called by react-native
done(callback?: (value: T) => void): void;
}
export interface PromiseConstructor {
/**
* A reference to the prototype.
*/
prototype: Promise<any>;
/**
* Creates a new Promise.
* @param init A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
<T>(init: (resolve: (value?: T | Promise<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: (T | Promise<T>)[]): Promise<T[]>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of values.
* @returns A new Promise.
*/
all(values: Promise<void>[]): Promise<void>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: (T | Promise<T>)[]): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | Promise<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
// @see lib.es6.d.ts
export var Promise: PromiseConstructor;
export type MeasureOnSuccessCallback = (
x: number,
y: number,
@@ -5634,7 +5538,7 @@ declare module "react" {
* Fires when a user has finished scrolling.
*/
onScrollEndDrag?: (event?: NativeSyntheticEvent<NativeScrollEvent>) => void
/**
* Fires when scroll view has finished moving
*/
@@ -6132,43 +6036,43 @@ declare module "react" {
/**
* Sets value for key and calls callback on completion, along with an Error if there is any
*/
setItem(key: string, value: string, callback?: (error?: Error) => void): Promise<string>
setItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>
removeItem(key: string, callback?: (error?: Error) => void): Promise<string>
removeItem(key: string, callback?: (error?: Error) => void): Promise<void>
/**
* Merges existing value with input value, assuming they are stringified json. Returns a Promise object.
* Not supported by all native implementation
*/
mergeItem(key: string, value: string, callback?: (error?: Error) => void): Promise<string>
mergeItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>
/**
* Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this.
* Use removeItem or multiRemove to clear only your own keys instead.
*/
clear(callback?: (error?: Error) => void): Promise<string>
clear(callback?: (error?: Error) => void): Promise<void>
/**
* Gets all keys known to the app, for all callers, libraries, etc
*/
getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise<string>
getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise<string[]>
/**
* multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet
*/
multiGet(keys: string[], callback?: (errors?: Error[], result?: string[][]) => void): Promise<string>
multiGet(keys: string[], callback?: (errors?: Error[], result?: [string, string][]) => void): Promise<[string, string][]>
/**
* multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet,
*
* multiSet([['k1', 'val1'], ['k2', 'val2']], cb);
*/
multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<string>
multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>
/**
* Delete all the keys in the keys array.
*/
multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise<string>
multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise<void>
/**
* Merges existing values with input values, assuming they are stringified json.
@@ -6176,7 +6080,7 @@ declare module "react" {
*
* Not supported by all native implementations.
*/
multiMerge(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<string>
multiMerge(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>
}
export type BackPressEventName = "hardwareBackPress"
+22 -2
View File
@@ -1,6 +1,6 @@
// Type definitions for react-virtualized
// Type definitions for react-virtualized 8.9.0
// Project: https://github.com/bvaughn/react-virtualized
// Definitions by: Ian Ker-Seymer <https://github.com/ianks>
// Definitions by: Andrew de Waal <https://github.com/andrewdewaal>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="react" />
@@ -50,6 +50,26 @@ declare module "react-virtualized" {
type GridProps = any;
export class Grid extends React.Component<GridProps, {}> { }
interface ListProps {
className?: string;
autoHeight?: boolean;
estimatedRowSize?: number;
height: number;
noRowsRenderer?: Function;
onRowsRendered?: (info: { overscanStartIndex: number, overscanStopIndex: number, startIndex: number, stopIndex: number }) => void;
onScroll?: (info: { clientHeight: number, scrollHeight: number, scrollTop: number }) => void;
overscanRowCount?: number;
rowHeight: number | ((info: { index: number }) => number);
rowRenderer: (info: { index: number, isScrolling: boolean }) => React.ReactNode;
rowCount: number;
scrollToAlignment?: string;
scrollToIndex?: number;
scrollTop?: number;
style?: React.CSSProperties;
tabIndex?: number;
width: number;
}
export class List extends React.Component<ListProps, {}> { }
/*
* Higher-Order Components
@@ -19,6 +19,7 @@ import {
InfiniteLoader,
ScrollSync,
WindowScroller,
List
} from "react-virtualized";
/*
@@ -107,6 +108,26 @@ function GridTest() {
);
}
function ListTest() {
// List data
const list = [
{name: 'Brian Vaughn', occupation: 'Software Engineer', location: 'San Jose, CA, 95125' /* ... */}
// And so on...
];
// Render your List
ReactDOM.render(
<List
width={300}
height={300}
rowHeight={30}
rowCount={list.length}
rowRenderer={({ index, isScrolling }) => list[index]}
/>,
document.getElementById('example')
);
}
function VirtualScrollTest() {
// List data as an array of strings
const list = [
+49
View File
@@ -0,0 +1,49 @@
// Type definitions for webpack-dev-middleware 1.9
// Project: http://github.com/webpack/webpack-dev-middleware
// Definitions by: Benjamin Lim <https://github.com/bumbleblym>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { NextHandleFunction } from 'connect';
import { compiler } from 'webpack';
export = WebpackDevMiddleware;
declare function WebpackDevMiddleware(compiler: compiler.Compiler, options: WebpackDevMiddleware.Options): WebpackDevMiddleware.WebpackDevMiddleware & NextHandleFunction;
declare namespace WebpackDevMiddleware {
interface Options {
noInfo?: boolean;
quiet?: boolean;
lazy?: boolean;
watchOptions?: compiler.WatchOptions;
publicPath: string;
index?: string;
headers?: {
[name: string]: string;
};
stats?: compiler.StatsToStringOptions;
reporter?: Reporter | null;
serverSideRender?: boolean;
log?: Logger;
warn?: Logger;
error?: Logger;
filename?: string;
}
interface ReporterOptions {
state: boolean;
stats: compiler.Stats;
options: Options;
}
type Reporter = (reporterOptions: ReporterOptions) => void;
type Logger = (message: any) => void;
interface WebpackDevMiddleware {
close(callback?: () => void): void;
invalidate(callback?: (stats: compiler.Stats) => void): void;
waitUntilValid(callback?: (stats: compiler.Stats) => void): void;
}
}
+20
View File
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"webpack-dev-middleware-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
@@ -0,0 +1,33 @@
import * as express from 'express';
import * as webpack from 'webpack';
import * as webpackDevMiddleware from 'webpack-dev-middleware';
const compiler = webpack({});
const webpackDevMiddlewareInstance = webpackDevMiddleware(compiler, {
noInfo: false,
quiet: false,
lazy: true,
watchOptions: {
aggregateTimeout: 300,
poll: true,
},
publicPath: '/assets/',
index: 'index.html',
headers: {
'X-Custom-Header': 'yes'
},
stats: {
colors: true,
},
reporter: null,
serverSideRender: false,
});
const app = express();
app.use(webpackDevMiddlewareInstance);
webpackDevMiddlewareInstance.close();
webpackDevMiddlewareInstance.invalidate();
webpackDevMiddlewareInstance.waitUntilValid(function(){
console.log('Package is in a valid state');
});
+19 -4
View File
@@ -1,6 +1,6 @@
// Type definitions for webpack 2.1
// Type definitions for webpack 2.2
// Project: https://github.com/webpack/webpack
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions by: Qubo <https://github.com/tkqubo>, Matt Lewis <https://github.com/mattlewis92>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="uglify-js" />
@@ -543,7 +543,12 @@ declare namespace webpack {
* When there are errors while compiling this plugin skips the emitting phase (and recording phase),
* so there are no assets emitted that include errors. The emitted flag in the stats is false for all assets.
*/
NoErrorsPlugin: NoErrorsPluginStatic;
NoEmitOnErrorsPlugin: NoEmitOnErrorsPluginStatic;
/**
* Alias for NoEmitOnErrorsPlugin
* @deprecated
*/
NoErrorsPlugin: NoEmitOnErrorsPluginStatic;
/**
* Does not watch specified files matching provided paths or RegExps.
*/
@@ -553,6 +558,12 @@ declare namespace webpack {
* Helps with debugging, but increases bundle size.
*/
NamedModulesPlugin: NamedModulesPluginStatic;
/**
* Some loaders need context information and read them from the configuration.
* This need to be passed via loader options in the long-term. See loader documentation for relevant options.
* To keep compatibility with old loaders, these options can be passed via this plugin.
*/
LoaderOptionsPlugin: LoaderOptionsPluginStatic;
}
interface Optimize {
@@ -706,7 +717,7 @@ declare namespace webpack {
new (): Plugin;
}
interface NoErrorsPluginStatic {
interface NoEmitOnErrorsPluginStatic {
new (): Plugin;
}
@@ -718,6 +729,10 @@ declare namespace webpack {
new (): Plugin;
}
interface LoaderOptionsPluginStatic {
new (options: any): Plugin;
}
namespace optimize {
interface DedupePluginStatic {
new (): Plugin;
+4
View File
@@ -363,7 +363,11 @@ plugin = new webpack.EvalSourceMapDevToolPlugin(false);
plugin = new webpack.HotModuleReplacementPlugin();
plugin = new webpack.ExtendedAPIPlugin();
plugin = new webpack.NoErrorsPlugin();
plugin = new webpack.NoEmitOnErrorsPlugin();
plugin = new webpack.WatchIgnorePlugin(paths);
plugin = new webpack.LoaderOptionsPlugin({
debug: true
});
//
// http://webpack.github.io/docs/node.js-api.html
+99 -233
View File
@@ -1,250 +1,116 @@
// Type definitions for yeoman-generator
// Type definitions for yeoman-generator 1.0
// Project: https://github.com/yeoman/generator
// Definitions by: Kentaro Okuno <http://github.com/armorik83>
// Definitions by: Kentaro Okuno <http://github.com/armorik83>, Jay Anslow <http://github.com/janslow>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = yo;
import { EventEmitter } from 'events';
import { Questions, Answers } from 'inquirer';
declare namespace yo {
export interface IYeomanGenerator {
argument(name: string, config: IArgumentConfig): void;
composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator;
defaultFor(name: string): void;
destinationRoot(rootPath?: string): string;
destinationPath(...path: string[]): string;
determineAppname(): void;
getCollisionFilter(): (output: any) => void;
hookFor(name: string, config: IHookConfig): void;
option(name: string, config: IYeomanGeneratorOption): void;
rootGeneratorName(): string;
run(args?: any): void;
run(args: any, callback?: Function): void;
runHooks(callback?: Function): void;
sourceRoot(rootPath?: string): string;
templatePath(...path: string[]): string;
prompt(opt: IPromptOptions | IPromptOptions[], callback: (answers: any) => void): void;
prompt<T>(opt: IPromptOptions | IPromptOptions[]): PromiseLike<T>;
npmInstall(packages?: string[] | string, options?: any, cb?: Function): void;
installDependencies(options?: IInstallDependencyOptions): void;
spawnCommand(name: string, args?: string[], options?: Object): void;
spawnCommandSync(name: string, args?: string[], options?: Object): void;
options: { [key: string]: any };
fs: IMemFsEditor;
declare type Callback = (err: any) => void;
declare namespace Base {
class Storage {
constructor(name: string, fs: MemFsEditor, configPath: string);
defaults(defaults: {}): {};
delete(key: string): void;
get(key: string): any;
getAll(): { [key: string]: any };
save(): void;
set(key: string, value: any): any;
}
export class YeomanGeneratorBase extends NodeJS.EventEmitter implements IYeomanGenerator {
argument(name: string, config: IArgumentConfig): void;
composeWith(namespace: string, options: any, settings?: IComposeSetting): IYeomanGenerator;
defaultFor(name: string): void;
destinationRoot(rootPath?: string): string;
destinationPath(...path: string[]): string;
determineAppname(): void;
getCollisionFilter(): (output: any) => void;
hookFor(name: string, config: IHookConfig): void;
option(name: string, config?: IYeomanGeneratorOption): void;
rootGeneratorName(): string;
run(args?: any): void;
run(args: any, callback?: Function): void;
runHooks(callback?: Function): void;
sourceRoot(rootPath?: string): string;
templatePath(...path: string[]): string;
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
async(): any;
prompt(opt: IPromptOptions | IPromptOptions[], callback: (answers: any) => void): void;
prompt<T>(opt: IPromptOptions | IPromptOptions[]): PromiseLike<T>;
log(message: string) : void;
npmInstall(packages: string[], options?: any, cb?: Function) :void;
installDependencies(options?: IInstallDependencyOptions): void;
spawnCommand(name: string, args?: string[], options?: Object): void;
spawnCommandSync(name: string, args?: string[], options?: Object): void;
appname: string;
gruntfile: IGruntFileStatic;
options: { [key: string]: any };
fs: IMemFsEditor;
}
export interface IMemFsEditor {
read(filepath: string, options?: Object): string;
readJSON(filepath: string, defaults?: Object): Object;
write(filepath: string, contents: string): void;
writeJSON(filepath: string, contents: Object, replacer?: Function, space?: number): void;
delete(filepath: string, options?: Object): void;
copy(from: string, to: string, options?: Object): void;
copyTpl(from: string, to: string, context: Object, options?: Object): void;
move(from: string, to: string, options?: Object): void;
exists(filepath: string): boolean;
commit(callback: Function): void;
commit(filters: any[], callback: Function): void;
}
export interface IInstallDependencyOptions {
interface InstallOptions {
npm?: boolean;
bower?: boolean;
yarn?: boolean;
skipMessage?: boolean;
callback?: Function;
callback?: Callback;
}
export interface IChoice {
name: string;
value: string;
short?: string;
}
export interface IPromptOptions{
type?: string;
name: string;
message: string | ((answers: Object) => string);
choices?: any[] | ((answers: Object) => any);
default?: string | number | string[] | number[] | ((answers: Object) => (string | number | string[] | number[]));
validate?: ((input: any) => boolean | string);
filter?: ((input: any) => any);
when?: ((answers: Object) => boolean) | boolean;
store?: boolean;
}
export interface IGruntFileStatic {
loadNpmTasks(pluginName: string): void;
insertConfig(name:string, config:any):void;
registerTask(name:string, tasks:any):void;
insertVariable(name:string, value:any):void;
prependJavaScript(code:string):void;
}
export interface IArgumentConfig {
desc: string;
interface ArgumentConfig {
description?: string;
required?: boolean;
optional?: boolean;
type: any;
defaults?: any;
type?: typeof String|typeof Number|typeof Array|typeof Object;
default?: any;
}
export interface IComposeSetting {
local?: string;
link?: string;
}
export interface IHookConfig {
as: string;
args: any;
options: any;
}
export interface IYeomanGeneratorOption {
interface OptionConfig {
alias?: string;
defaults?: any;
desc?: string;
default?: any;
description?: string;
hide?: boolean;
type?: any;
type?: typeof Boolean|typeof String|typeof Number;
}
export interface IQueueProps {
initializing: () => void;
prompting?: () => void;
configuring?: () => void;
default?: () => void;
writing: {
[target: string]: () => void;
};
conflicts?: () => void;
install?: () => void;
end: () => void;
}
export interface INamedBase extends IYeomanGenerator {
}
export interface IBase extends INamedBase {
}
export interface IAssert {
file(path: string): void;
file(paths: string[]): void;
fileContent(file: string, reg: RegExp): void;
/** @param {[String, RegExp][]} pairs */
fileContent(pairs: any[][]): void;
/** @param {[String, RegExp][]|String[]} pairs */
files(pairs: any[]): void;
/**
* @param {Object} subject
* @param {Object|Array} methods
*/
implement(subject: any, methods: any): void;
noFile(file: string): void;
noFileContent(file: string, reg: RegExp): void;
/** @param {[String, RegExp][]} pairs */
noFileContent(pairs: any[][]): void;
/**
* @param {Object} subject
* @param {Object|Array} methods
*/
noImplement(subject: any, methods: any): void;
textEqual(value: string, expected: string): void;
}
export interface ITestHelper {
createDummyGenerator(): IYeomanGenerator;
createGenerator(name: string, dependencies: any[], args: any, options: any): IYeomanGenerator;
decorate(context: any, method: string, replacement: Function, options: any): void;
gruntfile(options: any, done: Function): void;
mockPrompt(generator: IYeomanGenerator, answers: any): void;
registerDependencies(dependencies: string[]): void;
restore(): void;
/** @param {String|Function} generator */
run(generator: any): IRunContext;
}
export interface IRunContext {
async(): Function;
inDir(dirPath: string): IRunContext;
/** @param {String|String[]} args */
withArguments(args: any): IRunContext;
withGenerators(dependencies: string[]): IRunContext;
withOptions(options: any): IRunContext;
withPrompts(answers: any): IRunContext;
}
/** @type file file-utils */
var file: any;
var assert: IAssert;
var test: ITestHelper;
// "generators" is deprecated
namespace generators {
export class NamedBase extends YeomanGeneratorBase implements INamedBase {
constructor(args: string | string[], options: any);
}
export class Base extends NamedBase implements IBase {
static extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator;
}
}
export class NamedBase extends YeomanGeneratorBase implements INamedBase {
constructor(args: string | string[], options: any);
}
export class Base extends NamedBase implements IBase {
static extend(protoProps: IQueueProps, staticProps?: any): IYeomanGenerator;
interface MemFsEditor {
read(filepath: string, options?: {}): string;
readJSON(filepath: string, defaults?: {}): any;
write(filepath: string, contents: string): void;
writeJSON(filepath: string, contents: {}, replacer?: (key: string, value: any) => any, space?: number): void;
extendJSON(filepath: string, contents: {}, replacer?: (key: string, value: any) => any, space?: number): void;
delete(filepath: string, options?: {}): void;
copy(from: string, to: string, options?: {}): void;
copyTpl(from: string, to: string, context: {}, templateOptions?: {}, copyOptions?: {}): void;
move(from: string, to: string, options?: {}): void;
exists(filepath: string): boolean;
commit(callback: Callback): void;
commit(filters: any[], callback: Callback): void;
}
}
declare class Base extends EventEmitter {
static extend(protoProps?: any, staticProps?: any): Base;
constructor(args: string|string[], options: {});
env: {};
args: {};
resolved: string;
description: string;
appname: string;
config: Base.Storage;
fs: Base.MemFsEditor;
log(message?: string, context?: any): void;
argument(name: string, config: Base.ArgumentConfig): this;
composeWith(namespace: string, options: { [name: string]: any }, settings?: { local: string, link: 'weak'|'strong' }): this;
destinationPath(...path: string[]): string;
destinationRoot(rootPath?: string): string;
determineAppname(): string;
option(name: string, config: Base.OptionConfig): this;
prompt(questions: Questions): Promise<Answers>;
registerTransformStream(stream: {}|Array<{}>): this;
rootGeneratorName(): string;
rootGeneratorVersion(): string;
run(cb?: Callback): this;
sourceRoot(rootPath?: string): string;
templatePath(...path: string[]): string;
// actions/help mixin
argumentsHelp(): string;
desc(description: string): this;
help(): string;
optionsHelp(): string;
usage(): string;
// actions/spawn_command mixin
spawnCommand(command: string, args: string[], opt?: {}): any;
spawnCommandSync(command: string, args: string[], opt?: {}): any;
// actions/install mixin
bowerInstall(component?: string|string[], options?: {}, cb?: Callback, spawnOptions?: {}): this;
installDependencies(options?: Base.InstallOptions): this;
npmInstall(pkgs?: string|string[], options?: {}, cb?: Callback, spawnOptions?: {}): this;
runInstall(installer: string, paths?: string|string[], options?: {}, cb?: Callback, spawnOptions?: {}): this;
yarnInstall(pkgs?: string|string[], options?: {}, cb?: Callback, spawnOptions?: {}): this;
// actions/user mixin
readonly user: {
readonly git: {
email(): string;
name(): string;
};
readonly github: {
username(): string;
}
};
}
export = Base;
+2 -2
View File
@@ -4,7 +4,7 @@
"target": "es6",
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
@@ -17,4 +17,4 @@
"index.d.ts",
"yeoman-generator-tests.ts"
]
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "../tslint.json"
}
+129 -181
View File
@@ -1,202 +1,150 @@
import Base = require('yeoman-generator');
import { Questions, Answers } from 'inquirer';
import { EventEmitter } from 'events';
import yeoman = require('yeoman-generator');
class MyES2015Generator extends Base {}
var base = yeoman.generators.Base;
var namedBase = yeoman.generators.NamedBase;
const MyGenerator = Base.extend({
writing: function(this: Base): void {
this.fs.write('var foo = 1;', this.destinationPath('index.js'));
}
})
var generator = base.extend({
initializing: function() {
return;
},
writing: {
app: function() {
return;
},
other: function() {
return;
}
},
end: function() {
return;
const generator = new MyES2015Generator(['arg1', 'arg2'], { opt1: 'foo', opt2: 3, opt3: false });
const eventEmitter: EventEmitter = generator;
const env: Object = generator.env;
const args: Object = generator.args;
const resolved: string = generator.resolved;
const description: string = generator.description;
const appname: string = generator.appname;
const config: Base.Storage = generator.config;
const fs: Base.MemFsEditor = generator.fs;
generator.log('my message');
generator.argument('arg1', {});
generator.argument('arg2', {
description: 'second argument',
required: false,
optional: true,
type: String,
default: 'foo',
});
generator.argument('arg2', {
description: 'second argument',
required: false,
type: Number,
default: 3,
});
generator.argument('arg3', {
optional: true,
type: Array,
default: ['an item'],
});
generator.argument('arg4', {
type: Object,
default: {},
});
const argsHelp = generator.argumentsHelp();
generator.installDependencies();
generator.installDependencies({
bower: true,
npm: true,
callback: function () {
console.log('Everything is ready!');
}
});
generator.argument('name', {
desc: 'desc',
required: true,
optional: true,
type: 'any',
defaults: 'any',
});
generator.bowerInstall();
generator.bowerInstall('pkg');
generator.bowerInstall(['pkg1', 'pkg2']);
generator.bowerInstall('pkg', {});
generator.bowerInstall('pkg', { 'custom-option': 3 }, () => {});
generator.bowerInstall('pkg', {}, () => {}, {});
var compose = generator.composeWith('namespace', 'any', {
local: 'local',
link: 'link'
});
compose.defaultFor('name');
compose.destinationRoot() === 'string';
compose.destinationRoot('rootPath') === 'string';
compose.determineAppname();
compose.getCollisionFilter()('output');
compose.hookFor('name', {
as: 'string',
args: 'any',
options: 'any'
});
compose.option('name', {
alias: 'string',
defaults: 'any',
desc: 'string',
hide: true,
type: 'any'
});
var returnString: boolean;
returnString = compose.rootGeneratorName() === 'string';
compose.run('args');
compose.run('args', () => {
return;
});
compose.runHooks(() => {
return;
});
compose.sourceRoot('rootPath') === 'string';
compose.sourceRoot() === 'string';
var assert = yeoman.assert;
assert.file('path');
assert.file(['paths', 'paths']);
assert.fileContent('file', /.*/);
assert.fileContent([
['string', /.*/],
['string', /.*/],
['string', /.*/]
]);
assert.files([
['string', /.*/],
'string',
['string', /.*/],
'string'
]);
assert.implement('subject', 'methods');
assert.noFile('file');
assert.noFileContent('file', /.*/);
assert.noFileContent([
['string', /.*/],
['string', /.*/],
['string', /.*/]
]);
assert.noImplement('subject', 'methods');
assert.textEqual('value', 'expected');
var test = yeoman.test;
var dummyGen = test.createDummyGenerator();
dummyGen.determineAppname();
var createdGen = test.createGenerator('name', ['any', 'amy'], 'args', 'options');
createdGen.determineAppname();
test.decorate('context', 'method', () => {
return; // replacement
}, 'options');
test.gruntfile('options', () => {
return; // done
});
test.mockPrompt(createdGen, 'answers');
test.registerDependencies(['dependencies', 'dependencies']);
test.restore();
var runContext = test.run('generator');
runContext.async()();
runContext.inDir('dirPath')
.withArguments('args')
.withGenerators(['deps', 'deps'])
.withOptions('opts')
.withPrompts('answers');
// http://yeoman.io/generator/Base.html#destinationPath
generator.destinationPath() === 'string';
generator.destinationPath('path1') === 'string';
generator.destinationPath('path1', 'path2') === 'string';
generator.destinationPath('path1', 'path2', 'path3') === 'string';
// http://yeoman.io/generator/Base.html#templatePath
generator.templatePath() === 'string';
generator.templatePath('path1') === 'string';
generator.templatePath('path1', 'path2') === 'string';
generator.templatePath('path1', 'path2', 'path3') === 'string';
// http://yeoman.io/generator/Base.html#npmInstall
generator.npmInstall();
generator.npmInstall('pkg');
generator.npmInstall([ 'pkg1', 'pkg2' ]);
generator.npmInstall(['pkg1', 'pkg2']);
generator.npmInstall('pkg', {});
generator.npmInstall('pkg', {}, () => {});
generator.npmInstall('pkg', { 'custom-option': 3 }, () => {});
generator.npmInstall('pkg', {}, () => {}, {});
// http://yeoman.io/generator/Base.html#installDependencies
generator.installDependencies();
generator.installDependencies({});
generator.installDependencies({ npm: true });
generator.installDependencies({ bower: true });
generator.installDependencies({ skipMessage: true });
generator.installDependencies({ callback: () => {} });
generator.yarnInstall();
generator.yarnInstall('pkg');
generator.yarnInstall(['pkg1', 'pkg2']);
generator.yarnInstall('pkg', {});
generator.yarnInstall('pkg', { 'custom-option': 3 }, () => {});
generator.yarnInstall('pkg', {}, () => {}, {});
generator.runInstall('installer');
generator.runInstall('installer', 'pkg');
generator.runInstall('installer', ['pkg1', 'pkg2']);
generator.runInstall('installer', 'pkg', {});
generator.runInstall('installer', 'pkg', { 'custom-option': 3 }, () => {});
generator.runInstall('installer', 'pkg', {}, () => {}, {});
const composed1: Base = generator.composeWith('bootstrap', { sass: true });
const composed2: Base = generator.composeWith(require.resolve('generator-bootstrap/app/main.js'), { sass: true });
generator.desc('new description');
const dPath1: string = generator.destinationPath();
const dPath2: string = generator.destinationPath('foo');
const dPath3: string = generator.destinationPath(...['many', 'parts']);
const appname2: string = generator.determineAppname();
const gitEmail: string = generator.user.git.email();
const gitName: string = generator.user.git.name();
const githubUsername: string = generator.user.github.username();
const help: string = generator.help();
generator.option('name', {});
generator.option('opt2', {
description: 'a description',
type: Boolean,
alias: 'h',
default: false,
hide: false,
});
generator.option('opt3', {
type: String,
default: 'default value',
});
generator.option('opt4', {
type: Number,
default: 3.2,
});
const optionsHelp: string = generator.optionsHelp();
const answers: Promise<Answers> = generator.prompt([] as Questions);
generator.registerTransformStream([]);
const rootGeneratorName: string = generator.rootGeneratorName();
const rootGeneratorVersion: string = generator.rootGeneratorVersion();
generator.run();
generator.run(() => undefined);
const sourceRoot: string = generator.sourceRoot();
const sourceRoot2: string = generator.sourceRoot('new root');
// http://yeoman.io/generator/Base.html#spawnCommand
generator.spawnCommand('command', []);
generator.spawnCommand('command', [ '-arg' ]);
generator.spawnCommand('command', [], {});
// http://yeoman.io/generator/Base.html#spawnCommandSync
generator.spawnCommandSync('command', []);
generator.spawnCommandSync('command', [ '-arg' ]);
generator.spawnCommandSync('command', [], {});
// http://yeoman.io/generator/Base.html#option
generator.options['opt'] === 'string';
const tPath1: string = generator.templatePath();
const tPath2: string = generator.templatePath('foo');
const tPath3: string = generator.templatePath(...['many', 'parts']);
// http://yeoman.io/generator/Base.html#prompt
// https://github.com/SBoudrias/Inquirer.js
generator.prompt({ name: 'Name', message: 'Message' }, (answer) => {});
generator.prompt({ name: 'Name', message: (answers) => 'Message' }, (answer) => {});
generator.prompt({ name: 'Name', message: '', choices: [ 'c1', 'c2' ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', choices: [ { name: 'Choice 1', value: 'c1' } ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', choices: (answers) => [ 'c1', 'c2' ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', choices: (answers) => [ { name: 'Choice 1', value: 'c1' } ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', choices: (answers) => [ { name: 'Choice 1', value: 'c1', short: '1' } ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: 'string' }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: 10 }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: [ 'string' ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: [ 10 ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: (answers) => [ 'string' ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: (answers) => [ 10 ] }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: (answers) => 'string' }, (answer) => {});
generator.prompt({ name: 'Name', message: '', default: (answers) => 10 }, (answer) => {});
generator.prompt({ name: 'Name', message: '', type: "list" }, (answer) => {});
generator.prompt({ name: 'Name', message: '', validate: (input) => true }, (answer) => {});
generator.prompt({ name: 'Name', message: '', validate: (input) => "Error" }, (answer) => {});
generator.prompt({ name: 'Name', message: '', filter: (input: any) => input }, (answer) => {});
generator.prompt({ name: 'Name', message: '', when: (answers) => true }, (answer) => {});
generator.prompt({ name: 'Name', message: '', when: true }, (answer) => {});
// http://yeoman.io/generator/Base.html
// https://github.com/SBoudrias/mem-fs-editor
generator.fs.read("file") === "string";
generator.fs.read("file", {}) === "string";
generator.fs.readJSON("file") === {};
generator.fs.readJSON("file", {}) === {};
generator.fs.write("file", "contents");
generator.fs.writeJSON("file", {});
generator.fs.writeJSON("file", {}, () => {});
generator.fs.writeJSON("file", {}, () => {}, 2);
generator.fs.delete("file");
generator.fs.delete("file", {});
generator.fs.copy("from", "to");
generator.fs.copy("from", "to", {});
generator.fs.copyTpl("from", "to", {});
generator.fs.copyTpl("from", "to", {}, {});
generator.fs.move("from", "to");
generator.fs.move("from", "to", {});
generator.fs.exists("file") === true;
generator.fs.commit(() => {});
generator.fs.commit([], () => {});
const usage: string = generator.usage();