7272async function main ( ) {
7373 const pipelines = Array . isArray ( output ) ? output : [ output ]
7474 await validateInputParameters ( )
75- rimraf . sync ( TEMP_OPENAPI_DIR )
75+ await rimraf ( TEMP_OPENAPI_DIR )
7676 await mkdirp ( TEMP_OPENAPI_DIR )
7777
7878 // If the source repo is github, this is the local development workflow
@@ -97,7 +97,7 @@ async function main() {
9797 await copyFile ( file , path . join ( TEMP_OPENAPI_DIR , baseName ) )
9898 }
9999
100- rimraf . sync ( TEMP_BUNDLED_OPENAPI_DIR )
100+ await rimraf ( TEMP_BUNDLED_OPENAPI_DIR )
101101 await normalizeDataVersionNames ( TEMP_OPENAPI_DIR )
102102
103103 // The REST_API_DESCRIPTION_ROOT repo contains all current and
@@ -107,12 +107,12 @@ async function main() {
107107 const derefDir = await readdir ( TEMP_OPENAPI_DIR )
108108 const currentOpenApiVersions = Object . values ( allVersions ) . map ( ( elem ) => elem . openApiVersionName )
109109
110- derefDir . forEach ( ( schema ) => {
110+ for ( const schema of derefDir ) {
111111 // if the schema does not start with a current version name, delete it
112112 if ( ! currentOpenApiVersions . find ( ( version ) => schema . startsWith ( version ) ) ) {
113- rimraf . sync ( path . join ( TEMP_OPENAPI_DIR , schema ) )
113+ await rimraf ( path . join ( TEMP_OPENAPI_DIR , schema ) )
114114 }
115- } )
115+ }
116116 }
117117 const derefFiles = await readdir ( TEMP_OPENAPI_DIR )
118118 const { restSchemas, webhookSchemas } = await getOpenApiSchemaFiles ( derefFiles )
@@ -175,7 +175,7 @@ async function getBundledFiles() {
175175 }
176176
177177 // Create a tmp directory to store schema files generated from github/github
178- rimraf . sync ( TEMP_OPENAPI_DIR )
178+ await rimraf ( TEMP_OPENAPI_DIR )
179179 await mkdirp ( TEMP_BUNDLED_OPENAPI_DIR )
180180
181181 console . log (
0 commit comments