Created
November 7, 2023 19:57
-
-
Save amoilanen/b6bffdf75d4f8fa7e019a9165746dad0 to your computer and use it in GitHub Desktop.
Installs a local NPM package to a local project for testing purposes. Usage: npm_install_local_package package_dir project_dir
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 | |
if [ "$1" == "-h" ]; then | |
echo "Usage: `basename $0` npm_package_dir project_dir" | |
echo "Installs a local NPM package to a local project for test purposes" | |
exit 0 | |
fi | |
PACKAGE_DIR=$1 | |
REPO_DIR=$2 | |
PACKAGE_DIR=$1 | |
cd $PACKAGE_DIR | |
npm pack | |
echo "Found new package $PACKAGE_TAR" | |
PACKAGE_TAR=$(ls *.tgz) | |
mv $PACKAGE_DIR/$PACKAGE_TAR $REPO_DIR | |
cd $REPO_DIR | |
npm install $PACKAGE_TAR | |
rm $PACKAGE_TAR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment