@@ -6,6 +6,7 @@ import { join/*, sep, relative*/ } from 'path';
6
6
7
7
import Config from '../../config' ;
8
8
import { makeTsProject , templateLocals } from '../../utils' ;
9
+ import { TypeScriptTask } from '../typescript_task' ;
9
10
10
11
const plugins = < any > gulpLoadPlugins ( ) ;
11
12
@@ -17,60 +18,64 @@ let typedBuildCounter = Config.TYPED_COMPILE_INTERVAL; // Always start with the
17
18
* Executes the build process, transpiling the TypeScript files (except the spec and e2e-spec files) for the development
18
19
* environment.
19
20
*/
20
- export = ( ) => {
21
- let tsProject : any ;
22
- let typings = gulp . src ( [
23
- Config . TOOLS_DIR + '/manual_typings/**/*.d.ts'
24
- ] ) ;
25
- let src = [
26
- join ( Config . APP_SRC , '**/*.ts' ) ,
27
- '!' + join ( Config . APP_SRC , '**/*.spec.ts' ) ,
28
- '!' + join ( Config . APP_SRC , '**/*.e2e-spec.ts' ) ,
29
- '!' + join ( Config . TMP_DIR , `**/${ Config . NG_FACTORY_FILE } .ts` )
30
- ] ;
21
+ export =
22
+ class BuildJsDev extends TypeScriptTask {
23
+ run ( ) {
24
+ let tsProject : any ;
25
+ let typings = gulp . src ( [
26
+ Config . TOOLS_DIR + '/manual_typings/**/*.d.ts'
27
+ ] ) ;
28
+ let src = [
29
+ join ( Config . APP_SRC , '**/*.ts' ) ,
30
+ '!' + join ( Config . APP_SRC , '**/*.spec.ts' ) ,
31
+ '!' + join ( Config . APP_SRC , '**/*.e2e-spec.ts' ) ,
32
+ '!' + join ( Config . TMP_DIR , `**/${ Config . NG_FACTORY_FILE } .ts` )
33
+ ] ;
31
34
32
- let projectFiles = gulp . src ( src ) ;
33
- let result : any ;
34
- let isFullCompile = true ;
35
+ let projectFiles = gulp . src ( src ) ;
36
+ let result : any ;
37
+ let isFullCompile = true ;
35
38
36
- // Only do a typed build every X builds, otherwise do a typeless build to speed things up
37
- if ( typedBuildCounter < Config . TYPED_COMPILE_INTERVAL ) {
38
- isFullCompile = false ;
39
- tsProject = makeTsProject ( { isolatedModules : true } ) ;
40
- projectFiles = projectFiles . pipe ( plugins . cached ( ) ) ;
41
- util . log ( 'Performing typeless TypeScript compile.' ) ;
42
- } else {
43
- tsProject = makeTsProject ( ) ;
44
- projectFiles = merge ( typings , projectFiles ) ;
45
- }
39
+ // Only do a typed build every X builds, otherwise do a typeless build to speed things up
40
+ if ( typedBuildCounter < Config . TYPED_COMPILE_INTERVAL ) {
41
+ isFullCompile = false ;
42
+ tsProject = makeTsProject ( { isolatedModules : true } ) ;
43
+ projectFiles = projectFiles . pipe ( plugins . cached ( ) ) ;
44
+ util . log ( 'Performing typeless TypeScript compile.' ) ;
45
+ } else {
46
+ tsProject = makeTsProject ( ) ;
47
+ projectFiles = merge ( typings , projectFiles ) ;
48
+ }
46
49
47
- result = projectFiles
48
- . pipe ( plugins . plumber ( ) )
49
- . pipe ( plugins . sourcemaps . init ( ) )
50
- . pipe ( tsProject ( ) )
51
- . on ( 'error' , ( ) => {
52
- typedBuildCounter = Config . TYPED_COMPILE_INTERVAL ;
53
- } ) ;
50
+ result = projectFiles
51
+ . pipe ( plugins . plumber ( ) )
52
+ . pipe ( plugins . sourcemaps . init ( ) )
53
+ . pipe ( tsProject ( ) )
54
+ . on ( 'error' , ( ) => {
55
+ typedBuildCounter = Config . TYPED_COMPILE_INTERVAL ;
56
+ } ) ;
54
57
55
- if ( isFullCompile ) {
56
- typedBuildCounter = 0 ;
57
- } else {
58
- typedBuildCounter ++ ;
59
- }
58
+ if ( isFullCompile ) {
59
+ typedBuildCounter = 0 ;
60
+ } else {
61
+ typedBuildCounter ++ ;
62
+ }
60
63
61
- return result . js
62
- . pipe ( plugins . sourcemaps . write ( ) )
63
- // Use for debugging with Webstorm/IntelliJ
64
- // https://github.com/mgechev/angular2-seed/issues/1220
65
- // .pipe(plugins.sourcemaps.write('.', {
66
- // includeContent: false,
67
- // sourceRoot: (file: any) =>
68
- // relative(file.path, PROJECT_ROOT + '/' + APP_SRC).replace(sep, '/') + '/' + APP_SRC
69
- // }))
70
- . pipe ( plugins . template ( Object . assign (
71
- templateLocals ( ) , {
72
- SYSTEM_CONFIG_DEV : jsonSystemConfig
64
+ return result . js
65
+ . pipe ( plugins . sourcemaps . write ( ) )
66
+ // Use for debugging with Webstorm/IntelliJ
67
+ // https://github.com/mgechev/angular2-seed/issues/1220
68
+ // .pipe(plugins.sourcemaps.write('.', {
69
+ // includeContent: false,
70
+ // sourceRoot: (file: any) =>
71
+ // relative(file.path, PROJECT_ROOT + '/' + APP_SRC).replace(sep, '/') + '/' + APP_SRC
72
+ // }))
73
+ . pipe ( plugins . template ( Object . assign (
74
+ templateLocals ( ) , {
75
+ SYSTEM_CONFIG_DEV : jsonSystemConfig
76
+ }
77
+ ) ) )
78
+ . pipe ( gulp . dest ( Config . APP_DEST ) ) ;
73
79
}
74
- ) ) )
75
- . pipe ( gulp . dest ( Config . APP_DEST ) ) ;
76
- } ;
80
+ } ;
81
+
0 commit comments