|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# COLORS |
| 4 | +CYAN='\033[0;36m' |
| 5 | +YELLOW='\033[0;33m' |
| 6 | +ENDCOLOR="\033[0m" |
| 7 | + |
| 8 | +print_info() { |
| 9 | + echo -e "${CYAN} $1 ${ENDCOLOR}" |
| 10 | +} |
| 11 | + |
| 12 | +print_warning() { |
| 13 | + echo -e "${YELLOW}$1 ${ENDCOLOR}" |
| 14 | +} |
| 15 | + |
| 16 | +# VARIABLES |
| 17 | +install_and_symlink=false |
| 18 | +del_turbo_cache=false |
| 19 | +del_node_modules_dist_and_tsc_cache=false |
| 20 | + |
| 21 | +PS3='Please choose an option: ' |
| 22 | +options=( |
| 23 | + "Only install and symlink" |
| 24 | + "Please delete node_modules, dist, and typescript cache, and then install and symlink" |
| 25 | + "Please delete turbo cache, node modules, typescript cache, and install and symlink" |
| 26 | + "Quit" |
| 27 | +) |
| 28 | + |
| 29 | +select opt in "${options[@]}" |
| 30 | +do |
| 31 | + case $opt in |
| 32 | + "Only install and symlink") |
| 33 | + print_info "choosing simple install" |
| 34 | + install_and_symlink=true |
| 35 | + break |
| 36 | + ;; |
| 37 | + "Please delete node_modules, dist, and typescript cache, and then install and symlink") |
| 38 | + del_node_modules_dist_and_tsc_cache=true |
| 39 | + install_and_symlink=true |
| 40 | + break |
| 41 | + ;; |
| 42 | + "Please delete turbo cache, node modules, typescript cache, and install and symlink") |
| 43 | + del_turbo_cache=true |
| 44 | + del_node_modules_dist_and_tsc_cache=true |
| 45 | + install_and_symlink=true |
| 46 | + break; |
| 47 | + ;; |
| 48 | + "Quit") |
| 49 | + print_info "Quitting" |
| 50 | + exit 0 |
| 51 | + break |
| 52 | + ;; |
| 53 | + esac |
| 54 | +done |
| 55 | + |
| 56 | +print_info "running a git check" |
| 57 | +if [[ $(git diff --stat) != '' ]]; then |
| 58 | + print_warning "You have changes not checked into git, please stash or commit them and try again" |
| 59 | + exit 1 |
| 60 | +else |
| 61 | + print_info "Git status is good, moving on to local setup..." |
| 62 | +fi |
| 63 | + |
| 64 | +if [[ "$del_turbo_cache" = true ]] |
| 65 | +then |
| 66 | + print_info "deleting turbo cache..." |
| 67 | + find . -name ".turbo" -type d -prune -exec rm -rf "{}" \; |
| 68 | + rm -rf node_modules/.cache |
| 69 | +fi |
| 70 | + |
| 71 | +if [[ "$del_node_modules_dist_and_tsc_cache" = true ]] |
| 72 | +then |
| 73 | + print_info "nukin' node_modules, declaration, dist directories, and tsc build cache" |
| 74 | + rm -rf node_modules/.cache; |
| 75 | + find . -name "node_modules" -type d -prune -exec rm -rf "{}" \; |
| 76 | + find . -name "declarations" -type d -prune -exec rm -rf "{}" \; |
| 77 | + find . -name "dist" -type d -prune -exec rm -rf "{}" \; |
| 78 | + find . -name "tsconfig.tsbuildinfo" -type f -exec rm -rf "{}" \; |
| 79 | +fi |
| 80 | + |
| 81 | +if [[ "$install_and_symlink" = true ]] |
| 82 | +then |
| 83 | + pnpm i |
| 84 | + |
| 85 | + print_info "--installed node modules--" |
| 86 | + |
| 87 | + print_info "building ember-toucan-core" |
| 88 | + cd packages/ember-toucan-core |
| 89 | + pnpm build |
| 90 | + pnpm link . |
| 91 | + |
| 92 | + print_info "building ember-toucan-form" |
| 93 | + cd ../ember-toucan-form |
| 94 | + pnpm link @crowdstrike/ember-toucan-core |
| 95 | + pnpm build |
| 96 | + pnpm link . |
| 97 | + |
| 98 | + print_info "linking the docs app" |
| 99 | + cd ../../docs-app |
| 100 | + pnpm link @crowdstrike/ember-toucan-core |
| 101 | + pnpm link @crowdstrike/ember-toucan-form |
| 102 | + |
| 103 | + print_info "linking the test app" |
| 104 | + cd ../test-app |
| 105 | + pnpm link @crowdstrike/ember-toucan-core |
| 106 | + pnpm link @crowdstrike/ember-toucan-form |
| 107 | + |
| 108 | + pnpm i # this should link all of them |
| 109 | +fi |
| 110 | + |
| 111 | +print_info "Done" |
| 112 | +echo "Please open a terminal in the packages/ember-toucan-core and pnpm start" |
| 113 | +echo "Please open a new terminal in the root of the app and run pnpm start:docs" |
| 114 | +echo "Please open another terminal in the test-app folder and run pnpm start" |
| 115 | +echo "Please open a terminal in the packages/ember-toucan-forms and pnpm start" |
| 116 | +echo "REMEMBER to not check in these changes to the package.json and pnpm-lock yaml files" |
0 commit comments