-
Notifications
You must be signed in to change notification settings - Fork 1
/
hacky_npm_link.sh
22 lines (19 loc) · 949 Bytes
/
hacky_npm_link.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
if [ $# -lt 2 ]; then
echo 1>&2 "ERROR: Not enough arguments"
echo "USAGE: bash hacky_npm_link.sh <name of package> <path to local repo of package>"
exit 2
fi
SOURCE_DIRECTORY=$2
TARGET_DIRECTORY=$1
cd node_modules/$TARGET_DIRECTORY && \
rm -rf * && \
# hard link all files at surface level of $SOURCE_DIRECTORY
find $SOURCE_DIRECTORY -maxdepth 1 -mindepth 1 -type f -not -name ".*" -exec ln {} \; && \
# hard link all files at dist folder of $SOURCE_DIRECTORY
mkdir -p dist && pushd dist && \
find $SOURCE_DIRECTORY/dist -maxdepth 1 -mindepth 1 -type f -not -name ".*" -exec ln {} \; && popd && \
# hard link all files & symbolic link all folders at es folder of $SOURCE_DIRECTORY
mkdir -p es && pushd es && \
find $SOURCE_DIRECTORY/es -maxdepth 1 -mindepth 1 -type f -not -name ".*" -exec ln -s {} \; && \
find $SOURCE_DIRECTORY/es -maxdepth 1 -mindepth 1 -type d -not -name ".*" -exec ln -s {} \; && popd