@yuno-payments/dashboard-cli
v1.6.0
Published
CLI tool to manage MFEs without accessing the backoffice
Readme
Dashboard CLI
CLI tool to manage frontend and backend deployments without accessing the backoffice.
Installation
Global Installation
sudo npm install -g @yuno-payments/dashboard-cliLocal Development
npm install
npm run build
npm linkConfiguration
Prerequisites
- Node.js 16+
- Git repository (must be run from within a git repository)
- GitHub CLI (
gh) authenticated — rungh auth loginif needed - Valid Kingdom credentials
Login
dashboard loginYou will be prompted for your username and password. The CLI will:
- Store your credentials securely in
~/.dashboard-cli/config.json - Automatically obtain and cache authentication tokens
- Refresh tokens automatically when they expire
Other Auth Commands
# Check login status and token expiration
dashboard status
# Logout and clear credentials
dashboard logoutUsage
Deploy
The CLI auto-detects whether the current repo is a frontend (MFE) or backend (microservice) by searching Kingdom. If found in both, it prompts you to choose.
# Deploy to an environment (auto-detects frontend/backend)
dashboard deploy dev
dashboard deploy stg
dashboard deploy prodFrontend Options
# Deploy and publish to import map
dashboard deploy dev --publish
dashboard deploy dev -p
# Deploy using package.json version as tag
dashboard deploy stg --tag
dashboard deploy stg -t
# Both options
dashboard deploy prod -p -t--publish/-p: Updates the import map after deployment so the new version is immediately available.--tag/-t: Uses the remotepackage.jsonversion as deployment version instead of the current branch name.
Backend Options
# Deploy with explicit service name and version
dashboard deploy stg -s payment-ms -v v1.2.3
# Watch deployment until completion
dashboard deploy dev --watch
# Deploy to multiple environments
dashboard deploy all-stg
dashboard deploy all-prod --watch-s, --service <name>: Service name (defaults to current directory name).-v, --version <version>: Version to deploy (defaults to latest tag on main/master, or branch name).-w, --watch: Watch deployment status until completion.
Frontend environments: dev, stg, prod
Backend environments: dev, stg, mena-stg, sb, prod, mena-prod, all-stg, all-prod
Publish (frontend only)
Publishes an MFE to the import map without creating a new deployment. Only works from a frontend repo.
dashboard publish dev
dashboard publish stg
dashboard publish prodRun (local development)
Starts your local dev server and sets an import map override in Chrome so the dashboard points to your local MFE. No authentication required.
# Start dev server + apply override on dev dashboard
dashboard run dev
# Same for staging
dashboard run stg
# Override port auto-detection
dashboard run dev --port 9005- Auto-detects port from
package.jsonscripts (--portflag instart/devscripts) - Runs
npm run <env>(e.g.npm run dev), falls back tonpm run startif the env script doesn't exist - Waits for
localhost:<port>to be ready before applying the override - On
Ctrl+C: removes the override from Chrome and kills the server
Prerequisite: Chrome must have "Allow JavaScript from Apple Events" enabled (View > Developer > Allow JavaScript from Apple Events). macOS only.
--prod-data (dev only)
Runs your current MFE alongside dashboard-authentication-mfe and dashboard-api-mfe with prod Auth0 credentials, so you can authenticate and work with real production data locally.
dashboard run dev --prod-dataThis will:
- Discover companion MFE paths (prompts interactively the first time, then caches in config)
- Warn if companion MFEs are not on
master/main - Ensure
dashboard-authentication-mfe/.envhas prod Auth0 values (AUTH0_DOMAIN_PROD,AUTH0_CLIENT_ID_PROD) - Start
npm run prodfor auth-mfe and api-mfe (piped output with[auth]/[api]prefixes) - Start
npm run devfor the current MFE (main process with full stdio) - Wait for all 3 ports to be ready in parallel
- Apply all 3 import map overrides to
dashboard.dev.y.unoin a single batch - On
Ctrl+C: remove all overrides and kill all processes
Only works with the dev environment. Running dashboard run stg --prod-data will error.
Config
set-mfe-path
Manually set the local path for a companion MFE (used by --prod-data). Paths are stored in ~/.dashboard-cli/config.json.
dashboard config set-mfe-path dashboard-authentication-mfe /path/to/dashboard-authentication-mfe
dashboard config set-mfe-path dashboard-api-mfe /path/to/dashboard-api-mfeThis is optional — --prod-data will prompt you interactively the first time if paths are not configured.
Stop
Removes the import map override from Chrome without starting a server.
dashboard stop dev
dashboard stop stgVersions
Show deployed versions across environments. Auto-detects frontend/backend.
# Auto-detect from current directory
dashboard versions
# Explicit service name
dashboard versions dashboard-payments-mfe
dashboard versions payment-ms
# All services from a directory
dashboard versions --all --path /path/to/services
# Filter by environment
dashboard versions --env prod
dashboard versions payment-ms --env stgHow It Works
Service Type Detection
When you run deploy, versions, or publish, the CLI:
- Derives a name from
package.json(frontend) and the directory name (backend) - Searches both Kingdom endpoints (frontend + microservice) in parallel
- Routes to the correct flow automatically
- If found in both, prompts you to choose
Frontend Deployment
- Reads
package.jsonfrom the current directory for the MFE name (strips@yuno/or@yuno-payments/prefix) - Gets the current git branch and the remote repository from git
- Fetches
bundle_versionfrom the remotepackage.jsonvia GitHub API (gh) - Searches for the MFE in Kingdom API
- Creates a deployment with MFE ID, environment ID, version, and bundle version
- Monitors deployment status every 30 seconds (max 10 minutes)
- If
--publish: updates the import map with the new version
Backend Deployment
- Resolves service name from directory name (or
--serviceflag) - Resolves version from latest git tag on main/master, or current branch name (or
--versionflag) - Searches for the microservice in Kingdom API
- Creates deployments for each target environment
- If
--watch: monitors deployment status until completion - Confirms before deploying to production environments
Troubleshooting
"No credentials found"
Run dashboard login to authenticate.
"GitHub CLI is not authenticated"
Run gh auth login to authenticate with GitHub.
"package.json not found"
Make sure you're running the command from the root of your MFE project.
"Current directory is not a git repository"
The CLI requires the project to be a git repository.
"Service not found in Kingdom"
The CLI searches both frontend and backend APIs. Verify the name matches what's registered in Kingdom.
Development
npm install
npm run build
npm run dev deploy dev