Last active
May 26, 2017 21:06
-
-
Save frangio/9a223ba22cbbc7ca1b5bc0f4d3bd276f to your computer and use it in GitHub Desktop.
Git subcommand to clone an npm package's repository
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
#!/usr/bin/env sh | |
# usage: git npm-clone left-pad | |
set -o errexit | |
pkg="$1" | |
shift | |
url="$(npm view "$pkg" repository.url | sed 's/^git+//;t;q1')" | |
git clone "$url" "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment