File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
packages/angular_devkit/build_angular/src/utils Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
- import { json } from '@angular-devkit/core' ;
10
9
import { join , resolve } from 'path' ;
11
10
import { VERSION } from './package-version' ;
12
11
@@ -25,14 +24,22 @@ interface CacheMetadata {
25
24
path ?: string ;
26
25
}
27
26
27
+ function hasCacheMetadata ( value : unknown ) : value is { cli : { cache : CacheMetadata } } {
28
+ return (
29
+ ! ! value &&
30
+ typeof value === 'object' &&
31
+ 'cli' in value &&
32
+ ! ! value [ 'cli' ] &&
33
+ typeof value [ 'cli' ] === 'object' &&
34
+ 'cache' in value [ 'cli' ]
35
+ ) ;
36
+ }
37
+
28
38
export function normalizeCacheOptions (
29
- metadata : json . JsonObject ,
39
+ projectMetadata : unknown ,
30
40
worspaceRoot : string ,
31
41
) : NormalizedCachedOptions {
32
- const cacheMetadata : CacheMetadata =
33
- json . isJsonObject ( metadata . cli ) && json . isJsonObject ( metadata . cli . cache )
34
- ? metadata . cli . cache
35
- : { } ;
42
+ const cacheMetadata = hasCacheMetadata ( projectMetadata ) ? projectMetadata . cli . cache : { } ;
36
43
37
44
const { enabled = true , environment = 'local' , path = '.angular/cache' } = cacheMetadata ;
38
45
const isCI = process . env [ 'CI' ] === '1' || process . env [ 'CI' ] ?. toLowerCase ( ) === 'true' ;
You can’t perform that action at this time.
0 commit comments