mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-18 04:24:30 +08:00
# Conflicts: # amcharts/AmCharts.d.ts # angular-gettext/angular-gettext.d.ts # angular-jwt/angular-jwt.d.ts # angular-material/angular-material.d.ts # angularjs/angular.d.ts # auth0-js/auth0-js.d.ts # aws-lambda/aws-lambda.d.ts # aws-sdk/aws-sdk.d.ts # azure-mobile-apps/azure-mobile-apps.d.ts # azure-mobile-services-client/AzureMobileServicesClient.d.ts # blessed/blessed-tests.ts # blessed/blessed.d.ts # bootbox/bootbox.d.ts # bowser/bowser.d.ts # cache-manager/cache-manager.d.ts # chai-things/chai-things.d.ts # colors/colors.d.ts # cordova/cordova-tests.ts # cordova/plugins/Contacts.d.ts # cordova/plugins/FileSystem.d.ts # couchbase/couchbase.d.ts # cucumber/cucumber-tests.ts # cucumber/cucumber.d.ts # d3/d3.d.ts # dojo/dojo.d.ts # dustjs-linkedin/dustjs-linkedin.d.ts # esprima/esprima.d.ts # express-serve-static-core/express-serve-static-core.d.ts # express-session/express-session.d.ts # fetch-mock/fetch-mock.d.ts # fs-extra/fs-extra.d.ts # fullCalendar/fullCalendar.d.ts # github-electron/github-electron.d.ts # gulp-uglify/gulp-uglify.d.ts # gulp/gulp.d.ts # highcharts/highcharts.d.ts # imap/imap.d.ts # incremental-dom/incremental-dom.d.ts # inversify/inversify.d.ts # ionic/ionic.d.ts # ioredis/ioredis.d.ts # isomorphic-fetch/isomorphic-fetch-tests.ts # jake/jake.d.ts # joi/joi.d.ts # jquery-mockjax/jquery-mockjax.d.ts # jquery/jquery.d.ts # js-data-http/js-data-http-tests.ts # js-data-http/js-data-http.d.ts # js-data/js-data.d.ts # jsdom/jsdom.d.ts # jsts/jsts-tests.ts # knex/knex.d.ts # koa-favicon/koa-favicon.d.ts # koa-router/koa-router-tests.ts # koa-router/koa-router.d.ts # lodash/lodash.d.ts # mailparser/mailparser.d.ts # maquette/maquette.d.ts # material-ui/material-ui.d.ts # matter-js/matter-js.d.ts # moment/moment.d.ts # mongoose-promise/mongoose-promise-tests.ts # mongoose/mongoose-tests.ts # mongoose/mongoose.d.ts # multer/multer.d.ts # ncp/ncp.d.ts # nock/nock.d.ts # node/node-tests.ts # node/node.d.ts # nvd3/nvd3.d.ts # object-assign/object-assign.d.ts # openlayers/openlayers.d.ts # parse/parse.d.ts # pdf/pdf.d.ts # pdfkit/pdfkit.d.ts # pg/pg.d.ts # pixi.js/pixi.js.d.ts # progress/progress.d.ts # pusher-js/pusher-js.d.ts # quill/quill-tests.ts # quill/quill.d.ts # radium/radium.d.ts # ravenjs/ravenjs-tests.ts # react-dropzone/react-dropzone.d.ts # react-mdl/react-mdl.d.ts # react-native/react-native.d.ts # react-notification-system/react-notification-system.d.ts # react-router/history-tests.ts # react-router/react-router-tests.tsx # react-router/react-router.d.ts # react-select/react-select-tests.tsx # react-select/react-select.d.ts # react/react.d.ts # redux-form/redux-form.d.ts # request-promise/request-promise.d.ts # resolve-from/resolve-from.d.ts # riot-api-nodejs/riot-api-nodejs.d.ts # sanitize-html/sanitize-html.d.ts # segment-analytics/segment-analytics.d.ts # simple-assign/simple-assign-tests.ts # simple-assign/simple-assign.d.ts # slate-irc/slate-irc.d.ts # soap/soap.d.ts # socket.io/socket.io.d.ts # sql.js/sql.js-tests.ts # sql.js/sql.js.d.ts # steam/steam.d.ts # stylus/stylus.d.ts # swiper/swiper.d.ts # tedious/tedious.d.ts # threejs/three.d.ts # twilio/twilio.d.ts # underscore/underscore.d.ts # ws/ws.d.ts # yeoman-generator/yeoman-generator.d.ts
415 lines
16 KiB
TypeScript
415 lines
16 KiB
TypeScript
// Type definitions for jake
|
|
// Project: https://github.com/mde/jake
|
|
// Definitions by: Kon <http://phyzkit.net/>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference types="node" />
|
|
|
|
/**
|
|
* Complets an asynchronous task, allowing Jake's execution to proceed to the next task
|
|
* @param value A value to return from the task.
|
|
*/
|
|
declare function complete(value?: any): void;
|
|
|
|
/**
|
|
* Creates a description for a Jake Task (or FileTask, DirectoryTask). When invoked, the description that iscreated will be associated with whatever Task is created next.
|
|
* @param description The description for the Task
|
|
*/
|
|
declare function desc(description:string): void;
|
|
|
|
/**
|
|
* Creates a Jake DirectoryTask. Can be used as a prerequisite for FileTasks, or for simply ensuring a directory exists for use with a Task's action.
|
|
* @param name The name of the DiretoryTask
|
|
*/
|
|
declare function directory(name:string): jake.DirectoryTask;
|
|
|
|
/**
|
|
* Causes Jake execution to abort with an error. Allows passing an optional error code, which will be used to set the exit-code of exiting process.
|
|
* @param err The error to thow when aborting execution. If this argument is an Error object, it will simply be thrown. If a String, it will be used as the error-message. (If it is a multi-line String, the first line will be used as the Error message, and the remaining lines will be used as the error-stack.)
|
|
*/
|
|
declare function fail(...err:string[]): void;
|
|
declare function fail(...err:Error[]): void;
|
|
declare function fail(...err:any[]): void;
|
|
|
|
/**
|
|
* Creates a Jake FileTask.
|
|
* @name name The name of the Task
|
|
* @param prereqs Prerequisites to be run before this task
|
|
* @param action The action to perform for this task
|
|
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
*/
|
|
declare function file(name:string, prereqs?:string[], action?:()=>void, opts?:jake.FileTaskOptions): jake.FileTask;
|
|
|
|
/**
|
|
* Creates Jake FileTask from regex patterns
|
|
* @name name/pattern of the Task
|
|
* @param source calculated from the name pattern
|
|
* @param prereqs Prerequisites to be run before this task
|
|
* @param action The action to perform for this task
|
|
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
*/
|
|
declare function rule(pattern: RegExp, source: string | { (name: string): string; }, prereqs?: string[], action?: () => void, opts?: jake.TaskOptions): void;
|
|
|
|
/**
|
|
* Creates a namespace which allows logical grouping of tasks, and prevents name-collisions with task-names. Namespaces can be nested inside of other namespaces.
|
|
* @param name The name of the namespace
|
|
* @param scope The enclosing scope for the namespaced tasks
|
|
*/
|
|
declare function namespace(name:string, scope:()=>void): void;
|
|
|
|
/**
|
|
* @param name The name of the Task
|
|
* @param prereqs Prerequisites to be run before this task
|
|
* @param action The action to perform for this task
|
|
* @param opts
|
|
*/
|
|
declare function task(name:string, prereqs?:string[], action?:(...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
|
declare function task(name:string, action?:(...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
|
declare function task(name:string, opts?:jake.TaskOptions, action?:(...params:any[])=>any): jake.Task;
|
|
|
|
/**
|
|
* @param name The name of the NpmPublishTask
|
|
* @param packageFiles The files to include in the package
|
|
* @param definition A function that creates the package definition
|
|
*/
|
|
declare function npmPublishTask(name:string, packageFiles:string[]): jake.NpmPublishTask;
|
|
declare function npmPublishTask(name:string, definition?:()=>void): jake.NpmPublishTask;
|
|
|
|
|
|
declare namespace jake{
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////
|
|
// File-utils //////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
interface UtilOptions{
|
|
silent?: boolean;
|
|
}
|
|
|
|
/**
|
|
* The jake.mkdirP utility recursively creates a set of nested directories. It will not throw an error if any of the directories already exists.
|
|
* https://github.com/substack/node-mkdirp
|
|
*/
|
|
export function mkdirP(name:string, mode?:string, f?:(er:Error, made:any)=>void): void;
|
|
export function mkdirP(name:string, f?:(er:Error, made:any)=>void): void;
|
|
|
|
/**
|
|
* The jake.cpR utility does a recursive copy of a file or directory.
|
|
* Note that this command can only copy files and directories; it does not perform globbing (so arguments like '*.txt' are not possible).
|
|
* @param path the file/directory to copy,
|
|
* @param destination the destination.
|
|
*/
|
|
export function cpR(path:string, destination:string, opts?:UtilOptions, callback?:()=>void): void;
|
|
export function cpR(path:string, destination:string, callback?:(err:Error)=>void): void;
|
|
|
|
/**
|
|
* The jake.readdirR utility gives you a recursive directory listing, giving you output somewhat similar to the Unix find command. It only works with a directory name, and does not perform filtering or globbing.
|
|
* @return an array of filepaths for all files in the 'pkg' directory, and all its subdirectories.
|
|
*/
|
|
export function readdirR(name:string, opts?:UtilOptions): string[];
|
|
|
|
/**
|
|
* The jake.rmRf utility recursively removes a directory and all its contents.
|
|
*/
|
|
export function rmRf(name:string, opts?:UtilOptions): void;
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Running shell-commands ////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
interface ExecOptions{
|
|
/**
|
|
* print to stdout, default false
|
|
*/
|
|
|
|
printStdout?:boolean;
|
|
/**
|
|
* print to stderr, default false
|
|
*/
|
|
printStderr?:boolean;
|
|
|
|
/**
|
|
* stop execution on error, default true
|
|
*/
|
|
breakOnError?:boolean;
|
|
|
|
/**
|
|
*
|
|
*/
|
|
windowsVerbatimArguments?: boolean
|
|
}
|
|
export function exec(cmds:string[], callback?:()=>void, opts?:ExecOptions):void;
|
|
|
|
|
|
/**
|
|
* @event cmdStart When a new command begins to run. Passes one arg, the command being run.
|
|
* @event cmdEnd When a command finishes. Passes one arg, the command being run.
|
|
* @event stdout When the stdout for the child-process recieves data. This streams the stdout data. Passes one arg, the chunk of data.
|
|
* @event stderr When the stderr for the child-process recieves data. This streams the stderr data. Passes one arg, the chunk of data.
|
|
* @event error When a shell-command
|
|
*/
|
|
export interface Exec extends NodeJS.EventEmitter {
|
|
append(cmd:string): void;
|
|
run(): void;
|
|
}
|
|
|
|
export function createExec(cmds:string[], callback?:()=>void, opts?:ExecOptions ):Exec;
|
|
export function createExec(cmds:string[], opts?:ExecOptions, callback?:()=>void):Exec;
|
|
export function createExec(cmds:string, callback?:()=>void, opts?:ExecOptions ):Exec;
|
|
export function createExec(cmds:string, opts?:ExecOptions, callback?:()=>void):Exec;
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Logging and output ////////////////////////////////////////////////////////////////////////////////////////
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
interface Logger{
|
|
log(value:any): void;
|
|
error(value:any): void;
|
|
}
|
|
|
|
export var logger: Logger;
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// program ////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
export var program: {
|
|
opts: {
|
|
[name:string]: any;
|
|
quiet: boolean;
|
|
};
|
|
taskNames: string[];
|
|
taskArgs: string[];
|
|
envVars: { [key:string]: string; };
|
|
};
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// Tasks /////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
export interface TaskOptions{
|
|
/**
|
|
* Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
* @default false
|
|
*/
|
|
async?: boolean;
|
|
|
|
/**
|
|
* number of parllel async tasks
|
|
*/
|
|
parallelLimit?: number;
|
|
}
|
|
|
|
/**
|
|
* A Jake Task
|
|
*
|
|
* @event complete
|
|
*/
|
|
export class Task extends NodeJS.EventEmitter {
|
|
/**
|
|
* @name name The name of the Task
|
|
* @param prereqs Prerequisites to be run before this task
|
|
* @param action The action to perform for this task
|
|
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
*/
|
|
constructor(name:string, prereqs?:string[], action?:()=>void, opts?:TaskOptions);
|
|
|
|
/**
|
|
* Runs prerequisites, then this task. If the task has already been run, will not run the task again.
|
|
*/
|
|
invoke(): void;
|
|
|
|
/**
|
|
* Runs this task, without running any prerequisites. If the task has already been run, it will still run it again.
|
|
*/
|
|
reenable(): void;
|
|
|
|
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;
|
|
value: any;
|
|
}
|
|
|
|
export class DirectoryTask{
|
|
/**
|
|
* @param name The name of the directory to create.
|
|
*/
|
|
constructor(name:string);
|
|
}
|
|
|
|
export interface FileTaskOptions{
|
|
/**
|
|
* Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
* @default false
|
|
*/
|
|
async?: boolean;
|
|
}
|
|
|
|
export class FileTask{
|
|
/**
|
|
* @param name The name of the Task
|
|
* @param prereqs Prerequisites to be run before this task
|
|
* @param action The action to perform to create this file
|
|
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
|
*/
|
|
constructor(name:string, prereqs?:string[], action?:()=>void, opts?:FileTaskOptions);
|
|
}
|
|
|
|
interface FileFilter{
|
|
(filename:string): boolean;
|
|
}
|
|
|
|
export class FileList{
|
|
constructor();
|
|
|
|
/**
|
|
* Includes file-patterns in the FileList. Should be called with one or more
|
|
* pattern for finding file to include in the list. Arguments should be strings
|
|
* for either a glob-pattern or a specific file-name, or an array of them
|
|
*/
|
|
include(files:string[]): void;
|
|
include(...files:string[]): void;
|
|
|
|
/**
|
|
* Indicates whether a particular file would be filtered out by the current
|
|
* exclusion rules for this FileList.
|
|
* @param name The filename to check
|
|
* @return Whether or not the file should be excluded
|
|
*/
|
|
shouldExclude(name:string): boolean;
|
|
|
|
/**
|
|
* Excludes file-patterns from the FileList. Should be called with one or more
|
|
* pattern for finding file to include in the list. Arguments can be:
|
|
* 1. Strings for either a glob-pattern or a specific file-name
|
|
* 2. Regular expression literals
|
|
* 3. Functions to be run on the filename that return a true/false
|
|
*/
|
|
exclude(file:string[]): void;
|
|
exclude(...file:string[]): void;
|
|
exclude(file:RegExp[]): void;
|
|
exclude(...file:RegExp[]): void;
|
|
exclude(file:FileFilter[]): void;
|
|
exclude(...file:FileFilter[]): void;
|
|
|
|
/**
|
|
* Populates the FileList from the include/exclude rules with a list of
|
|
* actual files
|
|
*/
|
|
resolve(): void;
|
|
|
|
/**
|
|
* Convert to a plain-jane array
|
|
*/
|
|
toArray(): string[];
|
|
|
|
/**
|
|
* Get rid of any current exclusion rules
|
|
*/
|
|
clearExclude(): void;
|
|
}
|
|
|
|
export class PackageTask{
|
|
/**
|
|
* Instantiating a PackageTask creates a number of Jake Tasks that make packaging and distributing your software easy.
|
|
* @param name The name of the project
|
|
* @param version The current project version (will be appended to the project-name in the package-archive
|
|
* @param definition Defines the contents of the package, and format of the package-archive. Will be executed on the instantiated PackageTask (i.e., 'this', will be the PackageTask instance), to set the various instance-propertiess.
|
|
*/
|
|
constructor(name:string, version:string, definition:()=>void);
|
|
|
|
/**
|
|
* Equivalent to the '-C' command for the `tar` and `jar` commands. ("Change to this directory before adding files.")
|
|
*/
|
|
archiveChangeDir: string;
|
|
|
|
/**
|
|
* Specifies the files and directories to include in the package-archive. If unset, this will default to the main package directory -- i.e., name + version.
|
|
*/
|
|
archiveContentDir: string;
|
|
|
|
/**
|
|
* The shell-command to use for creating jar archives.
|
|
*/
|
|
jarCommand: string;
|
|
|
|
/**
|
|
* Can be set to point the `jar` utility at a manifest file to use in a .jar archive. If unset, one will be automatically created by the `jar` utility. This path should be relative to the root of the package directory (this.packageDir above, likely 'pkg')
|
|
*/
|
|
manifestFile: string;
|
|
|
|
/**
|
|
* The name of the project
|
|
*/
|
|
name: string;
|
|
|
|
/**
|
|
* If set to true, uses the `jar` utility to create a .jar archive of the pagckage
|
|
*/
|
|
needJar: boolean;
|
|
|
|
/**
|
|
* If set to true, uses the `tar` utility to create a gzip .tgz archive of the pagckage
|
|
*/
|
|
needTar: boolean;
|
|
|
|
/**
|
|
* If set to true, uses the `tar` utility to create a bzip2 .bz2 archive of the pagckage
|
|
*/
|
|
needTarBz2: boolean;
|
|
|
|
/**
|
|
* If set to true, uses the `zip` utility to create a .zip archive of the pagckage
|
|
*/
|
|
needZip: boolean;
|
|
|
|
/**
|
|
* The list of files and directories to include in the package-archive
|
|
*/
|
|
packageFiles: FileList;
|
|
|
|
/**
|
|
* The shell-command to use for creating tar archives.
|
|
*/
|
|
tarCommand: string;
|
|
|
|
/**
|
|
* The project version-string
|
|
*/
|
|
version: string;
|
|
|
|
/**
|
|
* The shell-command to use for creating zip archives.
|
|
*/
|
|
zipCommand: string;
|
|
|
|
}
|
|
|
|
export class TestTask{
|
|
constructor(name:string, definition?:()=>void);
|
|
}
|
|
|
|
export class NpmPublishTask{
|
|
constructor(name:string, packageFiles:string[]);
|
|
constructor(name:string, definition?:()=>void);
|
|
}
|
|
|
|
export function addListener(event: string, listener: Function): NodeJS.EventEmitter;
|
|
export function on(event: string, listener: Function): NodeJS.EventEmitter;
|
|
export function once(event: string, listener: Function): NodeJS.EventEmitter;
|
|
export function removeListener(event: string, listener: Function): NodeJS.EventEmitter;
|
|
export function removeAllListener(event: string): NodeJS.EventEmitter;
|
|
export function setMaxListeners(n: number): void;
|
|
export function listeners(event: string): Function[];
|
|
export function emit(event: string, ...args: any[]): boolean;
|
|
}
|