Skip to content

Commit 1c9ad5c

Browse files
committed
Do copyright without gulp-if and lazypipe
1 parent d7970a5 commit 1c9ad5c

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

Gulpfile.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import runSequence = require("run-sequence");
99
import concat = require("gulp-concat");
1010
import clone = require("gulp-clone");
1111
import newer = require("gulp-newer");
12-
import gIf = require("gulp-if");
1312
import tsc = require("gulp-typescript");
1413
declare module "gulp-typescript" {
1514
interface Settings {
@@ -32,7 +31,6 @@ import browserify = require("browserify");
3231
import through2 = require("through2");
3332
import merge2 = require("merge2");
3433
import intoStream = require("into-stream");
35-
import lazypipe = require("lazypipe");
3634
import * as os from "os";
3735
import Linter = require("tslint");
3836
const gulp = helpMaker(originalGulp);
@@ -435,16 +433,18 @@ const nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
435433
const nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
436434
const nodeStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescript_standalone.d.ts");
437435

438-
const prependCopyright = lazypipe()
439-
.pipe(() => insert.prepend(fs.readFileSync(copyright)));
436+
let copyrightContent: string;
437+
function prependCopyright(outputCopyright: boolean = !useDebugMode) {
438+
return insert.prepend(outputCopyright ? (copyrightContent || (copyrightContent = fs.readFileSync(copyright).toString())) : "");
439+
}
440440

441441
gulp.task(builtLocalCompiler, false, [servicesFile], () => {
442442
const localCompilerProject = tsc.createProject("src/compiler/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
443443
return localCompilerProject.src()
444444
.pipe(newer(builtLocalCompiler))
445445
.pipe(sourcemaps.init())
446446
.pipe(tsc(localCompilerProject))
447-
.pipe(gIf(useDebugMode, prependCopyright()))
447+
.pipe(prependCopyright())
448448
.pipe(sourcemaps.write("."))
449449
.pipe(gulp.dest(builtLocalDirectory));
450450
});
@@ -455,9 +455,9 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
455455
.pipe(newer(servicesFile))
456456
.pipe(sourcemaps.init())
457457
.pipe(tsc(servicesProject));
458-
const completedJs = js.pipe(gIf(useDebugMode, prependCopyright()))
458+
const completedJs = js.pipe(prependCopyright())
459459
.pipe(sourcemaps.write("."));
460-
const completedDts = dts.pipe(prependCopyright())
460+
const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/true))
461461
.pipe(insert.transform((contents, file) => {
462462
file.path = standaloneDefinitionsFile;
463463
return contents.replace(/^(\s*)(export )?const enum (\S+) {(\s*)$/gm, "$1$2enum $3 {$4");
@@ -489,7 +489,7 @@ gulp.task(serverFile, false, [servicesFile], () => {
489489
.pipe(newer(serverFile))
490490
.pipe(sourcemaps.init())
491491
.pipe(tsc(serverProject))
492-
.pipe(gIf(useDebugMode, prependCopyright()))
492+
.pipe(prependCopyright())
493493
.pipe(sourcemaps.write("."))
494494
.pipe(gulp.dest(builtLocalDirectory));
495495
});
@@ -508,10 +508,10 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
508508
.pipe(tsc(settings));
509509

510510
return merge2([
511-
js.pipe(gIf(useDebugMode, prependCopyright()))
511+
js.pipe(prependCopyright())
512512
.pipe(sourcemaps.write("."))
513513
.pipe(gulp.dest(".")),
514-
dts.pipe(gIf(useDebugMode, prependCopyright()))
514+
dts.pipe(prependCopyright())
515515
.pipe(gulp.dest("."))
516516
]);
517517
});

package.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@
3535
"@types/gulp": "latest",
3636
"@types/gulp-concat": "latest",
3737
"@types/gulp-help": "latest",
38-
"@types/gulp-if": "latest",
3938
"@types/gulp-newer": "latest",
4039
"@types/gulp-sourcemaps": "latest",
4140
"@types/gulp-typescript": "latest",
42-
"@types/lazypipe": "latest",
4341
"@types/merge2": "latest",
4442
"@types/minimatch": "latest",
4543
"@types/minimist": "latest",
@@ -55,15 +53,13 @@
5553
"gulp-clone": "latest",
5654
"gulp-concat": "latest",
5755
"gulp-help": "latest",
58-
"gulp-if": "latest",
5956
"gulp-insert": "latest",
6057
"gulp-newer": "latest",
6158
"gulp-sourcemaps": "latest",
6259
"gulp-typescript": "latest",
6360
"into-stream": "latest",
6461
"istanbul": "latest",
6562
"jake": "latest",
66-
"lazypipe": "latest",
6763
"merge2": "latest",
6864
"minimist": "latest",
6965
"mkdirp": "latest",

0 commit comments

Comments
 (0)