File tree Expand file tree Collapse file tree 1 file changed +12
-13
lines changed
ng-dev/ts-circular-dependencies Expand file tree Collapse file tree 1 file changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -107,19 +107,7 @@ export function main(
107107 Log . warn ( ` Please rerun with "--warnings" to inspect unresolved imports.` ) ;
108108 }
109109
110- if ( goldenFile ) {
111- // Golden file exists
112- if ( approve ) {
113- writeFileSync ( goldenFile , JSON . stringify ( actual , null , 2 ) ) ;
114- Log . info ( green ( '✔ Updated golden file.' ) ) ;
115- return 0 ;
116- }
117- if ( ! existsSync ( goldenFile ) ) {
118- Log . error ( `x Could not find golden file: ${ goldenFile } ` ) ;
119- return 1 ;
120- }
121- } else {
122- // No golden file exists
110+ if ( goldenFile === undefined ) {
123111 if ( approve ) {
124112 Log . error (
125113 `x Cannot approve circular depdencies within this repository as no golden file exists.` ,
@@ -135,6 +123,17 @@ export function main(
135123 return 0 ;
136124 }
137125
126+ if ( approve ) {
127+ writeFileSync ( goldenFile , JSON . stringify ( actual , null , 2 ) ) ;
128+ Log . info ( green ( '✔ Updated golden file.' ) ) ;
129+ return 0 ;
130+ }
131+
132+ if ( ! existsSync ( goldenFile ) ) {
133+ Log . error ( `x Could not find golden file: ${ goldenFile } ` ) ;
134+ return 1 ;
135+ }
136+
138137 const expected = goldenFile ? ( JSON . parse ( readFileSync ( goldenFile , 'utf8' ) ) as Golden ) : [ ] ;
139138 const { fixedCircularDeps, newCircularDeps} = compareGoldens ( actual , expected ) ;
140139 const isMatching = fixedCircularDeps . length === 0 && newCircularDeps . length === 0 ;
You can’t perform that action at this time.
0 commit comments