Skip to content

Commit 33f2dff

Browse files
authored
Merge pull request mgechev#1640 from brian428/feature/mgechev#1614
Feature/mgechev#1614
2 parents e78c461 + c95e760 commit 33f2dff

File tree

4 files changed

+61
-19
lines changed

4 files changed

+61
-19
lines changed

gulpfile.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ loadTasks(Config.PROJECT_TASKS_DIR);
1313
// --------------
1414
// Build dev.
1515
gulp.task('build.dev', (done: any) =>
16-
runSequence(//'clean.dev',
16+
runSequence('clean.once',
1717
// 'tslint',
1818
'build.assets.dev',
1919
'build.html_css',
@@ -73,7 +73,7 @@ gulp.task('build.prod.exp', (done: any) =>
7373
// Build test.
7474
gulp.task('build.test', (done: any) =>
7575
runSequence('clean.once',
76-
'tslint',
76+
// 'tslint',
7777
'build.assets.dev',
7878
'build.html_css',
7979
'build.js.dev',

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"async": "^2.1.1",
6767
"autoprefixer": "^6.5.1",
6868
"browser-sync": "^2.17.3",
69-
"codelyzer": "~1.0.0-beta.2",
70-
"compodoc": "0.0.8",
69+
"codelyzer": "~1.0.0-beta.4",
70+
"compodoc": "^0.0.15",
7171
"connect-history-api-fallback": "^1.3.0",
7272
"cssnano": "^3.7.7",
7373
"deep-extend": "^0.4.1",

tools/tasks/seed/build.js.dev.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import * as gulp from 'gulp';
32
import * as gulpLoadPlugins from 'gulp-load-plugins';
43
import * as merge from 'merge-stream';

tools/tasks/seed/build.js.test.ts

+57-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,71 @@
11
import * as gulp from 'gulp';
22
import * as gulpLoadPlugins from 'gulp-load-plugins';
3+
import * as merge from 'merge-stream';
4+
import * as util from 'gulp-util';
35
import { join } from 'path';
46

57
import Config from '../../config';
68
import { makeTsProject } from '../../utils';
9+
import { TypeScriptTask } from '../typescript_task';
710

811
const plugins = <any>gulpLoadPlugins();
912

13+
let typedBuildCounter = Config.TYPED_COMPILE_INTERVAL; // Always start with the typed build.
14+
1015
/**
1116
* Executes the build process, transpiling the TypeScript files (excluding the spec and e2e-spec files) for the test
1217
* environment.
1318
*/
14-
export = () => {
15-
let tsProject = makeTsProject();
16-
let src = [
17-
Config.TOOLS_DIR + '/manual_typings/**/*.d.ts',
18-
join(Config.APP_SRC, '**/*.spec.ts')
19-
];
20-
let result = gulp.src(src)
21-
.pipe(plugins.plumber())
22-
.pipe(plugins.sourcemaps.init())
23-
.pipe(tsProject());
24-
25-
return result.js
26-
.pipe(plugins.sourcemaps.write())
27-
.pipe(gulp.dest(Config.APP_DEST));
19+
export =
20+
class BuildJsTest extends TypeScriptTask {
21+
run() {
22+
let tsProject: any;
23+
let typings = gulp.src( [
24+
Config.TOOLS_DIR + '/manual_typings/**/*.d.ts'
25+
] );
26+
let src = [
27+
join(Config.APP_SRC, '**/*.spec.ts')
28+
];
29+
30+
let projectFiles = gulp.src(src);
31+
let result: any;
32+
let isFullCompile = true;
33+
34+
// Only do a typed build every X builds, otherwise do a typeless build to speed things up
35+
if (typedBuildCounter < Config.TYPED_COMPILE_INTERVAL) {
36+
isFullCompile = false;
37+
tsProject = makeTsProject({isolatedModules: true});
38+
projectFiles = projectFiles.pipe(plugins.cached());
39+
util.log('Performing typeless TypeScript compile of specs.');
40+
} else {
41+
tsProject = makeTsProject();
42+
projectFiles = merge(typings, projectFiles);
43+
}
44+
45+
//noinspection TypeScriptUnresolvedFunction
46+
result = projectFiles
47+
.pipe(plugins.plumber())
48+
.pipe(plugins.sourcemaps.init())
49+
.pipe(tsProject())
50+
.on('error', () => {
51+
typedBuildCounter = Config.TYPED_COMPILE_INTERVAL;
52+
});
53+
54+
if (isFullCompile) {
55+
typedBuildCounter = 0;
56+
} else {
57+
typedBuildCounter++;
58+
}
59+
60+
return result.js
61+
.pipe(plugins.sourcemaps.write())
62+
// Use for debugging with Webstorm/IntelliJ
63+
// https://github.com/mgechev/angular2-seed/issues/1220
64+
// .pipe(plugins.sourcemaps.write('.', {
65+
// includeContent: false,
66+
// sourceRoot: (file: any) =>
67+
// relative(file.path, PROJECT_ROOT + '/' + APP_SRC).replace(sep, '/') + '/' + APP_SRC
68+
// }))
69+
.pipe(gulp.dest(Config.APP_DEST));
70+
}
2871
};

0 commit comments

Comments
 (0)