__default: @../bin/just/choose.sh {{ source_file() }} choose # Checks whether the requriements are met [group('main')] check: #!/bin/bash source ../bin/just/colors.sh source ../bin/just/check.sh printf "${BLUE_BG}${BLACK_FG} Checking Frontend Requirements ${CLEAR}\n" check_cmd "screen" "screen" check_cmd "volta" "Volta" check_cmd "node" "Node" check_cmd "npm" "NPM" required_node_version=$( \ cat ../package.json \ | jq .volta.node \ | cut -c 2- \ | cut -d '.' -f 1 \ ) current_major_node_version=$(node -v | cut -c 2- | cut -d '.' -f 1) current_node_version=$(node -v | cut -c 2-) if [ "${current_major_node_version}" = "${required_node_version}" ]; then printf >&2 "${GREEN_FG}✔ Node${BLUE_FG} Version ${GREEN_FG}${current_node_version}${BLUE_FG} is ${GREEN_FG}installed${BLUE_FG}.\n" else printf >&2 "${RED_FG}✘ Wrong Node Version${YELLOW_FG} is installed!\n Version ${RED_FG}${required_node_version}${YELLOW_FG} is ${RED_FG}required${YELLOW_FG}.\n" error = 1 fi echo "" # Installs the dependencies [group('main')] install: cd .. && npm i --no-fund session_name := "euph-website_frontend" # Starts the local Development Setup [group('main')] up: halt #!/bin/bash source ../bin/just/colors.sh cd .. && screen -dmS {{ session_name }} npm run watch >> /dev/null if [ $? -eq 0 ]; then printf "${GREEN_FG}Frontend was started${CLEAR}\n" else printf "${RED_FG}Frontend didn't start${CLEAR}\n" fi # Stops the local Development Setup [group('main')] halt: #!/bin/bash source ../bin/just/colors.sh screen -XS {{ session_name }} quit >> /dev/null if [ $? -eq 0 ]; then printf "${GREEN_FG}Frontend was stopped${CLEAR}\n" fi [group('main')] attach: #!/bin/bash source ../bin/just/colors.sh if screen -ls | grep -q {{ session_name }}; then screen -r {{ session_name }} else printf "${RED_FG}Frontend is down${CLEAR}\n" fi linter_options := "All\nTS\nSCSS\nTwig" # Lints all Files, or if specified only a specifc Set [group('utility')] lint linter="": #!/bin/bash chosen_linter=$( printf "{{ linter_options }}" |\ fzf --header="Which linters should be run?" --height 6 -i -q "{{ linter }}" -1 ) cd .. case "$chosen_linter" in *All*) \ npm run lint:ts:fix && \ npm run lint:scss:fix && \ vendor/bin/twig-cs-fixer lint --fix && php bin/console lint:twig ;; *TS*) npm run lint:ts:fix ;; *SCSS*) npm run lint:scss:fix ;; *Twig*) vendor/bin/twig-cs-fixer lint --fix && php bin/console lint:twig ;; esac