Skip to content

Commit

Permalink
fix: typo fix for variable name
Browse files Browse the repository at this point in the history
  • Loading branch information
dalisoft committed Jul 30, 2024
1 parent e519fc3 commit 60fc11e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packaging/npm/lefthook/bin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ fi

# Search and find binary
if $IS_X_CALL; then
BIOME_BIN=$(find "${CACHE_DIR}" -iname "${BINARY_NAME}" | grep -s "${BINARY_NAME_SCOPE}" || echo "")
LEFTHOOK_BIN=$(find "${CACHE_DIR}" -iname "${BINARY_NAME}" | grep -s "${BINARY_NAME_SCOPE}" || echo "")
else
BIOME_BIN=$(find . -iname "${BINARY_NAME}" | grep -s "${BINARY_NAME_SCOPE}" || echo "")
LEFTHOOK_BIN=$(find . -iname "${BINARY_NAME}" | grep -s "${BINARY_NAME_SCOPE}" || echo "")
fi

# Check node_modules
if [ -z "${BIOME_BIN}" ]; then
if [ -z "${LEFTHOOK_BIN}" ]; then
echo "\`node_modules\` was not installed"
exit 1
fi

# Trim variables after success checks
BIOME_BIN=$(realpath -q "${BIOME_BIN}")
LEFTHOOK_BIN=$(realpath -q "${LEFTHOOK_BIN}")

# Make it executable
if test -f "${BIOME_BIN}"; then
chmod +x "${BIOME_BIN}"
if test -f "${LEFTHOOK_BIN}"; then
chmod +x "${LEFTHOOK_BIN}"
fi

# Replace binary in `bin` field for later use
if test -f "${CURRENT_DIR}/package.json"; then
sed -i.bak "s|bin.sh|${BIOME_BIN}|g" "${CURRENT_DIR}/package.json"
sed -i.bak "s|bin.sh|${LEFTHOOK_BIN}|g" "${CURRENT_DIR}/package.json"
rm -rf "package.json.bak"
elif echo "${CURRENT_DIR}" | grep -q ".bin"; then
ln -sf "${BIOME_BIN}" "$0"
ln -sf "${LEFTHOOK_BIN}" "$0"
fi

# Run currently until next run
"${BIOME_BIN}" "$@"
"${LEFTHOOK_BIN}" "$@"

0 comments on commit 60fc11e

Please sign in to comment.