chore(scripts): add a pre-launch script

This commit is contained in:
clouserw 2024-08-09 15:26:29 -07:00 коммит произвёл Wil Clouser
Родитель 1411fade7e
Коммит 0be0159d68
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: DB61495C4A403229
2 изменённых файлов: 36 добавлений и 4 удалений

32
_scripts/check-pre-launch.sh Executable file
Просмотреть файл

@ -0,0 +1,32 @@
#! /bin/bash
# This script is a bandaid for packages not being vocal about their own requirements and expectations and causing frustration when people try to set up the project.
# For the most part, this script doesn't exit with errors because that would stop the start-up. It just prints helpful hints for people without a lot of project context.
if [ ! -d "_scripts" ]; then
echo "Please run from the root of the project."
echo "Usage: ./_scripts/check-pre-launch.sh"
exit 1
fi
# 123done
FILE="packages/123done/secrets.json"
if [ ! -f $FILE ]; then
echo "$FILE is missing. 123done won't be functional without it."
echo " See https://mozilla.github.io/ecosystem-platform/tutorials/development-setup#step-3-optional-additions"
fi
if [ -z $(jq -r ".client_secret // empty" $FILE) ]; then
echo "$FILE is missing the client_secret key. 123done won't be functional without it."
echo " See https://mozilla.github.io/ecosystem-platform/tutorials/development-setup#step-3-optional-additions"
fi
# Auth Server
FILE="packages/fxa-auth-server/config/secrets.json"
if [ ! -f $FILE ]; then
echo "$FILE is missing. The auth server won't be fully functional without it."
echo " See https://mozilla.github.io/ecosystem-platform/tutorials/development-setup#step-3-optional-additions"
fi
if [ -z $(jq -r ".googleAuthConfig.clientId // empty" $FILE) ]; then
echo "$FILE is missing the googleAuthConfig.clientId key. Google 3rd Party Auth won't be functional without it."
echo " See https://mozilla.github.io/ecosystem-platform/tutorials/development-setup#step-3-optional-additions"
fi

Просмотреть файл

@ -11,20 +11,20 @@ module.exports = {
default: 'nps help',
start: {
default: {
script: `_dev/pm2/start.sh && _scripts/pm2-all.sh start && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
script: `_scripts/check-pre-launch.sh && _dev/pm2/start.sh && _scripts/pm2-all.sh start && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
description: 'Start the entire stack, i.e. all infrastructure and services.'
},
infrastructure: {
script: `_dev/pm2/start.sh`,
script: `_scripts/check-pre-launch.sh && _dev/pm2/start.sh`,
description: 'Start all infrastructure only.',
},
services: {
script: `_scripts/pm2-all.sh start`,
script: `_scripts/check-pre-launch.sh && _scripts/pm2-all.sh start`,
description: 'Start all Services only.'
},
firefox: './packages/fxa-dev-launcher/bin/fxa-dev-launcher.mjs &',
mza: {
script: `_dev/pm2/start.sh && _scripts/pm2-all.sh start ${mzaProjects} && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
script: `_scripts/check-pre-launch.sh && _dev/pm2/start.sh && _scripts/pm2-all.sh start ${mzaProjects} && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
description: 'Start infrastructure and only required Mozilla Accounts services',
},
sp2: {