Skip to content

Commit 0ff2cb4

Browse files
committed
Update build and test infrastructure
1 parent f1522fd commit 0ff2cb4

File tree

8 files changed

+29
-47
lines changed

8 files changed

+29
-47
lines changed

.gitmodules

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[submodule "typescript/dev"]
22
path = typescript/dev
33
url = https://github.com/Microsoft/TypeScript.git
4+
5+
[submodule "typescript/2.3"]
6+
path = typescript/2.3
7+
url = https://github.com/Microsoft/TypeScript.git

gulpfile.js

+16-39
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,18 @@ var diff = require('gulp-diff');
1313

1414
var tsVersions = {
1515
dev: './typescript/dev',
16-
release14: './typescript/1-4',
17-
release15: './typescript/1-5',
18-
release16: './typescript/1-6',
19-
release17: './typescript/1-7'
16+
release23: './typescript/2.3',
2017
};
2118

2219
function findTSDefinition(location) {
2320
return path.join(path.dirname(require.resolve(location)), 'typescript.d.ts');
2421
}
2522

26-
var tsOptions = {
27-
target: 'es5',
28-
module: 'commonjs',
29-
declaration: true,
30-
preserveConstEnums: true,
31-
typescript: require('./typescript/dev')
32-
};
33-
var tsProject = ts.createProject(tsOptions);
23+
function createProject() {
24+
return ts.createProject('lib/tsconfig.json', {});
25+
}
26+
27+
var tsProject = createProject();
3428

3529
var paths = {
3630
scripts: ['lib/**.ts'],
@@ -64,45 +58,28 @@ gulp.task('scripts', ['clean'], function() {
6458
});
6559

6660
// Type checking against multiple versions of TypeScript
67-
// Checking against the current release of TypeScript on NPM can be done using `gulp scripts`.
68-
gulp.task('typecheck-1.4', function() {
69-
return gulp.src(paths.scripts.concat([
70-
'!definitions/typescript.d.ts',
71-
findTSDefinition(tsVersions.release14)
72-
])).pipe(ts(tsOptions));
73-
});
74-
gulp.task('typecheck-1.5', function() {
75-
return gulp.src(paths.scripts.concat([
76-
'!definitions/typescript.d.ts',
77-
findTSDefinition(tsVersions.release15)
78-
])).pipe(ts(tsOptions));
79-
});
80-
gulp.task('typecheck-1.6', function() {
81-
return gulp.src(paths.scripts.concat([
82-
'!definitions/typescript.d.ts',
83-
findTSDefinition(tsVersions.release16)
84-
])).pipe(ts(tsOptions));
85-
});
86-
gulp.task('typecheck-1.7', function() {
61+
gulp.task('typecheck-dev', function() {
8762
return gulp.src(paths.scripts.concat([
8863
'!definitions/typescript.d.ts',
89-
findTSDefinition(tsVersions.release17)
90-
])).pipe(ts(tsOptions));
64+
findTSDefinition(tsVersions.dev)
65+
])).pipe(createProject()());
9166
});
92-
gulp.task('typecheck-dev', function() {
67+
68+
gulp.task('typecheck-2.3', function() {
9369
return gulp.src(paths.scripts.concat([
9470
'!definitions/typescript.d.ts',
95-
findTSDefinition(tsVersions.dev)
96-
])).pipe(ts(tsOptions));
71+
findTSDefinition(tsVersions.release23)
72+
])).pipe(createProject()());
9773
});
9874

99-
gulp.task('typecheck', [/* 'typecheck-1.4', 'typecheck-1.5', 'typecheck-1.6', */ 'typecheck-dev']);
75+
gulp.task('typecheck', ['typecheck-dev', 'typecheck-2.3']);
10076

10177
// Tests
10278

10379
// We run every test on multiple typescript versions:
10480
var libs = [
105-
['2.0', undefined],
81+
['2.4', undefined],
82+
['2.3', require(tsVersions.release23)],
10683
['dev', require(tsVersions.dev)]
10784
];
10885

lib/main.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as ts from 'typescript';
2-
import * as fs from 'fs';
32
import * as path from 'path';
43
import * as _project from './project';
54
import * as utils from './utils';

lib/project.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class CompileStream extends stream.Duplex implements ICompileStream {
150150

151151
private project: ProjectInfo;
152152

153-
_write(file: any, encoding, cb: (err?) => void);
154-
_write(file: VinylFile, encoding, cb = (err?) => {}) {
153+
_write(file: any, encoding: string, cb: (err?: any) => void): void;
154+
_write(file: VinylFile, encoding: string, cb = (err?: any) => {}) {
155155
if (!file) return cb();
156156

157157
if (file.isNull()) {
@@ -172,7 +172,7 @@ class CompileStream extends stream.Duplex implements ICompileStream {
172172

173173
}
174174

175-
end(chunk?, encoding?, callback?) {
175+
end(chunk?: any, encoding?: any, callback?: any) {
176176
if (typeof chunk === 'function') {
177177
this._write(null, null, chunk);
178178
} else if (typeof encoding === 'function') {

lib/reporter.ts

-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ export function longReporter(): Reporter {
105105
}
106106
}
107107
export function fullReporter(fullFilename: boolean = false): Reporter {
108-
const typescript: typeof ts = require('typescript');
109108
return {
110109
error: (error: TypeScriptError, typescript: typeof ts) => {
111110
console.error('[' + gutil.colors.gray('gulp-typescript') + '] '

lib/tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"target": "ES5",
44
"module": "commonjs",
55
"noUnusedLocals": true,
6-
"declaration": true
6+
"noImplicitAny": true,
7+
"noImplicitReturns": true,
8+
"declaration": true,
9+
"preserveConstEnums": true
710
}
811
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"gulp-sourcemaps": "~1.6.0",
7979
"merge-stream": "~1.0.0",
8080
"rimraf": "~2.5.2",
81-
"typescript": "2.3.3"
81+
"typescript": "2.4.1"
8282
},
8383
"peerDependencies": {
8484
"typescript": "~2.0.3 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev"

typescript/dev

Submodule dev updated 1348 files

0 commit comments

Comments
 (0)