From a848611f9a3ac48b81c5fdcfdc1e8bd8b9de62a6 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski-Owczarek Date: Wed, 6 Aug 2025 15:08:32 +0200 Subject: Build: Make the sed usage portable across Linux & macOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS (which uses the BSD-variant of sed), the `-i` flag requires its “backup extension” to come immediately after the i (with a space), even if it’s empty; this made the release `sed` commands fail on macOS. The GNU sed doesn’t require an extension but it allows it. To make the commands work both on macOS & Linux, make the following changes: 1. Always specify the backup extension. 2. Explicitly specify the script part by using the `-e` flag. 3. To simplify the patterns, use `|` as a separator instead of `/`; then slashes don't need to be escaped in the script parts. --- .release-it.cjs | 2 +- build/release/post-release.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.release-it.cjs b/.release-it.cjs index d5d8ec921..425e9d313 100644 --- a/.release-it.cjs +++ b/.release-it.cjs @@ -11,7 +11,7 @@ module.exports = { hooks: { "before:init": "bash ./build/release/pre-release.sh", "after:version:bump": - "sed -i 's/main\\/AUTHORS.txt/${version}\\/AUTHORS.txt/' package.json", + "sed -i '' -e 's|main/AUTHORS.txt|${version}/AUTHORS.txt|' package.json", "after:bump": "cross-env VERSION=${version} npm run build:all", "before:git:release": "git add -f dist/ dist-module/ changelog.md", "after:release": "echo 'Run the following to complete the release:' && " + diff --git a/build/release/post-release.sh b/build/release/post-release.sh index 6cc4d6517..271c00734 100644 --- a/build/release/post-release.sh +++ b/build/release/post-release.sh @@ -43,7 +43,7 @@ git push --follow-tags cd - # Restore AUTHORS URL -sed -i "s/$1\/AUTHORS.txt/main\/AUTHORS.txt/" package.json +sed -i '' -e "s|$1/AUTHORS.txt|main/AUTHORS.txt|" package.json git add package.json # Remove built files from tracking. -- cgit v1.2.3