Skip to content

Commit

Permalink
Fix incorrect error manifest path (#27970)
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Aug 11, 2021
1 parent ce4adfc commit f56a150
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
4 changes: 0 additions & 4 deletions errors/manifest.json
Expand Up @@ -415,10 +415,6 @@
"title": "import-esm-externals",
"path": "/errors/import-esm-externals.md"
},
{
"title": "max-custom-routes-reached",
"path": "max-custom-routes-reached.md"
},
{
"title": "static-page-generation-timeout",
"path": "/errors/static-page-generation-timeout.md"
Expand Down
20 changes: 16 additions & 4 deletions scripts/check-manifests.js
Expand Up @@ -20,7 +20,7 @@ function collectPaths(routes, paths = []) {

async function main() {
const manifests = ['errors/manifest.json', 'docs/manifest.json']
let hadMissing = false
let hadError = false

for (const manifest of manifests) {
const dir = path.dirname(manifest)
Expand All @@ -38,15 +38,27 @@ async function main() {
)

if (missingFiles.length) {
hadMissing = true
hadError = true
console.log(`Missing paths in ${manifest}:\n${missingFiles.join('\n')}`)
} else {
console.log(`No missing paths in ${manifest}`)
}

for (const filePath of paths) {
if (
!(await fs.promises
.access(path.join(process.cwd(), filePath), fs.constants.F_OK)
.then(() => true)
.catch(() => false))
) {
console.log('Could not find path:', filePath)
hadError = true
}
}
}

if (hadMissing) {
throw new Error('missing manifest items detected see above')
if (hadError) {
throw new Error('missing/incorrect manifest items detected see above')
}
}

Expand Down

0 comments on commit f56a150

Please sign in to comment.