#!/usr/bin/env node // // The content check, on its own, for proving it fails and for a quick answer // while writing copy. The build runs the same check inside prerender.js, so a // clean run here is not a substitute for `npm run build`. // // node scripts/validate-content.js // // Exit 0 nothing wrong, 1 findings, 2 nothing was checked. import { services } from '../src/data/services.js' import { industries } from '../src/data/industries.js' import { validateContent } from './lib/content.js' const { errors, warnings, checked } = validateContent({ services, industries }) for (const warning of warnings) console.warn(`content: note: ${warning}`) if (!services?.length || !industries?.length || checked === 0) { console.error('content: nothing was checked, which is not a pass. Did the data modules fail to import?') process.exit(2) } if (errors.length) { console.error(`content: ${errors.length} problem(s):`) for (const error of errors) console.error(` ${error}`) process.exit(1) } console.log(`content: ${checked} field(s) checked across ${services.length} service(s) and ${industries.length} industr(ies), nothing wrong.`)