Skip to content

Commit 0079b68

Browse files
committed
Merge pull request #1836 from Koslun/master
gulp:ts: fix ts copy of constant file and inject test client .ts files automatically.
2 parents 94fda09 + 17cb4e4 commit 0079b68

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

Diff for: app/templates/gulpfile.babel(gulp).js

+25-9
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,11 @@ gulp.task('inject:js', () => {
227227
.pipe(gulp.dest(clientPath));
228228
});<% if(filters.ts) { %>
229229

230-
gulp.task('inject:tsconfig', () => {
231-
let src = gulp.src([
232-
`${clientPath}/**/!(*.spec|*.mock).ts`,
233-
`!${clientPath}/bower_components/**/*`,
234-
`${clientPath}/typings/**/*.d.ts`
235-
], {read: false})
230+
function injectTsConfig(filesGlob, tsconfigPath){
231+
let src = gulp.src(filesGlob, {read: false})
236232
.pipe(plugins.sort());
237233

238-
return gulp.src('./tsconfig.client.json')
234+
return gulp.src(tsconfigPath)
239235
.pipe(plugins.inject(src, {
240236
starttag: '"files": [',
241237
endtag: ']',
@@ -244,6 +240,26 @@ gulp.task('inject:tsconfig', () => {
244240
}
245241
}))
246242
.pipe(gulp.dest('./'));
243+
}
244+
245+
gulp.task('inject:tsconfig', () => {
246+
return injectTsConfig([
247+
`${clientPath}/**/!(*.spec|*.mock).ts`,
248+
`!${clientPath}/bower_components/**/*`,
249+
`${clientPath}/typings/**/*.d.ts`,
250+
`!${clientPath}/test_typings/**/*.d.ts`
251+
],
252+
'./tsconfig.client.json');
253+
});
254+
255+
gulp.task('inject:tsconfigTest', () => {
256+
return injectTsConfig([
257+
`${clientPath}/**/+(*.spec|*.mock).ts`,
258+
`!${clientPath}/bower_components/**/*`,
259+
`!${clientPath}/typings/**/*.d.ts`,
260+
`${clientPath}/test_typings/**/*.d.ts`
261+
],
262+
'./tsconfig.client.test.json');
247263
});<% } %>
248264

249265
gulp.task('inject:css', () => {
@@ -305,12 +321,12 @@ gulp.task('styles', () => {
305321
.pipe(gulp.dest('.tmp/app'));
306322
});<% if(filters.ts) { %>
307323

308-
gulp.task('copy:constant', () => {
324+
gulp.task('copy:constant', ['constant'], () => {
309325
return gulp.src(`${clientPath}/app/app.constant.js`, { dot: true })
310326
.pipe(gulp.dest('.tmp/app'));
311327
})
312328

313-
gulp.task('transpile:client', ['tsd', 'constant', 'copy:constant'], () => {
329+
gulp.task('transpile:client', ['tsd', 'copy:constant'], () => {
314330
let tsProject = plugins.typescript.createProject('./tsconfig.client.json');
315331
return tsProject.src()
316332
.pipe(plugins.sourcemaps.init())

0 commit comments

Comments
 (0)