Skip to content

Commit 3863a43

Browse files
committed
Merge branch 'release/5.28.0'
2 parents a601f43 + 116b6be commit 3863a43

22 files changed

Lines changed: 154 additions & 79 deletions

CHANGELOG.md

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

33
# Changelog
44

5+
## v5.28.0 (2025-10-01)
6+
7+
_Commits from: v5.27.0..HEAD_
8+
9+
### 📂 Unscoped changes
10+
11+
#### Bug Fixes
12+
13+
- 🐛 correct variable assignment syntax in argument processing ([ffa8a1e](https://github.com/tomgrv/devcontainer-features/commit/ffa8a1e07e3ad8fdcb49331ea611169868727924))
14+
- 🐛 remove unnecessary color script sourcing ([0119d55](https://github.com/tomgrv/devcontainer-features/commit/0119d551c762d9583f49ab8c6232fd346bbf7eab))
15+
16+
#### Other changes
17+
18+
- Merge tag 'v5.27.0' into develop ([fc52d6e](https://github.com/tomgrv/devcontainer-features/commit/fc52d6e224126451e0d540797f2f5e60e2d5fe25))
19+
20+
### 📦 gitutils changes
21+
22+
#### Bug Fixes
23+
24+
- 🐛 correct install-plugins in commit hooks ([8d55832](https://github.com/tomgrv/devcontainer-features/commit/8d558327a278fc42ead7325b09f057c95383368d))
25+
- 🐛 handle branch checkout failure ([33fe044](https://github.com/tomgrv/devcontainer-features/commit/33fe044477d5a184fb9a9770594cc071b738234a))
26+
27+
#### Features
28+
29+
- ✨ improve emoji fix script ([f28ad39](https://github.com/tomgrv/devcontainer-features/commit/f28ad395e08fa861244722c2baba97055bb2fc8a))
30+
31+
#### Other changes
32+
33+
- ♻️ improve scripts ([633ea81](https://github.com/tomgrv/devcontainer-features/commit/633ea8147bb942eb1c8d6ff01ce444c6f46f0ac6))
34+
35+
### 📦 gitversion changes
36+
37+
#### Bug Fixes
38+
39+
- 🐛 improve version bump logic ([31dcaa3](https://github.com/tomgrv/devcontainer-features/commit/31dcaa3760ec8d09e9f9fdc84637d00f915473da))
40+
541
## v5.27.0 (2025-10-01)
642

743
_Commits from: v5.26.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.27.0",
3+
"version": "5.28.0",
44
"description": "Configure dev environment with devcontainer, gitflow, gitversion, git aliases & hooks. Can be used a devcontainer features",
55
"keywords": [
66
"dev",

src/common-utils/_zz_args.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ while getopts :$argnames value "$@"; do
7575
naming=$(echo -e "$varnames" | grep -E "^$value" | cut -f2)
7676

7777
if [ -n "$OPTARG" ]; then
78-
echo "$naming=\"$OPTARG\""
78+
echo "$naming='$OPTARG'"
7979
else
8080
echo "$naming=-$value"
8181
fi
@@ -104,21 +104,21 @@ else
104104
# Process remaining '-' parameters
105105
for arg in $(echo $varnames | grep -E "^-" | cut -f2); do
106106
if [ "$#" -gt "0" ]; then
107-
echo "$arg=$1" && shift 1
107+
echo "$arg='$1'" && shift 1
108108
fi
109109
done
110110

111111
# Process remaining '=' parameters
112112
for arg in $(echo $varnames | grep -E "^=" | cut -f2); do
113113
if [ "$#" -gt "0" ]; then
114-
echo "$arg=$1" && shift 1
114+
echo "$arg='$1'" && shift 1
115115
fi
116116
done
117117

118118
# Process remaining '+' parameters
119119
for arg in $(echo $varnames | grep -E "^\+" | cut -f2); do
120120
if [ "$#" -gt "0" ]; then
121-
echo "$arg=$(echo $@ | sed "s/ /\\\\ /g")" && shift $#
121+
echo "$arg='$(echo $@ | sed "s/ /\\\\ /g")'" && shift $#
122122
fi
123123
done
124124

src/common-utils/_zz_dispatch.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
set -e
88

9-
# Source colors script for colored output
10-
. zz_colors
11-
129
# Parse arguments and display help if needed
1310
eval $(
1411
zz_args "Dispatch Utility" $0 "$@" <<- help

src/common-utils/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "common-utils",
33
"name": "Common Utils",
44
"description": "Common utils for tomgrv/devcontainer-features",
5-
"version": "5.26.0",
5+
"version": "5.28.0",
66
"dependsOn": {
77
"ghcr.io/devcontainers/features/common-utils": {}
88
},

src/common-utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tomgrv/common-utils",
3-
"version": "5.26.0",
3+
"version": "5.28.0",
44
"description": "Common utilities and helper scripts for devcontainer features",
55
"files": [
66
"_*.sh",

src/githooks/_commit-msg.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if [ -t 1 ]; then
77
fi
88

99
# Install commitizen plugins
10-
git hook run install-plugins -- '.commitlint.extends//""'
10+
git hook run install-plugins -- '[.config.commitizen.path // "", .commitlint.extends // ""]'
1111

1212
# Apply commitlint rules to the latest commit message
1313
zz_log i "Applying commitlint rules to the latest commit..."

src/githooks/_install-plugins.sh

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
#!/bin/sh
22

3-
json_key=$1
4-
json_file=${2:-./package.json}
3+
# Function to print help and manage arguments
4+
5+
eval $(
6+
zz_args "Install npm plugins from package.json configuration" $0 "$@" <<-help
7+
f file json_file Package.json file path (default: ./package.json)
8+
- key json_key JSON key path to extract plugins from
9+
help
10+
)
11+
12+
# Set defaults if not provided
13+
json_file=${json_file:-./package.json}
14+
15+
if [ -z "$json_key" ]; then
16+
zz_log e "JSON key is required."
17+
exit 1
18+
fi
519

620
zz_log i "Using file {B $json_file}..."
7-
plugins=$(jq -r "$1" "$json_file" | tr -d "'[]:,\"")
21+
plugins=$(jq -r "$json_key" "$json_file" | tr -d "'[]:,\"")
822

923
if [ -z "$plugins" ]; then
1024
zz_log w "No plugins found at key {B $json_key} in {U $json_file}"
@@ -14,30 +28,39 @@ fi
1428
# Load the config file
1529
config=$(dirname $0)/.ci-plugins
1630

31+
# if config file only contains comments and empty lines, make it empty
32+
if [ -f "$config" ] && [ -z "$(grep -v -e '^#' -e '^$' $config)" ]; then
33+
zz_log w "Config file {B $config} is empty or contains only comments, reset it."
34+
cat /dev/null >$config
35+
fi
36+
37+
# Create the config file if it doesn't exist
38+
if [ ! -f "$config" ]; then
39+
zz_log w "Config file {B $config} does not exist, create it."
40+
touch $config
41+
fi
42+
1743
# foreach plugin, check if it is already installed
1844
for plugin in $plugins; do
19-
20-
if ! npm list $plugin 2>/dev/null 1>&2; then
21-
# Save the plugins to a config file
22-
zz_log i "Adding plugin {B $plugin} to list of CI dependencies ..."
23-
echo "$plugin" | sed 's/^ *//;s/ *$//' | grep -v --file=$config >>$config
24-
fi
45+
echo "$plugin" | sed 's/^ *//;s/ *$//' | grep -v --file=$config >>$config
2546
done
2647

2748
# Reload the plugins list
2849
plugins=$(cat $config | grep -v '^$' | tr '\n' ' ')
2950

30-
# If no plugins are left, exit
31-
if [ -z "$plugins" ]; then
32-
zz_log w "No plugins to install!"
33-
exit 0
34-
fi
35-
36-
# Install the plugins
37-
zz_log i "Installing plugins {B $plugins} ..."
38-
if ! npm install --no-save $plugins 2>/dev/null 1>&2; then
39-
zz_log e "Failed to install one of plugins {B $plugins}!"
40-
exit 1
41-
fi
51+
# For each plugin, check if it is already installed
52+
for plugin in $plugins; do
53+
if npm list --depth=0 | grep -q "$plugin@"; then
54+
plugins=$(echo $plugins | sed "s#$plugin##g" | tr -s ' ')
55+
fi
56+
done
4257

43-
zz_log s "Plugins {B $plugins} installed successfully!"
58+
# Install the plugins if there are any to install
59+
if [ -n "$plugins" ]; then
60+
zz_log i "Installing plugins {B $plugins} ..."
61+
if ! npm install --no-save $plugins 2>/dev/null 1>&2; then
62+
zz_log e "Failed to install one of plugins {B $plugins}!"
63+
exit 1
64+
fi
65+
zz_log s "Plugins {B $plugins} installed successfully!"
66+
fi

src/githooks/_prepare-commit-msg.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ if [ -t 1 ]; then
88
fi
99

1010
# Install commitizen plugins
11-
git hook run install-plugins -- '.config.commitizen.path//""'
11+
git hook run install-plugins -- '[.config.commitizen.path // "", .commitlint.extends // ""]'
12+
13+
1214

1315
# Edit commit message
1416
if [ $(grep -cv -e '^#' -e '^$' .git/COMMIT_EDITMSG) -eq 0 ]; then

src/githooks/devcontainer-feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "githooks",
33
"name": "Git Hooks",
44
"description": "A feature to add useful Git hooks to your project",
5-
"version": "5.26.0",
5+
"version": "5.28.0",
66
"dependsOn": {
77
"ghcr.io/devcontainers/features/node:1": "lts",
88
"ghcr.io/tomgrv/devcontainer-features/gitutils:5": {}

0 commit comments

Comments
 (0)