Skip to content

Commit 2fab021

Browse files
committed
doc(devbook): add more explanation + reorganize internal doc of bump_version.sh
1 parent 98c08ed commit 2fab021

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

docs/devbook/bump-versions/bump_versions.sh

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ error() {
3131
exit 1;
3232
}
3333

34-
# NOTE
35-
# `cargo get workspace.members` display the list of path to crates in the workspace.
36-
# for the `cargo set-version` command, we need the name of the module (last element of the path).
37-
3834
readonly ORANGE="\e[1;33m"
3935
readonly GREEN="\e[1;32m"
4036
readonly RESET="\e[0m"
@@ -44,6 +40,10 @@ declare OPEN_API_UPDATE=""
4440
declare OPEN_API_UPDATE_MESSAGE=""
4541

4642
update_crate_versions() {
43+
# NOTE
44+
# `cargo get workspace.members` display the list of path to crates in the workspace.
45+
# for the `cargo set-version` command, we need the name of the module (last element of the path).
46+
#
4747
local -r dry_run=$1
4848
local -r -n files_modify=$2
4949
local -r -a members="$(cargo get workspace.members --delimiter " ")"
@@ -173,6 +173,26 @@ if [ true = $DRY_RUN ]
173173
then
174174
echo -e "${ORANGE}warning${RESET}: script is run in dry mode. To apply the changes, run ${GREEN}$0 --run${RESET}"
175175
else
176+
# NOTE
177+
# The goal is to transform individual `git diff` formatted output to a list item with the crate or package name and the version change.
178+
# ie, transform this:
179+
# ```
180+
# diff --git a/mithril-explorer/package.json b/mithril-explorer/package.json
181+
# index 20f2e0030..e0e680d52 100644
182+
# --- a/mithril-explorer/package.json
183+
# +++ b/mithril-explorer/package.json
184+
# @@ -1,6 +1,6 @@
185+
# {
186+
# "name": "mithril-explorer",
187+
# - "version": "0.7.19",
188+
# + "version": "0.7.20",
189+
# "private": true,
190+
# "scripts": {
191+
# "dev": "next dev",
192+
# ```
193+
# to this:
194+
# `* [js] mithril-explorer from `0.7.18` to `0.7.19``
195+
#
176196
UPDATED_CRATES="$(find . -name Cargo.toml -exec git diff "$COMMIT_REF" {} + | grep -E "^[\+\-]version = \"[0-9\.]+\"|name = " | tr '\n' ' ' | sed -r "s/ name = \"([a-z\-]+)\" -version = \"([0-9\.]+)\" \+version = \"([0-9\.]+)\" ?/* \1 from \`\2\` to \`\3\`\n/g")"
177197
if [[ -n $UPDATED_CRATES ]]
178198
then

0 commit comments

Comments
 (0)