mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Adding a bunch of gulp utilities
This should allow a developer to write a gulpfile in TypeScript to compile a TypeScript project.
This commit is contained in:
parent
338059f48e
commit
429c0c5c7d
20
gulp-autoprefixer/gulp-autoprefixer-tests.ts
Normal file
20
gulp-autoprefixer/gulp-autoprefixer-tests.ts
Normal file
@ -0,0 +1,20 @@
|
||||
/// <reference path="./gulp-autoprefixer.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import autoprefixer = require("gulp-autoprefixer");
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(autoprefixer())
|
||||
.pipe(gulp.dest("build"));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(autoprefixer({ browsers: ["Chrome"]}))
|
||||
.pipe(gulp.dest("build"));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(autoprefixer({cascade: false}))
|
||||
.pipe(gulp.dest("build"));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(autoprefixer({remove: false}))
|
||||
.pipe(gulp.dest("build"));
|
||||
18
gulp-autoprefixer/gulp-autoprefixer.d.ts
vendored
Normal file
18
gulp-autoprefixer/gulp-autoprefixer.d.ts
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Type definitions for gulp-autoprefixer
|
||||
// Project: https://github.com/sindresorhus/gulp-autoprefixer
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-autoprefixer" {
|
||||
interface Options {
|
||||
browsers?: string[];
|
||||
cascade?: boolean;
|
||||
remove?: boolean;
|
||||
}
|
||||
|
||||
function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export = autoPrefixer;
|
||||
}
|
||||
25
gulp-gh-pages/gulp-gh-pages-tests.ts
Normal file
25
gulp-gh-pages/gulp-gh-pages-tests.ts
Normal file
@ -0,0 +1,25 @@
|
||||
/// <reference path="./gulp-gh-pages.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import ghPages = require("gulp-gh-pages");
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages());
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({remoteUrl: "https://github.com/Asana/DefinitelyTyped.git"}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({origin: "origin"}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({branch: "master"}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({cacheDir: "/tmp"}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({push: false}));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(ghPages({message: "master"}));
|
||||
21
gulp-gh-pages/gulp-gh-pages.d.ts
vendored
Normal file
21
gulp-gh-pages/gulp-gh-pages.d.ts
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Type definitions for gulp-gh-pages
|
||||
// Project: https://github.com/rowoot/gulp-gh-pages
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-gh-pages" {
|
||||
interface Options {
|
||||
remoteUrl?: string;
|
||||
origin?: string;
|
||||
branch?: string;
|
||||
cacheDir?: string;
|
||||
push?: boolean;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
function ghPages(opts?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export = ghPages;
|
||||
}
|
||||
10
gulp-if/gulp-if-tests.ts
Normal file
10
gulp-if/gulp-if-tests.ts
Normal file
@ -0,0 +1,10 @@
|
||||
/// <reference path="./gulp-if.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import _if = require("gulp-if");
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(_if(true, gulp.src("test.css")));
|
||||
|
||||
gulp.src("test.css")
|
||||
.pipe(_if(false, gulp.src("test.css"), gulp.src("test.css")));
|
||||
11
gulp-if/gulp-if.d.ts
vendored
Normal file
11
gulp-if/gulp-if.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Type definitions for gulp-if
|
||||
// Project: https://github.com/robrich/gulp-if
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-if" {
|
||||
function gulpIf(condition: boolean, stream: NodeJS.ReadWriteStream, elseStream?: NodeJS.ReadWriteStream): NodeJS.ReadWriteStream;
|
||||
export = gulpIf;
|
||||
}
|
||||
32
gulp-istanbul/gulp-istanbul-tests.ts
Normal file
32
gulp-istanbul/gulp-istanbul-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
/// <reference path="./gulp-istanbul.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import istanbul = require("gulp-istanbul");
|
||||
|
||||
function testFramework(): NodeJS.ReadWriteStream {
|
||||
return null;
|
||||
}
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul()) // Covering files
|
||||
.pipe(gulp.dest('test-tmp/'))
|
||||
.on('finish', function () {
|
||||
gulp.src(['test/*.html'])
|
||||
.pipe(testFramework())
|
||||
.pipe(istanbul.writeReports()) // Creating the reports after tests runned
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task('test', function (cb) {
|
||||
gulp.src(['lib/**/*.js', 'main.js'])
|
||||
.pipe(istanbul({includeUntested: true})) // Covering files
|
||||
.pipe(istanbul.hookRequire())
|
||||
.on('finish', function () {
|
||||
gulp.src(['test/*.html'])
|
||||
.pipe(testFramework())
|
||||
.pipe(istanbul.writeReports({reporters: ['text']})) // Creating the reports after tests runned
|
||||
.on('end', cb);
|
||||
});
|
||||
});
|
||||
51
gulp-istanbul/gulp-istanbul.d.ts
vendored
Normal file
51
gulp-istanbul/gulp-istanbul.d.ts
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
// Type definitions for gulp-istanbul
|
||||
// Project: https://github.com/SBoudrias/gulp-istanbul
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-istanbul" {
|
||||
function GulpIstanbul(opts?: GulpIstanbul.Options): NodeJS.ReadWriteStream;
|
||||
|
||||
module GulpIstanbul {
|
||||
export function hookRequire(): NodeJS.ReadWriteStream;
|
||||
export function summarizeCoverage(opts?: {coverageVariable: string}): Coverage;
|
||||
export function writeReports(opts?: ReportOptions): NodeJS.ReadWriteStream;
|
||||
|
||||
interface Options {
|
||||
coverageVariable?: string;
|
||||
includeUntested?: boolean;
|
||||
embedSource?: boolean;
|
||||
preserveComments?: boolean;
|
||||
noCompact?: boolean;
|
||||
noAutoWrap?: boolean;
|
||||
codeGenerationOptions?: Object;
|
||||
debug?: boolean;
|
||||
walkDebug?: boolean;
|
||||
}
|
||||
|
||||
interface Coverage {
|
||||
lines: CoverageStats;
|
||||
statements: CoverageStats;
|
||||
functions: CoverageStats;
|
||||
branches: CoverageStats;
|
||||
}
|
||||
|
||||
interface CoverageStats {
|
||||
total: number;
|
||||
covered: number;
|
||||
skipped: number;
|
||||
pct: number;
|
||||
}
|
||||
|
||||
interface ReportOptions {
|
||||
dir?: string;
|
||||
reporters?: string[];
|
||||
reportOpts?: {dir?: string};
|
||||
coverageVariable?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpIstanbul;
|
||||
}
|
||||
9
gulp-mocha/gulp-mocha-tests.ts
Normal file
9
gulp-mocha/gulp-mocha-tests.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path="./gulp-mocha.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import mocha = require("gulp-mocha");
|
||||
|
||||
gulp.task('default', function () {
|
||||
return gulp.src('test.js', {read: false})
|
||||
.pipe(mocha({reporter: 'nyan'}));
|
||||
});
|
||||
12
gulp-mocha/gulp-mocha.d.ts
vendored
Normal file
12
gulp-mocha/gulp-mocha.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
// Type definitions for gulp-mocha
|
||||
// Project: https://github.com/sindresorhus/gulp-mocha
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../mocha/mocha.d.ts"/>
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-mocha" {
|
||||
function mocha(setupOptions: MochaSetupOptions): NodeJS.ReadWriteStream;
|
||||
export = mocha;
|
||||
}
|
||||
29
gulp-rename/gulp-rename-tests.ts
Normal file
29
gulp-rename/gulp-rename-tests.ts
Normal file
@ -0,0 +1,29 @@
|
||||
/// <reference path="./gulp-rename.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import rename = require("gulp-rename");
|
||||
|
||||
// rename via string
|
||||
gulp.src("./src/main/text/hello.txt")
|
||||
.pipe(rename("main/text/ciao/goodbye.md"))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/goodbye.md
|
||||
|
||||
// rename via function
|
||||
gulp.src("./src/**/hello.txt")
|
||||
.pipe(rename((path) => {
|
||||
path.dirname += "/ciao";
|
||||
path.basename += "-goodbye";
|
||||
path.extname = ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/hello-goodbye.md
|
||||
|
||||
// rename via hash
|
||||
gulp.src("./src/main/text/hello.txt", { base: process.cwd() })
|
||||
.pipe(rename({
|
||||
dirname: "main/text/ciao",
|
||||
basename: "aloha",
|
||||
prefix: "bonjour-",
|
||||
suffix: "-hola",
|
||||
extname: ".md"
|
||||
}))
|
||||
.pipe(gulp.dest("./dist")); // ./dist/main/text/ciao/bonjour-aloha-hola.md
|
||||
20
gulp-rename/gulp-rename.d.ts
vendored
Normal file
20
gulp-rename/gulp-rename.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
// Type definitions for gulp-rename
|
||||
// Project: https://github.com/hparra/gulp-rename
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-rename" {
|
||||
interface Options {
|
||||
dirname?: string;
|
||||
basename?: string;
|
||||
prefix?: string;
|
||||
suffix?: string;
|
||||
extname?: string;
|
||||
}
|
||||
function rename(name: string): NodeJS.ReadWriteStream;
|
||||
function rename(callback: (path: Options) => any): NodeJS.ReadWriteStream;
|
||||
function rename(opts: Options): NodeJS.ReadWriteStream;
|
||||
export = rename;
|
||||
}
|
||||
11
gulp-replace/gulp-replace-tests.ts
Normal file
11
gulp-replace/gulp-replace-tests.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path="./gulp-replace.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import replace = require("gulp-replace");
|
||||
|
||||
gulp.task('templates', function(){
|
||||
gulp.src(['file.txt'])
|
||||
.pipe(replace("test", "foo"))
|
||||
.pipe(replace(/foo(.{3})/g, '$1foo'))
|
||||
.pipe(gulp.dest('build/file.txt'));
|
||||
});
|
||||
17
gulp-replace/gulp-replace.d.ts
vendored
Normal file
17
gulp-replace/gulp-replace.d.ts
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
// Type definitions for gulp-replace
|
||||
// Project: https://github.com/lazd/gulp-replace
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-replace" {
|
||||
interface Options {
|
||||
skipBinary: boolean;
|
||||
}
|
||||
|
||||
function replace(pattern: string, replacement: string, opts?: Options): NodeJS.ReadWriteStream;
|
||||
function replace(pattern: RegExp, replacement: string, opts?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export = replace;
|
||||
}
|
||||
16
gulp-sass/gulp-sass-tests.ts
Normal file
16
gulp-sass/gulp-sass-tests.ts
Normal file
@ -0,0 +1,16 @@
|
||||
/// <reference path="./gulp-sass.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import sass = require("gulp-sass");
|
||||
|
||||
gulp.task('sass', function () {
|
||||
gulp.src('./scss/*.scss')
|
||||
.pipe(sass())
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
|
||||
gulp.task('sass', function () {
|
||||
gulp.src('./scss/*.scss')
|
||||
.pipe(sass({errLogToConsole: true}))
|
||||
.pipe(gulp.dest('./css'));
|
||||
});
|
||||
49
gulp-sass/gulp-sass.d.ts
vendored
Normal file
49
gulp-sass/gulp-sass.d.ts
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
// Type definitions for gulp-sass
|
||||
// Project: https://github.com/dlmanning/gulp-sass
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-sass" {
|
||||
interface SassResults {
|
||||
css: string;
|
||||
map: string;
|
||||
stats: {
|
||||
entry: string;
|
||||
start: Date;
|
||||
end: Date;
|
||||
duration: number;
|
||||
includedFiles: string[];
|
||||
}
|
||||
}
|
||||
|
||||
interface SassOptions {
|
||||
file?: string;
|
||||
data?: string;
|
||||
success?: (results: SassResults) => any;
|
||||
error?: (err: Error) => any;
|
||||
includePaths?: string[];
|
||||
imagePaths?: string[];
|
||||
indentedSyntax?: boolean;
|
||||
omitSourceMapUrl?: boolean;
|
||||
outFile?: string;
|
||||
outputStyle?: string;
|
||||
precision?: number;
|
||||
sourceComments?: boolean;
|
||||
sourceMap?: boolean | string;
|
||||
sourceMapEmbed?: boolean;
|
||||
sourceMapContents?: boolean;
|
||||
}
|
||||
|
||||
interface Options extends SassOptions {
|
||||
errLogToConsole?: boolean;
|
||||
onSuccess?: (css: string) => any;
|
||||
onError?: (err: Error) => any;
|
||||
sync?: boolean;
|
||||
}
|
||||
|
||||
function sass(opts?: Options): NodeJS.ReadWriteStream;
|
||||
|
||||
export = sass;
|
||||
}
|
||||
99
gulp-sourcemaps/gulp-sourcemaps-tests.ts
Normal file
99
gulp-sourcemaps/gulp-sourcemaps-tests.ts
Normal file
@ -0,0 +1,99 @@
|
||||
/// <reference path="./gulp-sourcemaps.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import sourcemaps = require("gulp-sourcemaps");
|
||||
|
||||
function plugin1(): NodeJS.ReadWriteStream { return null; }
|
||||
function plugin2(): NodeJS.ReadWriteStream { return null; }
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write('../maps'))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init({loadMaps: true}))
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write())
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
gulp.src(['src/test.js', 'src/testdir/test2.js'], { base: 'src' })
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write('../maps'))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
var stream = gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write('../maps', {addComment: false}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
var stream = gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write({includeContent: false, sourceRoot: '/src'}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
var stream = gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write({
|
||||
includeContent: false,
|
||||
sourceRoot: function(file) {
|
||||
return '/src';
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('dist'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
var stream = gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write('../maps', {
|
||||
sourceMappingURLPrefix: 'https://asset-host.example.com/assets'
|
||||
}))
|
||||
.pipe(gulp.dest('public/scripts'));
|
||||
});
|
||||
|
||||
gulp.task('javascript', function() {
|
||||
var stream = gulp.src('src/**/*.js')
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(plugin1())
|
||||
.pipe(plugin2())
|
||||
.pipe(sourcemaps.write('../maps', {
|
||||
sourceMappingURLPrefix: function(file) {
|
||||
return 'https://asset-host.example.com/assets'
|
||||
}
|
||||
}))
|
||||
.pipe(gulp.dest('public/scripts'));
|
||||
});
|
||||
28
gulp-sourcemaps/gulp-sourcemaps.d.ts
vendored
Normal file
28
gulp-sourcemaps/gulp-sourcemaps.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for gulp-sourcemaps
|
||||
// Project: https://github.com/floridoo/gulp-sourcemaps
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-sourcemaps" {
|
||||
interface InitOptions {
|
||||
loadMaps?: boolean;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
interface WriteMapper {
|
||||
(file: string): string;
|
||||
}
|
||||
|
||||
interface WriteOptions {
|
||||
addComment?: boolean;
|
||||
includeContext?: boolean;
|
||||
sourceRoot?: string | WriteMapper;
|
||||
sourceMappingURLPrefix?: string | WriteMapper;
|
||||
}
|
||||
|
||||
export function init(opts?: InitOptions): NodeJS.ReadWriteStream;
|
||||
export function write(opts?: WriteOptions): NodeJS.ReadWriteStream;
|
||||
export function write(path?: string, opts?: WriteOptions): NodeJS.ReadWriteStream;
|
||||
}
|
||||
47
gulp-tslint/gulp-tslint-tests.ts
Normal file
47
gulp-tslint/gulp-tslint-tests.ts
Normal file
@ -0,0 +1,47 @@
|
||||
/// <reference path="./gulp-tslint.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import tslint = require("gulp-tslint");
|
||||
import vinyl = require("vinyl");
|
||||
|
||||
gulp.task('tslint', function(){
|
||||
gulp.src('source.ts')
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report('verbose'));
|
||||
});
|
||||
|
||||
/* Output is in the following form:
|
||||
* [{
|
||||
* "name": "invalid.ts",
|
||||
* "failure": "missing whitespace",
|
||||
* // Lines and characters start from 0
|
||||
* "startPosition": {"position": 8, "line": 0, "character": 8},
|
||||
* "endPosition": {"position": 9, "line": 0, "character": 9},
|
||||
* "ruleName": "one-line"
|
||||
* }]
|
||||
*/
|
||||
var testReporter = function (output: tslint.Output[], file: vinyl, options: tslint.Options) {
|
||||
// file is a reference to the vinyl File object
|
||||
console.log("Found " + output.length + " errors in " + file.path);
|
||||
// options is a reference to the reporter options, e.g. options.emitError
|
||||
};
|
||||
|
||||
gulp.task('invalid-custom', function(){
|
||||
gulp.src('invalid.ts')
|
||||
.pipe(tslint())
|
||||
.pipe(tslint.report(testReporter));
|
||||
});
|
||||
|
||||
gulp.task('tslint-json', function(){
|
||||
gulp.src('invalid.ts')
|
||||
.pipe(tslint({
|
||||
configuration: {
|
||||
rules: {
|
||||
"class-name": true
|
||||
// ...
|
||||
}
|
||||
}
|
||||
}))
|
||||
.pipe(tslint.report('prose'));;
|
||||
});
|
||||
42
gulp-tslint/gulp-tslint.d.ts
vendored
Normal file
42
gulp-tslint/gulp-tslint.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Type definitions for gulp-tslint
|
||||
// Project: https://github.com/panuhorsmalahti/gulp-tslint
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
/// <reference path="../vinyl/vinyl.d.ts"/>
|
||||
|
||||
declare module "gulp-tslint" {
|
||||
import vinyl = require("vinyl");
|
||||
|
||||
function GulpTsLint(opts?: GulpTsLint.Options): NodeJS.ReadWriteStream;
|
||||
|
||||
module GulpTsLint {
|
||||
interface Options {
|
||||
configuration?: Object;
|
||||
rulesDirectory?: string;
|
||||
emitError?: boolean;
|
||||
}
|
||||
|
||||
interface Position {
|
||||
position: number;
|
||||
line: number;
|
||||
character: number;
|
||||
}
|
||||
|
||||
interface Output {
|
||||
name: string;
|
||||
failure: string;
|
||||
startPosition: Position;
|
||||
endPosition: Position;
|
||||
ruleName: string;
|
||||
}
|
||||
|
||||
export function report(reporter?: string): NodeJS.ReadWriteStream;
|
||||
export function report(reporter?: (output: Output[], file: vinyl, options: Options) => any): NodeJS.ReadWriteStream;
|
||||
|
||||
}
|
||||
|
||||
export = GulpTsLint;
|
||||
}
|
||||
|
||||
15
gulp-typedoc/gulp-typedoc-tests.ts
Normal file
15
gulp-typedoc/gulp-typedoc-tests.ts
Normal file
@ -0,0 +1,15 @@
|
||||
/// <reference path="./gulp-typedoc.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import typedoc = require("gulp-typedoc");
|
||||
|
||||
gulp.task("typedoc", function() {
|
||||
return gulp
|
||||
.src(["data/*.ts"])
|
||||
.pipe(typedoc({
|
||||
module: "commonjs",
|
||||
out: "./out",
|
||||
name: "my-project",
|
||||
target: "es5"
|
||||
}));
|
||||
});
|
||||
30
gulp-typedoc/gulp-typedoc.d.ts
vendored
Normal file
30
gulp-typedoc/gulp-typedoc.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for gulp-typedoc
|
||||
// Project: https://github.com/rogierschouten/gulp-typedoc
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-typedoc" {
|
||||
interface Options {
|
||||
out: string;
|
||||
mode?: string;
|
||||
json?: string;
|
||||
exclude?: string;
|
||||
includeDeclarations?: boolean;
|
||||
externalPattern?: string;
|
||||
excludeExternals?: boolean;
|
||||
module?: string;
|
||||
target?: string;
|
||||
theme?: string;
|
||||
name?: string;
|
||||
readme?: string;
|
||||
hideGenerator?: boolean;
|
||||
gaID?: string;
|
||||
gaSite?: string;
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
function typedoc(opts: Options): NodeJS.ReadWriteStream;
|
||||
export = typedoc;
|
||||
}
|
||||
40
gulp-typescript/gulp-typescript-tests.ts
Normal file
40
gulp-typescript/gulp-typescript-tests.ts
Normal file
@ -0,0 +1,40 @@
|
||||
/// <reference path="./gulp-typescript.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import typescript = require("gulp-typescript");
|
||||
|
||||
function merge(streams: NodeJS.ReadWriteStream[]): NodeJS.ReadWriteStream {
|
||||
return null;
|
||||
}
|
||||
|
||||
gulp.task('scripts', function() {
|
||||
var tsResult = gulp.src('lib/*.ts')
|
||||
.pipe(typescript({
|
||||
declarationFiles: true,
|
||||
noExternalResolve: true
|
||||
}));
|
||||
|
||||
return merge([
|
||||
tsResult.dts.pipe(gulp.dest('release/definitions')),
|
||||
tsResult.js.pipe(gulp.dest('release/js'))]
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
var tsProject = typescript.createProject({
|
||||
declarationFiles: true,
|
||||
noExternalResolve: true
|
||||
});
|
||||
|
||||
gulp.task('scripts', function() {
|
||||
var tsResult = gulp.src('lib/*.ts')
|
||||
.pipe(typescript(tsProject));
|
||||
|
||||
return merge([ // Merge the two output streams, so this task is finished when the IO of both operations are done.
|
||||
tsResult.dts.pipe(gulp.dest('release/definitions')),
|
||||
tsResult.js.pipe(gulp.dest('release/js'))]
|
||||
);
|
||||
});
|
||||
gulp.task('watch', ['scripts'], function() {
|
||||
gulp.watch('lib/*.ts', ['scripts']);
|
||||
});
|
||||
38
gulp-typescript/gulp-typescript.d.ts
vendored
Normal file
38
gulp-typescript/gulp-typescript.d.ts
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Type definitions for gulp-typescript
|
||||
// Project: https://github.com/ivogabe/gulp-typescript
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "gulp-typescript" {
|
||||
function GulpTypescript(params: GulpTypescript.Params, filters?: GulpTypescript.FilterSettings): GulpTypescript.CompilationStream;
|
||||
|
||||
module GulpTypescript {
|
||||
export function createProject(params: Params): Params;
|
||||
export function filter(filters: FilterSettings): CompilationStream;
|
||||
interface Params {
|
||||
declarationFiles?: boolean;
|
||||
module?: string;
|
||||
noEmitOnError?: boolean;
|
||||
noExternalResolve?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noLib?: boolean;
|
||||
removeComments?: boolean;
|
||||
sourceRoot?: string;
|
||||
sortOutput?: boolean;
|
||||
target?: string;
|
||||
}
|
||||
|
||||
interface FilterSettings {
|
||||
referencedFrom?: string[];
|
||||
}
|
||||
|
||||
interface CompilationStream extends NodeJS.ReadWriteStream {
|
||||
dts: NodeJS.ReadWriteStream;
|
||||
js: NodeJS.ReadWriteStream;
|
||||
}
|
||||
}
|
||||
|
||||
export = GulpTypescript;
|
||||
}
|
||||
8
vinyl-source-stream/vinyl-source-stream-tests.ts
Normal file
8
vinyl-source-stream/vinyl-source-stream-tests.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference path="./vinyl-source-stream.d.ts"/>
|
||||
/// <reference path="../gulp/gulp.d.ts"/>
|
||||
import gulp = require("gulp");
|
||||
import vinylSourceStream = require("vinyl-source-stream");
|
||||
|
||||
gulp.src("test.js")
|
||||
.pipe(vinylSourceStream("foo.js"))
|
||||
.pipe(gulp.dest("build"));
|
||||
11
vinyl-source-stream/vinyl-source-stream.d.ts
vendored
Normal file
11
vinyl-source-stream/vinyl-source-stream.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Type definitions for vinyl-source-stream
|
||||
// Project: https://github.com/hughsk/vinyl-source-stream
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts"/>
|
||||
|
||||
declare module "vinyl-source-stream" {
|
||||
function vinylSourceStream(filename: string): NodeJS.ReadWriteStream;
|
||||
export = vinylSourceStream;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user