Last active
June 13, 2017 20:00
-
-
Save nathanlogan/696811cb695cda26843101a56fe11ece to your computer and use it in GitHub Desktop.
An npm one-liner OSX script for npm linking all components in a subdirectory
This file contains 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
{ | |
"name": "", | |
"version": "", | |
"description": "", | |
"repository": {}, | |
"scripts": { | |
"link-one:osx": "cd src/components/ && select fname in */; do (cd $fname && npm link) && break; done && cd ../..", | |
"link-all:osx": "cd src/components/ && for fname in */; do (cd $fname && npm link); done && cd ../.." | |
}, | |
"dependencies": {}, | |
"author": "", | |
"license": "", | |
"homepage": "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes your components are in a
/src/components
directory, but you could, of course, tweak that in the script to your heart's content. The parenthesis ((
and)
) are important here, as they create a subshell that allows for thecd
without affecting the parent script. Other than that, I think it's pretty straightforward.