@@ -21,49 +21,45 @@ docVersions = renderMultiVersion
2121 ? versions . params . previousVersions . concat ( versions . params . currentVersion )
2222 : [ versions . params . currentVersion ] ;
2323
24- const apiDocRenders = [ ] ;
24+ Promise . all (
25+ docVersions . map ( async ( version ) => {
26+ // We don't add a version-postfix directory name for "current" version, since local website builds want to use the
27+ // locally generated API doc models when present.
28+ const versionPostfix = version === versions . params . currentVersion ? "" : `-${ version } ` ;
2529
26- docVersions . forEach ( ( version ) => {
27- // We don't add a version-postfix directory name for "current" version, since local website builds want to use the
28- // locally generated API doc models when present.
29- const versionPostfix = version === versions . params . currentVersion ? "" : `-${ version } ` ;
30+ const apiReportsDirectoryPath = path . resolve (
31+ __dirname ,
32+ ".." ,
33+ ".." ,
34+ `_api-extractor-temp${ versionPostfix } ` ,
35+ "doc-models" ,
36+ ) ;
3037
31- const apiReportsDirectoryPath = path . resolve (
32- __dirname ,
33- ".." ,
34- ".." ,
35- `_api-extractor-temp${ versionPostfix } ` ,
36- "doc-models" ,
37- ) ;
38+ // TODO: remove check for 2.0 and just set apiDocsDirectoryPath to include version.
39+ // currently publishing to base apis directory until 2.0 release
40+ const apiDocsDirectoryPath = renderMultiVersion
41+ ? path . resolve ( __dirname , ".." , "content" , "docs" , "api" , version )
42+ : path . resolve ( __dirname , ".." , "content" , "docs" , "api" ) ;
3843
39- // TODO: remove check for 2.0 and just set apiDocsDirectoryPath to include version.
40- // currently publishing to base apis directory until 2.0 release
41- const apiDocsDirectoryPath = renderMultiVersion
42- ? path . resolve ( __dirname , ".." , "content" , "docs" , "api" , version )
43- : path . resolve ( __dirname , ".." , "content" , "docs" , "api" ) ;
44+ // TODO: remove check for 2.0 and just set uriDirectoryPath to include version.
45+ // currently publishing to base apis directory until 2.0 release
46+ const uriRootDirectoryPath = renderMultiVersion ? `/docs/api/${ version } ` : `/docs/api` ;
4447
45- // TODO: remove check for 2.0 and just set uriDirectoryPath to include version.
46- // currently publishing to base apis directory until 2.0 release
47- const uriRootDirectoryPath = renderMultiVersion ? `/docs/api/${ version } ` : `/docs/api` ;
48-
49- apiDocRenders . push (
50- renderApiDocumentation (
48+ await renderApiDocumentation (
5149 apiReportsDirectoryPath ,
5250 apiDocsDirectoryPath ,
5351 uriRootDirectoryPath ,
5452 version ,
55- ) . then ( ( ) => {
56- console . log ( chalk . green ( `(${ version } ) API docs written!` ) ) ;
57- } ) ,
58- ) ;
59- } ) ;
53+ ) ;
6054
61- Promise . all ( apiDocRenders ) . then (
55+ console . log ( chalk . green ( `(${ version } ) API docs written!` ) ) ;
56+ } ) ,
57+ ) . then (
6258 ( ) => {
6359 console . log ( chalk . green ( "All API docs written!" ) ) ;
6460 process . exit ( 0 ) ;
6561 } ,
66- ( error ) => {
62+ ( ) => {
6763 process . exit ( 1 ) ;
6864 } ,
6965) ;
0 commit comments