-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure the GulpProxy class is assignable to Gulp, which was causing l…
…ots of downstream issues. (#1)
- Loading branch information
Showing
1 changed file
with
12 additions
and
15 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 |
---|---|---|
@@ -1,29 +1,26 @@ | ||
import gulp = require('gulp'); | ||
import Orchestrator = require('orchestrator'); | ||
|
||
/* tslint:disable:max-line-length */ | ||
export class GulpProxy { | ||
export class GulpProxy extends Orchestrator implements gulp.Gulp { | ||
public src: gulp.SrcMethod; | ||
public dest: gulp.DestMethod; | ||
public watch: gulp.WatchMethod; | ||
|
||
private _gulp: gulp.Gulp; | ||
|
||
constructor(gulpInstance: gulp.Gulp) { | ||
super(); | ||
this._gulp = gulpInstance; | ||
this.src = gulpInstance.src; | ||
this.dest = gulpInstance.dest; | ||
this.watch = gulpInstance.watch; | ||
} | ||
|
||
public task(): void { | ||
/* tslint:disable-next-line:no-any */ | ||
public task(): any { | ||
throw new Error( | ||
'You should not define gulp tasks, but instead subclass the GulpTask and override the executeTask method.' | ||
); | ||
} | ||
|
||
public src(glob: string | string[], opt?: gulp.SrcOptions): NodeJS.ReadWriteStream { | ||
return this._gulp.src(glob, opt); | ||
} | ||
|
||
public dest(outFolder: string | ((file: string) => string), | ||
opt?: gulp.DestOptions): NodeJS.ReadWriteStream { | ||
return this._gulp.dest(outFolder, opt); | ||
} | ||
|
||
public watch(glob: string | string[], fn: (gulp.WatchCallback | string)): NodeJS.EventEmitter { | ||
return this._gulp.watch(glob, fn); | ||
} | ||
} |