File tree Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Expand file tree Collapse file tree 2 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 1
- tabs: [' src/App.jsx' ]
1
+ tabs: [" src/App.jsx" ]
2
2
live-reload-browser: false
3
- terminal-one: |
4
- yarn install
5
- yarn dev
3
+ terminals: ["yarn install && yarn dev", "bash env-script.sh"]
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Do NOT Delete This script file, this is used for setting up
4
+ # the basic ENV variables that you may need to use
5
+
6
+ # Fetch environment variables containing "PUBLIC"
7
+ env_variables=$( printenv | grep " PUBLIC" )
8
+
9
+ # Create a temporary file for storing the new environment variables
10
+ temp_file=$( mktemp)
11
+
12
+ # Iterate over each environment variable
13
+ while IFS= read -r line; do
14
+ # Extract the variable name
15
+ variable_name=$( echo " $line " | cut -d ' =' -f 1)
16
+
17
+ # Join with "VITE_" prefix
18
+ new_variable_name=" VITE_${variable_name} "
19
+
20
+ # Append to temporary file
21
+ echo -e " \n$new_variable_name =${! variable_name} " >> " $temp_file "
22
+ done <<< " $env_variables"
23
+
24
+ # Cleanup: Delete existing environment variables in .env file with the same keys
25
+ while IFS= read -r line; do
26
+ # Extract the variable name from the .env file
27
+ existing_variable_name=$( echo " $line " | cut -d ' =' -f 1)
28
+
29
+ # Remove the corresponding line from the .env file
30
+ sed -i " /^$existing_variable_name =/d" .env
31
+ done < " $temp_file "
32
+
33
+ # Append the new environment variables to the .env file
34
+ cat " $temp_file " >> .env
35
+
36
+ # Remove the temporary file
37
+ rm " $temp_file "
You can’t perform that action at this time.
0 commit comments