Skip to content

Instantly share code, notes, and snippets.



Last active Feb 10, 2020
What would you like to do?
# vim ft=sh
echo "Bootstrap has started"
echo "Set proper NVM version"
source $(brew --prefix nvm)/ --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

This comment has been minimized.

Copy link

@fluffywaffles fluffywaffles commented Feb 10, 2020

  1. You can use /bin/sh -e or set -e to make the script error if any step errors
  2. exit 0 at the bottom isn't necessary :)
  3. 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 that has already been sourced (in their bash_profile or whatever); then, you can look up the nvm command using nvm=$(command -v nvm). If [[ -z ${nvm} ]] (the path to nvm is zero-length), then print an error about not being able to find it.
  4. 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 at git remote get-url origin and searching for the string "better/mortgage".
  5. Also db-stop doesn't halt all active containers; I'd update the echo to say "Halting Database containers." ;)
  6. the makefile no longer uses DB_DROP so you can leave that part out
  7. Why are you cleaning node_modules? I would recommend only doing this if it causes problems. npm 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.
  8. git clean -dfx in mortgage/backend is interesting. Why do you need to regularly git clean -dfx? Is it just untracked files like override.json that you're trying to clear?
  9. cd - is great; you could also use pushd and popd to make things a bit more explicit.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment