@sentry/wizard 3.34.2 → 3.34.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/e2e-tests/jest.config.d.ts +1 -0
- package/dist/e2e-tests/jest.config.js +5 -0
- package/dist/e2e-tests/jest.config.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs.test.d.ts +1 -0
- package/dist/e2e-tests/tests/nextjs.test.js +221 -0
- package/dist/e2e-tests/tests/nextjs.test.js.map +1 -0
- package/dist/e2e-tests/tests/remix.test.js +47 -43
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.d.ts +1 -0
- package/dist/e2e-tests/tests/sveltekit.test.js +186 -0
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -0
- package/dist/e2e-tests/utils/index.d.ts +13 -2
- package/dist/e2e-tests/utils/index.js +45 -13
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/package.json +3 -5
- package/dist/src/apple/templates.d.ts +1 -1
- package/dist/src/apple/templates.js +6 -2
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.js +2 -1
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +68 -47
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.d.ts +1 -0
- package/dist/src/nextjs/templates.js +5 -1
- package/dist/src/nextjs/templates.js.map +1 -1
- package/e2e-tests/.env.example +11 -0
- package/e2e-tests/jest.config.ts +8 -1
- package/e2e-tests/package.json +14 -0
- package/e2e-tests/run.sh +15 -0
- package/e2e-tests/test-applications/nextjs-test-app/next.config.mjs +4 -0
- package/e2e-tests/test-applications/nextjs-test-app/package.json +22 -0
- package/e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx +20 -0
- package/e2e-tests/test-applications/nextjs-test-app/src/app/page.tsx +90 -0
- package/e2e-tests/test-applications/sveltekit-test-app/package.json +21 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.d.ts +13 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.html +11 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/lib/index.ts +1 -0
- package/e2e-tests/test-applications/sveltekit-test-app/src/routes/+page.svelte +2 -0
- package/e2e-tests/test-applications/sveltekit-test-app/svelte.config.js +18 -0
- package/e2e-tests/test-applications/sveltekit-test-app/vite.config.ts +6 -0
- package/e2e-tests/tests/nextjs.test.ts +161 -0
- package/e2e-tests/tests/remix.test.ts +35 -44
- package/e2e-tests/tests/sveltekit.test.ts +154 -0
- package/e2e-tests/utils/index.ts +54 -11
- package/package.json +3 -5
- package/src/apple/templates.ts +5 -1
- package/src/apple/xcode-manager.ts +2 -0
- package/src/nextjs/nextjs-wizard.ts +31 -6
- package/src/nextjs/templates.ts +15 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AAEzB,qDAAyC;AACzC,yCAA6B;AAC7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAO/B,SAAS,mCAAmC,CAC1C,IAAS,EACT,UAAkB;IAElB,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;IAC5C,IAAM,SAAS,GAAW,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,eAAe,IAAI,EAAE,CAAC,CAAC,MAAM,CAC3E,UAAC,GAAG;QACF,OAAO,CACL,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;YACzB,SAAS,CAAC,eAAe,CAAC,GAAG,CAA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I,EAAE,EAAE,CAAC,CAAE;iBACvD,CAAC,CAAC;aACJ;iBAAM,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC7C,IAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC1D,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CACnC,cAAc,EACd,cAAc,CAAC,IAAI;oBACjB,CAAC,CAAC,UAAG,IAAI,SAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,MAAG;oBACpD,CAAC,CAAC,IAAI,CACT,CAAC;gBACF,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,aAAa,EAAE;aAC/B;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,mBAAC;AAAD,CAAC,AAhID,IAgIC;AAhIY,oCAAY","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\nimport * as path from 'path';\nconst xcode = require('xcode');\n\ninterface ProjetFile {\n key: string;\n path: string;\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: any,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey];\n\n xcObjects.XCConfigurationList[\n target.buildConfigurationList\n ].buildConfigurations.forEach((buildConfig: { value: string }) => {\n const buildSettings =\n xcObjects.XCBuildConfiguration[buildConfig.value].buildSettings;\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n });\n}\n\nfunction addSentrySPM(proj: any, targetName: string): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid() as string;\n const sentrySPMUUID = proj.generateUuid() as string;\n\n //Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n for (const framework of frameworks) {\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n }\n\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[sentryFrameworkUUID + '_comment'] =\n 'Sentry in Frameworks';\n\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n }\n }\n\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey];\n\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid() as string;\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n if (!xcObjects.XCRemoteSwiftPackageReference) {\n xcObjects.XCRemoteSwiftPackageReference = {};\n }\n\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID + '_comment'] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n if (!xcObjects.XCSwiftPackageProductDependency) {\n xcObjects.XCSwiftPackageProductDependency = {};\n }\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID + '_comment'] =\n 'Sentry';\n\n clack.log.step('Added Sentry SPM dependency to your project');\n}\n\nfunction addUploadSymbolsScript(\n xcodeProject: any,\n sentryProject: SentryProjectData,\n targetName: string,\n uploadSource = true,\n): void {\n const xcObjects = xcodeProject.hash.project.objects;\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n\n for (const scriptKey in xcObjects.PBXShellScriptBuildPhase || {}) {\n if (!scriptKey.endsWith('_comment')) {\n const script = xcObjects.PBXShellScriptBuildPhase[scriptKey].shellScript;\n //Sentry script already exists, update it\n if (script.includes('sentry-cli')) {\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey];\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey + '_comment'];\n break;\n }\n }\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n targetKey,\n {\n inputFileListPaths: [],\n outputFileListPaths: [],\n inputPaths: [templates.scriptInputPath],\n shellPath: '/bin/sh',\n shellScript: templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n ),\n },\n );\n clack.log.step(`Added Sentry upload script to \"${targetName}\" build phase`);\n}\n\nexport class XcodeProject {\n projectPath: string;\n project: any;\n objects: any;\n files: ProjetFile[] | undefined;\n\n public constructor(projectPath: string) {\n this.projectPath = projectPath;\n this.project = xcode.project(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n return Object.keys(this.objects.PBXNativeTarget || {})\n .filter((key) => {\n return (\n !key.endsWith('_comment') &&\n this.objects.PBXNativeTarget[key].productType.startsWith(\n '\"com.apple.product-type.application',\n )\n );\n })\n .map((key) => {\n return this.objects.PBXNativeTarget[key].name as string;\n });\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n apiKeys: { token: string },\n addSPMReference: boolean,\n uploadSource = true,\n ): void {\n addUploadSymbolsScript(this.project, sentryProject, target, uploadSource);\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (addSPMReference) {\n addSentrySPM(this.project, target);\n }\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.projectPath, newContent);\n }\n\n public filesForTarget(target: string): string[] | undefined {\n const files = this.projectFiles();\n const fileDictionary: any = {};\n files.forEach((file) => {\n fileDictionary[file.key] = file.path;\n });\n\n const nativeTarget = Object.keys(this.objects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n this.objects.PBXNativeTarget[key].name === target\n );\n },\n )[0];\n\n if (nativeTarget === undefined) {\n return undefined;\n }\n\n const buildPhaseKey = this.objects.PBXNativeTarget[\n nativeTarget\n ].buildPhases.filter((phase: any) => {\n return this.objects.PBXSourcesBuildPhase[phase.value] !== undefined;\n })[0];\n\n if (buildPhaseKey === undefined) {\n return undefined;\n }\n\n const buildPhases = this.objects.PBXSourcesBuildPhase[buildPhaseKey.value];\n if (buildPhases === undefined) {\n return undefined;\n }\n\n const baseDir = path.dirname(path.dirname(this.projectPath));\n\n return buildPhases.files\n .map((file: any) => {\n const buildFile = fileDictionary[\n this.objects.PBXBuildFile[file.value].fileRef\n ] as string;\n if (!buildFile) {\n return '';\n }\n return path.join(baseDir, buildFile);\n })\n .filter((f: string) => f.length > 0) as string[];\n }\n\n projectFiles(): ProjetFile[] {\n if (this.files === undefined) {\n const proj = this.project.getFirstProject();\n const mainGroupKey = proj.firstProject.mainGroup;\n const mainGroup = this.objects.PBXGroup[mainGroupKey];\n this.files = this.buildGroup(mainGroup);\n }\n return this.files;\n }\n\n buildGroup(group: any, path = ''): ProjetFile[] {\n const result: ProjetFile[] = [];\n for (const child of group.children) {\n if (this.objects.PBXFileReference[child.value]) {\n const fileReference = this.objects.PBXFileReference[child.value];\n result.push({\n key: child.value,\n path: `${path}${fileReference.path.replace(/\"/g, '')}`,\n });\n } else if (this.objects.PBXGroup[child.value]) {\n const groupReference = this.objects.PBXGroup[child.value];\n const groupChildren = this.buildGroup(\n groupReference,\n groupReference.path\n ? `${path}${groupReference.path.replace(/\"/g, '')}/`\n : path,\n );\n result.push(...groupChildren);\n }\n }\n return result;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AAEzB,qDAAyC;AACzC,yCAA6B;AAC7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAO/B,SAAS,mCAAmC,CAC1C,IAAS,EACT,UAAkB;IAElB,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,O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,SAAA;YACd,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC9C,IAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACjE,MAAM,CAAC,IAAI,CAAC;oBACV,GAAG,EAAE,KAAK,CAAC,KAAK;oBAChB,IAAI,EAAE,UAAG,IAAI,SAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAE;iBACvD,CAAC,CAAC;aACJ;iBAAM,IAAI,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;gBAC7C,IAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC1D,IAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CACnC,cAAc,EACd,cAAc,CAAC,IAAI;oBACjB,CAAC,CAAC,UAAG,IAAI,SAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,MAAG;oBACpD,CAAC,CAAC,IAAI,CACT,CAAC;gBACF,MAAM,CAAC,IAAI,OAAX,MAAM,EAAS,aAAa,EAAE;aAC/B;SACF;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IACH,mBAAC;AAAD,CAAC,AAhID,IAgIC;AAhIY,oCAAY","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\nimport * as path from 'path';\nconst xcode = require('xcode');\n\ninterface ProjetFile {\n key: string;\n path: string;\n}\n\nfunction setDebugInformationFormatAndSandbox(\n proj: any,\n targetName: string,\n): void {\n const xcObjects = proj.hash.project.objects;\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey];\n\n xcObjects.XCConfigurationList[\n target.buildConfigurationList\n ].buildConfigurations.forEach((buildConfig: { value: string }) => {\n const buildSettings =\n xcObjects.XCBuildConfiguration[buildConfig.value].buildSettings;\n buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n buildSettings.ENABLE_USER_SCRIPT_SANDBOXING = '\"NO\"';\n });\n}\n\nfunction addSentrySPM(proj: any, targetName: string): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid() as string;\n const sentrySPMUUID = proj.generateUuid() as string;\n\n //Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n for (const framework of frameworks) {\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n }\n\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[sentryFrameworkUUID + '_comment'] =\n 'Sentry in Frameworks';\n\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n }\n }\n\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n const target = xcObjects.PBXNativeTarget[targetKey];\n\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid() as string;\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n if (!xcObjects.XCRemoteSwiftPackageReference) {\n xcObjects.XCRemoteSwiftPackageReference = {};\n }\n\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID + '_comment'] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n if (!xcObjects.XCSwiftPackageProductDependency) {\n xcObjects.XCSwiftPackageProductDependency = {};\n }\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID + '_comment'] =\n 'Sentry';\n\n clack.log.step('Added Sentry SPM dependency to your project');\n}\n\nfunction addUploadSymbolsScript(\n xcodeProject: any,\n sentryProject: SentryProjectData,\n targetName: string,\n uploadSource = true,\n): void {\n const xcObjects = xcodeProject.hash.project.objects;\n const targetKey: string = Object.keys(xcObjects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n xcObjects.PBXNativeTarget[key].name === targetName\n );\n },\n )[0];\n\n for (const scriptKey in xcObjects.PBXShellScriptBuildPhase || {}) {\n if (!scriptKey.endsWith('_comment')) {\n const script = xcObjects.PBXShellScriptBuildPhase[scriptKey].shellScript;\n //Sentry script already exists, update it\n if (script.includes('sentry-cli')) {\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey];\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey + '_comment'];\n break;\n }\n }\n }\n\n const isHomebrewInstalled = fs.existsSync('/opt/homebrew/bin/sentry-cli');\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n targetKey,\n {\n inputFileListPaths: [],\n outputFileListPaths: [],\n inputPaths: [templates.scriptInputPath],\n shellPath: '/bin/sh',\n shellScript: templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n uploadSource,\n isHomebrewInstalled,\n ),\n },\n );\n clack.log.step(`Added Sentry upload script to \"${targetName}\" build phase`);\n}\n\nexport class XcodeProject {\n projectPath: string;\n project: any;\n objects: any;\n files: ProjetFile[] | undefined;\n\n public constructor(projectPath: string) {\n this.projectPath = projectPath;\n this.project = xcode.project(projectPath);\n this.project.parseSync();\n this.objects = this.project.hash.project.objects;\n }\n\n public getAllTargets(): string[] {\n return Object.keys(this.objects.PBXNativeTarget || {})\n .filter((key) => {\n return (\n !key.endsWith('_comment') &&\n this.objects.PBXNativeTarget[key].productType.startsWith(\n '\"com.apple.product-type.application',\n )\n );\n })\n .map((key) => {\n return this.objects.PBXNativeTarget[key].name as string;\n });\n }\n\n public updateXcodeProject(\n sentryProject: SentryProjectData,\n target: string,\n apiKeys: { token: string },\n addSPMReference: boolean,\n uploadSource = true,\n ): void {\n addUploadSymbolsScript(this.project, sentryProject, target, uploadSource);\n if (uploadSource) {\n setDebugInformationFormatAndSandbox(this.project, target);\n }\n if (addSPMReference) {\n addSentrySPM(this.project, target);\n }\n const newContent = this.project.writeSync();\n fs.writeFileSync(this.projectPath, newContent);\n }\n\n public filesForTarget(target: string): string[] | undefined {\n const files = this.projectFiles();\n const fileDictionary: any = {};\n files.forEach((file) => {\n fileDictionary[file.key] = file.path;\n });\n\n const nativeTarget = Object.keys(this.objects.PBXNativeTarget || {}).filter(\n (key) => {\n return (\n !key.endsWith('_comment') &&\n this.objects.PBXNativeTarget[key].name === target\n );\n },\n )[0];\n\n if (nativeTarget === undefined) {\n return undefined;\n }\n\n const buildPhaseKey = this.objects.PBXNativeTarget[\n nativeTarget\n ].buildPhases.filter((phase: any) => {\n return this.objects.PBXSourcesBuildPhase[phase.value] !== undefined;\n })[0];\n\n if (buildPhaseKey === undefined) {\n return undefined;\n }\n\n const buildPhases = this.objects.PBXSourcesBuildPhase[buildPhaseKey.value];\n if (buildPhases === undefined) {\n return undefined;\n }\n\n const baseDir = path.dirname(path.dirname(this.projectPath));\n\n return buildPhases.files\n .map((file: any) => {\n const buildFile = fileDictionary[\n this.objects.PBXBuildFile[file.value].fileRef\n ] as string;\n if (!buildFile) {\n return '';\n }\n return path.join(baseDir, buildFile);\n })\n .filter((f: string) => f.length > 0) as string[];\n }\n\n projectFiles(): ProjetFile[] {\n if (this.files === undefined) {\n const proj = this.project.getFirstProject();\n const mainGroupKey = proj.firstProject.mainGroup;\n const mainGroup = this.objects.PBXGroup[mainGroupKey];\n this.files = this.buildGroup(mainGroup);\n }\n return this.files;\n }\n\n buildGroup(group: any, path = ''): ProjetFile[] {\n const result: ProjetFile[] = [];\n for (const child of group.children) {\n if (this.objects.PBXFileReference[child.value]) {\n const fileReference = this.objects.PBXFileReference[child.value];\n result.push({\n key: child.value,\n path: `${path}${fileReference.path.replace(/\"/g, '')}`,\n });\n } else if (this.objects.PBXGroup[child.value]) {\n const groupReference = this.objects.PBXGroup[child.value];\n const groupChildren = this.buildGroup(\n groupReference,\n groupReference.path\n ? `${path}${groupReference.path.replace(/\"/g, '')}/`\n : path,\n );\n result.push(...groupChildren);\n }\n }\n return result;\n }\n}\n"]}
|
|
@@ -212,7 +212,7 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
212
212
|
console.log((0, templates_1.getFullUnderscoreErrorCopyPasteSnippet)(underscoreErrorPageFile === '_error.ts' ||
|
|
213
213
|
underscoreErrorPageFile === '_error.tsx'));
|
|
214
214
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
215
|
-
message: "Did add the code to your ".concat(chalk_1.default.cyan(path.join.apply(path, __spreadArray(__spreadArray([], pagesLocation, false), [underscoreErrorPageFile], false))), " file as described above?"),
|
|
215
|
+
message: "Did you add the code to your ".concat(chalk_1.default.cyan(path.join.apply(path, __spreadArray(__spreadArray([], pagesLocation, false), [underscoreErrorPageFile], false))), " file as described above?"),
|
|
216
216
|
active: 'Yes',
|
|
217
217
|
inactive: 'No, get me out of here',
|
|
218
218
|
}))];
|
|
@@ -268,7 +268,7 @@ function runNextjsWizardWithTelemetry(options) {
|
|
|
268
268
|
console.log((0, templates_1.getGlobalErrorCopyPasteSnippet)(globalErrorPageFile === 'global-error.ts' ||
|
|
269
269
|
globalErrorPageFile === 'global-error.tsx'));
|
|
270
270
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
271
|
-
message: "Did add the code to your ".concat(chalk_1.default.cyan(path.join.apply(path, __spreadArray(__spreadArray([], appDirLocation, false), [globalErrorPageFile], false))), " file as described above?"),
|
|
271
|
+
message: "Did you add the code to your ".concat(chalk_1.default.cyan(path.join.apply(path, __spreadArray(__spreadArray([], appDirLocation, false), [globalErrorPageFile], false))), " file as described above?"),
|
|
272
272
|
active: 'Yes',
|
|
273
273
|
inactive: 'No, get me out of here',
|
|
274
274
|
}))];
|
|
@@ -514,9 +514,9 @@ function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, sdkCon
|
|
|
514
514
|
case 6:
|
|
515
515
|
_a.sent();
|
|
516
516
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('setup-next-config', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
517
|
-
var withSentryConfigOptionsTemplate, nextConfigPossibleFilesMap, foundNextConfigFile, foundNextConfigFileType, foundNextConfigFileFilename, nextConfigCjsContent, probablyIncludesSdk, shouldInject, injectAnyhow, nextConfigMjsContent, probablyIncludesSdk, shouldInject, injectAnyhow, mod, expressionToWrap, newCode,
|
|
518
|
-
return __generator(this, function (
|
|
519
|
-
switch (
|
|
517
|
+
var withSentryConfigOptionsTemplate, nextConfigPossibleFilesMap, foundNextConfigFile, isTypeModule, packageJsonText, packageJson, _a, configFilename, configContent, foundNextConfigFileType, foundNextConfigFileFilename, nextConfigCjsContent, probablyIncludesSdk, shouldInject, injectAnyhow, nextConfigMjsContent, probablyIncludesSdk, shouldInject, injectAnyhow, mod, expressionToWrap, newCode, _b, shouldContinue;
|
|
518
|
+
return __generator(this, function (_c) {
|
|
519
|
+
switch (_c.label) {
|
|
520
520
|
case 0:
|
|
521
521
|
withSentryConfigOptionsTemplate = (0, templates_1.getWithSentryConfigOptionsTemplate)({
|
|
522
522
|
orgSlug: selectedProject.organization.slug,
|
|
@@ -538,61 +538,82 @@ function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, sdkCon
|
|
|
538
538
|
var fileName = _a[1];
|
|
539
539
|
return fs.existsSync(path.join(process.cwd(), fileName));
|
|
540
540
|
});
|
|
541
|
-
if (!!foundNextConfigFile) return [3 /*break*/,
|
|
541
|
+
if (!!foundNextConfigFile) return [3 /*break*/, 6];
|
|
542
542
|
Sentry.setTag('next-config-strategy', 'create');
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
path.join(process.cwd(), nextConfigPossibleFilesMap.js), (0, templates_1.getNextjsConfigCjsTemplate)(withSentryConfigOptionsTemplate), { encoding: 'utf8', flag: 'w' })];
|
|
543
|
+
isTypeModule = false;
|
|
544
|
+
_c.label = 1;
|
|
546
545
|
case 1:
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
return [2 /*return*/];
|
|
546
|
+
_c.trys.push([1, 3, , 4]);
|
|
547
|
+
return [4 /*yield*/, fs.promises.readFile(path.join(process.cwd(), 'package.json'), 'utf8')];
|
|
550
548
|
case 2:
|
|
549
|
+
packageJsonText = _c.sent();
|
|
550
|
+
packageJson = JSON.parse(packageJsonText);
|
|
551
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
552
|
+
if (packageJson.type === 'module') {
|
|
553
|
+
isTypeModule = true;
|
|
554
|
+
}
|
|
555
|
+
return [3 /*break*/, 4];
|
|
556
|
+
case 3:
|
|
557
|
+
_a = _c.sent();
|
|
558
|
+
return [3 /*break*/, 4];
|
|
559
|
+
case 4:
|
|
560
|
+
configFilename = isTypeModule
|
|
561
|
+
? nextConfigPossibleFilesMap.mjs
|
|
562
|
+
: nextConfigPossibleFilesMap.js;
|
|
563
|
+
configContent = isTypeModule
|
|
564
|
+
? (0, templates_1.getNextjsConfigMjsTemplate)(withSentryConfigOptionsTemplate)
|
|
565
|
+
: (0, templates_1.getNextjsConfigCjsTemplate)(withSentryConfigOptionsTemplate);
|
|
566
|
+
return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), configFilename), configContent, { encoding: 'utf8', flag: 'w' })];
|
|
567
|
+
case 5:
|
|
568
|
+
_c.sent();
|
|
569
|
+
prompts_1.default.log.success("Created ".concat(chalk_1.default.cyan(configFilename), " with Sentry configuration."));
|
|
570
|
+
return [2 /*return*/];
|
|
571
|
+
case 6:
|
|
551
572
|
foundNextConfigFileType = foundNextConfigFile[0], foundNextConfigFileFilename = foundNextConfigFile[1];
|
|
552
|
-
if (!(foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs')) return [3 /*break*/,
|
|
573
|
+
if (!(foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs')) return [3 /*break*/, 11];
|
|
553
574
|
Sentry.setTag('next-config-strategy', 'modify');
|
|
554
575
|
nextConfigCjsContent = fs.readFileSync(path.join(process.cwd(), foundNextConfigFileFilename), 'utf8');
|
|
555
576
|
probablyIncludesSdk = nextConfigCjsContent.includes('@sentry/nextjs') &&
|
|
556
577
|
nextConfigCjsContent.includes('withSentryConfig');
|
|
557
578
|
shouldInject = true;
|
|
558
|
-
if (!probablyIncludesSdk) return [3 /*break*/,
|
|
579
|
+
if (!probablyIncludesSdk) return [3 /*break*/, 8];
|
|
559
580
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
560
581
|
message: "".concat(chalk_1.default.cyan(foundNextConfigFileFilename), " already contains Sentry SDK configuration. Should the wizard modify it anyways?"),
|
|
561
582
|
}))];
|
|
562
|
-
case
|
|
563
|
-
injectAnyhow =
|
|
583
|
+
case 7:
|
|
584
|
+
injectAnyhow = _c.sent();
|
|
564
585
|
shouldInject = injectAnyhow;
|
|
565
|
-
|
|
566
|
-
case
|
|
567
|
-
if (!shouldInject) return [3 /*break*/,
|
|
586
|
+
_c.label = 8;
|
|
587
|
+
case 8:
|
|
588
|
+
if (!shouldInject) return [3 /*break*/, 10];
|
|
568
589
|
return [4 /*yield*/, fs.promises.appendFile(path.join(process.cwd(), foundNextConfigFileFilename), (0, templates_1.getNextjsConfigCjsAppendix)(withSentryConfigOptionsTemplate), 'utf8')];
|
|
569
|
-
case
|
|
570
|
-
|
|
590
|
+
case 9:
|
|
591
|
+
_c.sent();
|
|
571
592
|
prompts_1.default.log.success("Added Sentry configuration to ".concat(chalk_1.default.cyan(foundNextConfigFileFilename), ". ").concat(chalk_1.default.dim('(you probably want to clean this up a bit!)')));
|
|
572
|
-
|
|
573
|
-
case
|
|
593
|
+
_c.label = 10;
|
|
594
|
+
case 10:
|
|
574
595
|
Sentry.setTag('next-config-mod-result', 'success');
|
|
575
|
-
|
|
576
|
-
case
|
|
596
|
+
_c.label = 11;
|
|
597
|
+
case 11:
|
|
577
598
|
if (!(foundNextConfigFileType === 'mjs' ||
|
|
578
599
|
foundNextConfigFileType === 'mts' ||
|
|
579
600
|
foundNextConfigFileType === 'cts' ||
|
|
580
|
-
foundNextConfigFileType === 'ts')) return [3 /*break*/,
|
|
601
|
+
foundNextConfigFileType === 'ts')) return [3 /*break*/, 20];
|
|
581
602
|
nextConfigMjsContent = fs.readFileSync(path.join(process.cwd(), foundNextConfigFileFilename), 'utf8');
|
|
582
603
|
probablyIncludesSdk = nextConfigMjsContent.includes('@sentry/nextjs') &&
|
|
583
604
|
nextConfigMjsContent.includes('withSentryConfig');
|
|
584
605
|
shouldInject = true;
|
|
585
|
-
if (!probablyIncludesSdk) return [3 /*break*/,
|
|
606
|
+
if (!probablyIncludesSdk) return [3 /*break*/, 13];
|
|
586
607
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
587
608
|
message: "".concat(chalk_1.default.cyan(foundNextConfigFileFilename), " already contains Sentry SDK configuration. Should the wizard modify it anyways?"),
|
|
588
609
|
}))];
|
|
589
|
-
case
|
|
590
|
-
injectAnyhow =
|
|
610
|
+
case 12:
|
|
611
|
+
injectAnyhow = _c.sent();
|
|
591
612
|
shouldInject = injectAnyhow;
|
|
592
|
-
|
|
593
|
-
case
|
|
594
|
-
|
|
595
|
-
if (!shouldInject) return [3 /*break*/,
|
|
613
|
+
_c.label = 13;
|
|
614
|
+
case 13:
|
|
615
|
+
_c.trys.push([13, 16, , 20]);
|
|
616
|
+
if (!shouldInject) return [3 /*break*/, 15];
|
|
596
617
|
mod = (0, magicast_1.parseModule)(nextConfigMjsContent);
|
|
597
618
|
mod.imports.$add({
|
|
598
619
|
from: '@sentry/nextjs',
|
|
@@ -607,14 +628,14 @@ function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, sdkCon
|
|
|
607
628
|
encoding: 'utf8',
|
|
608
629
|
flag: 'w',
|
|
609
630
|
})];
|
|
610
|
-
case
|
|
611
|
-
|
|
631
|
+
case 14:
|
|
632
|
+
_c.sent();
|
|
612
633
|
prompts_1.default.log.success("Added Sentry configuration to ".concat(chalk_1.default.cyan(foundNextConfigFileFilename), ". ").concat(chalk_1.default.dim('(you probably want to clean this up a bit!)')));
|
|
613
634
|
Sentry.setTag('next-config-mod-result', 'success');
|
|
614
|
-
|
|
615
|
-
case
|
|
616
|
-
case
|
|
617
|
-
|
|
635
|
+
_c.label = 15;
|
|
636
|
+
case 15: return [3 /*break*/, 20];
|
|
637
|
+
case 16:
|
|
638
|
+
_b = _c.sent();
|
|
618
639
|
Sentry.setTag('next-config-mod-result', 'fail');
|
|
619
640
|
prompts_1.default.log.warn(chalk_1.default.yellow("Something went wrong writing to ".concat(chalk_1.default.cyan(foundNextConfigFileFilename), ".")));
|
|
620
641
|
prompts_1.default.log.info("Please put the following code snippet into ".concat(chalk_1.default.cyan(foundNextConfigFileFilename), ": ").concat(chalk_1.default.dim('You probably have to clean it up a bit.'), "\n"));
|
|
@@ -625,15 +646,15 @@ function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, sdkCon
|
|
|
625
646
|
active: 'Yes',
|
|
626
647
|
inactive: 'No, get me out of here',
|
|
627
648
|
}))];
|
|
628
|
-
case
|
|
629
|
-
shouldContinue =
|
|
630
|
-
if (!!shouldContinue) return [3 /*break*/,
|
|
649
|
+
case 17:
|
|
650
|
+
shouldContinue = _c.sent();
|
|
651
|
+
if (!!shouldContinue) return [3 /*break*/, 19];
|
|
631
652
|
return [4 /*yield*/, (0, clack_utils_1.abort)()];
|
|
632
|
-
case
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
case
|
|
636
|
-
case
|
|
653
|
+
case 18:
|
|
654
|
+
_c.sent();
|
|
655
|
+
_c.label = 19;
|
|
656
|
+
case 19: return [3 /*break*/, 20];
|
|
657
|
+
case 20: return [2 /*return*/];
|
|
637
658
|
}
|
|
638
659
|
});
|
|
639
660
|
}); })];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE;4CACP;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,yDAAyD;6CAChE;4CACD;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,8CAA8C;6CACrD;yCACF;wCACD,YAAY,EAAE,IAAI;qCACnB,CAAC,CACH,EAAA;;oCAlBK,oCAAoC,GAAG,SAkB5C;oCAED,sBAAO,oCAAoC,EAAC;;;yBAC7C,CAAC,EAAA;wBAtBF,sBAAO,SAsBL,EAAC;;;;CACJ;AAED;;GAEG;AACH,SAAe,6BAA6B;;;;;;;oBAGnB,qBAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,MAAM,CACP,EAAA;;oBAHD,kBAAkB,GAAG,SAGpB,CAAC;;;;oBAEF,sBAAO,IAAI,EAAC;wBAGd,sBAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;;;;CAC/C","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\n// @ts-ignore - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getSentryConfigContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n} from './templates';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { getNextJsVersionBucket } from './utils';\nimport { configureCI } from '../sourcemaps/sourcemaps-wizard';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: '@sentry/nextjs@^8',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n const reactComponentAnnotation =\n await askShouldEnableReactComponentAnnotation();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n reactComponentAnnotation,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, '_error.jsx'),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(path.join(...pagesLocation, '_error.jsx'))}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n const appDirLocation =\n fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(selfHosted, selectedProject, sentryUrl),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK doesn't yet fully support Turbopack in dev mode. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds will still fully work. ${chalk.bold(\n `To continue this setup, if you are using Turbopack, temporarily remove \\`--turbo\\` from your dev command until you have verified the SDK is working as expected.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await traceStep('configure-ci', () => configureCI('nextjs', authToken));\n }\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager());\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${packageManagerForOutro.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\n) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions(\n newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n );\n }\n } else {\n await showCopyPasteInstructions(\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(instrumentationHookLocation),\n );\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n reactComponentAnnotation: sdkConfigOptions.reactComponentAnnotation,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n await fs.promises.writeFile(\n // We are creating a `next.config.js` file by default as it is supported by the most Next.js versions\n path.join(process.cwd(), nextConfigPossibleFilesMap.js),\n getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan('next.config.js')} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n const expressionToWrap = generateCode(mod.exports.default.$ast).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = builders.raw(`withSentryConfig(\n ${expressionToWrap},\n ${withSentryConfigOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n const typeScriptDetected = isUsingTypeScript();\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n });\n\n fs.mkdirSync(\n path.join(process.cwd(), ...appFolderLocation, 'sentry-example-page'),\n {\n recursive: true,\n },\n );\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'sentry-example-page',\n newPageFileName,\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n ),\n {\n recursive: true,\n },\n );\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n getSentryExampleAppDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'sentry-example-page.jsx',\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExamplePagesDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async () => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n return shouldSetTunnelRoute;\n });\n}\n\nasync function askShouldEnableReactComponentAnnotation() {\n return await traceStep('ask-react-component-annotation-option', async () => {\n const shouldEnableReactComponentAnnotation = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to enable React component annotations to make breadcrumbs and session replays more readable?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Annotates React component names - increases bundle size',\n },\n {\n label: 'No',\n value: false,\n hint: 'Continue without React component annotations',\n },\n ],\n initialValue: true,\n }),\n );\n\n return shouldEnableReactComponentAnnotation;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nextjs-wizard.js","sourceRoot":"","sources":["../../../src/nextjs/nextjs-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AACzB,4EAA4E;AAC5E,qCAA+D;AAC/D,yCAA6B;AAE7B,mDAAuC;AAEvC,oDAiB8B;AAE9B,yCAiBqB;AACrB,0CAAwD;AACxD,sDAA+E;AAC/E,iCAAiD;AACjD,qEAA8D;AAE9D,SAAgB,eAAe,CAAC,OAAsB;IACpD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,QAAQ;QACrB,aAAa,EAAE,OAAO;KACvB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,C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,IAAA,8BAAgB,EACjE,iBAAK,CAAC,MAAM,CAAC;wCACX,OAAO,EACL,0GAA0G;wCAC5G,OAAO,EAAE;4CACP;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,yDAAyD;6CAChE;4CACD;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,8CAA8C;6CACrD;yCACF;wCACD,YAAY,EAAE,IAAI;qCACnB,CAAC,CACH,EAAA;;oCAlBK,oCAAoC,GAAG,SAkB5C;oCAED,sBAAO,oCAAoC,EAAC;;;yBAC7C,CAAC,EAAA;wBAtBF,sBAAO,SAsBL,EAAC;;;;CACJ;AAED;;GAEG;AACH,SAAe,6BAA6B;;;;;;;oBAGnB,qBAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAC7C,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,EACxC,MAAM,CACP,EAAA;;oBAHD,kBAAkB,GAAG,SAGpB,CAAC;;;;oBAEF,sBAAO,IAAI,EAAC;wBAGd,sBAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAC;;;;CAC/C","sourcesContent":["/* eslint-disable max-lines */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\n// @ts-ignore - magicast is ESM and TS complains about that. It works though\nimport { builders, generateCode, parseModule } from 'magicast';\nimport * as path from 'path';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n createNewConfigFile,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n getPackageManager,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n runPrettierIfInstalled,\n showCopyPasteInstructions,\n} from '../utils/clack-utils';\nimport type { SentryProjectData, WizardOptions } from '../utils/types';\nimport {\n getFullUnderscoreErrorCopyPasteSnippet,\n getGlobalErrorCopyPasteSnippet,\n getInstrumentationHookContent,\n getInstrumentationHookCopyPasteSnippet,\n getNextjsConfigCjsAppendix,\n getNextjsConfigCjsTemplate,\n getNextjsConfigEsmCopyPasteSnippet,\n getSentryConfigContents,\n getSentryDefaultGlobalErrorPage,\n getSentryDefaultUnderscoreErrorPage,\n getSentryExamplePagesDirApiRoute,\n getSentryExampleAppDirApiRoute,\n getSentryExamplePageContents,\n getSimpleUnderscoreErrorCopyPasteSnippet,\n getWithSentryConfigOptionsTemplate,\n getNextjsConfigMjsTemplate,\n} from './templates';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { getNextJsVersionBucket } from './utils';\nimport { configureCI } from '../sourcemaps/sourcemaps-wizard';\n\nexport function runNextjsWizard(options: WizardOptions) {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'nextjs',\n wizardOptions: options,\n },\n () => runNextjsWizardWithTelemetry(options),\n );\n}\n\nexport async function runNextjsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Next.js Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n const typeScriptDetected = isUsingTypeScript();\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, 'next', 'Next.js');\n\n const nextVersion = getPackageVersion('next', packageJson);\n Sentry.setTag('nextjs-version', getNextJsVersionBucket(nextVersion));\n\n const { selectedProject, authToken, selfHosted, sentryUrl } =\n await getOrAskForProjectData(options, 'javascript-nextjs');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/nextjs',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n const { packageManager: packageManagerFromInstallStep } =\n await installPackage({\n packageName: '@sentry/nextjs@^8',\n alreadyInstalled: !!packageJson?.dependencies?.['@sentry/nextjs'],\n });\n\n await traceStep('configure-sdk', async () => {\n const tunnelRoute = await askShouldSetTunnelRoute();\n const reactComponentAnnotation =\n await askShouldEnableReactComponentAnnotation();\n\n await createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl, {\n tunnelRoute,\n reactComponentAnnotation,\n });\n });\n\n await traceStep('create-underscoreerror-page', async () => {\n const srcDir = path.join(process.cwd(), 'src');\n const maybePagesDirPath = path.join(process.cwd(), 'pages');\n const maybeSrcPagesDirPath = path.join(srcDir, 'pages');\n\n const pagesLocation =\n fs.existsSync(maybePagesDirPath) &&\n fs.lstatSync(maybePagesDirPath).isDirectory()\n ? ['pages']\n : fs.existsSync(maybeSrcPagesDirPath) &&\n fs.lstatSync(maybeSrcPagesDirPath).isDirectory()\n ? ['src', 'pages']\n : undefined;\n\n if (!pagesLocation) {\n return;\n }\n\n const underscoreErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...pagesLocation, '_error.tsx'),\n )\n ? '_error.tsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.ts'))\n ? '_error.ts'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.jsx'))\n ? '_error.jsx'\n : fs.existsSync(path.join(process.cwd(), ...pagesLocation, '_error.js'))\n ? '_error.js'\n : undefined;\n\n if (!underscoreErrorPageFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), ...pagesLocation, '_error.jsx'),\n getSentryDefaultUnderscoreErrorPage(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(path.join(...pagesLocation, '_error.jsx'))}.`,\n );\n } else if (\n fs\n .readFileSync(\n path.join(process.cwd(), ...pagesLocation, underscoreErrorPageFile),\n 'utf8',\n )\n .includes('getInitialProps')\n ) {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease put the following function call in the ${chalk.bold(\n 'getInitialProps',\n )}\\nmethod of your custom error page at ${chalk.bold(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(getSimpleUnderscoreErrorCopyPasteSnippet());\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you modify your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n } else {\n clack.log.info(\n `It seems like you already have a custom error page.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )}:`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getFullUnderscoreErrorCopyPasteSnippet(\n underscoreErrorPageFile === '_error.ts' ||\n underscoreErrorPageFile === '_error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...pagesLocation, underscoreErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n await traceStep('create-global-error-page', async () => {\n const maybeAppDirPath = path.join(process.cwd(), 'app');\n const maybeSrcAppDirPath = path.join(process.cwd(), 'src', 'app');\n\n const appDirLocation =\n fs.existsSync(maybeAppDirPath) &&\n fs.lstatSync(maybeAppDirPath).isDirectory()\n ? ['app']\n : fs.existsSync(maybeSrcAppDirPath) &&\n fs.lstatSync(maybeSrcAppDirPath).isDirectory()\n ? ['src', 'app']\n : undefined;\n\n if (!appDirLocation) {\n return;\n }\n\n const globalErrorPageFile = fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.tsx'),\n )\n ? 'global-error.tsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.ts'),\n )\n ? 'global-error.ts'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.jsx'),\n )\n ? 'global-error.jsx'\n : fs.existsSync(\n path.join(process.cwd(), ...appDirLocation, 'global-error.js'),\n )\n ? 'global-error.js'\n : undefined;\n\n if (!globalErrorPageFile) {\n const newGlobalErrorFileName = `global-error.${\n typeScriptDetected ? 'tsx' : 'jsx'\n }`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), ...appDirLocation, newGlobalErrorFileName),\n getSentryDefaultGlobalErrorPage(typeScriptDetected),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appDirLocation, newGlobalErrorFileName),\n )}.`,\n );\n } else {\n clack.log.info(\n `It seems like you already have a custom error page for your app directory.\\n\\nPlease add the following code to your custom error page\\nat ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )}:\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getGlobalErrorCopyPasteSnippet(\n globalErrorPageFile === 'global-error.ts' ||\n globalErrorPageFile === 'global-error.tsx',\n ),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Did you add the code to your ${chalk.cyan(\n path.join(...appDirLocation, globalErrorPageFile),\n )} file as described above?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n if (shouldCreateExamplePage) {\n await traceStep('create-example-page', async () =>\n createExamplePage(selfHosted, selectedProject, sentryUrl),\n );\n }\n\n await addDotEnvSentryBuildPluginFile(authToken);\n\n const isLikelyUsingTurbopack = await checkIfLikelyIsUsingTurbopack();\n if (isLikelyUsingTurbopack || isLikelyUsingTurbopack === null) {\n await abortIfCancelled(\n clack.select({\n message: `Warning: The Sentry SDK doesn't yet fully support Turbopack in dev mode. The SDK will not be loaded in the browser, and serverside instrumentation will be inaccurate or incomplete. Production builds will still fully work. ${chalk.bold(\n `To continue this setup, if you are using Turbopack, temporarily remove \\`--turbo\\` from your dev command until you have verified the SDK is working as expected.`,\n )}`,\n options: [\n {\n label: 'I understand.',\n hint: 'press enter',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n }\n\n const mightBeUsingVercel = fs.existsSync(\n path.join(process.cwd(), 'vercel.json'),\n );\n\n if (mightBeUsingVercel) {\n clack.log.info(\n \"▲ It seems like you're using Vercel. We recommend using the Sentry Vercel integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry\",\n );\n } else {\n await traceStep('configure-ci', () => configureCI('nextjs', authToken));\n }\n\n const packageManagerForOutro =\n packageManagerFromInstallStep ?? (await getPackageManager());\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry Next.js SDK!')} ${\n shouldCreateExamplePage\n ? `\\n\\nYou can validate your setup by (re)starting your dev environment (e.g. ${chalk.cyan(\n `${packageManagerForOutro.runScriptCommand} dev`,\n )}) and visiting ${chalk.cyan('\"/sentry-example-page\"')}`\n : ''\n }${\n shouldCreateExamplePage && isLikelyUsingTurbopack\n ? `\\nDon't forget to remove \\`--turbo\\` from your dev command until you have verified the SDK is working. You can safely add it back afterwards.`\n : ''\n }\n\n${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-javascript/issues',\n)}`);\n}\n\ntype SDKConfigOptions = {\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nasync function createOrMergeNextJsFiles(\n selectedProject: SentryProjectData,\n selfHosted: boolean,\n sentryUrl: string,\n sdkConfigOptions: SDKConfigOptions,\n) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client', 'edge'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(\n selectedProject.keys[0].dsn.public,\n configVariant,\n selectedFeatures,\n ),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created fresh ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n }\n });\n }\n\n await traceStep('setup-instrumentation-hook', async () => {\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n\n let instrumentationHookLocation: 'src' | 'root' | 'does-not-exist';\n\n const instrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.ts'),\n );\n const instrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'instrumentation.js'),\n );\n const srcInstrumentationTsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.ts'),\n );\n const srcInstrumentationJsExists = fs.existsSync(\n path.join(process.cwd(), 'src', 'instrumentation.js'),\n );\n\n // https://nextjs.org/docs/app/building-your-application/configuring/src-directory\n // https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n // The logic for where Next.js picks up the instrumentation file is as follows:\n // - If there is either an `app` folder or a `pages` folder in the root directory of your Next.js app, Next.js looks\n // for an `instrumentation.ts` file in the root of the Next.js app.\n // - Otherwise, if there is neither an `app` folder or a `pages` folder in the rood directory of your Next.js app,\n // AND if there is an `src` folder, Next.js will look for the `instrumentation.ts` file in the `src` folder.\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n if (instrumentationJsExists || instrumentationTsExists) {\n instrumentationHookLocation = 'root';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n } else {\n if (srcInstrumentationTsExists || srcInstrumentationJsExists) {\n instrumentationHookLocation = 'src';\n } else {\n instrumentationHookLocation = 'does-not-exist';\n }\n }\n\n const newInstrumentationFileName = `instrumentation.${\n typeScriptDetected ? 'ts' : 'js'\n }`;\n\n if (instrumentationHookLocation === 'does-not-exist') {\n let newInstrumentationHookLocation: 'root' | 'src';\n if (hasRootPagesDirectory || hasRootAppDirectory) {\n newInstrumentationHookLocation = 'root';\n } else if (hasSrcDirectory) {\n newInstrumentationHookLocation = 'src';\n } else {\n newInstrumentationHookLocation = 'root';\n }\n\n const newInstrumentationHookPath =\n newInstrumentationHookLocation === 'root'\n ? path.join(process.cwd(), newInstrumentationFileName)\n : path.join(process.cwd(), 'src', newInstrumentationFileName);\n\n const successfullyCreated = await createNewConfigFile(\n newInstrumentationHookPath,\n getInstrumentationHookContent(newInstrumentationHookLocation),\n );\n\n if (!successfullyCreated) {\n await showCopyPasteInstructions(\n newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(\n newInstrumentationHookLocation,\n ),\n );\n }\n } else {\n await showCopyPasteInstructions(\n srcInstrumentationTsExists || instrumentationTsExists\n ? 'instrumentation.ts'\n : srcInstrumentationJsExists || instrumentationJsExists\n ? 'instrumentation.js'\n : newInstrumentationFileName,\n getInstrumentationHookCopyPasteSnippet(instrumentationHookLocation),\n );\n }\n });\n\n await traceStep('setup-next-config', async () => {\n const withSentryConfigOptionsTemplate = getWithSentryConfigOptionsTemplate({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n selfHosted,\n sentryUrl,\n tunnelRoute: sdkConfigOptions.tunnelRoute,\n reactComponentAnnotation: sdkConfigOptions.reactComponentAnnotation,\n });\n\n const nextConfigPossibleFilesMap = {\n js: 'next.config.js',\n mjs: 'next.config.mjs',\n cjs: 'next.config.cjs',\n ts: 'next.config.ts',\n mts: 'next.config.mts',\n cts: 'next.config.cts',\n };\n\n const foundNextConfigFile = Object.entries(nextConfigPossibleFilesMap).find(\n ([, fileName]) => fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!foundNextConfigFile) {\n Sentry.setTag('next-config-strategy', 'create');\n\n // Try to figure out whether the user prefers ESM\n let isTypeModule = false;\n try {\n const packageJsonText = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const packageJson = JSON.parse(packageJsonText);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (packageJson.type === 'module') {\n isTypeModule = true;\n }\n } catch {\n // noop\n }\n\n // We are creating `next.config.(m)js` files by default as they are supported by the most Next.js versions\n const configFilename = isTypeModule\n ? nextConfigPossibleFilesMap.mjs\n : nextConfigPossibleFilesMap.js;\n const configContent = isTypeModule\n ? getNextjsConfigMjsTemplate(withSentryConfigOptionsTemplate)\n : getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate);\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFilename),\n configContent,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(configFilename)} with Sentry configuration.`,\n );\n\n return;\n }\n\n const [foundNextConfigFileType, foundNextConfigFileFilename] =\n foundNextConfigFile;\n\n if (foundNextConfigFileType === 'js' || foundNextConfigFileType === 'cjs') {\n Sentry.setTag('next-config-strategy', 'modify');\n\n const nextConfigCjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigCjsContent.includes('@sentry/nextjs') &&\n nextConfigCjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n if (shouldInject) {\n await fs.promises.appendFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate),\n 'utf8',\n );\n\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n }\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n\n if (\n foundNextConfigFileType === 'mjs' ||\n foundNextConfigFileType === 'mts' ||\n foundNextConfigFileType === 'cts' ||\n foundNextConfigFileType === 'ts'\n ) {\n const nextConfigMjsContent = fs.readFileSync(\n path.join(process.cwd(), foundNextConfigFileFilename),\n 'utf8',\n );\n\n const probablyIncludesSdk =\n nextConfigMjsContent.includes('@sentry/nextjs') &&\n nextConfigMjsContent.includes('withSentryConfig');\n\n let shouldInject = true;\n\n if (probablyIncludesSdk) {\n const injectAnyhow = await abortIfCancelled(\n clack.confirm({\n message: `${chalk.cyan(\n foundNextConfigFileFilename,\n )} already contains Sentry SDK configuration. Should the wizard modify it anyways?`,\n }),\n );\n\n shouldInject = injectAnyhow;\n }\n\n try {\n if (shouldInject) {\n const mod = parseModule(nextConfigMjsContent);\n mod.imports.$add({\n from: '@sentry/nextjs',\n imported: 'withSentryConfig',\n local: 'withSentryConfig',\n });\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access\n const expressionToWrap = generateCode(mod.exports.default.$ast).code;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n mod.exports.default = builders.raw(`withSentryConfig(\n ${expressionToWrap},\n ${withSentryConfigOptionsTemplate}\n)`);\n const newCode = mod.generate().code;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), foundNextConfigFileFilename),\n newCode,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added Sentry configuration to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}. ${chalk.dim('(you probably want to clean this up a bit!)')}`,\n );\n\n Sentry.setTag('next-config-mod-result', 'success');\n }\n } catch {\n Sentry.setTag('next-config-mod-result', 'fail');\n clack.log.warn(\n chalk.yellow(\n `Something went wrong writing to ${chalk.cyan(\n foundNextConfigFileFilename,\n )}.`,\n ),\n );\n clack.log.info(\n `Please put the following code snippet into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}: ${chalk.dim('You probably have to clean it up a bit.')}\\n`,\n );\n\n // eslint-disable-next-line no-console\n console.log(\n getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate),\n );\n\n const shouldContinue = await abortIfCancelled(\n clack.confirm({\n message: `Are you done putting the snippet above into ${chalk.cyan(\n foundNextConfigFileFilename,\n )}?`,\n active: 'Yes',\n inactive: 'No, get me out of here',\n }),\n );\n\n if (!shouldContinue) {\n await abort();\n }\n }\n }\n });\n}\n\nfunction hasDirectoryPathFromRoot(dirnameOrDirs: string | string[]): boolean {\n const dirPath = Array.isArray(dirnameOrDirs)\n ? path.join(process.cwd(), ...dirnameOrDirs)\n : path.join(process.cwd(), dirnameOrDirs);\n\n return fs.existsSync(dirPath) && fs.lstatSync(dirPath).isDirectory();\n}\n\nasync function createExamplePage(\n selfHosted: boolean,\n selectedProject: SentryProjectData,\n sentryUrl: string,\n): Promise<void> {\n const hasSrcDirectory = hasDirectoryPathFromRoot('src');\n const hasRootAppDirectory = hasDirectoryPathFromRoot('app');\n const hasRootPagesDirectory = hasDirectoryPathFromRoot('pages');\n const hasSrcAppDirectory = hasDirectoryPathFromRoot(['src', 'app']);\n const hasSrcPagesDirectory = hasDirectoryPathFromRoot(['src', 'pages']);\n\n Sentry.setTag('nextjs-app-dir', hasRootAppDirectory || hasSrcAppDirectory);\n\n const typeScriptDetected = isUsingTypeScript();\n\n // If `pages` or an `app` directory exists in the root, we'll put the example page there.\n // `app` directory takes priority over `pages` directory when they coexist, so we prioritize that.\n // https://nextjs.org/docs/app/building-your-application/routing#the-app-router\n\n const appFolderLocation = hasRootAppDirectory\n ? ['app']\n : hasSrcAppDirectory\n ? ['src', 'app']\n : undefined;\n\n let pagesFolderLocation = hasRootPagesDirectory\n ? ['pages']\n : hasSrcPagesDirectory\n ? ['src', 'pages']\n : undefined;\n\n // If the user has neither pages nor app directory we create a pages folder for them\n if (!appFolderLocation && !pagesFolderLocation) {\n const newPagesFolderLocation = hasSrcDirectory\n ? ['src', 'pages']\n : ['pages'];\n fs.mkdirSync(path.join(process.cwd(), ...newPagesFolderLocation), {\n recursive: true,\n });\n\n pagesFolderLocation = newPagesFolderLocation;\n }\n\n if (appFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: true,\n });\n\n fs.mkdirSync(\n path.join(process.cwd(), ...appFolderLocation, 'sentry-example-page'),\n {\n recursive: true,\n },\n );\n\n const newPageFileName = `page.${typeScriptDetected ? 'tsx' : 'jsx'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'sentry-example-page',\n newPageFileName,\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...appFolderLocation, 'sentry-example-page', newPageFileName),\n )}.`,\n );\n\n fs.mkdirSync(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n ),\n {\n recursive: true,\n },\n );\n\n const newRouteFileName = `route.${typeScriptDetected ? 'ts' : 'js'}`;\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n getSentryExampleAppDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(\n ...appFolderLocation,\n 'api',\n 'sentry-example-api',\n newRouteFileName,\n ),\n )}.`,\n );\n } else if (pagesFolderLocation) {\n const examplePageContents = getSentryExamplePageContents({\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n sentryUrl,\n useClient: false,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'sentry-example-page.jsx',\n ),\n examplePageContents,\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'sentry-example-page.js'),\n )}.`,\n );\n\n fs.mkdirSync(path.join(process.cwd(), ...pagesFolderLocation, 'api'), {\n recursive: true,\n });\n\n await fs.promises.writeFile(\n path.join(\n process.cwd(),\n ...pagesFolderLocation,\n 'api',\n 'sentry-example-api.js',\n ),\n getSentryExamplePagesDirApiRoute(),\n { encoding: 'utf8', flag: 'w' },\n );\n\n clack.log.success(\n `Created ${chalk.cyan(\n path.join(...pagesFolderLocation, 'api', 'sentry-example-api.js'),\n )}.`,\n );\n }\n}\n\n/**\n * Ask users if they want to set the tunnelRoute option.\n * We can't set this by default because it potentially increases hosting bills.\n * It's valuable enough to for users to justify asking the additional question.\n */\nasync function askShouldSetTunnelRoute() {\n return await traceStep('ask-tunnelRoute-option', async () => {\n const shouldSetTunnelRoute = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to route Sentry requests in the browser through your Next.js server to avoid ad blockers?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Can increase your server load and hosting bill',\n },\n {\n label: 'No',\n value: false,\n hint: 'Browser errors and events might be blocked by ad blockers before being sent to Sentry',\n },\n ],\n initialValue: true,\n }),\n );\n\n if (!shouldSetTunnelRoute) {\n clack.log.info(\n \"Sounds good! We'll leave the option commented for later, just in case :)\",\n );\n }\n\n return shouldSetTunnelRoute;\n });\n}\n\nasync function askShouldEnableReactComponentAnnotation() {\n return await traceStep('ask-react-component-annotation-option', async () => {\n const shouldEnableReactComponentAnnotation = await abortIfCancelled(\n clack.select({\n message:\n 'Do you want to enable React component annotations to make breadcrumbs and session replays more readable?',\n options: [\n {\n label: 'Yes',\n value: true,\n hint: 'Annotates React component names - increases bundle size',\n },\n {\n label: 'No',\n value: false,\n hint: 'Continue without React component annotations',\n },\n ],\n initialValue: true,\n }),\n );\n\n return shouldEnableReactComponentAnnotation;\n });\n}\n\n/**\n * Returns true or false depending on whether we think the user is using Turbopack. May return null in case we aren't sure.\n */\nasync function checkIfLikelyIsUsingTurbopack(): Promise<boolean | null> {\n let packageJsonContent: string;\n try {\n packageJsonContent = await fs.promises.readFile(\n path.join(process.cwd(), 'package.json'),\n 'utf8',\n );\n } catch {\n return null;\n }\n\n return packageJsonContent.includes('--turbo');\n}\n"]}
|
|
@@ -8,6 +8,7 @@ type WithSentryConfigOptions = {
|
|
|
8
8
|
};
|
|
9
9
|
export declare function getWithSentryConfigOptionsTemplate({ orgSlug, projectSlug, selfHosted, tunnelRoute, reactComponentAnnotation, sentryUrl, }: WithSentryConfigOptions): string;
|
|
10
10
|
export declare function getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate: string): string;
|
|
11
|
+
export declare function getNextjsConfigMjsTemplate(withSentryConfigOptionsTemplate: string): string;
|
|
11
12
|
export declare function getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate: string): string;
|
|
12
13
|
export declare function getNextjsConfigEsmCopyPasteSnippet(withSentryConfigOptionsTemplate: string): string;
|
|
13
14
|
export declare function getSentryConfigContents(dsn: string, config: 'server' | 'client' | 'edge', selectedFeaturesMap: {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getGlobalErrorCopyPasteSnippet = exports.getSentryDefaultGlobalErrorPage = exports.getInstrumentationHookCopyPasteSnippet = exports.getInstrumentationHookContent = exports.getFullUnderscoreErrorCopyPasteSnippet = exports.getSimpleUnderscoreErrorCopyPasteSnippet = exports.getSentryDefaultUnderscoreErrorPage = exports.getSentryExampleAppDirApiRoute = exports.getSentryExamplePagesDirApiRoute = exports.getSentryExamplePageContents = exports.getSentryConfigContents = exports.getNextjsConfigEsmCopyPasteSnippet = exports.getNextjsConfigCjsAppendix = exports.getNextjsConfigCjsTemplate = exports.getWithSentryConfigOptionsTemplate = void 0;
|
|
6
|
+
exports.getGlobalErrorCopyPasteSnippet = exports.getSentryDefaultGlobalErrorPage = exports.getInstrumentationHookCopyPasteSnippet = exports.getInstrumentationHookContent = exports.getFullUnderscoreErrorCopyPasteSnippet = exports.getSimpleUnderscoreErrorCopyPasteSnippet = exports.getSentryDefaultUnderscoreErrorPage = exports.getSentryExampleAppDirApiRoute = exports.getSentryExamplePagesDirApiRoute = exports.getSentryExamplePageContents = exports.getSentryConfigContents = exports.getNextjsConfigEsmCopyPasteSnippet = exports.getNextjsConfigCjsAppendix = exports.getNextjsConfigMjsTemplate = exports.getNextjsConfigCjsTemplate = exports.getWithSentryConfigOptionsTemplate = void 0;
|
|
7
7
|
var chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
var clack_utils_1 = require("../utils/clack-utils");
|
|
9
9
|
function getWithSentryConfigOptionsTemplate(_a) {
|
|
@@ -17,6 +17,10 @@ function getNextjsConfigCjsTemplate(withSentryConfigOptionsTemplate) {
|
|
|
17
17
|
return "const { withSentryConfig } = require(\"@sentry/nextjs\");\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nmodule.exports = withSentryConfig(\n nextConfig,\n ".concat(withSentryConfigOptionsTemplate, "\n);\n");
|
|
18
18
|
}
|
|
19
19
|
exports.getNextjsConfigCjsTemplate = getNextjsConfigCjsTemplate;
|
|
20
|
+
function getNextjsConfigMjsTemplate(withSentryConfigOptionsTemplate) {
|
|
21
|
+
return "import { withSentryConfig } from \"@sentry/nextjs\";\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default withSentryConfig(\n nextConfig,\n ".concat(withSentryConfigOptionsTemplate, "\n);\n");
|
|
22
|
+
}
|
|
23
|
+
exports.getNextjsConfigMjsTemplate = getNextjsConfigMjsTemplate;
|
|
20
24
|
function getNextjsConfigCjsAppendix(withSentryConfigOptionsTemplate) {
|
|
21
25
|
return "\n\n// Injected content via Sentry wizard below\n\nconst { withSentryConfig } = require(\"@sentry/nextjs\");\n\nmodule.exports = withSentryConfig(\n module.exports,\n ".concat(withSentryConfigOptionsTemplate, "\n);\n");
|
|
22
26
|
}
|