Files
logos-web/apps/cms/scripts/schema-push-prompts.ts
jinhojang6 113902fc3a fix(ci): get pnpm test:release fully green end-to-end
- 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.
2026-05-21 20:24:54 +09:00

49 lines
1.1 KiB
TypeScript

const schemaConflictPromptPattern =
/Is [\s\S]* (?:table|column|schema) created or renamed from another (?:table|column|schema)\?/
const promptSubmittedPattern =
/(?:will be created|will be renamed|will be renamed\/moved|all .* conflicts resolved)/
export interface AutoSubmitState {
lastSubmissionAt: number
pendingPrompt: boolean
}
export interface SchemaPushAutomationEnv {
NODE_ENV?: string
VERCEL?: string
VERCEL_ENV?: string
}
export const createAutoSubmitState = (): AutoSubmitState => ({
lastSubmissionAt: 0,
pendingPrompt: false,
})
export const isLocalSchemaPushAutomationAllowed = (
env: SchemaPushAutomationEnv
): boolean => env.NODE_ENV !== 'production' && !env.VERCEL && !env.VERCEL_ENV
export const shouldSubmitDefaultSchemaChoice = (
output: string,
state: AutoSubmitState,
now = Date.now()
): boolean => {
if (promptSubmittedPattern.test(output)) {
state.pendingPrompt = false
}
if (!schemaConflictPromptPattern.test(output)) {
return false
}
if (state.pendingPrompt && now - state.lastSubmissionAt < 1000) {
return false
}
state.pendingPrompt = true
state.lastSubmissionAt = now
return true
}