From 138143a613667c4e26faa5ab0646d562cf3a4d6b Mon Sep 17 00:00:00 2001 From: Andrey <44743245+andreysam@users.noreply.github.com> Date: Wed, 13 Sep 2023 12:25:38 +0300 Subject: [PATCH] fix(nextjs): Create necessary directories in app router (#439) Create directories for example page if they don't exist yet Co-authored-by: Lukas Stracke --- CHANGELOG.md | 5 ++++- src/nextjs/nextjs-wizard.ts | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b32f7970..6caa9324 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,10 @@ - enh(android): Show link to issues page after setup is complete (#448) - fix(nextjs): Add selfhosted url in `next.config.js` (#438) - +- fix(nextjs): Create necessary directories in app router (#439) + +Work in this release contributed by @andreysam. Thank you for your contributions! + ## 3.12.0 - feat(sourcemaps): Automatically insert Sentry Webpack plugin (#432) diff --git a/src/nextjs/nextjs-wizard.ts b/src/nextjs/nextjs-wizard.ts index 61b62aef..734fdce5 100644 --- a/src/nextjs/nextjs-wizard.ts +++ b/src/nextjs/nextjs-wizard.ts @@ -325,6 +325,13 @@ export async function runNextjsWizard(options: WizardOptions): Promise { useClient: true, }); + fs.mkdirSync( + path.join(process.cwd(), ...appLocation, 'sentry-example-page'), + { + recursive: true, + }, + ); + await fs.promises.writeFile( path.join( process.cwd(), @@ -342,9 +349,12 @@ export async function runNextjsWizard(options: WizardOptions): Promise { )}.`, ); - fs.mkdirSync(path.join(process.cwd(), ...appLocation, 'api'), { - recursive: true, - }); + fs.mkdirSync( + path.join(process.cwd(), ...appLocation, 'api', 'sentry-example-api'), + { + recursive: true, + }, + ); await fs.promises.writeFile( path.join(