1
- import child_process = require ( 'child_process' ) ;
2
- import fs = require ( 'fs' ) ;
3
- import gulp = require ( 'gulp' ) ;
1
+ import { execSync } from 'child_process' ;
2
+ import { readdirSync , statSync } from 'fs' ;
3
+ import { task } from 'gulp' ;
4
4
import gulpRunSequence = require( 'run-sequence' ) ;
5
5
import path = require( 'path' ) ;
6
6
7
7
import { execTask } from '../task_helpers' ;
8
8
import { DIST_COMPONENTS_ROOT } from '../constants' ;
9
9
10
10
11
- gulp . task ( 'build:release' , function ( done : ( ) => void ) {
11
+ task ( 'build:release' , function ( done : ( ) => void ) {
12
12
// Synchronously run those tasks.
13
13
gulpRunSequence (
14
14
'clean' ,
@@ -20,31 +20,32 @@ gulp.task('build:release', function(done: () => void) {
20
20
21
21
22
22
/** Make sure we're logged in. */
23
- gulp . task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
23
+ task ( ':publish:whoami' , execTask ( 'npm' , [ 'whoami' ] , {
24
24
silent : true ,
25
25
errMessage : 'You must be logged in to publish.'
26
26
} ) ) ;
27
- gulp . task ( ':publish:logout' , execTask ( 'npm' , [ 'logout' ] ) ) ;
28
- gulp . task ( ':publish' , function ( done : ( ) => void ) {
29
- const exec : any = child_process . execSync ;
27
+
28
+ task ( ':publish:logout' , execTask ( 'npm' , [ 'logout' ] ) ) ;
29
+
30
+ task ( ':publish' , function ( ) {
30
31
const currentDir = process . cwd ( ) ;
31
32
32
- fs . readdirSync ( DIST_COMPONENTS_ROOT )
33
+ readdirSync ( DIST_COMPONENTS_ROOT )
33
34
. forEach ( dirName => {
34
35
const componentPath = path . join ( DIST_COMPONENTS_ROOT , dirName ) ;
35
- const stat = fs . statSync ( componentPath ) ;
36
+ const stat = statSync ( componentPath ) ;
36
37
37
38
if ( ! stat . isDirectory ( ) ) {
38
39
return ;
39
40
}
40
41
41
42
process . chdir ( componentPath ) ;
42
- exec ( 'npm publish' ) ;
43
+ execSync ( 'npm publish' ) ;
43
44
} ) ;
44
45
process . chdir ( currentDir ) ;
45
46
} ) ;
46
47
47
- gulp . task ( 'publish' , function ( done : ( ) => void ) {
48
+ task ( 'publish' , function ( done : ( ) => void ) {
48
49
gulpRunSequence (
49
50
':publish:whoami' ,
50
51
'build:release' ,
0 commit comments