image-guard 5.2.3 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/NOTICE.md +7 -0
- package/README.md +7 -21
- package/bin/image-guard.sh +15 -0
- package/package.json +5 -5
- package/NOTICE +0 -6
- /package/{LICENSE → LICENSE.md} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,13 @@ Starting with version 5.2.0, all notable changes to Image Guard are documented i
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and the project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [5.2.4] - 2026-03-04
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
* Changed bin entry from a Node.js script to a shell wrapper that locates node from common version managers (nvm, Volta, asdf, mise) and package managers (Homebrew) before invocation, resolving hook failures in GUI Git clients that don’t inherit the shell’s PATH
|
|
12
|
+
- **Migration:** If you set up hooks, replace `npx image-guard --staged` with `./node_modules/.bin/image-guard --staged` in your `.githooks/pre-commit` or `.husky/pre-commit`.
|
|
13
|
+
|
|
7
14
|
## [5.2.3] - 2026-02-21
|
|
8
15
|
|
|
9
16
|
### Fixed
|
package/NOTICE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Image Guard
|
|
2
|
+
|
|
3
|
+
Copyright 2022 [Jens Oliver Meiert](https://meiert.com/)
|
|
4
|
+
|
|
5
|
+
The initial developer of imagemin is [the imagemin team](https://github.com/orgs/imagemin/people).
|
|
6
|
+
|
|
7
|
+
The initial developer of imagemin-merlin (aka Merlin) is [sum.cumo](https://web.archive.org/web/20191208211414/https://www.sumcumo.com/). Copyright 2019 sum.cumo GmbH.
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Native Git hooks are simpler to set up and don’t require additional dependenci
|
|
|
64
64
|
mkdir -p .githooks;\
|
|
65
65
|
cat > .githooks/pre-commit << 'EOF'
|
|
66
66
|
#!/bin/sh
|
|
67
|
-
|
|
67
|
+
./node_modules/.bin/image-guard --staged
|
|
68
68
|
EOF
|
|
69
69
|
chmod +x .githooks/pre-commit;\
|
|
70
70
|
git config core.hooksPath .githooks;\
|
|
@@ -72,7 +72,7 @@ git add .githooks/pre-commit;\
|
|
|
72
72
|
git commit -m "feat: add Git pre-commit hook for Image Guard";\
|
|
73
73
|
npm pkg set scripts.postprepare="mkdir -p .githooks && cat > .githooks/pre-commit << 'EOF'
|
|
74
74
|
#\!/bin/sh
|
|
75
|
-
|
|
75
|
+
./node_modules/.bin/image-guard --staged
|
|
76
76
|
EOF
|
|
77
77
|
chmod +x .githooks/pre-commit && git config core.hooksPath .githooks"
|
|
78
78
|
```
|
|
@@ -82,21 +82,21 @@ chmod +x .githooks/pre-commit && git config core.hooksPath .githooks"
|
|
|
82
82
|
If you already use [Husky](https://typicode.github.io/husky/), run the following commands in your project root (you can copy and execute them at once):
|
|
83
83
|
|
|
84
84
|
```console
|
|
85
|
-
grep -qxF "
|
|
85
|
+
grep -qxF "./node_modules/.bin/image-guard --staged" .husky/pre-commit || printf '\n./node_modules/.bin/image-guard --staged' >> .husky/pre-commit;\
|
|
86
86
|
git add .husky/pre-commit;\
|
|
87
87
|
git commit -m "feat: add Husky pre-commit hook for Image Guard";\
|
|
88
|
-
npm pkg set scripts.postprepare="grep -qxF '
|
|
88
|
+
npm pkg set scripts.postprepare="grep -qxF './node_modules/.bin/image-guard --staged' .husky/pre-commit || printf '\\n./node_modules/.bin/image-guard --staged' >> .husky/pre-commit"
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
If you don’t use Husky
|
|
91
|
+
If you don’t yet but want to use Husky, run the following commands from your project root:
|
|
92
92
|
|
|
93
93
|
```console
|
|
94
94
|
npm i -D husky;\
|
|
95
95
|
npx husky init;\
|
|
96
|
-
echo "
|
|
96
|
+
echo "./node_modules/.bin/image-guard --staged" > .husky/pre-commit;\
|
|
97
97
|
git add .husky/pre-commit;\
|
|
98
98
|
git commit -m "feat: add Husky pre-commit hook for Image Guard";\
|
|
99
|
-
npm pkg set scripts.postprepare="grep -qxF '
|
|
99
|
+
npm pkg set scripts.postprepare="grep -qxF './node_modules/.bin/image-guard --staged' .husky/pre-commit || printf '\\n./node_modules/.bin/image-guard --staged' >> .husky/pre-commit"
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
(The `postprepare` script ensures that the hook is added to the repository whenever someone installs the package.)
|
|
@@ -117,20 +117,6 @@ npm pkg set scripts.postprepare="grep -qxF 'npx image-guard --staged' .husky/pre
|
|
|
117
117
|
|
|
118
118
|
* `--quiet` suppresses per‑file logs and prints only the final summary (plus errors). This reduces console noise and speeds up runs in CI and Git hooks.
|
|
119
119
|
|
|
120
|
-
### Troubleshooting
|
|
121
|
-
|
|
122
|
-
#### “npx: command not found”
|
|
123
|
-
|
|
124
|
-
If Git hooks fail with “npx: command not found,” make sure to install (`npm i -D image-guard`) and to refer to the binary directly in the `pre-commit` hook (and, not detailed here, also in the `postprepare` script):
|
|
125
|
-
|
|
126
|
-
```console
|
|
127
|
-
#!/bin/sh
|
|
128
|
-
export PATH="$PWD/node_modules/.bin:$PATH"
|
|
129
|
-
./node_modules/.bin/image-guard --staged
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
This issue can arise in GUI Git clients (VS Code, GitHub Desktop, etc.) or with Node version managers, as these environments may not inherit your shell's `PATH`/Node environment. This affects any tool using npx in hooks.
|
|
133
|
-
|
|
134
120
|
## What Does the Output Look Like?
|
|
135
121
|
|
|
136
122
|
Roughly like this:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
if ! command -v node > /dev/null 2>&1; then
|
|
3
|
+
[ -s "${NVM_DIR:-$HOME/.nvm}/nvm.sh" ] && . "${NVM_DIR:-$HOME/.nvm}/nvm.sh"
|
|
4
|
+
[ -d "$HOME/.volta/bin" ] && export PATH="$HOME/.volta/bin:$PATH"
|
|
5
|
+
[ -d "$HOME/.asdf/shims" ] && export PATH="$HOME/.asdf/shims:$PATH"
|
|
6
|
+
[ -d "$HOME/.local/share/mise/shims" ] && export PATH="$HOME/.local/share/mise/shims:$PATH"
|
|
7
|
+
[ -d "/opt/homebrew/bin" ] && export PATH="/opt/homebrew/bin:$PATH"
|
|
8
|
+
[ -d "/usr/local/bin" ] && export PATH="/usr/local/bin:$PATH"
|
|
9
|
+
[ -d "/home/linuxbrew/.linuxbrew/bin" ] && export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
|
|
10
|
+
fi
|
|
11
|
+
if ! command -v node > /dev/null 2>&1; then
|
|
12
|
+
echo "Image Guard: Node not found. Install Node.js via nvm, Volta, asdf, mise, or Homebrew." >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
exec node "$(dirname "$0")/../image-guard/bin/image-guard.js" "$@"
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Jens Oliver Meiert",
|
|
3
3
|
"bin": {
|
|
4
|
-
"image-guard": "bin/image-guard.
|
|
5
|
-
"imagemin-guard": "bin/image-guard.
|
|
6
|
-
"imagemin-merlin": "bin/image-guard.
|
|
4
|
+
"image-guard": "bin/image-guard.sh",
|
|
5
|
+
"imagemin-guard": "bin/image-guard.sh",
|
|
6
|
+
"imagemin-merlin": "bin/image-guard.sh"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"globby": "^16.1.0",
|
|
10
10
|
"heic-decode": "^2.1.0",
|
|
11
11
|
"sharp": "^0.34.5",
|
|
12
|
-
"simple-git": "^3.
|
|
12
|
+
"simple-git": "^3.31.1"
|
|
13
13
|
},
|
|
14
14
|
"description": "Near-lossless image compressor that’s easy to use and easy to automate",
|
|
15
15
|
"devDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"test": "node --test bin/image-guard.test.js"
|
|
47
47
|
},
|
|
48
48
|
"type": "module",
|
|
49
|
-
"version": "5.2.
|
|
49
|
+
"version": "5.2.4"
|
|
50
50
|
}
|
package/NOTICE
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
Image Guard
|
|
2
|
-
Copyright 2022 Jens Oliver Meiert (https://meiert.com/)
|
|
3
|
-
|
|
4
|
-
The initial developer of imagemin is the imagemin team (https://github.com/orgs/imagemin/people).
|
|
5
|
-
|
|
6
|
-
The initial developer of imagemin-merlin (aka Merlin) is sum.cumo (https://web.archive.org/web/20191208211414/https://www.sumcumo.com/). Copyright 2019 sum.cumo GmbH.
|
/package/{LICENSE → LICENSE.md}
RENAMED
|
File without changes
|