Skip to content

Commit

Permalink
fix(generators): update errors gen (vercel#60233)
Browse files Browse the repository at this point in the history
### What?

Errors were updated to MDX as part of
vercel#52038, and as a part of this, the
`errors/manifest.json` file was removed.

This PR did not update the generators used to create new errors, causing
the error gen to...error 😄

This fixes the generator.
  • Loading branch information
tknickman authored Jan 4, 2024
1 parent 406a861 commit 9e2935b
Showing 1 changed file with 3 additions and 14 deletions.
17 changes: 3 additions & 14 deletions turbo/generators/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,24 +114,13 @@ export default function generator(plop: NodePlopAPI): void {
],
actions: function (answers) {
const { name } = answers as ErrorResponse
const errorsRoot = path.join(plop.getDestBasePath(), 'errors')

return [
{
type: 'add',
path: `errors/{{ toFileName name }}.md`,
templateFile: `errors/template.txt`,
},
{
type: 'modify',
path: 'errors/manifest.json',
transform(fileContents: string) {
const manifestData = JSON.parse(fileContents)
manifestData.routes[0].routes.push({
title: helpers.toFileName(name),
path: `/errors/${helpers.toFileName(name)}.md`,
})
return JSON.stringify(manifestData, null, 2)
},
path: path.join(errorsRoot, `{{ toFileName name }}.mdx`),
templateFile: path.join(errorsRoot, `template.txt`),
},
`Url for the error: https://nextjs.org/docs/messages/${helpers.toFileName(
name
Expand Down

0 comments on commit 9e2935b

Please sign in to comment.