-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from mcode/intermediary-env-vars
intermediary vars
- Loading branch information
Showing
20 changed files
with
147 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,71 @@ | ||
#!/bin/sh | ||
|
||
# Handle closing application on signal interrupt (ctrl + c) | ||
trap 'kill $CONTINUOUS_INSTALL_PID $SERVER_PID; gradle --stop; exit' INT | ||
trap 'kill $CONTINUOUS_INSTALL_PID $SERVER_PID $BACKEND_SERVER_PID; exit' INT | ||
|
||
mkdir logs | ||
touch ./logs/frontend_installer.log | ||
touch ./logs/frontend_runner.log | ||
touch ./logs/backend_installer.log | ||
touch ./logs/backend_runner.log | ||
|
||
# Reset log file content for new application boot | ||
echo "*** Logs for continuous installer ***" > ./logs/installer.log | ||
echo "*** Logs for 'npm run start' ***" > ./logs/runner.log | ||
echo "*** Logs for continuous frontend installer ***" > ./logs/frontend_installer.log | ||
echo "*** Logs for frontend 'npm run start' ***" > ./logs/frontend_runner.log | ||
|
||
echo "*** Logs for continuous backend installer ***" > ./logs/backend_installer.log | ||
echo "*** Logs for backend 'npm run start' ***" > ./logs/backend_runner.log | ||
|
||
# Print that the application is starting in watch mode | ||
echo "starting application in watch mode..." | ||
|
||
# Start the continious build listener process | ||
echo "starting continuous installer..." | ||
npm install | ||
echo "starting continuous installers..." | ||
|
||
cd frontend | ||
npm install | tee ./logs/frontend_installer.log | ||
cd .. | ||
npm install | tee ./logs/backend_installer.log | ||
|
||
( package_modify_time=$(stat -c %Y package.json) | ||
package_lock_modify_time=$(stat -c %Y package-lock.json) | ||
( package_modify_time=$(stat -c %Y frontend/package.json) | ||
package_lock_modify_time=$(stat -c %Y frontend/package-lock.json) | ||
backend_modify_time=$(stat -c %Y package.json) | ||
backend_lock_modify_time=$(stat -c %Y package-lock.json) | ||
while sleep 1 | ||
do | ||
new_package_modify_time=$(stat -c %Y package.json) | ||
new_package_lock_modify_time=$(stat -c %Y package-lock.json) | ||
new_package_modify_time=$(stat -c %Y frontend/package.json) | ||
new_package_lock_modify_time=$(stat -c %Y frontend/package-lock.json) | ||
new_backend_modify_time=$(stat -c %Y package.json) | ||
new_backend_lock_modify_time=$(stat -c %Y package-lock.json) | ||
|
||
if [[ "$package_modify_time" != "$new_package_modify_time" ]] || [[ "$package_lock_modify_time" != "$new_package_lock_modify_time" ]] | ||
if [[ "$package_modify_time" != "$new_package_modify_time" ]] || [[ "$package_lock_modify_time" != "$new_package_lock_modify_time" ]] || [[ "$backend_lock_modify_time" != "$new_backend_lock_modify_time" ]]|| [[ "$backend_modify_time" != "$new_backend_modify_time" ]] | ||
then | ||
echo "running npm install..." | ||
npm install | tee ./logs/installer.log | ||
echo "running frontent npm install..." | ||
cd frontend | ||
npm install | tee ./logs/frontend_installer.log | ||
cd .. | ||
elif [[ "$backend_lock_modify_time" != "$new_backend_lock_modify_time" ]]|| [[ "$backend_modify_time" != "$new_backend_modify_time" ]] | ||
then | ||
echo "running backend npm install..." | ||
npm install | tee ./logs/backend_installer.log | ||
fi | ||
|
||
package_modify_time=$new_package_modify_time | ||
package_lock_modify_time=$new_package_lock_modify_time | ||
backend_modify_time=$new_backend_modify_time | ||
backend_lock_modify_time=$new_backend_lock_modify_time | ||
|
||
done ) & CONTINUOUS_INSTALL_PID=$! | ||
|
||
# Start server process once initial build finishes | ||
( npm start | tee ./logs/runner.log ) & SERVER_PID=$! | ||
cd frontend | ||
( npm run start | tee ./logs/frontend_runner.log ) & SERVER_PID=$! | ||
|
||
cd .. | ||
( npm run start | tee ./logs/backend_runner.log ) & BACKEND_SERVER_PID=$! | ||
|
||
# Handle application background process exiting | ||
wait $CONTINUOUS_INSTALL_PID $SERVER_PID | ||
wait $CONTINUOUS_INSTALL_PID $SERVER_PID $BACKEND_SERVER_PID | ||
EXIT_CODE=$? | ||
echo "application exited with exit code $EXIT_CODE..." | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
cd frontend | ||
( npm run start ) & SERVER_PID=$! | ||
|
||
cd .. | ||
( npm run start ) & BACKEND_SERVER_PID=$! | ||
|
||
# Handle application background process exiting | ||
wait $SERVER_PID $BACKEND_SERVER_PID | ||
EXIT_CODE=$? | ||
echo "application exited with exit code $EXIT_CODE..." |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import { defineConfig } from 'vite'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
// https://vitejs.dev/config/ | ||
import dotenv from 'dotenv'; | ||
|
||
dotenv.config({path : '../.env'}); // load env vars from .env | ||
export default defineConfig({ | ||
// depending on your application, base can also be "/" | ||
base: '', | ||
plugins: [react()], | ||
}) | ||
define: { | ||
'process.env': process.env | ||
}, | ||
server: { | ||
port: parseInt(process.env.FRONTEND_PORT!), | ||
open: false, | ||
host: true | ||
} | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.