Skip to content

Commit af4b6b7

Browse files
author
Thomas G.
committed
fix: 🐛 check already installed plugins
1 parent a6f2b13 commit af4b6b7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/githooks/_install-plugins.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,22 @@
33
json_key=$1
44
json_file=${2:-package.json}
55

6-
plugins=$(cat $json_file | npx --yes jqn "$1" | tr -d "'[]:,\"\n")
6+
plugins=$(cat $json_file | npx --yes jqn "$1" | tr -d "'[]:,\"")
77

88
if [ -z "$plugins" ]; then
99
zz_log w "No plugins found at key {B $json_key} in {U $json_file}"
1010
elif ! npm list $plugins 2>/dev/null 1>&2; then
11+
12+
config=$(dirname $0)/.ci-plugins
13+
14+
# Save the plugins to a config file
15+
zz_log i "Adding plugins {B $plugins} to list of CI dependencies ..."
16+
echo "$plugins" | sed 's/^ *//;s/ *$//' | grep -v --file=$config >>$config
17+
18+
# Reload the plugins list
19+
plugins=$(cat $config | tr '\n' ' ')
20+
21+
# Install the plugins
1122
zz_log i "Installing plugins {B $plugins} ..."
1223
npm install --no-save $plugins 2>/dev/null 1>&2
1324
zz_log s "Plugins {B $plugins} installed successfully!"

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.10.1",
5+
"version": "5.10.2",
66
"dependsOn": {
77
"ghcr.io/devcontainers/features/node:1": "lts",
88
"ghcr.io/tomgrv/devcontainer-features/common-utils:3": {},

0 commit comments

Comments
 (0)