specli 0.0.33 → 0.0.34
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/cli.sh +19 -5
- package/package.json +1 -1
package/bin/cli.sh
CHANGED
|
@@ -22,15 +22,29 @@ for arg in "$@"; do
|
|
|
22
22
|
fi
|
|
23
23
|
done
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
|
|
25
|
+
# Check if Bun version is >= 1.3
|
|
26
|
+
bun_version_ok() {
|
|
27
|
+
version=$(bun --version 2>/dev/null) || return 1
|
|
28
|
+
major=$(printf '%s' "$version" | cut -d. -f1)
|
|
29
|
+
minor=$(printf '%s' "$version" | cut -d. -f2)
|
|
30
|
+
[ "$major" -gt 1 ] || { [ "$major" -eq 1 ] && [ "$minor" -ge 3 ]; }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
# 1. Prefer Bun if installed and version >= 1.3
|
|
34
|
+
if command -v bun >/dev/null 2>&1 && bun_version_ok; then
|
|
27
35
|
exec bun "$CLI_JS" "$@"
|
|
28
36
|
fi
|
|
29
37
|
|
|
30
|
-
# 2. Bun is required for compile
|
|
38
|
+
# 2. Bun >= 1.3 is required for compile
|
|
31
39
|
if [ "$is_compile" -eq 1 ]; then
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
if ! command -v bun >/dev/null 2>&1; then
|
|
41
|
+
printf '%s\n' "Error: The 'compile' command requires Bun >= 1.3." "Install Bun: https://bun.sh" >&2
|
|
42
|
+
exit 1
|
|
43
|
+
fi
|
|
44
|
+
if ! bun_version_ok; then
|
|
45
|
+
printf '%s\n' "Error: The 'compile' command requires Bun >= 1.3 (found $(bun --version))." "Update Bun: https://bun.sh" >&2
|
|
46
|
+
exit 1
|
|
47
|
+
fi
|
|
34
48
|
fi
|
|
35
49
|
|
|
36
50
|
# 3. Fallback to Node.js
|