add sed -i lint check to ensure portability

This commit is contained in:
Chris Holland 2024-01-20 14:35:10 -08:00
parent dd535a4e32
commit 2990bd0538
3 changed files with 7 additions and 2 deletions

View file

@ -5,5 +5,10 @@ if [ -x "$(command -v shellcheck)" ]; then
else else
echo "Warning: shellcheck is not installed, skipping shell scripts" echo "Warning: shellcheck is not installed, skipping shell scripts"
fi fi
incompatible_sed=$(! grep -RPn --color=always --exclude-dir=node_modules --exclude-dir=.git 'sed(?:\s-\w+)*\s-i(?!\S|\s"")')
if [ "$incompatible_sed" ]; then
printf "\nWarning: avoid non-portable sed flag -i without backup extension, use -i.bak\n"
printf "%s\n\n" "$incompatible_sed"
fi
yarn run lint yarn run lint
"$(yarn bin)/eslint" --rulesdir custom-eslint-rules --ext .ts . "$(yarn bin)/eslint" --rulesdir custom-eslint-rules --ext .ts .

View file

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
# Replace issue numbers in brackets eg (#1337) with a link to the issue on the repository # Replace issue numbers in brackets eg (#1337) with a link to the issue on the repository
sed -i 's; (#\([0-9]*\)); ([#\1](https://github.com/tridactyl/tridactyl/issues/\1));g' CHANGELOG.md sed -i.bak 's; (#\([0-9]*\)); ([#\1](https://github.com/tridactyl/tridactyl/issues/\1));g' CHANGELOG.md

View file

@ -16,5 +16,5 @@ do
sed "/REPLACETHIS/,$ d" tutor.template.html > "$dest$fileroot.html" sed "/REPLACETHIS/,$ d" tutor.template.html > "$dest$fileroot.html"
"$(yarn bin)/marked" "$page" >> "$dest$fileroot.html" "$(yarn bin)/marked" "$page" >> "$dest$fileroot.html"
sed "1,/REPLACETHIS/ d" tutor.template.html >> "$dest$fileroot.html" sed "1,/REPLACETHIS/ d" tutor.template.html >> "$dest$fileroot.html"
sed -i "s|\.md|.html|g" "$dest$fileroot.html" sed -i.bak "s|\.md|.html|g" "$dest$fileroot.html"
done done