Skip to content

Commit 85ca69b

Browse files
authored
fix: broken local build due to sed -i warning (#206)
The workaround to replace sdk versions in [replace-version.sh](https://github.com/launchdarkly/js-core/blob/main/scripts/replace-version.sh#L14) does not work locally on OS X because the sed command is not posix compliant. This breaks yarn build locally on os x. On os x, `sed -i` expects the next argument to a backup file extension. On Linux/Unix, it does not. This ticket implements a workaround for the workaround. As you can see, this is a rabbit hole which eventually is best solved by not using this script at all.
1 parent 5b7fc30 commit 85ca69b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/replace-version.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Run this script like:
22
# ./scripts/replace-version.sh packages/sdk/node
33

4-
# It will look for the string __LD_VERSION__ in the `dist` directory and replace
4+
# It will look for the string __LD_VERSION__ in the `dist` directory and replace
55
# any instances with the version from the package.json.
66

77
# This is a workaround for a bug with the node-workspace plugin with release-please.
@@ -11,4 +11,5 @@ set -e
1111

1212
version=$(node -p "let pj = require('./$1/package.json');\`\${pj.version}\`");
1313

14-
find "$1/dist" -type f -exec sed -i "s/__LD_VERSION__/$version/g" {} +
14+
find "$1/dist" -type f -exec sed -i.UNUSED_BAK "s/__LD_VERSION__/$version/g" {} +
15+
find "$1/dist" -type f -name "*.UNUSED_BAK" -exec rm {} +

0 commit comments

Comments
 (0)