5
5
const spawnSync = require ( 'child_process' ) . spawnSync ;
6
6
const fs = require ( 'fs' ) ;
7
7
const temp = require ( 'temp' ) ;
8
- const { blue, green, red , gray, yellow } = require ( 'chalk' ) ;
8
+ const { blue, green, gray } = require ( 'chalk' ) ;
9
9
10
10
const path = require ( 'path' ) ;
11
11
const glob = require ( 'glob' ) ;
12
- const cli = 'https://github.com/angular/angular-cli.git' ;
13
12
const cliBuilds = 'https://github.com/angular/cli-builds.git' ;
14
13
const ngToolsWebpackBuilds = 'https://github.com/angular/ngtools-webpack-builds.git' ;
15
14
16
15
17
16
class Executor {
18
- constructor ( cwd ) { this . _cwd = cwd ; }
17
+ constructor ( cwd ) {
18
+ this . _cwd = cwd ;
19
+ }
19
20
20
21
execute ( command , ...args ) {
21
22
args = args . filter ( x => x !== undefined ) ;
@@ -32,9 +33,15 @@ class Executor {
32
33
}
33
34
}
34
35
35
- git ( ...args ) { return this . execute ( 'git' , ...args ) ; }
36
- npm ( ...args ) { return this . execute ( 'npm' , ...args ) ; }
37
- rm ( ...args ) { return this . execute ( 'rm' , ...args ) ; }
36
+ git ( ...args ) {
37
+ return this . execute ( 'git' , ...args ) ;
38
+ }
39
+ npm ( ...args ) {
40
+ return this . execute ( 'npm' , ...args ) ;
41
+ }
42
+ rm ( ...args ) {
43
+ return this . execute ( 'rm' , ...args ) ;
44
+ }
38
45
39
46
glob ( pattern , options ) {
40
47
return glob . sync ( pattern , Object . assign ( { } , options || { } , { cwd : this . _cwd } ) ) ;
@@ -68,7 +75,7 @@ class Executor {
68
75
69
76
updateVersion ( hash ) {
70
77
const packageJson = JSON . parse ( this . read ( 'package.json' ) ) ;
71
- packageJson . version = `${ packageJson . version } -${ hash . substr ( 1 , 7 ) } ` ;
78
+ packageJson . version = `${ packageJson . version } -${ hash } ` ;
72
79
this . write ( 'package.json' , JSON . stringify ( packageJson , null , 2 ) ) ;
73
80
}
74
81
@@ -86,7 +93,7 @@ function main() {
86
93
const tempRoot = temp . mkdirSync ( 'angular-cli-builds' ) ;
87
94
const tempExec = new Executor ( tempRoot ) ;
88
95
89
- console . log ( green ( ` Cloning builds repos...\n` ) ) ;
96
+ console . log ( green ( ' Cloning builds repos...\n' ) ) ;
90
97
tempExec . git ( 'clone' , cliBuilds ) ;
91
98
tempExec . git ( 'clone' , ngToolsWebpackBuilds ) ;
92
99
0 commit comments