From a888f2c43d482fc861af583ec2a1305ffd83a726 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Wed, 18 Dec 2024 22:14:59 +0100 Subject: [PATCH] Create reset frontend testing script and link in contributing --- CONTRIBUTING.md | 19 ++++++++++--------- frontend/reset_local_env.sh | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+), 9 deletions(-) create mode 100644 frontend/reset_local_env.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d1057b2bc..67a1ef3f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -629,14 +629,15 @@ All branding elements such as logos, icons, colors and fonts should follow those Nuxt uses auto imports to make frontend development more seamless, but at times these imports malfunction. For the `Property 'PROPERTY_NAME' does not exist on type...` errors, this is caused both by having an out of sync `yarn.lock` file and having Nuxt improperly installed. -Things to check are: +Please run [frontend/reset_local_env.sh](frontend/reset_local_env.sh) to reset the local frontend environment to allow for local testing. This can be done via the following commands: -1. Replace `yarn.lock` file with the one in main -2. Run `yarn cache clean` (this clears the yarn cache system wide and takes a long time) -3. Delete the `node_modules` folder -4. Load environment variables into your shell with `set -a && source ../.env.dev && set +a` -5. Rerun `yarn install` -6. Restart your IDE to assure that changes are picked up + ```bash + # Linux: + sh frontend/reset_local_env.sh -> [!NOTE] -> Also make sure that the dependencies have been installed within the appropriate directory (`/backend` and `/frontend`). + # MacOS: + sh frontend/reset_local_env.sh + + # Windows: + # Run the commands below found in frontend/reset_local_env.sh. + ``` diff --git a/frontend/reset_local_env.sh b/frontend/reset_local_env.sh new file mode 100644 index 000000000..3b09baf06 --- /dev/null +++ b/frontend/reset_local_env.sh @@ -0,0 +1,20 @@ +# Run this script to reset the local frontend environment to allow for local testing. +# macOS: sh frontend/reset_local_env.sh +# Linux: bash frontend/reset_local_env.sh +# Windows: Run the commands below. + +# Replace local yarn.lock file with the one in main: +wget -O yarn.lock https://raw.githubusercontent.com/activist-org/activist/refs/heads/main/frontend/yarn.lock + +# Clear the yarn cache system wide (might take a long time): +yarn cache clean + +# Delete the node_modules folder: +rm -rf node_modules + +# Load environment variables into your shell: +set -a && source ../.env.dev && set +a + +# Reinstall and prompt to restart IDE: +yarn install +echo "Please restart your IDE to assure that changes are picked up."