niahere 0.2.4 → 0.2.5
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/bin/nia +16 -9
- package/package.json +1 -1
package/bin/nia
CHANGED
|
@@ -20,13 +20,20 @@ if ! command -v bun >/dev/null 2>&1; then
|
|
|
20
20
|
fi
|
|
21
21
|
fi
|
|
22
22
|
|
|
23
|
-
# Resolve
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
case "$SCRIPT" in /*) ;; *) SCRIPT="$DIR/$SCRIPT" ;; esac
|
|
29
|
-
done
|
|
30
|
-
PACKAGE_DIR="$(cd "$(dirname "$SCRIPT")/.." && pwd)"
|
|
23
|
+
# Resolve the real path of this script (follows all symlinks)
|
|
24
|
+
REAL="$(realpath "$0" 2>/dev/null)" || REAL="$(perl -MCwd -e 'print Cwd::realpath($ARGV[0])' "$0" 2>/dev/null)" || REAL="$0"
|
|
25
|
+
# Go up from bin/ to package root
|
|
26
|
+
PACKAGE_DIR="$(dirname "$REAL")/.."
|
|
27
|
+
ENTRY="$PACKAGE_DIR/src/cli/index.ts"
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+
if [ ! -f "$ENTRY" ]; then
|
|
30
|
+
# Fallback: try npm global root
|
|
31
|
+
ENTRY="$(npm root -g 2>/dev/null)/niahere/src/cli/index.ts"
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
if [ ! -f "$ENTRY" ]; then
|
|
35
|
+
echo "Error: could not find niahere. Try: npm i -g niahere"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
exec bun "$ENTRY" "$@"
|
package/package.json
CHANGED