From ff1060f5bda5fcfeac2f7f2ca83e9e7ada064b20 Mon Sep 17 00:00:00 2001 From: AZ0228 <53315675+AZ0228@users.noreply.github.com> Date: Fri, 17 Apr 2026 18:33:35 -0400 Subject: [PATCH] adding setup script --- .DS_Store | Bin 10244 -> 10244 bytes backend/docs/SHUTTLE_TRACKER_SETUP.md | 2 +- bin/meridian.js | 82 ++++++++++++++++++++++++++ package.json | 1 + 4 files changed, 84 insertions(+), 1 deletion(-) diff --git a/.DS_Store b/.DS_Store index efc162ad0f90d05926bb33d4d58144e1d983f689..6198ba9e8c3c4d1f37215366350bf472b7fa11c1 100644 GIT binary patch delta 37 tcmZn(XbG6$LAU^hRb)@B|7WyZ~sg6sGuHfU{TSNP4cSx1zK835@>3xWUu delta 66 zcmZn(XbG6$jIU^hRb_GTUdWkz{c20eyshD?SchJ4SQ{N$vZ{3Hej1_2;;Vqjo= Vw^>DSC*Njvh2JcjZ-_840{}sQ5jX$< diff --git a/backend/docs/SHUTTLE_TRACKER_SETUP.md b/backend/docs/SHUTTLE_TRACKER_SETUP.md index 19683d1d..fbeed150 100644 --- a/backend/docs/SHUTTLE_TRACKER_SETUP.md +++ b/backend/docs/SHUTTLE_TRACKER_SETUP.md @@ -187,7 +187,7 @@ If the mobile app shows "Shuttle tracker is not available for this school": If the shuttle API is not accessible: - Verify the API URL is correct and accessible - Check CORS settings on the shuttle API -- Ensure the API follows the expected format (see ShuttleTracker.mdx) +- Ensure the API follows the expected format (see `Meridian-Mintlify/mobile/shuttle-tracker.mdx`, published as `/mobile/shuttle-tracker` in developer docs) ### Mobile App Not Showing Map diff --git a/bin/meridian.js b/bin/meridian.js index c689b7b4..5eea15e2 100755 --- a/bin/meridian.js +++ b/bin/meridian.js @@ -18,6 +18,7 @@ const path = require('path'); const fs = require('fs'); +const { spawnSync } = require('child_process'); const { findWorkspaceRoot, getRepoPaths, assertRepoExists } = require('./lib/workspace'); const { isClean, @@ -61,6 +62,7 @@ function usage() { console.log(dim(` ${sep}`)); console.log(''); console.log(cyan(' Commands')); + console.log(dim(' ├─ setup ') + 'Bootstrap local Meridian development'); console.log(dim(' ├─ status ') + 'Show repo state and lockfile pin'); console.log(dim(' ├─ start ') + 'Create fresh feature branch in both repos'); console.log(dim(' ├─ switch ') + 'Switch both repos to existing branch'); @@ -70,6 +72,7 @@ function usage() { console.log(''); console.log(cyan(' Examples')); console.log(dim(' meridian start MER-123-Org-Forms')); + console.log(dim(' meridian setup')); console.log(dim(' meridian start MER-123-Org-Forms ') + cyan('--from-current') + dim(' (create from current branch)')); console.log(dim(' meridian switch MER-123-Org-Forms')); console.log(dim(' meridian symlink')); @@ -141,6 +144,82 @@ function resolveWorkspace() { return { meridianPath, eventsPath }; } +function resolveWorkspaceForSetup() { + const root = findWorkspaceRoot(); + if (!root) { + console.error(''); + console.error(red(' Could not find Meridian workspace')); + console.error(dim(' Run from Meridian/ or set MERIDIAN_WORKSPACE.')); + console.error(''); + process.exit(1); + } + const { meridianPath, eventsPath } = getRepoPaths(root); + const merCheck = assertRepoExists(meridianPath, 'Meridian'); + if (!merCheck.ok) { + console.error(''); + console.error(red(' Meridian not found')); + console.error(dim(` ${merCheck.message}`)); + console.error(''); + process.exit(1); + } + return { meridianPath, eventsPath }; +} + +function runCommand(command, args, cwd, label) { + console.log(''); + console.log(cyan(` ${label}`)); + const res = spawnSync(command, args, { cwd, stdio: 'inherit' }); + if (res.status !== 0) { + console.error(''); + console.error(red(` Failed: ${label}`)); + console.error(''); + process.exit(res.status || 1); + } +} + +function cloneEventsRepo(eventsPath) { + runCommand('git', ['clone', EVENTS_CLONE_URL, eventsPath], process.cwd(), 'Cloning Events-Backend'); +} + +async function cmdSetup() { + const { meridianPath, eventsPath } = resolveWorkspaceForSetup(); + const eventsCheck = assertRepoExists(eventsPath, 'Events-Backend'); + + if (!eventsCheck.ok) { + console.log(''); + console.log(yellow(' Events-Backend not found')); + console.log(dim(` Expected at: ${eventsPath}`)); + const shouldClone = await promptYesNo('Clone Events-Backend now?'); + if (!shouldClone) { + console.error(''); + console.error(dim(` Clone manually: git clone ${EVENTS_CLONE_URL} ${eventsPath}`)); + console.error(''); + process.exit(1); + } + cloneEventsRepo(eventsPath); + } + + runCommand('npm', ['install'], meridianPath, 'Installing root dependencies'); + runCommand('npm', ['install'], path.join(meridianPath, 'frontend'), 'Installing frontend dependencies'); + runCommand('npm', ['install'], path.join(meridianPath, 'backend'), 'Installing backend dependencies'); + + if (!isEventsSymlink(meridianPath)) { + const shouldSymlink = await promptYesNo('Symlink backend/events to sibling Events-Backend now?'); + if (shouldSymlink) { + cmdSymlink(); + } else { + console.log(''); + console.log(yellow(' backend/events is not symlinked')); + console.log(dim(' Run ') + cyan('meridian symlink') + dim(' when you are ready to link Events-Backend for local dev.')); + console.log(''); + } + } + + console.log(green(' Setup complete.')); + console.log(dim(' Next: copy .env files and run ') + cyan('npm run dev')); + console.log(''); +} + function isEventsSymlink(meridianPath) { const eventsPath = path.join(meridianPath, 'backend', 'events'); try { @@ -648,6 +727,9 @@ async function main() { const allowMain = args.includes('--allow-main'); switch (cmd) { + case 'setup': + await cmdSetup(); + break; case 'status': cmdStatus(); break; diff --git a/package.json b/package.json index 9747187a..fd5e775f 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "nodemon": "^3.1.10" }, "scripts": { + "setup": "node bin/meridian.js setup", "start": "node --preserve-symlinks backend/server.js", "heroku-prebuild": "chmod +x ./bin/setup_ssh ./bin/fetch_private_deps && ./bin/setup_ssh && ./bin/fetch_private_deps", "fetch-private": "chmod +x ./bin/setup_ssh ./bin/fetch_private_deps && ./bin/setup_ssh && ./bin/fetch_private_deps",