IAPL rename: gate checks, and two breaks they found on an unedited 1.16.7 site
- pnpm legacy:site (scripts/legacy-site-check.mjs): the reference site of v1.16.7, unedited, installed against this build — old commands, doctor without errors, import map unchanged, tsc, builds with webpack and Turbopack - test/legacyNameForms.test.ts: the remaining spellings with 'ipal' as a closed list; a new one fails - found by legacy:site and fixed: 'ipal-tokens --check' called a tokens.css written before 1.17.0 out of date (its header names the command); the doctor's env-example rule did not accept IPAL_* in .env.example - the doctor's seed rules catch IPAL_SEED_ALLOW_FULL=1 as before - PROGRAMISTA: the new release check Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
b91984fbcd
commit
926ba4a67e
@@ -1,6 +1,7 @@
|
||||
import type { DoctorRule, RuleFinding } from '../types.js'
|
||||
|
||||
import { databaseNameFromUri, databaseNamesFor } from '../../env/databaseName.js'
|
||||
import { legacyEnvName } from '../../shared/envName.js'
|
||||
import { configFile } from '../project.js'
|
||||
import { stripComments } from '../util.js'
|
||||
|
||||
@@ -77,12 +78,13 @@ export const envRules: DoctorRule[] = [
|
||||
const want = ['DATABASE_URI', 'PAYLOAD_SECRET', 'NEXT_PUBLIC_SERVER_URL', 'IAPL_IP_HEADER']
|
||||
if (/buildR2Storage/.test(cfg) && !ctx.auditSkips.has('r2')) {want.push('R2_BUCKET', 'R2_ENDPOINT', 'R2_ACCESS_KEY_ID', 'R2_SECRET_ACCESS_KEY', 'R2_PUBLIC_URL')}
|
||||
if (/cookieScanner\s*:\s*\{[^}]*\bcrawl\s*:\s*(?!false)/.test(cfg)) {want.push('IAPL_COOKIE_SCAN_URL', 'IAPL_COOKIE_SCAN_TOKEN')}
|
||||
const missing = want.filter((v) => !(v in ctx.env.example!))
|
||||
// a plugin variable under its spelling from before 1.17.0 (IPAL_…) is there too
|
||||
const missing = want.filter((v) => !(v in ctx.env.example!) && !((legacyEnvName(v) ?? v) in ctx.env.example!))
|
||||
if (missing.length) {out.push({ file: '.env.example', fix: 'add the names (empty or placeholder values)', message: `.env.example lacks ${missing.join(', ')}`, severity: 'warning' })}
|
||||
// A real-looking credential in a committed file.
|
||||
const creds = (ctx.env.example.DATABASE_URI ?? '').match(/^[a-z+]+:\/\/([^@/]+)@/i)?.[1]
|
||||
if (creds && !PLACEHOLDER.test(creds)) {out.push({ file: '.env.example', fix: 'replace with USER:PASS', message: 'DATABASE_URI in .env.example carries credentials', severity: 'error' })}
|
||||
for (const key of ['PAYLOAD_SECRET', 'R2_SECRET_ACCESS_KEY', 'GRAPH_CLIENT_SECRET', 'IAPL_DOCTOR_TOKEN']) {
|
||||
for (const key of ['PAYLOAD_SECRET', 'R2_SECRET_ACCESS_KEY', 'GRAPH_CLIENT_SECRET', 'IAPL_DOCTOR_TOKEN', 'IPAL_DOCTOR_TOKEN']) {
|
||||
const value = ctx.env.example[key]
|
||||
if (value && value.length >= 16 && !PLACEHOLDER.test(value)) {out.push({ file: '.env.example', fix: `leave ${key} empty`, message: `${key} in .env.example has a value`, severity: 'error' })}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user