Last active
February 10, 2020 15:05
-
-
Save rafaelrinaldi/61e1c5735ffe05074dda126d7029c38b to your computer and use it in GitHub Desktop.
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
#!/bin/sh | |
# vim ft=sh | |
echo "Bootstrap has started" | |
echo "Set proper NVM version" | |
source $(brew --prefix nvm)/nvm.sh --no-use | |
nvm use v10.15.0 | |
echo "Halt active containers" | |
make db-stop | |
echo "Create and seed DB" | |
DB_DROP=true make db-init | |
echo "Install root dependencies" | |
rm -rf node_modules; npm i | |
# We don't need `better-com` as much? | |
# echo "Installing dependencies for \`better-com\`" | |
# cd better-com; rm -rf node_modules; npm i; cd - | |
echo "Installing and linking dependencies for \`crate\`" | |
cd @better/crate; rm -rf node_modules; npm i; npm run npm-link-mortgage-frontend; cd - | |
echo "Installing dependencies for \`mortgage/backend\`" | |
cd mortgage/backend; git clean -dfx; rm -rf node_modules; npm i; cd - | |
echo "Installing dependencies for \`mortgage/frontend\`" | |
cd mortgage/frontend; rm -rf node_modules; npm i; cd - | |
echo "Installing dependencies for \`barrel\`" | |
cd barrel; rm -rf node_modules; npm i; cd - | |
echo "Bootstrap has completed" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
/bin/sh -e
orset -e
to make the script error if any step errorsexit 0
at the bottom isn't necessary :)brew --prefix
is non-portable and someone could have also installed nvm using the script directly. It should be an expected part of the user's configuration thatnvm.sh
has already been sourced (in their bash_profile or whatever); then, you can look up the nvm command usingnvm=$(command -v nvm)
. If[[ -z ${nvm} ]]
(the path to nvm is zero-length), then print an error about not being able to find it.db-stop
only actually works from the root of the better monorepo, and you don't check if you're in the repo. I would suggest looking atgit remote get-url origin
and searching for the string"better/mortgage"
.echo
to say "Halting Database containers." ;)DB_DROP
so you can leave that part outnpm i
intelligently installs matching versions and missing versions on its own. If things aren't working without cleaning node_modules, that's a bug, and it should be fixed.git clean -dfx
in mortgage/backend is interesting. Why do you need to regularlygit clean -dfx
? Is it just untracked files likeoverride.json
that you're trying to clear?cd -
is great; you could also usepushd
andpopd
to make things a bit more explicit.💯