qmd 833 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. # Resolve symlinks so global installs (npm link / npm install -g) can find the
  3. # actual package directory instead of the global bin directory.
  4. SOURCE="$0"
  5. while [ -L "$SOURCE" ]; do
  6. SOURCE_DIR="$(cd -P "$(dirname "$SOURCE")" && pwd)"
  7. TARGET="$(readlink "$SOURCE")"
  8. case "$TARGET" in
  9. /*) SOURCE="$TARGET" ;;
  10. *) SOURCE="$SOURCE_DIR/$TARGET" ;;
  11. esac
  12. done
  13. # Detect the runtime used to install this package and use the matching one
  14. # to avoid native module ABI mismatches (e.g., better-sqlite3 compiled for bun vs node)
  15. DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
  16. # Check if we were installed with bun (look for bun.lock or bun-lockb)
  17. if [ -f "$DIR/bun.lock" ] || [ -f "$DIR/bun.lockb" ] || [ -n "$BUN_INSTALL" ]; then
  18. exec bun "$DIR/dist/cli/qmd.js" "$@"
  19. else
  20. exec node "$DIR/dist/cli/qmd.js" "$@"
  21. fi