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 @@ -30,10 +30,26 @@ export const BaseBuildCommandOptions: any = [
30
30
description : 'define the output filename cache-busting hashing mode' ,
31
31
aliases : [ 'oh' ]
32
32
} ,
33
+ { name : 'json' , type : Boolean , default : false } ,
33
34
] ;
34
35
35
36
export interface BuildTaskOptions extends BuildOptions {
36
37
watch ?: boolean ;
38
+ watcher ?: string ;
39
+ supressSizes : boolean ;
40
+ baseHref ?: string ;
41
+ aot ?: boolean ;
42
+ sourcemap ?: boolean ;
43
+ vendorChunk ?: boolean ;
44
+ verbose ?: boolean ;
45
+ progress ?: boolean ;
46
+ i18nFile ?: string ;
47
+ i18nFormat ?: string ;
48
+ locale ?: string ;
49
+ deployUrl ?: string ;
50
+ outputHashing ?: string ;
51
+ extractCss ?: boolean | null ;
52
+ json ?: boolean ;
37
53
}
38
54
39
55
const BuildCommand = Command . extend ( {
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { BuildTaskOptions } from '../commands/build';
6
6
import { NgCliWebpackConfig } from '../models/webpack-config' ;
7
7
import { getWebpackStatsConfig } from '../models/webpack-configs/utils' ;
8
8
import { CliConfig } from '../models/config' ;
9
+ const fs = require ( 'fs' ) ;
9
10
10
11
11
12
export default Task . extend ( {
@@ -32,6 +33,15 @@ export default Task.extend({
32
33
return ;
33
34
}
34
35
36
+ if ( ! runTaskOptions . watch && runTaskOptions . json ) {
37
+ const jsonStats = stats . toJson ( 'verbose' ) ;
38
+
39
+ fs . writeFileSync (
40
+ path . resolve ( project . root , outputPath , 'stats.json' ) ,
41
+ JSON . stringify ( jsonStats , null , 2 )
42
+ ) ;
43
+ }
44
+
35
45
if ( stats . hasErrors ( ) ) {
36
46
reject ( ) ;
37
47
} 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