@jterrazz/codestyle 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/codestyle.sh +16 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jterrazz/codestyle",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "author": "Jean-Baptiste Terrazzoni <contact@jterrazz.com>",
5
5
  "bin": {
6
6
  "codestyle": "./src/codestyle.sh"
package/src/codestyle.sh CHANGED
@@ -64,8 +64,22 @@ code_pid=""
64
64
  style_pid=""
65
65
 
66
66
  # Find the node_modules/.bin directory relative to this script
67
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
68
- BIN_DIR="$SCRIPT_DIR/../node_modules/.bin"
67
+ # Resolve symlinks to get the real script location
68
+ SOURCE="${BASH_SOURCE[0]}"
69
+ while [ -L "$SOURCE" ]; do
70
+ DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
71
+ SOURCE="$(readlink "$SOURCE")"
72
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
73
+ done
74
+ SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
75
+ # Find bin directory: installed package or development
76
+ if [ -x "$SCRIPT_DIR/../../../.bin/oxlint" ]; then
77
+ BIN_DIR="$SCRIPT_DIR/../../../.bin"
78
+ elif [ -x "$SCRIPT_DIR/../node_modules/.bin/oxlint" ]; then
79
+ BIN_DIR="$SCRIPT_DIR/../node_modules/.bin"
80
+ else
81
+ BIN_DIR="$(npm bin 2>/dev/null)"
82
+ fi
69
83
 
70
84
  if [ "$RUN_TYPE" = true ]; then
71
85
  "$BIN_DIR/tsgo" --noEmit "${EXTRA_ARGS[@]}" > "$tmp_dir/type.log" 2>&1 &