20 lines
465 B
Bash
20 lines
465 B
Bash
|
|
#!/bin/bash
|
||
|
|
set -e
|
||
|
|
|
||
|
|
# Find the pnpm binary in the runfiles.
|
||
|
|
# Use -L to follow symlinks.
|
||
|
|
PNPM=$(find -L "$0.runfiles" -type f -path "*/file/pnpm" | head -n 1)
|
||
|
|
|
||
|
|
if [ -z "$PNPM" ]; then
|
||
|
|
echo "Error: Could not find pnpm binary in runfiles."
|
||
|
|
exit 1
|
||
|
|
fi
|
||
|
|
|
||
|
|
chmod +x "$PNPM"
|
||
|
|
|
||
|
|
# If running via 'bazel run', switch to the workspace directory to modify source files.
|
||
|
|
if [ -n "$BUILD_WORKSPACE_DIRECTORY" ]; then
|
||
|
|
cd "$BUILD_WORKSPACE_DIRECTORY"
|
||
|
|
fi
|
||
|
|
|
||
|
|
exec "$PNPM" "$@"
|