From d427a03a44277a00a7265b48ecbd0ed9525b71f2 Mon Sep 17 00:00:00 2001 From: nikolaysamoil0ff Date: Sat, 21 Mar 2026 04:48:14 +0100 Subject: [PATCH] Fix: properly await async package updates Replaced forEach with an async-aware loop to ensure all package updates are awaited before the script completes. This prevents premature completion and ensures errors are properly propagated. --- .../src/release/updatePkgsForGenericBump.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/libs/codegen/src/release/updatePkgsForGenericBump.ts b/libs/codegen/src/release/updatePkgsForGenericBump.ts index cfa681bee..abd958550 100644 --- a/libs/codegen/src/release/updatePkgsForGenericBump.ts +++ b/libs/codegen/src/release/updatePkgsForGenericBump.ts @@ -103,11 +103,14 @@ async function updateChangelog(pkgPath: string, highestVersion: string) { async function updatePkgsForGenericBump() { // Find package.json paths for cds-web, cds-mobile, and cds-common - const pkgJsonPaths = await glob(`packages/(${PACKAGES_TO_SYNC_VERSION.join('|')})/package.json`, { - absolute: true, - cwd: MONOREPO_ROOT, - onlyFiles: true, - }); + const pkgJsonPaths = await glob( + `packages/(${PACKAGES_TO_SYNC_VERSION.join('|')})/package.json`, + { + absolute: true, + cwd: MONOREPO_ROOT, + onlyFiles: true, + }, + ); // Get the highest version number among the specified packages const highestVersion = await getHighestVersion(pkgJsonPaths); @@ -115,14 +118,14 @@ async function updatePkgsForGenericBump() { console.info(chalk.blue(`Updating all versions to ${highestVersion}`)); // Update versions in package.json and CHANGELOG for each package - pkgJsonPaths.forEach(async (pkgPath) => { + for (const pkgPath of pkgJsonPaths) { const packageVersion = await getPkgVersion(pkgPath); if (semver.lt(packageVersion, highestVersion)) { await updatePkgVersion(pkgPath, highestVersion); await updateChangelog(pkgPath, highestVersion); } - }); + } // Write updated package.json console.info(chalk.green(`Versions updated successfully!`));