-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (47 loc) · 1.12 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var gulp = require('gulp');
var ts = require('gulp-typescript');
var fs = require('fs');
var mkdirp = require('mkdirp');
var mkdirSync = function (path) {
try {
fs.mkdirSync(path);
} catch(e) {
if ( e.code != 'EEXIST' ) throw e;
}
}
var tsProject = ts.createProject({
module: "amd",
target: "es5",
jsx: "react",
sortOutput: false,
declaration: false,
noEmitHelpers: true,
removeComments: false,
noExternalResolve: true,
experimentalDecorators: true,
typescript: require('typescript')
});
var testComponent = "\
export default class NAME {\
private someFunc = () => {\
return true;\
};\
render() {\
let s = this.someFunc();\
return null;\
}\
}";
gulp.task('build', function () {
mkdirp('test');
mkdirp('out');
for(var i = 0; i < 10000; i++) {
var name = "Component" + i;
fs.writeFileSync('test/' + name + '.tsx', testComponent.replace("NAME", name));
}
});
gulp.task('compile', ['build'], function() {
var tsResult = gulp.src('test/*.tsx')
.pipe(ts(tsProject));
return tsResult.js.pipe(gulp.dest('out'));
});
gulp.task('default', ['compile']);