-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add script to keep version in sync
- Loading branch information
Showing
8 changed files
with
177 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Ensure script runs relative to the repo root | ||
set -euo pipefail | ||
cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
|
||
# Trap signals for graceful exit | ||
trap 'echo "Script interrupted" >&2; exit 2' INT TERM | ||
|
||
# Run changeset with passed arguments | ||
npx changeset "$@" | ||
exitCode=$? | ||
|
||
if [ $exitCode -ne 0 ]; then | ||
echo "Changeset finished with error" >&2 | ||
exit $exitCode | ||
fi | ||
|
||
# Handle "post" scripts if arguments are provided | ||
if [ $# -gt 0 ]; then | ||
command="$1" | ||
shift # Remove the first argument from $@ | ||
script="changeset:post${command}" | ||
echo "Running post script: ${script}" | ||
npm run "${script}" --if-present -- "$@" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { replaceInFile } from "replace-in-file"; | ||
|
||
import pkgJson from "../package.json"; | ||
|
||
const version = pkgJson.version; | ||
|
||
await replaceInFile({ | ||
files: ["liblab.config.json"], | ||
from: /"sdkVersion": "\d.\d.\d"/g, | ||
to: `"sdkVersion": "${version}"`, | ||
}); | ||
|
||
await replaceInFile({ | ||
files: ["README.md"], | ||
from: [ | ||
/SDK \d.\d.\d/g, | ||
/SDK version: `\d.\d.\d`/g, | ||
], | ||
to: [ | ||
`SDK ${version}`, | ||
`SDK version: \`${version}\``, | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters