Files
Vijay Budhram c556dcb4b1 feat(dev): speed up local stack startup with a fast build path
Because:
 - `yarn start mza` was slow: the start tasks pulled the full production
   build (including tsc) on every boot, though dev servers compile from
   source at runtime.

This commit:
 - Adds a `build-fast` Nx target that skips `build-ts` for app services
   while still building dist-loaded libs, and routes `yarn start mza` and
   `yarn restart mza` through it via FXA_BUILD_TARGET=build-fast.
 - Drops `build` from the `start`/`restart` target dependencies; the build
   now runs explicitly in pm2-all.sh (full build by default), so `yarn
   start` still does a full build and CI, which calls `build` directly, is
   unaffected.
 - Hardens local startup: Docker daemon preflight, labeled URL checks with
   curl timeouts, a non-fatal redis readiness gate, and a db-patcher
   expected-count derived from the migrations layout.
 - Parallelizes the fxa-shared ESM/CJS tsc build to cut critical-path time.
 - Fixes the l10n-gettext-extract workflow to read .nvmrc from the
   checked-out fxa-code/ path.
2026-06-12 12:54:12 -04:00

115 lines
4.1 KiB
JavaScript

/**
* These are Nx tags used to identify which services to start up
* when executing the various partial startup scripts.
*/
const mzaProjects = 'tag:type:core,tag:type:demo';
const sp2Projects = 'tag:type:core,tag:type:demo,tag:type:sp2';
const sp3Projects = 'tag:type:core,tag:type:demo,tag:type:sp3';
module.exports = {
scripts: {
default: 'nps help',
start: {
default: {
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: `_scripts/check-pre-launch.sh && _dev/pm2/start.sh`,
description: 'Start all infrastructure only.',
},
services: {
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: `_scripts/start-mza.sh ${mzaProjects}`,
description: 'Start infrastructure and only required Mozilla Accounts services (fast build)',
},
sp2: {
script: `_dev/pm2/start.sh && _scripts/pm2-all.sh start ${sp2Projects} && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
description: 'Start infrastructure and only required SubPlat 2.0 services.'
},
sp3: {
script: `_dev/pm2/start.sh && _scripts/pm2-all.sh start ${sp3Projects} && pm2 restart sync && echo "Use 'yarn stop' to stop all the servers"`,
description: 'Start infrastructure and only required SubPlat 3.0 services.'
},
},
stop: {
default: {
script: 'pm2 kill',
description: 'Stop all infrastructure and services.',
},
infrastructure: {
script: `pm2 stop _dev/pm2/infrastructure.config.js`,
description: 'Stop all infrastructure, only.',
},
services: {
script: `_scripts/pm2-all.sh stop`,
description: 'Stop all services, only.',
},
mza: {
script: `_scripts/pm2-all.sh stop ${mzaProjects}`,
description: 'Stop required Mozilla Accounts services.',
},
sp2: {
script: `_scripts/pm2-all.sh stop ${sp2Projects}`,
description: 'Stop required SubPlat 2.0 services.',
},
sp3: {
script: `_scripts/pm2-all.sh stop ${sp3Projects}`,
description: 'Stop required SubPlat 3.0 services.',
},
},
restart: {
default: {
script: 'pm2 restart all',
description: 'Restart all infrastructure and services.',
},
infrastructure: {
script: `pm2 restart _dev/pm2/infrastructure.config.js`,
description: 'Restart all infrastructure, only.',
},
services: {
script: `_scripts/pm2-all.sh restart`,
description: 'Restart all services, only.',
},
mza: {
script: `FXA_BUILD_TARGET=build-fast _scripts/pm2-all.sh restart ${mzaProjects}`,
description: 'Restart required Mozilla Accounts services (fast build).',
},
sp2: {
script: `_scripts/pm2-all.sh restart ${sp2Projects}`,
description: 'Restart required SubPlat 2.0 services.',
},
sp3: {
script: `_scripts/pm2-all.sh restart ${sp3Projects}`,
description: 'Restart required SubPlat 3.0 services.',
},
},
delete: {
default: {
script: 'pm2 kill',
description: 'Delete all infrastructure and services.',
},
services: {
script: '_scripts/pm2-all.sh delete',
description: 'Delete all services, only.',
},
mza: {
script: `_scripts/pm2-all.sh delete ${mzaProjects}`,
description: 'Delete required Mozilla Accounts services.',
},
sp2: {
script: `_scripts/pm2-all.sh delete ${sp2Projects}`,
description: 'Delete required SubPlat 2.0 services.',
},
sp3: {
script: `_scripts/pm2-all.sh delete ${sp3Projects}`,
description: 'Delete required SubPlat 3.0 services.',
},
},
},
};