Skip to content

Commit a601f43

Browse files
committed
Merge branch 'release/5.27.0'
2 parents a1ee0ad + c3846ac commit a601f43

13 files changed

Lines changed: 120 additions & 102 deletions

CHANGELOG.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,36 @@
22

33
# Changelog
44

5+
## v5.27.0 (2025-10-01)
6+
7+
_Commits from: v5.26.0..HEAD_
8+
9+
### 📂 Unscoped changes
10+
11+
#### Bug Fixes
12+
13+
- 🐛 update dependencies ([ed2465e](https://github.com/tomgrv/devcontainer-features/commit/ed2465e7570eec12a4847bed00bafa6967746251))
14+
15+
#### Other changes
16+
17+
- Merge tag 'v5.26.0' into develop ([11f0ad3](https://github.com/tomgrv/devcontainer-features/commit/11f0ad30b2eae7e3faca69a3c426800cb887151d))
18+
19+
### 📦 gitutils changes
20+
21+
#### Bug Fixes
22+
23+
- 🐛 improve error handling for version & CHANGELOG commit ([569cb42](https://github.com/tomgrv/devcontainer-features/commit/569cb423e9d10643d902418c9391f907f524f24c))
24+
25+
#### Features
26+
27+
- ✨ list workspace directories and affected workspaces ([6acab47](https://github.com/tomgrv/devcontainer-features/commit/6acab47128b8119dbfad544dc63e5e081d59c479))
28+
29+
### 📦 gitversion changes
30+
31+
#### Other changes
32+
33+
- ♻️ 🛠️ use git workspaces command ([82ac773](https://github.com/tomgrv/devcontainer-features/commit/82ac77387d98f1d9bedf254db2eb334ef0185853))
34+
535
## v5.26.0 (2025-10-01)
636

737
_Commits from: v5.25.0..HEAD_

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tomgrv/devcontainer-features",
3-
"version": "5.26.0",
3+
"version": "5.27.0",
44
"description": "Configure dev environment with devcontainer, gitflow, gitversion, git aliases & hooks. Can be used a devcontainer features",
55
"keywords": [
66
"dev",

src/act/devcontainer-feature.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
"description": "A tool for running GitHub Actions locally",
55
"version": "1.6.1",
66
"dependsOn": {
7-
"ghcr.io/devcontainers/features/docker-in-docker": {}
7+
"ghcr.io/devcontainers/features/docker-in-docker": {},
8+
"ghcr.io/tomgrv/devcontainer-features/common-utils:5": {}
89
},
910
"installsAfter": [
1011
"ghcr.io/devcontainers/features/common-utils",
11-
"ghcr.io/devcontainers/features/docker-in-docker"
12+
"ghcr.io/devcontainers/features/docker-in-docker",
13+
"ghcr.io/tomgrv/devcontainer-features/common-utils"
1214
],
1315
"options": {
1416
"version": {

src/githooks/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"version": "5.26.0",
66
"dependsOn": {
77
"ghcr.io/devcontainers/features/node:1": "lts",
8-
"ghcr.io/tomgrv/devcontainer-features/common-utils:3": {},
98
"ghcr.io/tomgrv/devcontainer-features/gitutils:5": {}
109
},
1110
"installsAfter": [
1211
"ghcr.io/tomgrv/devcontainer-features/common-utils",
12+
"ghcr.io/tomgrv/devcontainer-features/gitversion",
1313
"ghcr.io/tomgrv/devcontainer-features/gitutils"
1414
],
1515
"customizations": {

src/gitutils/_git-release-prod.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ GIT_EDITOR=:
4545
GBV=$(bump-changelog -b -m)
4646
if [ "$?" -eq 0 ] && [ -n "$GBV" ]; then
4747
zz_log s "Version & CHANGELOG updated to: {B $GBV}"
48-
git commit -am "chore(release): $GBV"
48+
49+
if ! git commit -am "chore(release): $GBV"; then
50+
zz_log e "Cannot commit version & CHANGELOG"
51+
exit 1
52+
fi
53+
4954
if git flow $flow finish $name --push; then
5055
zz_log s "Release finished: {B $GBV}"
5156
rm -f .git/RELEASE
5257
else
53-
git undo
5458
zz_log e "Cannot finish release. CHANGELOG & VERSION are not updated."
5559
fi
5660
else

src/gitutils/_git-workspaces.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
3+
# Function to print help and manage arguments
4+
eval $(
5+
zz_args "List workspace directories and affected workspaces" $0 "$@" <<-help
6+
r range range Git range to check for affected workspaces (prints only affected workspaces)
7+
help
8+
)
9+
10+
#### Go to repository root
11+
cd "$(git rev-parse --show-toplevel)"
12+
13+
list_workspace_dirs() {
14+
if [ -f "package.json" ] && command -v jq >/dev/null 2>&1; then
15+
local workspaces
16+
workspaces=$(jq -r '.workspaces[]? // empty' package.json 2>/dev/null || true)
17+
18+
if [ -n "$workspaces" ]; then
19+
echo "$workspaces" | while read -r workspace_pattern; do
20+
if echo "$workspace_pattern" | grep -q '\*'; then
21+
# Expand simple glob patterns like "packages/*" or "src/*"
22+
find . -path "./$workspace_pattern" -type d -mindepth 1 -maxdepth 2 2>/dev/null || true
23+
else
24+
if [ -d "$workspace_pattern" ]; then
25+
echo "./$workspace_pattern"
26+
fi
27+
fi
28+
done
29+
return 0
30+
fi
31+
fi
32+
33+
# Fallback: list all immediate subdirectories
34+
find . -mindepth 1 -maxdepth 1 -type d
35+
}
36+
37+
get_affected_workspaces() {
38+
local range="$1"
39+
40+
# If no range provided, nothing to do
41+
if [ -z "$range" ]; then
42+
return 0
43+
fi
44+
45+
# Get all changed files in the range and determine which workspaces they belong to
46+
git log --name-only --pretty=format: "$range" 2>/dev/null \
47+
| while read -r line; do
48+
if [ -n "$line" ]; then
49+
# This is a file path, check which workspace it belongs to
50+
list_workspace_dirs | while read -r workspace_dir; do
51+
workspace_dir_clean=$(echo "$workspace_dir" | sed 's|^./||')
52+
if echo "$line" | grep -q "^$workspace_dir_clean/"; then
53+
echo "$workspace_dir"
54+
fi
55+
done
56+
# Check for root-level files (not in any workspace subdirectory)
57+
if ! echo "$line" | grep -q "/"; then
58+
echo "."
59+
fi
60+
fi
61+
done
62+
}
63+
64+
# Main execution logic
65+
if [ -n "$range" ]; then
66+
get_affected_workspaces "$range" | sort -u
67+
else
68+
list_workspace_dirs
69+
fi

src/gitutils/devcontainer-feature.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"id": "gitutils",
33
"name": "Git Aliases",
44
"description": "A feature to add useful Git aliases to your shell.",
5-
"version": "5.26.0",
5+
"version": "5.27.0",
66
"dependsOn": {
77
"ghcr.io/devcontainers/features/node:1": "lts",
8-
"ghcr.io/tomgrv/devcontainer-features/common-utils:3": {
8+
"ghcr.io/tomgrv/devcontainer-features/common-utils:5": {
99
"utils": "jq dos2unix git-flow"
1010
},
1111
"ghcr.io/tomgrv/devcontainer-features/gitversion:5": "5.*"

src/gitutils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tomgrv/gitutils",
3-
"version": "5.26.0",
3+
"version": "5.27.0",
44
"description": "Git utilities and aliases for development workflow",
55
"files": [
66
"_*.sh",

src/gitversion/_bump-changelog.sh

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -92,39 +92,6 @@ list_changelog_range() {
9292
fi
9393
}
9494

95-
# ===== WORKSPACE MANAGEMENT FUNCTIONS =====
96-
97-
# Get workspace directories from package.json workspaces configuration
98-
# Returns list of workspace directories, falls back to all subdirectories if no workspaces config
99-
get_workspace_dirs() {
100-
if [ -f "package.json" ] && command -v jq > /dev/null 2>&1; then
101-
# Try to get workspaces array from package.json
102-
local workspaces=$(jq -r '.workspaces[]? // empty' package.json 2> /dev/null)
103-
104-
if [ -n "$workspaces" ]; then
105-
# Use configured workspaces
106-
echo "$workspaces" | while read -r workspace_pattern; do
107-
# Handle glob patterns by expanding them
108-
if echo "$workspace_pattern" | grep -q '\*'; then
109-
# Use find to expand glob patterns like "packages/*"
110-
find . -path "./$workspace_pattern" -type d -mindepth 1 -maxdepth 2 2> /dev/null || true
111-
else
112-
# Direct path
113-
if [ -d "$workspace_pattern" ]; then
114-
echo "$workspace_pattern"
115-
fi
116-
fi
117-
done
118-
else
119-
# Fallback to all subdirectories
120-
find . -type d -mindepth 1 -maxdepth 1
121-
fi
122-
else
123-
# Fallback to all subdirectories when package.json or jq not available
124-
find . -type d -mindepth 1 -maxdepth 1
125-
fi
126-
}
127-
12895

12996
# ===== CHANGELOG GENERATION FUNCTIONS =====
13097

src/gitversion/_bump-version.sh

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -21,60 +21,6 @@ help
2121
# Change to repository root to ensure we're working from the correct directory
2222
cd "$(git rev-parse --show-toplevel)" > /dev/null
2323

24-
# ===== WORKSPACE MANAGEMENT FUNCTIONS =====
25-
26-
# Get workspace directories from package.json workspaces configuration
27-
# Returns list of workspace directories, falls back to all subdirectories if no workspaces config
28-
get_workspace_dirs() {
29-
if [ -f "package.json" ] && command -v jq > /dev/null 2>&1; then
30-
# Try to get workspaces array from package.json
31-
local workspaces=$(jq -r '.workspaces[]? // empty' package.json 2> /dev/null)
32-
33-
if [ -n "$workspaces" ]; then
34-
# Use configured workspaces
35-
echo "$workspaces" | while read -r workspace_pattern; do
36-
# Handle glob patterns by expanding them
37-
if echo "$workspace_pattern" | grep -q '\*'; then
38-
# Use find to expand glob patterns like "packages/*"
39-
find . -path "./$workspace_pattern" -type d -mindepth 1 -maxdepth 2 2> /dev/null || true
40-
else
41-
# Direct path
42-
if [ -d "$workspace_pattern" ]; then
43-
echo "$workspace_pattern"
44-
fi
45-
fi
46-
done
47-
else
48-
# Fallback to all subdirectories
49-
find . -type d -mindepth 1 -maxdepth 1
50-
fi
51-
else
52-
# Fallback to all subdirectories when package.json or jq not available
53-
find . -type d -mindepth 1 -maxdepth 1
54-
fi
55-
}
56-
57-
# Get affected workspace names from commit history for a given range
58-
# Parameters: range (git range specification)
59-
# Returns list of workspace names that have commits with matching scopes
60-
get_affected_workspaces() {
61-
local range="$1"
62-
63-
# Extract scopes from commits and match against workspace names
64-
git log --oneline --format="%s" "$range" 2> /dev/null \
65-
| sed -n 's/^[^(]*(\([^)]*\)):.*/\1/p' \
66-
| sort -u \
67-
| while read -r commit_scope; do
68-
# Check if this scope matches any workspace directory
69-
get_workspace_dirs | while read -r workspace_dir; do
70-
local workspace_name=$(basename "$workspace_dir")
71-
if [ "$commit_scope" = "$workspace_name" ]; then
72-
echo "$workspace_dir"
73-
fi
74-
done
75-
done | sort -u
76-
}
77-
7824
# ===== VERSION DETERMINATION FUNCTIONS =====
7925

8026
# Get all git tags in reverse chronological order (newest first)
@@ -286,14 +232,14 @@ update_files() {
286232
return 1
287233
fi
288234
zz_log i "Minimal mode: only bumping workspaces with related commits"
289-
workspace_list=$(get_affected_workspaces "$range")
235+
workspace_list=$(git workspaces -r "$range")
290236

291237
if [ -z "$workspace_list" ]; then
292238
zz_log w "No workspaces affected by recent commits - skipping workspace updates"
293239
return
294240
fi
295241
else
296-
workspace_list=$(get_workspace_dirs)
242+
workspace_list=$(git workspaces)
297243
fi
298244

299245
zz_log i "Bumping version in $filename across workspaces to $version"

0 commit comments

Comments
 (0)