fix(generators): update errors gen (#60233)
### What? Errors were updated to MDX as part of https://github.com/vercel/next.js/pull/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.
This commit is contained in:
parent
406a861c3d
commit
9e2935b05c
1 changed files with 3 additions and 14 deletions
|
@ -114,24 +114,13 @@ export default function generator(plop: NodePlopAPI): void {
|
||||||
],
|
],
|
||||||
actions: function (answers) {
|
actions: function (answers) {
|
||||||
const { name } = answers as ErrorResponse
|
const { name } = answers as ErrorResponse
|
||||||
|
const errorsRoot = path.join(plop.getDestBasePath(), 'errors')
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
type: 'add',
|
type: 'add',
|
||||||
path: `errors/{{ toFileName name }}.md`,
|
path: path.join(errorsRoot, `{{ toFileName name }}.mdx`),
|
||||||
templateFile: `errors/template.txt`,
|
templateFile: path.join(errorsRoot, `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)
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
`Url for the error: https://nextjs.org/docs/messages/${helpers.toFileName(
|
`Url for the error: https://nextjs.org/docs/messages/${helpers.toFileName(
|
||||||
name
|
name
|
||||||
|
|
Loading…
Reference in a new issue