Created
January 16, 2026 02:59
-
-
Save telamon/48f833c0b466d5e12d8a1f016380b05d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| if [ -z "$1" ]; then | |
| echo "Usage: nplink ../path/to/local/dep" | |
| echo "Current links" | |
| find . -maxdepth 3 -xtype d -type l -ls | |
| exit 1 | |
| fi | |
| DEP=$(realpath "$1") | |
| PKG_NAME=$(jq -r .name < "$DEP/package.json") | |
| NAME=$(basename "$PKG_NAME") | |
| SCOPE=$(dirname "$PKG_NAME") | |
| if [ "$SCOPE" = "." ]; then | |
| TARGET="node_modules/$NAME" | |
| else | |
| TARGET="node_modules/$SCOPE/$NAME" | |
| fi | |
| echo "→ Linking $PKG_NAME from $DEP" | |
| rm -rf "$TARGET" | |
| mkdir -p "$(dirname "$TARGET")" | |
| ln -s "$DEP" "$TARGET" | |
| echo "" | |
| ls -l "$TARGET" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment