Last active
March 12, 2019 03:55
-
-
Save loklaan/4345956a15933bdb76118495f34cd5bf to your computer and use it in GitHub Desktop.
Build, pack & link npm packages.
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
function build_pack () { | |
echo "Building & packing \"$(basename $(pwd))\"" && \ | |
yarn build && npm pack && \ | |
echo "Packed! Bai!" | |
} | |
function link_pack () { | |
package_name="${1:?required}" | |
src_tgz="${2:?required}" | |
package_dir="node_modules/$package_name" | |
under_package_dir="$package_dir/package" | |
echo "Linking a packed tar.: $(basename "$src_tgz")" && \ | |
echo "" && \ | |
echo " $(basename "$src_tgz") ⟹ $package_dir" && \ | |
echo "" && \ | |
rm -rf "$package_dir" && \ | |
mkdir "$package_dir" && \ | |
tar --strip=1 -C "$package_dir" -xzf "$src_tgz" && \ | |
echo "...Linked! Bai!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Distilled in this package:
https://github.com/loklaan/linkaroo