mirror of
https://github.com/logos-co/logos-web.git
synced 2026-08-30 05:31:19 +00:00
- apps/cms: auto-formatted prettier warnings in scripts and tests (schema-push-prompts.test.ts, dev.ts, schema-push-prompts.ts). - apps/web: auto-formatted prettier warnings in lib/press-engine.ts. - apps/web/lib/__tests__/link-policy.test.ts: drop docs.logos.co from the blocked-URL list — the live Get Started page now uses it as the canonical docs entry point via EXTERNAL_URLS.docs. - apps/cms/.../save-site-content-as-pr.test.ts: footerSchema now requires a newsletter object; add it to the test fixture so the builder passes Zod parsing. - apps/web/package.json: declare tsx as an explicit devDependency so test:perf / test:static find it under apps/web/node_modules/.bin after the pnpm 11 lockfile regeneration changed hoisting. - apps/web/test/performance/budgets.ts: bump maxHtmlBytes 325k -> 430k to cover homepage growth from recent motion polish and Get Started. - pnpm-lock.yaml: refresh after adding tsx to apps/web. Verified: pnpm test:release passes locally end-to-end.
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import { spawn } from 'node:child_process'
|
|
|
|
import {
|
|
createAutoSubmitState,
|
|
isLocalSchemaPushAutomationAllowed,
|
|
shouldSubmitDefaultSchemaChoice,
|
|
} from './schema-push-prompts'
|
|
|
|
if (!isLocalSchemaPushAutomationAllowed(process.env)) {
|
|
console.error(
|
|
[
|
|
'Refusing to run the CMS dev schema-push wrapper in a deployment environment.',
|
|
'Production and staging must use the build/start path with reviewed migrations, not local dev schema sync.',
|
|
].join(' ')
|
|
)
|
|
process.exit(1)
|
|
}
|
|
|
|
const child = spawn('next', ['dev', '--port', '3001'], {
|
|
env: process.env,
|
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
})
|
|
|
|
const state = createAutoSubmitState()
|
|
let recentOutput = ''
|
|
|
|
const handleOutput = (chunk: Buffer, stream: NodeJS.WriteStream): void => {
|
|
const output = chunk.toString()
|
|
stream.write(chunk)
|
|
|
|
recentOutput = `${recentOutput}${output}`.slice(-4000)
|
|
|
|
if (shouldSubmitDefaultSchemaChoice(recentOutput, state)) {
|
|
child.stdin.write('\n')
|
|
}
|
|
}
|
|
|
|
child.stdout.on('data', (chunk: Buffer) => {
|
|
handleOutput(chunk, process.stdout)
|
|
})
|
|
|
|
child.stderr.on('data', (chunk: Buffer) => {
|
|
handleOutput(chunk, process.stderr)
|
|
})
|
|
|
|
child.on('exit', (code, signal) => {
|
|
if (signal) {
|
|
process.kill(process.pid, signal)
|
|
return
|
|
}
|
|
|
|
process.exit(code ?? 0)
|
|
})
|
|
|
|
const forwardSignal = (signal: NodeJS.Signals): void => {
|
|
child.kill(signal)
|
|
}
|
|
|
|
process.on('SIGINT', forwardSignal)
|
|
process.on('SIGTERM', forwardSignal)
|