diff --git a/_scripts/check-pre-launch.sh b/_scripts/check-pre-launch.sh new file mode 100755 index 0000000000..d94b7e2933 --- /dev/null +++ b/_scripts/check-pre-launch.sh @@ -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 diff --git a/package-scripts.js b/package-scripts.js index 31c1201196..5e87d4a9f9 100644 --- a/package-scripts.js +++ b/package-scripts.js @@ -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: {