@@ -36,7 +36,7 @@ const outLibDir = path.join(outDir, '@angular2-material');
36
36
/**
37
37
* Create a TS Build Task, based on the options.
38
38
*/
39
- function makeTsBuildTask ( options ) {
39
+ function createTsBuildTask ( options ) {
40
40
const tsConfigDir = options . tsConfigPath ;
41
41
const tsConfigPath = path . join ( tsConfigDir , 'tsconfig.json' ) ;
42
42
const tsConfig = JSON . parse ( fs . readFileSync ( tsConfigPath , 'utf-8' ) ) ;
@@ -64,7 +64,7 @@ function makeTsBuildTask(options) {
64
64
/**
65
65
* Create a SASS Build Task.
66
66
*/
67
- function makeSassBuildTask ( options ) {
67
+ function createSassBuildTask ( options ) {
68
68
const dest = options . dest ;
69
69
const glob = path . join ( options . root , '**/*.scss' ) ;
70
70
const sassOptions = {
@@ -84,7 +84,7 @@ function makeSassBuildTask(options) {
84
84
/**
85
85
* Create a Gulp task that executes a process.
86
86
*/
87
- function makeExecTask ( packageName , executable , args ) {
87
+ function createExecTask ( packageName , executable , args ) {
88
88
if ( ! args ) {
89
89
args = executable ;
90
90
executable = undefined ;
@@ -106,13 +106,13 @@ function makeExecTask(packageName, executable, args) {
106
106
/***************************************************************************************************
107
107
* Components Build Tasks.
108
108
*/
109
- gulp . task ( ':build:components:ts' , makeTsBuildTask ( { tsConfigPath : componentsDir } ) ) ;
109
+ gulp . task ( ':build:components:ts' , createTsBuildTask ( { tsConfigPath : componentsDir } ) ) ;
110
110
gulp . task ( ':build:components:assets' , function ( ) {
111
111
return gulp . src ( path . join ( componentsDir , '*/**/*.!(ts|spec.ts)' ) )
112
112
. pipe ( gulp . dest ( outLibDir ) ) ;
113
113
} ) ;
114
114
gulp . task ( ':build:components:scss' , function ( ) {
115
- const cssTask = makeSassBuildTask ( {
115
+ const cssTask = createSassBuildTask ( {
116
116
dest : outLibDir ,
117
117
root : componentsDir ,
118
118
includePaths : path . join ( componentsDir , 'core/style' )
@@ -131,16 +131,16 @@ gulp.task('build:components', [
131
131
] , function ( ) {
132
132
inlineResources ( [ outLibDir ] ) ;
133
133
} ) ;
134
- gulp . task ( ':build:components:ngc' , [ 'build:components' ] , makeExecTask (
134
+ gulp . task ( ':build:components:ngc' , [ 'build:components' ] , createExecTask (
135
135
'@angular/compiler-cli' , 'ngc' , [ '-p' , path . relative ( __dirname , componentsDir ) ]
136
136
) ) ;
137
137
138
138
139
139
/***************************************************************************************************
140
140
* DevApp Build Tasks.
141
141
*/
142
- gulp . task ( ':build:devapp:ts' , [ ':build:components:ts' ] , makeTsBuildTask ( { tsConfigPath : devAppDir } ) ) ;
143
- gulp . task ( ':build:devapp:scss' , [ ':build:components:scss' ] , makeSassBuildTask ( {
142
+ gulp . task ( ':build:devapp:ts' , [ ':build:components:ts' ] , createTsBuildTask ( { tsConfigPath : devAppDir } ) ) ;
143
+ gulp . task ( ':build:devapp:scss' , [ ':build:components:scss' ] , createSassBuildTask ( {
144
144
dest : outDir ,
145
145
root : devAppDir ,
146
146
// Change this once we have a better strategy for releasing SCSS files.
@@ -177,8 +177,8 @@ gulp.task('build:devapp', [
177
177
/***************************************************************************************************
178
178
* DevApp Build Tasks.
179
179
*/
180
- gulp . task ( ':build:e2eapp:ts' , [ ':build:components:ts' ] , makeTsBuildTask ( { tsConfigPath : e2eAppDir } ) ) ;
181
- gulp . task ( ':build:e2eapp:scss' , [ ':build:components:scss' ] , makeSassBuildTask ( {
180
+ gulp . task ( ':build:e2eapp:ts' , [ ':build:components:ts' ] , createTsBuildTask ( { tsConfigPath : e2eAppDir } ) ) ;
181
+ gulp . task ( ':build:e2eapp:scss' , [ ':build:components:scss' ] , createSassBuildTask ( {
182
182
dest : outDir ,
183
183
root : e2eAppDir ,
184
184
// Change this once we have a better strategy for releasing SCSS files.
@@ -221,6 +221,7 @@ gulp.task('default', ['help']);
221
221
gulp . task ( 'help' , function ( ) {
222
222
const tasks = Object . keys ( gulp . tasks )
223
223
. filter ( x => ! x . startsWith ( ':' ) )
224
+ . filter ( x => ! x . startsWith ( 'ci:' ) )
224
225
. filter ( x => x != 'default' )
225
226
. sort ( ) ;
226
227
@@ -243,6 +244,10 @@ gulp.task(':clean:assets', function() {
243
244
. pipe ( gulpClean ( ) ) ;
244
245
} ) ;
245
246
247
+ gulp . task ( 'lint' , createExecTask ( 'tslint' , [ '-c' , 'tslint.json' , '\'src/**/*.ts\'' ] ) ) ;
248
+ gulp . task ( 'stylelint' , createExecTask (
249
+ 'stylelint' , [ 'stylelint' , '\'src/**/*.scss\'' , '--config stylelint-config.json' , '--syntax scss' ]
250
+ ) ) ;
246
251
247
252
/***************************************************************************************************
248
253
* Watch Tasks.
@@ -319,9 +324,9 @@ gulp.task('test:single-run', function(done) {
319
324
} , done ) . start ( ) ;
320
325
} ) ;
321
326
322
- gulp . task ( ':test:protractor:setup' , makeExecTask ( 'protractor' , 'webdriver-manager' , [ 'update' ] ) ) ;
327
+ gulp . task ( ':test:protractor:setup' , createExecTask ( 'protractor' , 'webdriver-manager' , [ 'update' ] ) ) ;
323
328
324
- gulp . task ( ':test:protractor' , makeExecTask (
329
+ gulp . task ( ':test:protractor' , createExecTask (
325
330
'protractor' , [ path . join ( __dirname , 'test/protractor.conf.js' ) ]
326
331
) ) ;
327
332
@@ -359,3 +364,15 @@ gulp.task('build:release', function(done) {
359
364
done
360
365
) ;
361
366
} ) ;
367
+
368
+
369
+ /***************************************************************************************************
370
+ * Continuous Integration.
371
+ */
372
+ gulp . task ( 'ci:lint' , [ 'lint' , 'stylelint' ] ) ;
373
+ gulp . task ( 'ci:test' , [ 'test:single-run' ] ) ;
374
+ gulp . task ( 'ci:e2e' , [ 'e2e' ] ) ;
375
+ gulp . task ( 'ci:extract-metadata' , [ ':build:components:ngc' ] ) ;
376
+ gulp . task ( 'ci:forbidden-identifiers' , function ( ) {
377
+ require ( './scripts/ci/forbidden-identifiers.js' ) ;
378
+ } ) ;
0 commit comments