forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DefinitelyTyped#3785 from k-kagurazaka/dts-for-gulp
Add definitions for conveniently writing gulpfile with TypeScript
- Loading branch information
Showing
20 changed files
with
456 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/// <reference path="./gulp-concat.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import concat = require("gulp-concat"); | ||
|
||
gulp.task("concat:simple", () => { | ||
gulp.src(["file*.txt"]) | ||
.pipe(concat("file.txt")) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("concat:newLine", () => { | ||
gulp.src(["file*.txt"]) | ||
.pipe(concat("file.txt", { newLine: ";" })) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("concat:vinyl", () => { | ||
gulp.src(["file*.txt"]) | ||
.pipe(concat({ path: "file.txt", stat: { mode: 0666 } })) | ||
.pipe(gulp.dest("build")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Type definitions for gulp-concat | ||
// Project: http://github.com/wearefractal/gulp-concat | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "gulp-concat" { | ||
|
||
interface IOptions { | ||
newLine: string; | ||
} | ||
|
||
interface IFsStats { | ||
dev?: number; | ||
ino?: number; | ||
mode?: number; | ||
nlink?: number; | ||
uid?: number; | ||
gid?: number; | ||
rdev?: number; | ||
size?: number; | ||
blksize?: number; | ||
blocks?: number; | ||
atime?: Date; | ||
mtime?: Date; | ||
ctime?: Date; | ||
} | ||
|
||
interface IVinylOptions { | ||
cwd?: string; | ||
base?: string; | ||
path?: string; | ||
stat?: IFsStats; | ||
contents?: NodeJS.ReadableStream | Buffer; | ||
} | ||
|
||
function concat(filename: string, options?: IOptions): NodeJS.ReadWriteStream; | ||
function concat(options: IVinylOptions): NodeJS.ReadWriteStream; | ||
|
||
export = concat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// <reference path="./gulp-flatten.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import flatten = require("gulp-flatten"); | ||
|
||
gulp.task("flatten:simple", () => { | ||
gulp.src(["files/**/*.txt"]) | ||
.pipe(flatten()) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("flatten:newPath", () => { | ||
gulp.src(["files/**/*.txt"]) | ||
.pipe(flatten({ newPath: "new/path" })) | ||
.pipe(gulp.dest("build")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Type definitions for gulp-flatten | ||
// Project: https://github.com/armed/gulp-flatten | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "gulp-flatten" { | ||
|
||
interface IOptions { | ||
newPath: string; | ||
} | ||
|
||
function flatten(options?: IOptions): NodeJS.ReadWriteStream; | ||
|
||
export = flatten; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/// <reference path="./gulp-inject.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import inject = require("gulp-inject"); | ||
|
||
gulp.task("inject:simple", () => { | ||
gulp.src("src/index.html") | ||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }))) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("inject:relative", () => { | ||
gulp.src(["src/index.html"]) | ||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { relative: true })) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("inject:starttag", () => { | ||
gulp.src(["src/index.html"]) | ||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { starttag: "<!-- inject:head:{{ext}} -->" })) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("inject:name", () => { | ||
gulp.src(["src/index.html"]) | ||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css"], { read: false }), { name: "head" })) | ||
.pipe(gulp.dest("build")); | ||
}); | ||
|
||
gulp.task("inject:transform", () => { | ||
gulp.src(["files.json"]) | ||
.pipe(inject(gulp.src(["src/**/*.js", "src/**/*.css", "src/**/*.html"], { read: false }), { | ||
starttag: "\"{{ext}}\": [", | ||
endtag: "]", | ||
transform: (filepath, file, i, length) => { | ||
return " \"" + filepath + "\"" + (i + 1 < length ? "," : ""); | ||
} | ||
})) | ||
.pipe(gulp.dest("build")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Type definitions for gulp-inject | ||
// Project: https://github.com/klei/gulp-inject | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
/// <reference path="../vinyl/vinyl.d.ts" /> | ||
|
||
declare module "gulp-inject" { | ||
|
||
import File = require("vinyl"); | ||
|
||
interface ITagFunction { | ||
(targetExt: string, sourceExt: string): string; | ||
} | ||
|
||
interface ITransformFunction { | ||
(filepath: string, file?: File, index?: number, length?: number, targetFile?: File): string; | ||
} | ||
|
||
interface IOptions { | ||
ignorePath?: string | string[]; | ||
relative?: boolean; | ||
addPrefix?: string; | ||
addRootSlash?: boolean; | ||
name?: string; | ||
starttag?: string | ITagFunction; | ||
endtag?: string | ITagFunction; | ||
transform?: ITransformFunction; | ||
selfClosingTag?: boolean; | ||
} | ||
|
||
function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream; | ||
|
||
export = inject; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// <reference path="./gulp-less.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import less = require("gulp-less"); | ||
|
||
gulp.task("less", () => { | ||
gulp.src("less/**/*.less") | ||
.pipe(less({ | ||
paths: ["less/includes"] | ||
})) | ||
.pipe(gulp.dest("public/css")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Type definitions for gulp-less | ||
// Project: https://github.com/plus3network/gulp-less | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "gulp-less" { | ||
|
||
interface IOptions { | ||
paths: string[]; | ||
plugins?: any[]; | ||
} | ||
|
||
function less(options?: IOptions): NodeJS.ReadWriteStream; | ||
|
||
export = less; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/// <reference path="./gulp-minify-css.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import minifyCSS = require("gulp-minify-css"); | ||
|
||
gulp.task("minify-css", () => { | ||
gulp.src("css/**/*.css") | ||
.pipe(minifyCSS({ keepBreaks: true })) | ||
.pipe(gulp.dest("dist")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Type definitions for gulp-minify-css | ||
// Project: https://github.com/jonathanepollack/gulp-minify-css | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "gulp-minify-css" { | ||
|
||
interface IOptions { | ||
cache?: boolean; | ||
advanced?: boolean; | ||
aggressiveMerging?: boolean; | ||
benchmark?: boolean; | ||
compatibility?: string; | ||
debug?: boolean; | ||
inliner?: Object; | ||
keepBreaks?: boolean; | ||
keepSpecialComments?: string | number; | ||
processImport?: boolean; | ||
rebase?: boolean; | ||
relativeTo?: string; | ||
root?: string; | ||
roundingPrecision?: number; | ||
shorthandCompacting?: boolean; | ||
} | ||
|
||
function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream; | ||
|
||
export = minifyCSS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// <reference path="./gulp-tsd.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import tsd = require("gulp-tsd"); | ||
|
||
gulp.task("tsd", () => { | ||
gulp.src("gulp_tsd.json") | ||
.pipe(tsd()); | ||
}); | ||
|
||
gulp.task("tsd:options", callback => { | ||
tsd({ | ||
command: "reinstall", | ||
config: "tsd.json" | ||
}, callback); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Type definitions for gulp-tsd | ||
// Project: https://github.com/moznion/gulp-tsd | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
declare module "gulp-tsd" { | ||
|
||
interface IOptions { | ||
command?: string; | ||
latest?: boolean; | ||
config?: string; | ||
opts?: Object; | ||
} | ||
|
||
function tsd(opts?: IOptions, callback?: gulp.ITaskCallback): NodeJS.ReadWriteStream; | ||
|
||
export = tsd; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference path="./main-bower-files.d.ts" /> | ||
/// <reference path="../gulp/gulp.d.ts" /> | ||
|
||
import gulp = require("gulp"); | ||
import mainBowerFiles = require("main-bower-files"); | ||
|
||
gulp.task("main-bower-files:simple", () => { | ||
gulp.src(mainBowerFiles()) | ||
.pipe(gulp.dest("dist/bower")); | ||
}); | ||
|
||
gulp.task("main-bower-files:options", () => { | ||
var files = mainBowerFiles({ | ||
debugging: false, | ||
env: process.env.NODE_ENV, | ||
paths: { | ||
bowerDirectory: "path/for/bower_components", | ||
bowerrc: "path/for/.bowerrc", | ||
bowerJson: "path/for/bower.json" | ||
}, | ||
checkExistence: false, | ||
includeDev: false, | ||
includeSelf: false, | ||
filter: (filepath) => { | ||
return filepath.indexOf("search") >= 0; | ||
} | ||
}); | ||
|
||
gulp.src(files, { base: "path/to/bower_components" }) | ||
.pipe(gulp.dest("dist/bower")); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Type definitions for main-bower-files | ||
// Project: https://github.com/ck86/main-bower-files | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts" /> | ||
|
||
declare module "main-bower-files" { | ||
|
||
interface IPaths { | ||
bowerDirectory?: string; | ||
bowerrc?: string; | ||
bowerJson?: string; | ||
} | ||
|
||
interface IFilterFunction { | ||
(filepath: string): boolean; | ||
} | ||
|
||
interface IOptions { | ||
debugging?: boolean; | ||
main?: string | string[] | Object; | ||
env?: string; | ||
paths?: IPaths | string; | ||
checkExistence?: boolean; | ||
includeDev?: boolean | string; | ||
includeSelf?: boolean; | ||
filter?: RegExp | IFilterFunction | string | string[]; | ||
} | ||
|
||
function mainBowerFiles(options?: IOptions): string[]; | ||
|
||
export = mainBowerFiles; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/// <reference path="./merge-stream.d.ts" /> | ||
|
||
import stream = require("stream"); | ||
import Stream = stream.Readable; | ||
import merge = require("merge-stream"); | ||
|
||
var stream1 = new Stream(); | ||
var stream2 = new Stream(); | ||
|
||
var merged = merge(stream1, stream2); | ||
|
||
var stream3 = new Stream(); | ||
merged.add(stream3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Type definitions for merge-stream | ||
// Project: https://github.com/grncdr/merge-stream | ||
// Definitions by: Keita Kagurazaka <https://github.com/k-kagurazaka> | ||
// Definitions: https://github.com/borisyankov/DefinitelyTyped | ||
|
||
/// <reference path="../node/node.d.ts"/> | ||
|
||
declare module "merge-stream" { | ||
|
||
interface IMergedStream extends NodeJS.ReadWriteStream { | ||
add: (source: NodeJS.ReadableStream) => IMergedStream; | ||
} | ||
|
||
function merge<T extends NodeJS.ReadableStream>(...streams: T[]): IMergedStream; | ||
export = merge; | ||
} |
Oops, something went wrong.