File tree 3 files changed +36
-0
lines changed
3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,26 @@ export const baseBuildCommandOptions: any = [
31
31
description : 'define the output filename cache-busting hashing mode' ,
32
32
aliases : [ 'oh' ]
33
33
} ,
34
+ { name : 'json' , type : Boolean , default : false } ,
34
35
] ;
35
36
36
37
export interface BuildTaskOptions extends BuildOptions {
37
38
watch ?: boolean ;
39
+ watcher ?: string ;
40
+ supressSizes : boolean ;
41
+ baseHref ?: string ;
42
+ aot ?: boolean ;
43
+ sourcemap ?: boolean ;
44
+ vendorChunk ?: boolean ;
45
+ verbose ?: boolean ;
46
+ progress ?: boolean ;
47
+ i18nFile ?: string ;
48
+ i18nFormat ?: string ;
49
+ locale ?: string ;
50
+ deployUrl ?: string ;
51
+ outputHashing ?: string ;
52
+ extractCss ?: boolean | null ;
53
+ json ?: boolean ;
38
54
}
39
55
40
56
const BuildCommand = Command . extend ( {
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { BuildTaskOptions } from '../commands/build';
7
7
import { NgCliWebpackConfig } from '../models/webpack-config' ;
8
8
import { getWebpackStatsConfig } from '../models/webpack-configs/utils' ;
9
9
import { CliConfig } from '../models/config' ;
10
+ const fs = require ( 'fs' ) ;
10
11
11
12
12
13
export default Task . extend ( {
@@ -36,6 +37,15 @@ export default Task.extend({
36
37
return ;
37
38
}
38
39
40
+ if ( ! runTaskOptions . watch && runTaskOptions . json ) {
41
+ const jsonStats = stats . toJson ( 'verbose' ) ;
42
+
43
+ fs . writeFileSync (
44
+ path . resolve ( project . root , outputPath , 'stats.json' ) ,
45
+ JSON . stringify ( jsonStats , null , 2 )
46
+ ) ;
47
+ }
48
+
39
49
if ( stats . hasErrors ( ) ) {
40
50
reject ( ) ;
41
51
} else {
Original file line number Diff line number Diff line change
1
+ import { ng } from '../../utils/process' ;
2
+ import { expectFileToExist } from '../../utils/fs' ;
3
+ import { expectGitToBeClean } from '../../utils/git' ;
4
+
5
+
6
+ export default function ( ) {
7
+ return ng ( 'build' , '--json' )
8
+ . then ( ( ) => expectFileToExist ( './dist/stats.json' ) )
9
+ . then ( ( ) => expectGitToBeClean ( ) ) ;
10
+ }
You can’t perform that action at this time.
0 commit comments