Rebuilds content management around a single admin route (/admin — "BlackDice Studio"), replacing blackdice-studio.html. Publishing writes one JSON content document instead of regenerating HTML files, so it can no longer overwrite hand-made site changes the way the old tool did. - /admin: click-to-edit copy/images, article CRUD with a Word-safe rich text editor, demo clip management, per-page SEO, enquiry log, publish history with rollback - Real per-page URLs for all pages and articles, each with its own meta/canonical/OG/JSON-LD - Newsroom + article pages driven by the CMS post library, seeded from the old studio's export (17 articles) plus a drafted GSMA Open Gateway press release awaiting approval - Demo sections on Mobile SDK and Halo CPE, interactive by default and upgradable to an uploaded clip per slot - Dependency-free Node API server (auth, publish, uploads, snapshots, leads, live sitemap) - Deployment configs for Node/nginx/IIS, Vercel and Netlify See docs/ARCHITECTURE.md, docs/PROJECT-STRUCTURE.md, docs/CMS-GUIDE.md and docs/DEPLOYMENT.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
1.3 KiB
JavaScript
43 lines
1.3 KiB
JavaScript
/**
|
|
* Dev runner: starts the CMS API (server/index.mjs) and the Vite dev server
|
|
* together, so /admin can publish while you work on the site.
|
|
*
|
|
* npm run dev → API on 8787, site on 5173 (or $PORT)
|
|
* npm run dev:web → Vite only (site reads factory content)
|
|
* npm run dev:api → API only
|
|
*/
|
|
import { spawn } from 'node:child_process'
|
|
import path from 'node:path'
|
|
|
|
const ROOT = path.resolve(import.meta.dirname, '..')
|
|
const API_PORT = process.env.API_PORT || '8787'
|
|
|
|
const children = []
|
|
// Both processes are plain Node scripts, launched without a shell so paths with
|
|
// spaces (C:\Program Files\nodejs\node.exe) are passed through intact.
|
|
function run(name, args, env) {
|
|
const child = spawn(process.execPath, args, {
|
|
cwd: ROOT,
|
|
stdio: ['ignore', 'inherit', 'inherit'],
|
|
env: { ...process.env, ...env },
|
|
})
|
|
child.on('exit', (code) => {
|
|
if (code) console.error(`[${name}] exited with ${code}`)
|
|
shutdown()
|
|
})
|
|
children.push(child)
|
|
return child
|
|
}
|
|
|
|
let closing = false
|
|
function shutdown() {
|
|
if (closing) return
|
|
closing = true
|
|
for (const child of children) child.kill()
|
|
}
|
|
process.on('SIGINT', shutdown)
|
|
process.on('SIGTERM', shutdown)
|
|
|
|
run('api', ['server/index.mjs'], { PORT: API_PORT })
|
|
run('web', ['node_modules/vite/bin/vite.js'], { API_URL: `http://localhost:${API_PORT}` })
|