@@ -13,6 +13,8 @@ async function buildSpec(
13
13
) : Promise < void > {
14
14
createSpinner ( `'${ client } ' spec` , verbose ) . start ( ) . info ( ) ;
15
15
const cacheFile = toAbsolutePath ( `specs/dist/${ client } .cache` ) ;
16
+ let hash = '' ;
17
+
16
18
if ( useCache ) {
17
19
const spinner = createSpinner (
18
20
`checking cache for '${ client } '` ,
@@ -21,7 +23,11 @@ async function buildSpec(
21
23
// check if file and cache exist
22
24
if ( await exists ( toAbsolutePath ( `specs/bundled/${ client } .yml` ) ) ) {
23
25
// compare with stored cache
24
- const hash = ( await hashElement ( toAbsolutePath ( `specs/${ client } ` ) ) ) . hash ;
26
+ const specHash = ( await hashElement ( toAbsolutePath ( `specs/${ client } ` ) ) )
27
+ . hash ;
28
+ const commonHash = ( await hashElement ( toAbsolutePath ( `specs/common` ) ) )
29
+ . hash ;
30
+ hash = `${ specHash } -${ commonHash } ` ;
25
31
if ( await exists ( cacheFile ) ) {
26
32
const storedHash = ( await fsp . readFile ( cacheFile ) ) . toString ( ) ;
27
33
if ( storedHash === hash ) {
@@ -45,14 +51,18 @@ async function buildSpec(
45
51
{ verbose }
46
52
) ;
47
53
48
- spinner . text = `validating '${ client } ' spec` ;
54
+ spinner . text = `validating '${ client } ' bundled spec` ;
49
55
await run ( `yarn openapi lint specs/bundled/${ client } .${ outputFormat } ` , {
50
56
verbose,
51
57
} ) ;
52
58
53
- spinner . text = `storing ${ client } spec cache` ;
54
- const hash = ( await hashElement ( toAbsolutePath ( `specs/${ client } ` ) ) ) . hash ;
55
- await fsp . writeFile ( cacheFile , hash ) ;
59
+ spinner . text = `linting '${ client } ' bundled spec` ;
60
+ await run ( `yarn specs:lint bundled/${ client } .${ outputFormat } ` , { verbose } ) ;
61
+
62
+ if ( hash ) {
63
+ spinner . text = `storing ${ client } spec cache` ;
64
+ await fsp . writeFile ( cacheFile , hash ) ;
65
+ }
56
66
57
67
spinner . succeed ( `building complete for '${ client } ' spec` ) ;
58
68
}
0 commit comments