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