mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-20 12:00:53 +08: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:
@@ -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']);
|
||||
});
|
||||
Vendored
+38
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user