From 88603adf8d7b6f50c72ff8462de2feda24b30e47 Mon Sep 17 00:00:00 2001 From: Alex Bit Date: Mon, 10 Aug 2026 19:52:49 -0700 Subject: [PATCH] fix: Make sync-codemod-versions portable across macOS and Linux Replace sed -i with a Node rewrite so version sync works on both BSD sed and GNU sed. The macOS-only sed -i '' form broke Release on Linux CI. Co-authored-by: Cursor --- scripts/sync-codemod-versions.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/sync-codemod-versions.sh b/scripts/sync-codemod-versions.sh index 80c4aef..d9a9e90 100755 --- a/scripts/sync-codemod-versions.sh +++ b/scripts/sync-codemod-versions.sh @@ -13,8 +13,17 @@ for pkg_json in codemods/*/package.json; do fi version="$(node -p "require('./$pkg_json').version")" - # Replace the version line in codemod.yaml - sed -i '' "s/^version: .*/version: \"$version\"/" "$codemod_yaml" + # Use Node instead of sed -i: BSD sed (macOS) and GNU sed (Linux CI) disagree + # on the in-place backup-extension syntax. + node --input-type=module -e " + import fs from 'node:fs'; + const file = process.argv[1]; + const version = process.argv[2]; + const next = fs + .readFileSync(file, 'utf8') + .replace(/^version: .*$/m, \`version: \"\${version}\"\`); + fs.writeFileSync(file, next); + " "$codemod_yaml" "$version" echo "Synced $codemod_yaml to version $version" done