@sentry/wizard 3.27.0 → 3.29.0
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 +13 -0
- package/dist/package.json +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +56 -8
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +2 -2
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +4 -1
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/remix/remix-wizard.d.ts +1 -1
- package/dist/src/remix/remix-wizard.js +27 -11
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-setup.d.ts +24 -3
- package/dist/src/remix/sdk-setup.js +95 -61
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +64 -43
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.d.ts +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +3 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.d.ts +8 -2
- package/dist/src/sveltekit/templates.js +11 -5
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -0
- package/dist/src/utils/clack-utils.js +59 -1
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/test/remix/client-entry.test.d.ts +1 -0
- package/dist/test/remix/client-entry.test.js +41 -0
- package/dist/test/remix/client-entry.test.js.map +1 -0
- package/dist/test/remix/server-instrumentation.test.d.ts +1 -0
- package/dist/test/remix/server-instrumentation.test.js +22 -0
- package/dist/test/remix/server-instrumentation.test.js.map +1 -0
- package/dist/test/sveltekit/templates.test.d.ts +1 -0
- package/dist/test/sveltekit/templates.test.js +43 -0
- package/dist/test/sveltekit/templates.test.js.map +1 -0
- package/package.json +1 -1
- package/src/nextjs/nextjs-wizard.ts +48 -3
- package/src/nextjs/templates.ts +12 -3
- package/src/react-native/react-native-wizard.ts +4 -0
- package/src/remix/remix-wizard.ts +32 -6
- package/src/remix/sdk-setup.ts +145 -48
- package/src/sveltekit/sdk-setup.ts +100 -22
- package/src/sveltekit/sveltekit-wizard.ts +4 -1
- package/src/sveltekit/templates.ts +36 -10
- package/src/utils/clack-utils.ts +47 -1
- package/test/remix/client-entry.test.ts +122 -0
- package/test/remix/server-instrumentation.test.ts +38 -0
- package/test/sveltekit/templates.test.ts +152 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-native-wizard.js","sourceRoot":"","sources":["../../../src/react-native/react-native-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AAEzB,oDAY8B;AAC9B,sDAA+E;AAC/E,8CAA+C;AAC/C,yBAA8B;AAC9B,iCAUiB;AACjB,mCAIkB;AAClB,yCAAsD;AACtD,+BAA8E;AAE9E,2CAA6C;AAC7C,0CAAwD;AACxD,mDAAuC;AACvC,0CAAuD;AACvD,oCAAiD;AACjD,iCAGiB;AACjB,+BAA2E;AAC3E,2CAA0D;AAC1D,iDAAkD;AAElD,mEAAmE;AACnE,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,cAAc,GAAG,sBAAsB,CAAC;AAExC,QAAA,UAAU,GAAG,cAAc,CAAC;AAC5B,QAAA,aAAa,GAAG,cAAc,CAAC;AAE/B,QAAA,kBAAkB,GAAG,UAAU,CAAC;AAChC,QAAA,oBAAoB,GAAG,UAAU,CAAC;AAE/C;;;GAGG;AACU,QAAA,qCAAqC,GAAG,UAAU,CAAC;AAEhE;;GAEG;AACU,QAAA,2CAA2C,GAAG,U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C,GAAG,CAAC,IAAI,CACZ,mDAA4C,eAAK,CAAC,IAAI,CACpD,kBAAkB,CACnB,MAAG,CACL,CAAC;wBACF,sBAAO;qBACR;oBAED,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,+BAA+B,CAAC,CAAC;oBAC1E,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,2CAAoC,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAG,CACtE,CAAC;oBAEF,IAAA,qBAAS,EAAC,wBAAwB,EAAE;wBAClC,OAAA,IAAA,4BAAmB,EAAC,kBAAkB,EAAE,qBAAqB,CAAC;oBAA9D,CAA8D,CAC/D,CAAC;oBACF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,eAAK,CAAC,KAAK,CAAC,kBAAW,eAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAS,CAAC,CAChE,CAAC;;;;;CACH;AAED,SAAe,iBAAiB;;;;YAC9B,sBAAO,IAAA,qBAAS,EAAC,qBAAqB,EAAE;;;;oCACP,qBAAM,IAAA,8BAAgB,EACnD,iBAAK,CAAC,MAAM,CAAC;oCACX,OAAO,EAAE,uCAAuC;oCAChD,OAAO,EAAE;wCACP;4CACE,KAAK,EAAE,IAAI;4CACX,KAAK,EAAE,KAAK;4CACZ,IAAI,EAAE,mEAAmE;yCAC1E;wCACD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE;qCAChD;oCACD,YAAY,EAAE,IAAI;iCACnB,CAAC,CACH,EAAA;;gCAbK,sBAAsB,GAAG,SAa9B;gCACD,MAAM,CAAC,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC;gCACnE,sBAAO,sBAAsB,EAAC;;;qBAC/B,CAAC,EAAC;;;CACJ","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\nimport {\n CliSetupConfigContent,\n abortIfCancelled,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n confirmContinueIfPackageVersionNotSupported,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { podInstall } from '../apple/cocoapod';\nimport { platform } from 'os';\nimport {\n getValidExistingBuildPhases,\n findBundlePhase,\n patchBundlePhase,\n findDebugFilesUploadPhase,\n addDebugFilesUploadPhaseWithCli,\n writeXcodeProject,\n addSentryWithCliToBundleShellScript,\n addSentryWithBundledScriptsToBundleShellScript,\n addDebugFilesUploadPhaseWithBundledScripts,\n} from './xcode';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n addRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { runReactNativeUninstall } from './uninstall';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport { ReactNativeWizardOptions } from './options';\nimport { addSentryInit } from './javascript';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as Sentry from '@sentry/node';\nimport { fulfillsVersionRange } from '../utils/semver';\nimport { getIssueStreamUrl } from '../utils/url';\nimport {\n patchMetroConfigWithSentrySerializer,\n patchMetroWithSentryConfig,\n} from './metro';\nimport { patchExpoAppConfig, printSentryExpoMigrationOutro } from './expo';\nimport { addSentryToExpoMetroConfig } from './expo-metro';\nimport { addExpoEnvLocal } from './expo-env-file';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport const RN_SDK_PACKAGE = '@sentry/react-native';\n\nexport const RN_PACKAGE = 'react-native';\nexport const RN_HUMAN_NAME = 'React Native';\n\nexport const SUPPORTED_RN_RANGE = '>=0.69.0';\nexport const SUPPORTED_EXPO_RANGE = '>=50.0.0';\n\n/**\n * The following SDK version ship with bundled Xcode scripts\n * which simplifies the Xcode Build Phases setup.\n */\nexport const SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\n/**\n * The following SDK version ship with Sentry Metro plugin\n */\nexport const SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\n/**\n * The following SDK version ship with bundled Expo plugin\n */\nexport const SDK_EXPO_SUPPORTED_SDK_RANGE = `>=5.16.0`;\n\n// The following SDK version shipped `withSentryConfig`\nexport const SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE =\n '>=5.17.0';\n\nexport type RNCliSetupConfigContent = Pick<\n Required<CliSetupConfigContent>,\n 'authToken' | 'org' | 'project' | 'url'\n>;\n\nexport async function runReactNativeWizard(\n params: ReactNativeWizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: params.telemetryEnabled,\n integration: 'react-native',\n },\n () => runReactNativeWizardWithTelemetry(params),\n );\n}\n\nexport async function runReactNativeWizardWithTelemetry(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n if (options.uninstall) {\n Sentry.setTag('uninstall', true);\n return runReactNativeUninstall(options);\n }\n\n printWelcome({\n wizardName: 'Sentry React Native Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n const hasInstalled = (dep: string) => hasPackageInstalled(dep, packageJson);\n\n if (hasInstalled('sentry-expo')) {\n Sentry.setTag('has-sentry-expo-installed', true);\n printSentryExpoMigrationOutro();\n return;\n }\n\n await ensurePackageIsInstalled(packageJson, RN_PACKAGE, RN_HUMAN_NAME);\n\n const rnVersion = getPackageVersion(RN_PACKAGE, packageJson);\n if (rnVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: RN_HUMAN_NAME,\n packageVersion: rnVersion,\n packageId: RN_PACKAGE,\n acceptableVersions: SUPPORTED_RN_RANGE,\n note: `Please upgrade to ${SUPPORTED_RN_RANGE} if you wish to use the Sentry Wizard.\nOr setup using ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/',\n )}`,\n });\n }\n\n await installPackage({\n packageName: RN_SDK_PACKAGE,\n alreadyInstalled: hasPackageInstalled(RN_SDK_PACKAGE, packageJson),\n });\n const sdkVersion = getPackageVersion(\n RN_SDK_PACKAGE,\n await getPackageDotJson(),\n );\n\n const expoVersion = getPackageVersion('expo', packageJson);\n const isExpo = !!expoVersion;\n if (expoVersion && sdkVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: 'Sentry React Native SDK',\n packageVersion: sdkVersion,\n packageId: RN_SDK_PACKAGE,\n acceptableVersions: SDK_EXPO_SUPPORTED_SDK_RANGE,\n note: `Please upgrade to ${SDK_EXPO_SUPPORTED_SDK_RANGE} to continue with the wizard in this Expo project.`,\n });\n await confirmContinueIfPackageVersionNotSupported({\n packageName: 'Expo SDK',\n packageVersion: expoVersion,\n packageId: 'expo',\n acceptableVersions: SUPPORTED_EXPO_RANGE,\n note: `Please upgrade to ${SUPPORTED_EXPO_RANGE} to continue with the wizard in this Expo project.`,\n });\n }\n\n const { selectedProject, authToken, sentryUrl } =\n await getOrAskForProjectData(options, 'react-native');\n const orgSlug = selectedProject.organization.slug;\n const projectSlug = selectedProject.slug;\n const projectId = selectedProject.id;\n const cliConfig: RNCliSetupConfigContent = {\n authToken,\n org: orgSlug,\n project: projectSlug,\n url: sentryUrl,\n };\n\n await traceStep('patch-app-js', () =>\n addSentryInit({ dsn: selectedProject.keys[0].dsn.public }),\n );\n\n if (isExpo) {\n await traceStep('patch-expo-app-config', () =>\n patchExpoAppConfig(cliConfig),\n );\n await traceStep('add-expo-env-local', () => addExpoEnvLocal(cliConfig));\n }\n\n if (isExpo) {\n await traceStep('patch-metro-config', addSentryToExpoMetroConfig);\n } else {\n await traceStep('patch-metro-config', () =>\n addSentryToMetroConfig({ sdkVersion }),\n );\n }\n\n if (fs.existsSync('ios')) {\n Sentry.setTag('patch-ios', true);\n await traceStep('patch-xcode-files', () =>\n patchXcodeFiles(cliConfig, { sdkVersion }),\n );\n }\n\n if (fs.existsSync('android')) {\n Sentry.setTag('patch-android', true);\n await traceStep('patch-android-files', () => patchAndroidFiles(cliConfig));\n }\n\n const confirmedFirstException = await confirmFirstSentryException(\n sentryUrl,\n orgSlug,\n projectId,\n );\n Sentry.setTag('user-confirmed-first-error', confirmedFirstException);\n\n if (confirmedFirstException) {\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n } else {\n clack.outro(\n `${chalk.dim(\n 'Let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n }\n}\n\nfunction addSentryToMetroConfig({\n sdkVersion,\n}: {\n sdkVersion: string | undefined;\n}) {\n if (\n sdkVersion &&\n fulfillsVersionRange({\n version: sdkVersion,\n acceptableVersions:\n SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n return patchMetroWithSentryConfig();\n }\n\n if (\n sdkVersion &&\n fulfillsVersionRange({\n version: sdkVersion,\n acceptableVersions: SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n return patchMetroConfigWithSentrySerializer();\n }\n}\n\nasync function confirmFirstSentryException(\n url: string,\n orgSlug: string,\n projectId: string,\n) {\n const issuesStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\n\n clack.log\n .step(`To make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n\nAfter that check your project issues:\n\n${chalk.cyan(issuesStreamUrl)}`);\n\n // We want the code snippet to be easily copy-pasteable, without any clack artifacts\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\n<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>\n`),\n );\n\n const firstErrorConfirmed = clack.confirm({\n message: `Have you successfully sent a test event?`,\n });\n\n return firstErrorConfirmed;\n}\n\nasync function patchXcodeFiles(\n config: RNCliSetupConfigContent,\n context: {\n sdkVersion: string | undefined;\n },\n) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'ios/sentry.properties',\n gitignore: false,\n });\n\n if (platform() === 'darwin' && (await confirmPodInstall())) {\n await traceStep('pod-install', () => podInstall('ios'));\n }\n\n const xcodeProjectPath = traceStep('find-xcode-project', () =>\n getFirstMatchedPath(XCODE_PROJECT),\n );\n Sentry.setTag(\n 'xcode-project-status',\n xcodeProjectPath ? 'found' : 'not-found',\n );\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.cyan(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const [xcodeProject, buildPhasesMap] = traceStep(\n 'parse-xcode-project',\n () => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const project = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n project.parseSync();\n\n const map = getValidExistingBuildPhases(project);\n return [project, map];\n },\n );\n Sentry.setTag('xcode-project-status', 'parsed');\n\n traceStep('patch-bundle-phase', () => {\n const bundlePhase = findBundlePhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-bundle-phase-status',\n bundlePhase ? 'found' : 'not-found',\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n patchBundlePhase(\n bundlePhase,\n addSentryWithBundledScriptsToBundleShellScript,\n );\n } else {\n patchBundlePhase(bundlePhase, addSentryWithCliToBundleShellScript);\n }\n Sentry.setTag('xcode-bundle-phase-status', 'patched');\n });\n\n traceStep('add-debug-files-upload-phase', () => {\n const debugFilesUploadPhaseExists =\n !!findDebugFilesUploadPhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-debug-files-upload-phase-status',\n debugFilesUploadPhaseExists ? 'already-exists' : undefined,\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n addDebugFilesUploadPhaseWithBundledScripts(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n } else {\n addDebugFilesUploadPhaseWithCli(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n }\n Sentry.setTag('xcode-debug-files-upload-phase-status', 'added');\n });\n\n traceStep('write-xcode-project', () => {\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n });\n Sentry.setTag('xcode-project-status', 'patched');\n}\n\nasync function patchAndroidFiles(config: RNCliSetupConfigContent) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'android/sentry.properties',\n gitignore: false,\n });\n\n const appBuildGradlePath = traceStep('find-app-build-gradle', () =>\n getFirstMatchedPath(APP_BUILD_GRADLE),\n );\n Sentry.setTag(\n 'app-build-gradle-status',\n appBuildGradlePath ? 'found' : 'not-found',\n );\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android ${chalk.cyan(\n 'app/build.gradle',\n )} file using ${chalk.cyan(APP_BUILD_GRADLE)}.`,\n );\n return;\n }\n\n const appBuildGradle = traceStep('read-app-build-gradle', () =>\n fs.readFileSync(appBuildGradlePath, 'utf-8'),\n );\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (includesSentry) {\n Sentry.setTag('app-build-gradle-status', 'already-includes-sentry');\n clack.log.warn(\n `Android ${chalk.cyan('app/build.gradle')} file already includes Sentry.`,\n );\n return;\n }\n\n const patchedAppBuildGradle = traceStep('add-rn-sentry-gradle-plugin', () =>\n addRNSentryGradlePlugin(appBuildGradle),\n );\n if (!doesAppBuildGradleIncludeRNSentryGradlePlugin(patchedAppBuildGradle)) {\n Sentry.setTag(\n 'app-build-gradle-status',\n 'failed-to-add-rn-sentry-gradle-plugin',\n );\n clack.log.warn(\n `Could not add Sentry RN Gradle Plugin to ${chalk.cyan(\n 'app/build.gradle',\n )}.`,\n );\n return;\n }\n\n Sentry.setTag('app-build-gradle-status', 'added-rn-sentry-gradle-plugin');\n clack.log.success(\n `Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`,\n );\n\n traceStep('write-app-build-gradle', () =>\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle),\n );\n clack.log.success(\n chalk.green(`Android ${chalk.cyan('app/build.gradle')} saved.`),\n );\n}\n\nasync function confirmPodInstall(): Promise<boolean> {\n return traceStep('confirm-pod-install', async () => {\n const continueWithPodInstall = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run `pod install` now?',\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended for smaller projects, this might take several minutes',\n },\n { value: false, label: `No, I'll do it later` },\n ],\n initialValue: true,\n }),\n );\n Sentry.setTag('continue-with-pod-install', continueWithPodInstall);\n return continueWithPodInstall;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"react-native-wizard.js","sourceRoot":"","sources":["../../../src/react-native/react-native-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,qCAAyB;AAEzB,oDAa8B;AAC9B,sDAA+E;AAC/E,8CAA+C;AAC/C,yBAA8B;AAC9B,iCAUiB;AACjB,mCAIkB;AAClB,yCAAsD;AACtD,+BAA8E;A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,MAAM,CAAC;oCACX,OAAO,EAAE,uCAAuC;oCAChD,OAAO,EAAE;wCACP;4CACE,KAAK,EAAE,IAAI;4CACX,KAAK,EAAE,KAAK;4CACZ,IAAI,EAAE,mEAAmE;yCAC1E;wCACD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,sBAAsB,EAAE;qCAChD;oCACD,YAAY,EAAE,IAAI;iCACnB,CAAC,CACH,EAAA;;gCAbK,sBAAsB,GAAG,SAa9B;gCACD,MAAM,CAAC,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,CAAC,CAAC;gCACnE,sBAAO,sBAAsB,EAAC;;;qBAC/B,CAAC,EAAC;;;CACJ","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\nimport {\n CliSetupConfigContent,\n abortIfCancelled,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n confirmContinueIfPackageVersionNotSupported,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n propertiesCliSetupConfig,\n runPrettierIfInstalled,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { podInstall } from '../apple/cocoapod';\nimport { platform } from 'os';\nimport {\n getValidExistingBuildPhases,\n findBundlePhase,\n patchBundlePhase,\n findDebugFilesUploadPhase,\n addDebugFilesUploadPhaseWithCli,\n writeXcodeProject,\n addSentryWithCliToBundleShellScript,\n addSentryWithBundledScriptsToBundleShellScript,\n addDebugFilesUploadPhaseWithBundledScripts,\n} from './xcode';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n addRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { runReactNativeUninstall } from './uninstall';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport { ReactNativeWizardOptions } from './options';\nimport { addSentryInit } from './javascript';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as Sentry from '@sentry/node';\nimport { fulfillsVersionRange } from '../utils/semver';\nimport { getIssueStreamUrl } from '../utils/url';\nimport {\n patchMetroConfigWithSentrySerializer,\n patchMetroWithSentryConfig,\n} from './metro';\nimport { patchExpoAppConfig, printSentryExpoMigrationOutro } from './expo';\nimport { addSentryToExpoMetroConfig } from './expo-metro';\nimport { addExpoEnvLocal } from './expo-env-file';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\nconst xcode = require('xcode');\n\nexport const RN_SDK_PACKAGE = '@sentry/react-native';\n\nexport const RN_PACKAGE = 'react-native';\nexport const RN_HUMAN_NAME = 'React Native';\n\nexport const SUPPORTED_RN_RANGE = '>=0.69.0';\nexport const SUPPORTED_EXPO_RANGE = '>=50.0.0';\n\n/**\n * The following SDK version ship with bundled Xcode scripts\n * which simplifies the Xcode Build Phases setup.\n */\nexport const SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\n/**\n * The following SDK version ship with Sentry Metro plugin\n */\nexport const SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE = '>=5.11.0';\n\n/**\n * The following SDK version ship with bundled Expo plugin\n */\nexport const SDK_EXPO_SUPPORTED_SDK_RANGE = `>=5.16.0`;\n\n// The following SDK version shipped `withSentryConfig`\nexport const SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE =\n '>=5.17.0';\n\nexport type RNCliSetupConfigContent = Pick<\n Required<CliSetupConfigContent>,\n 'authToken' | 'org' | 'project' | 'url'\n>;\n\nexport async function runReactNativeWizard(\n params: ReactNativeWizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: params.telemetryEnabled,\n integration: 'react-native',\n },\n () => runReactNativeWizardWithTelemetry(params),\n );\n}\n\nexport async function runReactNativeWizardWithTelemetry(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n if (options.uninstall) {\n Sentry.setTag('uninstall', true);\n return runReactNativeUninstall(options);\n }\n\n printWelcome({\n wizardName: 'Sentry React Native Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n const hasInstalled = (dep: string) => hasPackageInstalled(dep, packageJson);\n\n if (hasInstalled('sentry-expo')) {\n Sentry.setTag('has-sentry-expo-installed', true);\n printSentryExpoMigrationOutro();\n return;\n }\n\n await ensurePackageIsInstalled(packageJson, RN_PACKAGE, RN_HUMAN_NAME);\n\n const rnVersion = getPackageVersion(RN_PACKAGE, packageJson);\n if (rnVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: RN_HUMAN_NAME,\n packageVersion: rnVersion,\n packageId: RN_PACKAGE,\n acceptableVersions: SUPPORTED_RN_RANGE,\n note: `Please upgrade to ${SUPPORTED_RN_RANGE} if you wish to use the Sentry Wizard.\nOr setup using ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/',\n )}`,\n });\n }\n\n await installPackage({\n packageName: RN_SDK_PACKAGE,\n alreadyInstalled: hasPackageInstalled(RN_SDK_PACKAGE, packageJson),\n });\n const sdkVersion = getPackageVersion(\n RN_SDK_PACKAGE,\n await getPackageDotJson(),\n );\n\n const expoVersion = getPackageVersion('expo', packageJson);\n const isExpo = !!expoVersion;\n if (expoVersion && sdkVersion) {\n await confirmContinueIfPackageVersionNotSupported({\n packageName: 'Sentry React Native SDK',\n packageVersion: sdkVersion,\n packageId: RN_SDK_PACKAGE,\n acceptableVersions: SDK_EXPO_SUPPORTED_SDK_RANGE,\n note: `Please upgrade to ${SDK_EXPO_SUPPORTED_SDK_RANGE} to continue with the wizard in this Expo project.`,\n });\n await confirmContinueIfPackageVersionNotSupported({\n packageName: 'Expo SDK',\n packageVersion: expoVersion,\n packageId: 'expo',\n acceptableVersions: SUPPORTED_EXPO_RANGE,\n note: `Please upgrade to ${SUPPORTED_EXPO_RANGE} to continue with the wizard in this Expo project.`,\n });\n }\n\n const { selectedProject, authToken, sentryUrl } =\n await getOrAskForProjectData(options, 'react-native');\n const orgSlug = selectedProject.organization.slug;\n const projectSlug = selectedProject.slug;\n const projectId = selectedProject.id;\n const cliConfig: RNCliSetupConfigContent = {\n authToken,\n org: orgSlug,\n project: projectSlug,\n url: sentryUrl,\n };\n\n await traceStep('patch-app-js', () =>\n addSentryInit({ dsn: selectedProject.keys[0].dsn.public }),\n );\n\n if (isExpo) {\n await traceStep('patch-expo-app-config', () =>\n patchExpoAppConfig(cliConfig),\n );\n await traceStep('add-expo-env-local', () => addExpoEnvLocal(cliConfig));\n }\n\n if (isExpo) {\n await traceStep('patch-metro-config', addSentryToExpoMetroConfig);\n } else {\n await traceStep('patch-metro-config', () =>\n addSentryToMetroConfig({ sdkVersion }),\n );\n }\n\n if (fs.existsSync('ios')) {\n Sentry.setTag('patch-ios', true);\n await traceStep('patch-xcode-files', () =>\n patchXcodeFiles(cliConfig, { sdkVersion }),\n );\n }\n\n if (fs.existsSync('android')) {\n Sentry.setTag('patch-android', true);\n await traceStep('patch-android-files', () => patchAndroidFiles(cliConfig));\n }\n\n await runPrettierIfInstalled();\n\n const confirmedFirstException = await confirmFirstSentryException(\n sentryUrl,\n orgSlug,\n projectId,\n );\n\n Sentry.setTag('user-confirmed-first-error', confirmedFirstException);\n\n if (confirmedFirstException) {\n clack.outro(\n `${chalk.green('Everything is set up!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n } else {\n clack.outro(\n `${chalk.dim(\n 'Let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n }\n}\n\nfunction addSentryToMetroConfig({\n sdkVersion,\n}: {\n sdkVersion: string | undefined;\n}) {\n if (\n sdkVersion &&\n fulfillsVersionRange({\n version: sdkVersion,\n acceptableVersions:\n SDK_SENTRY_METRO_WITH_SENTRY_CONFIG_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n return patchMetroWithSentryConfig();\n }\n\n if (\n sdkVersion &&\n fulfillsVersionRange({\n version: sdkVersion,\n acceptableVersions: SDK_SENTRY_METRO_PLUGIN_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n return patchMetroConfigWithSentrySerializer();\n }\n}\n\nasync function confirmFirstSentryException(\n url: string,\n orgSlug: string,\n projectId: string,\n) {\n const issuesStreamUrl = getIssueStreamUrl({ url, orgSlug, projectId });\n\n clack.log\n .step(`To make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n\nAfter that check your project issues:\n\n${chalk.cyan(issuesStreamUrl)}`);\n\n // We want the code snippet to be easily copy-pasteable, without any clack artifacts\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\n<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>\n`),\n );\n\n const firstErrorConfirmed = clack.confirm({\n message: `Have you successfully sent a test event?`,\n });\n\n return firstErrorConfirmed;\n}\n\nasync function patchXcodeFiles(\n config: RNCliSetupConfigContent,\n context: {\n sdkVersion: string | undefined;\n },\n) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'ios/sentry.properties',\n gitignore: false,\n });\n\n if (platform() === 'darwin' && (await confirmPodInstall())) {\n await traceStep('pod-install', () => podInstall('ios'));\n }\n\n const xcodeProjectPath = traceStep('find-xcode-project', () =>\n getFirstMatchedPath(XCODE_PROJECT),\n );\n Sentry.setTag(\n 'xcode-project-status',\n xcodeProjectPath ? 'found' : 'not-found',\n );\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.cyan(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const [xcodeProject, buildPhasesMap] = traceStep(\n 'parse-xcode-project',\n () => {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const project = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n project.parseSync();\n\n const map = getValidExistingBuildPhases(project);\n return [project, map];\n },\n );\n Sentry.setTag('xcode-project-status', 'parsed');\n\n traceStep('patch-bundle-phase', () => {\n const bundlePhase = findBundlePhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-bundle-phase-status',\n bundlePhase ? 'found' : 'not-found',\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n patchBundlePhase(\n bundlePhase,\n addSentryWithBundledScriptsToBundleShellScript,\n );\n } else {\n patchBundlePhase(bundlePhase, addSentryWithCliToBundleShellScript);\n }\n Sentry.setTag('xcode-bundle-phase-status', 'patched');\n });\n\n traceStep('add-debug-files-upload-phase', () => {\n const debugFilesUploadPhaseExists =\n !!findDebugFilesUploadPhase(buildPhasesMap);\n Sentry.setTag(\n 'xcode-debug-files-upload-phase-status',\n debugFilesUploadPhaseExists ? 'already-exists' : undefined,\n );\n if (\n context.sdkVersion &&\n fulfillsVersionRange({\n version: context.sdkVersion,\n acceptableVersions: SDK_XCODE_SCRIPTS_SUPPORTED_SDK_RANGE,\n canBeLatest: true,\n })\n ) {\n addDebugFilesUploadPhaseWithBundledScripts(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n } else {\n addDebugFilesUploadPhaseWithCli(xcodeProject, {\n debugFilesUploadPhaseExists,\n });\n }\n Sentry.setTag('xcode-debug-files-upload-phase-status', 'added');\n });\n\n traceStep('write-xcode-project', () => {\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n });\n Sentry.setTag('xcode-project-status', 'patched');\n}\n\nasync function patchAndroidFiles(config: RNCliSetupConfigContent) {\n await addSentryCliConfig(config, {\n ...propertiesCliSetupConfig,\n name: 'source maps and iOS debug files',\n filename: 'android/sentry.properties',\n gitignore: false,\n });\n\n const appBuildGradlePath = traceStep('find-app-build-gradle', () =>\n getFirstMatchedPath(APP_BUILD_GRADLE),\n );\n Sentry.setTag(\n 'app-build-gradle-status',\n appBuildGradlePath ? 'found' : 'not-found',\n );\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android ${chalk.cyan(\n 'app/build.gradle',\n )} file using ${chalk.cyan(APP_BUILD_GRADLE)}.`,\n );\n return;\n }\n\n const appBuildGradle = traceStep('read-app-build-gradle', () =>\n fs.readFileSync(appBuildGradlePath, 'utf-8'),\n );\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (includesSentry) {\n Sentry.setTag('app-build-gradle-status', 'already-includes-sentry');\n clack.log.warn(\n `Android ${chalk.cyan('app/build.gradle')} file already includes Sentry.`,\n );\n return;\n }\n\n const patchedAppBuildGradle = traceStep('add-rn-sentry-gradle-plugin', () =>\n addRNSentryGradlePlugin(appBuildGradle),\n );\n if (!doesAppBuildGradleIncludeRNSentryGradlePlugin(patchedAppBuildGradle)) {\n Sentry.setTag(\n 'app-build-gradle-status',\n 'failed-to-add-rn-sentry-gradle-plugin',\n );\n clack.log.warn(\n `Could not add Sentry RN Gradle Plugin to ${chalk.cyan(\n 'app/build.gradle',\n )}.`,\n );\n return;\n }\n\n Sentry.setTag('app-build-gradle-status', 'added-rn-sentry-gradle-plugin');\n clack.log.success(\n `Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`,\n );\n\n traceStep('write-app-build-gradle', () =>\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle),\n );\n clack.log.success(\n chalk.green(`Android ${chalk.cyan('app/build.gradle')} saved.`),\n );\n}\n\nasync function confirmPodInstall(): Promise<boolean> {\n return traceStep('confirm-pod-install', async () => {\n const continueWithPodInstall = await abortIfCancelled(\n clack.select({\n message: 'Do you want to run `pod install` now?',\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended for smaller projects, this might take several minutes',\n },\n { value: false, label: `No, I'll do it later` },\n ],\n initialValue: true,\n }),\n );\n Sentry.setTag('continue-with-pod-install', continueWithPodInstall);\n return continueWithPodInstall;\n });\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { WizardOptions } from '../utils/types';
|
|
1
|
+
import type { WizardOptions } from '../utils/types';
|
|
2
2
|
export declare function runRemixWizard(options: WizardOptions): Promise<void>;
|
|
@@ -66,7 +66,7 @@ function runRemixWizard(options) {
|
|
|
66
66
|
exports.runRemixWizard = runRemixWizard;
|
|
67
67
|
function runRemixWizardWithTelemetry(options) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig, instrumentationFile, serverFileInstrumented, shouldCreateExamplePage;
|
|
69
|
+
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig, selectedFeatures, instrumentationFile, serverFileInstrumented, shouldCreateExamplePage;
|
|
70
70
|
var _this = this;
|
|
71
71
|
return __generator(this, function (_b) {
|
|
72
72
|
switch (_b.label) {
|
|
@@ -103,9 +103,20 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
103
103
|
isTS = (0, clack_utils_1.isUsingTypeScript)();
|
|
104
104
|
isV2 = (0, sdk_setup_1.isRemixV2)(remixConfig, packageJson);
|
|
105
105
|
viteConfig = (0, ast_utils_1.findFile)('vite.config');
|
|
106
|
-
return [4 /*yield*/, (0, clack_utils_1.
|
|
106
|
+
return [4 /*yield*/, (0, clack_utils_1.featureSelectionPrompt)([
|
|
107
|
+
{
|
|
108
|
+
id: 'performance',
|
|
109
|
+
prompt: "Do you want to enable ".concat(chalk_1.default.bold('Tracing'), " to track the performance of your application?"),
|
|
110
|
+
enabledHint: 'recommended',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'replay',
|
|
114
|
+
prompt: "Do you want to enable ".concat(chalk_1.default.bold('Sentry Session Replay'), " to get a video-like reproduction of errors during a user session?"),
|
|
115
|
+
enabledHint: 'recommended, but increases bundle size',
|
|
116
|
+
},
|
|
117
|
+
])];
|
|
107
118
|
case 7:
|
|
108
|
-
_b.sent();
|
|
119
|
+
selectedFeatures = _b.sent();
|
|
109
120
|
if (!viteConfig) return [3 /*break*/, 9];
|
|
110
121
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('Update vite configuration for sourcemap uploads', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
111
122
|
var e_1;
|
|
@@ -141,7 +152,7 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
141
152
|
return __generator(this, function (_a) {
|
|
142
153
|
switch (_a.label) {
|
|
143
154
|
case 0:
|
|
144
|
-
_a.trys.push([0,
|
|
155
|
+
_a.trys.push([0, 3, , 4]);
|
|
145
156
|
return [4 /*yield*/, (0, sdk_setup_1.updateBuildScript)({
|
|
146
157
|
org: selectedProject.organization.slug,
|
|
147
158
|
project: selectedProject.slug,
|
|
@@ -150,14 +161,17 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
150
161
|
})];
|
|
151
162
|
case 1:
|
|
152
163
|
_a.sent();
|
|
153
|
-
return [
|
|
164
|
+
return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)({ authToken: authToken }, clack_utils_1.rcCliSetupConfig)];
|
|
154
165
|
case 2:
|
|
166
|
+
_a.sent();
|
|
167
|
+
return [3 /*break*/, 4];
|
|
168
|
+
case 3:
|
|
155
169
|
e_2 = _a.sent();
|
|
156
170
|
prompts_1.default.log
|
|
157
171
|
.warn("Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/");
|
|
158
172
|
(0, debug_1.debug)(e_2);
|
|
159
|
-
return [3 /*break*/,
|
|
160
|
-
case
|
|
173
|
+
return [3 /*break*/, 4];
|
|
174
|
+
case 4: return [2 /*return*/];
|
|
161
175
|
}
|
|
162
176
|
});
|
|
163
177
|
}); })];
|
|
@@ -200,7 +214,7 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
200
214
|
switch (_a.label) {
|
|
201
215
|
case 0:
|
|
202
216
|
_a.trys.push([0, 2, , 3]);
|
|
203
|
-
return [4 /*yield*/, (0, sdk_setup_1.initializeSentryOnEntryClient)(dsn, isTS)];
|
|
217
|
+
return [4 /*yield*/, (0, sdk_setup_1.initializeSentryOnEntryClient)(dsn, isTS, selectedFeatures)];
|
|
204
218
|
case 1:
|
|
205
219
|
_a.sent();
|
|
206
220
|
return [3 /*break*/, 3];
|
|
@@ -222,7 +236,7 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
222
236
|
switch (_a.label) {
|
|
223
237
|
case 0:
|
|
224
238
|
_a.trys.push([0, 2, , 3]);
|
|
225
|
-
return [4 /*yield*/, (0, sdk_setup_1.createServerInstrumentationFile)(dsn)];
|
|
239
|
+
return [4 /*yield*/, (0, sdk_setup_1.createServerInstrumentationFile)(dsn, selectedFeatures)];
|
|
226
240
|
case 1:
|
|
227
241
|
instrumentationFile = _a.sent();
|
|
228
242
|
return [3 /*break*/, 3];
|
|
@@ -244,7 +258,7 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
244
258
|
switch (_a.label) {
|
|
245
259
|
case 0:
|
|
246
260
|
_a.trys.push([0, 2, , 3]);
|
|
247
|
-
return [4 /*yield*/, (0, sdk_setup_1.insertServerInstrumentationFile)(dsn)];
|
|
261
|
+
return [4 /*yield*/, (0, sdk_setup_1.insertServerInstrumentationFile)(dsn, selectedFeatures)];
|
|
248
262
|
case 1:
|
|
249
263
|
serverFileInstrumented = _a.sent();
|
|
250
264
|
return [3 /*break*/, 3];
|
|
@@ -327,7 +341,9 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
327
341
|
case 20:
|
|
328
342
|
_b.sent();
|
|
329
343
|
_b.label = 21;
|
|
330
|
-
case 21:
|
|
344
|
+
case 21: return [4 /*yield*/, (0, clack_utils_1.runPrettierIfInstalled)()];
|
|
345
|
+
case 22:
|
|
346
|
+
_b.sent();
|
|
331
347
|
prompts_1.default.outro("\n".concat(chalk_1.default.green('Sentry has been successfully configured for your Remix project.'), "\n\n").concat(chalk_1.default.cyan('You can now deploy your project to see Sentry in action.'), "\n\n").concat(chalk_1.default.cyan("To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/")));
|
|
332
348
|
return [2 /*return*/];
|
|
333
349
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAW8B;AAC9B,sDAA4D;AAE5D,yCAWqB;AACrB,wCAAuC;AACvC,0CAAwD;AACxD,iCAAwC;AACxC,iDAAkD;AAClD,gDAA8C;AAC9C,iDAA+D;AAC/D,6CAAkD;AAElD,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,OAAO;iBACrB,EACD,cAAM,OAAA,2BAA2B,CAAC,OAAO,CAAC,EAApC,CAAoC,CAC3C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,2BAA2B,CACxC,OAAsB;;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;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AAC,GAAG;6CACN,IAAI,CAAC,8LACuG,CAAC,CAAC;wCACjH,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;;;;;6BAEZ,CACF,EAAA;;oBAZD,SAYC,CAAC;;yBAGJ,qBAAM,IAAA,qBAAS,EAAC,iCAAiC,EAAE;;;;;;oCAE/C,qBAAM,IAAA,yCAA6B,EAAC,IAAI,EAAE,IAAI,CAAC,EAAA;;oCAA/C,SAA+C,CAAC;;;;oCAEhD,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sKACkG,CAAC,CAAC;oCACnH,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;;;;;yBAEZ,CAAC,EAAA;;oBARF,SAQE,CAAC;oBAE6B,qBAAM,IAAA,wCAA0B,GAAE,EAAA;;oBAA5D,uBAAuB,GAAG,SAAkC;yBAE9D,uBAAuB,EAAvB,yBAAuB;oBACzB,qBAAM,IAAA,qBAAS,EAAC,qBAAqB,EAAE;;;4CACrC,qBAAM,IAAA,+BAAiB,EAAC;4CACtB,IAAI,MAAA;4CACJ,UAAU,YAAA;4CACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;4CAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;4CAC7B,GAAG,EAAE,SAAS;yCACf,CAAC,EAAA;;wCANF,SAME,CAAC;;;;6BACJ,CAAC,EAAA;;oBARF,SAQE,CAAC;;;oBAGL,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n instrumentSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n insertServerInstrumentationFile,\n createServerInstrumentationFile,\n updateStartScript,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n let instrumentationFile = '';\n\n await traceStep('Create server instrumentation file', async () => {\n try {\n instrumentationFile = await createServerInstrumentationFile(dsn);\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n });\n\n let serverFileInstrumented = false;\n\n await traceStep(\n 'Create server instrumentation file and import it',\n async () => {\n try {\n serverFileInstrumented = await insertServerInstrumentationFile(dsn);\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n },\n );\n\n if (!serverFileInstrumented && instrumentationFile) {\n await traceStep(\n 'Update `start` script to import instrumentation file.',\n async () => {\n try {\n await updateStartScript(instrumentationFile);\n } catch (e) {\n clack.log\n .warn(`Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n },\n );\n }\n\n await traceStep('Instrument server `handleError`', async () => {\n try {\n await instrumentSentryOnEntryServer(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAa8B;AAC9B,sDAA4D;AAE5D,yCAWqB;AACrB,wCAAuC;AACvC,0CAAwD;AACx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AAC;;;;oCAEhD,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,sKACkG,CAAC,CAAC;oCACnH,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;;;;;yBAEZ,CAAC,EAAA;;oBARF,SAQE,CAAC;oBAE6B,qBAAM,IAAA,wCAA0B,GAAE,EAAA;;oBAA5D,uBAAuB,GAAG,SAAkC;yBAE9D,uBAAuB,EAAvB,yBAAuB;oBACzB,qBAAM,IAAA,qBAAS,EAAC,qBAAqB,EAAE;;;4CACrC,qBAAM,IAAA,+BAAiB,EAAC;4CACtB,IAAI,MAAA;4CACJ,UAAU,YAAA;4CACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;4CAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;4CAC7B,GAAG,EAAE,SAAS;yCACf,CAAC,EAAA;;wCANF,SAME,CAAC;;;;6BACJ,CAAC,EAAA;;oBARF,SAQE,CAAC;;yBAGL,qBAAM,IAAA,oCAAsB,GAAE,EAAA;;oBAA9B,SAA8B,CAAC;oBAE/B,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n runPrettierIfInstalled,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport type { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n instrumentSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n insertServerInstrumentationFile,\n createServerInstrumentationFile,\n updateStartScript,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\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 if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS, selectedFeatures);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n let instrumentationFile = '';\n\n await traceStep('Create server instrumentation file', async () => {\n try {\n instrumentationFile = await createServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n });\n\n let serverFileInstrumented = false;\n\n await traceStep(\n 'Create server instrumentation file and import it',\n async () => {\n try {\n serverFileInstrumented = await insertServerInstrumentationFile(\n dsn,\n selectedFeatures,\n );\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n },\n );\n\n if (!serverFileInstrumented && instrumentationFile) {\n await traceStep(\n 'Update `start` script to import instrumentation file.',\n async () => {\n try {\n await updateStartScript(instrumentationFile);\n } catch (e) {\n clack.log\n .warn(`Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n },\n );\n }\n\n await traceStep('Instrument server `handleError`', async () => {\n try {\n await instrumentSentryOnEntryServer(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n await runPrettierIfInstalled();\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProxifiedModule } from 'magicast';
|
|
1
2
|
import type { PackageDotJson } from '../utils/package-json';
|
|
2
3
|
export type PartialRemixConfig = {
|
|
3
4
|
unstable_dev?: boolean;
|
|
@@ -11,8 +12,21 @@ export type PartialRemixConfig = {
|
|
|
11
12
|
};
|
|
12
13
|
};
|
|
13
14
|
export declare function runRemixReveal(isTS: boolean): void;
|
|
14
|
-
export declare function
|
|
15
|
-
|
|
15
|
+
export declare function generateServerInstrumentationFile(dsn: string, selectedFeatures: {
|
|
16
|
+
performance: boolean;
|
|
17
|
+
replay: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
instrumentationFile: string;
|
|
20
|
+
instrumentationFileMod: ProxifiedModule<any>;
|
|
21
|
+
};
|
|
22
|
+
export declare function createServerInstrumentationFile(dsn: string, selectedFeatures: {
|
|
23
|
+
performance: boolean;
|
|
24
|
+
replay: boolean;
|
|
25
|
+
}): Promise<string>;
|
|
26
|
+
export declare function insertServerInstrumentationFile(dsn: string, selectedFeatures: {
|
|
27
|
+
performance: boolean;
|
|
28
|
+
replay: boolean;
|
|
29
|
+
}): Promise<boolean>;
|
|
16
30
|
export declare function isRemixV2(remixConfig: PartialRemixConfig, packageJson: PackageDotJson): boolean;
|
|
17
31
|
export declare function loadRemixConfig(): Promise<PartialRemixConfig>;
|
|
18
32
|
export declare function instrumentRootRoute(isV2?: boolean, isTS?: boolean): Promise<void>;
|
|
@@ -22,6 +36,13 @@ export declare function updateBuildScript(args: {
|
|
|
22
36
|
url?: string;
|
|
23
37
|
isHydrogen: boolean;
|
|
24
38
|
}): Promise<void>;
|
|
25
|
-
export declare function
|
|
39
|
+
export declare function updateEntryClientMod(originalEntryClientMod: ProxifiedModule<any>, dsn: string, selectedFeatures: {
|
|
40
|
+
performance: boolean;
|
|
41
|
+
replay: boolean;
|
|
42
|
+
}): ProxifiedModule<any>;
|
|
43
|
+
export declare function initializeSentryOnEntryClient(dsn: string, isTS: boolean, selectedFeatures: {
|
|
44
|
+
performance: boolean;
|
|
45
|
+
replay: boolean;
|
|
46
|
+
}): Promise<void>;
|
|
26
47
|
export declare function updateStartScript(instrumentationFile: string): Promise<void>;
|
|
27
48
|
export declare function instrumentSentryOnEntryServer(isV2: boolean, isTS: boolean): Promise<void>;
|
|
@@ -63,7 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
63
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
64
64
|
};
|
|
65
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
-
exports.instrumentSentryOnEntryServer = exports.updateStartScript = exports.initializeSentryOnEntryClient = exports.updateBuildScript = exports.instrumentRootRoute = exports.loadRemixConfig = exports.isRemixV2 = exports.insertServerInstrumentationFile = exports.createServerInstrumentationFile = exports.runRemixReveal = void 0;
|
|
66
|
+
exports.instrumentSentryOnEntryServer = exports.updateStartScript = exports.initializeSentryOnEntryClient = exports.updateEntryClientMod = exports.updateBuildScript = exports.instrumentRootRoute = exports.loadRemixConfig = exports.isRemixV2 = exports.insertServerInstrumentationFile = exports.createServerInstrumentationFile = exports.generateServerInstrumentationFile = exports.runRemixReveal = void 0;
|
|
67
67
|
var fs = __importStar(require("fs"));
|
|
68
68
|
var path = __importStar(require("path"));
|
|
69
69
|
var url = __importStar(require("url"));
|
|
@@ -97,17 +97,41 @@ function runRemixReveal(isTS) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
exports.runRemixReveal = runRemixReveal;
|
|
100
|
-
function
|
|
101
|
-
var
|
|
100
|
+
function getInitCallArgs(dsn, type, selectedFeatures) {
|
|
101
|
+
var initCallArgs = {
|
|
102
102
|
dsn: dsn,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
};
|
|
104
|
+
// Adding tracing sample rate for both client and server
|
|
105
|
+
if (selectedFeatures.performance) {
|
|
106
|
+
initCallArgs.tracesSampleRate = 1.0;
|
|
107
|
+
}
|
|
108
|
+
// Adding integrations and replay options only for client
|
|
109
|
+
if (type === 'client' &&
|
|
110
|
+
(selectedFeatures.performance || selectedFeatures.replay)) {
|
|
111
|
+
initCallArgs.integrations = [];
|
|
112
|
+
if (selectedFeatures.performance) {
|
|
113
|
+
// @ts-expect-error - Adding Proxified AST node to the array
|
|
114
|
+
initCallArgs.integrations.push(magicast_1.builders.functionCall('Sentry.browserTracingIntegration', magicast_1.builders.raw('{ useEffect, useLocation, useMatches }')));
|
|
115
|
+
}
|
|
116
|
+
if (selectedFeatures.replay) {
|
|
117
|
+
// @ts-expect-error - Adding Proxified AST node to the array
|
|
118
|
+
initCallArgs.integrations.push(magicast_1.builders.functionCall('Sentry.replayIntegration', {
|
|
119
|
+
maskAllText: true,
|
|
120
|
+
blockAllMedia: true,
|
|
121
|
+
}));
|
|
122
|
+
initCallArgs.replaysSessionSampleRate = 0.1;
|
|
123
|
+
initCallArgs.replaysOnErrorSampleRate = 1.0;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Adding autoInstrumentRemix option only for server
|
|
127
|
+
if (type === 'server') {
|
|
128
|
+
initCallArgs.autoInstrumentRemix = true;
|
|
129
|
+
}
|
|
130
|
+
return initCallArgs;
|
|
131
|
+
}
|
|
132
|
+
function insertClientInitCall(dsn, originalHooksMod, selectedFeatures) {
|
|
133
|
+
var initCallArgs = getInitCallArgs(dsn, 'client', selectedFeatures);
|
|
134
|
+
var initCall = magicast_1.builders.functionCall('Sentry.init', initCallArgs);
|
|
111
135
|
var originalHooksModAST = originalHooksMod.$ast;
|
|
112
136
|
var initCallInsertionIndex = (0, utils_1.getAfterImportsInsertionIndex)(originalHooksModAST);
|
|
113
137
|
originalHooksModAST.body.splice(initCallInsertionIndex, 0,
|
|
@@ -115,45 +139,48 @@ function insertClientInitCall(dsn, originalHooksMod) {
|
|
|
115
139
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
116
140
|
(0, magicast_1.generateCode)(initCall).code);
|
|
117
141
|
}
|
|
118
|
-
function
|
|
142
|
+
function generateServerInstrumentationFile(dsn, selectedFeatures) {
|
|
143
|
+
// create an empty file named `instrument.server.mjs`
|
|
144
|
+
var instrumentationFile = 'instrumentation.server.mjs';
|
|
145
|
+
var instrumentationFileMod = (0, magicast_1.parseModule)('');
|
|
146
|
+
instrumentationFileMod.imports.$add({
|
|
147
|
+
from: '@sentry/remix',
|
|
148
|
+
imported: '*',
|
|
149
|
+
local: 'Sentry',
|
|
150
|
+
});
|
|
151
|
+
var initCallArgs = getInitCallArgs(dsn, 'server', selectedFeatures);
|
|
152
|
+
var initCall = magicast_1.builders.functionCall('Sentry.init', initCallArgs);
|
|
153
|
+
var instrumentationFileModAST = instrumentationFileMod.$ast;
|
|
154
|
+
var initCallInsertionIndex = (0, utils_1.getAfterImportsInsertionIndex)(instrumentationFileModAST);
|
|
155
|
+
instrumentationFileModAST.body.splice(initCallInsertionIndex, 0,
|
|
156
|
+
// @ts-expect-error - string works here because the AST is proxified by magicast
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
158
|
+
(0, magicast_1.generateCode)(initCall).code);
|
|
159
|
+
return { instrumentationFile: instrumentationFile, instrumentationFileMod: instrumentationFileMod };
|
|
160
|
+
}
|
|
161
|
+
exports.generateServerInstrumentationFile = generateServerInstrumentationFile;
|
|
162
|
+
function createServerInstrumentationFile(dsn, selectedFeatures) {
|
|
119
163
|
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
-
var instrumentationFile, instrumentationFileMod
|
|
121
|
-
return __generator(this, function (
|
|
122
|
-
switch (
|
|
164
|
+
var _a, instrumentationFile, instrumentationFileMod;
|
|
165
|
+
return __generator(this, function (_b) {
|
|
166
|
+
switch (_b.label) {
|
|
123
167
|
case 0:
|
|
124
|
-
instrumentationFile =
|
|
125
|
-
|
|
126
|
-
instrumentationFileMod.imports.$add({
|
|
127
|
-
from: '@sentry/remix',
|
|
128
|
-
imported: '*',
|
|
129
|
-
local: 'Sentry',
|
|
130
|
-
});
|
|
131
|
-
initCall = magicast_1.builders.functionCall('Sentry.init', {
|
|
132
|
-
dsn: dsn,
|
|
133
|
-
tracesSampleRate: 1.0,
|
|
134
|
-
autoInstrumentRemix: true,
|
|
135
|
-
});
|
|
136
|
-
instrumentationFileModAST = instrumentationFileMod.$ast;
|
|
137
|
-
initCallInsertionIndex = (0, utils_1.getAfterImportsInsertionIndex)(instrumentationFileModAST);
|
|
138
|
-
instrumentationFileModAST.body.splice(initCallInsertionIndex, 0,
|
|
139
|
-
// @ts-expect-error - string works here because the AST is proxified by magicast
|
|
140
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
141
|
-
(0, magicast_1.generateCode)(initCall).code);
|
|
142
|
-
return [4 /*yield*/, (0, magicast_1.writeFile)(instrumentationFileModAST, instrumentationFile)];
|
|
168
|
+
_a = generateServerInstrumentationFile(dsn, selectedFeatures), instrumentationFile = _a.instrumentationFile, instrumentationFileMod = _a.instrumentationFileMod;
|
|
169
|
+
return [4 /*yield*/, (0, magicast_1.writeFile)(instrumentationFileMod.$ast, instrumentationFile)];
|
|
143
170
|
case 1:
|
|
144
|
-
|
|
171
|
+
_b.sent();
|
|
145
172
|
return [2 /*return*/, instrumentationFile];
|
|
146
173
|
}
|
|
147
174
|
});
|
|
148
175
|
});
|
|
149
176
|
}
|
|
150
177
|
exports.createServerInstrumentationFile = createServerInstrumentationFile;
|
|
151
|
-
function insertServerInstrumentationFile(dsn) {
|
|
178
|
+
function insertServerInstrumentationFile(dsn, selectedFeatures) {
|
|
152
179
|
return __awaiter(this, void 0, void 0, function () {
|
|
153
180
|
var instrumentationFile, expressServerPath, originalExpressServerMod;
|
|
154
181
|
return __generator(this, function (_a) {
|
|
155
182
|
switch (_a.label) {
|
|
156
|
-
case 0: return [4 /*yield*/, createServerInstrumentationFile(dsn)];
|
|
183
|
+
case 0: return [4 /*yield*/, createServerInstrumentationFile(dsn, selectedFeatures)];
|
|
157
184
|
case 1:
|
|
158
185
|
instrumentationFile = _a.sent();
|
|
159
186
|
return [4 /*yield*/, (0, express_server_1.findCustomExpressServerImplementation)()];
|
|
@@ -286,9 +313,36 @@ function updateBuildScript(args) {
|
|
|
286
313
|
});
|
|
287
314
|
}
|
|
288
315
|
exports.updateBuildScript = updateBuildScript;
|
|
289
|
-
function
|
|
316
|
+
function updateEntryClientMod(originalEntryClientMod, dsn, selectedFeatures) {
|
|
317
|
+
originalEntryClientMod.imports.$add({
|
|
318
|
+
from: '@sentry/remix',
|
|
319
|
+
imported: '*',
|
|
320
|
+
local: 'Sentry',
|
|
321
|
+
});
|
|
322
|
+
if (selectedFeatures.performance) {
|
|
323
|
+
originalEntryClientMod.imports.$add({
|
|
324
|
+
from: '@remix-run/react',
|
|
325
|
+
imported: 'useLocation',
|
|
326
|
+
local: 'useLocation',
|
|
327
|
+
});
|
|
328
|
+
originalEntryClientMod.imports.$add({
|
|
329
|
+
from: '@remix-run/react',
|
|
330
|
+
imported: 'useMatches',
|
|
331
|
+
local: 'useMatches',
|
|
332
|
+
});
|
|
333
|
+
originalEntryClientMod.imports.$add({
|
|
334
|
+
from: 'react',
|
|
335
|
+
imported: 'useEffect',
|
|
336
|
+
local: 'useEffect',
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
insertClientInitCall(dsn, originalEntryClientMod, selectedFeatures);
|
|
340
|
+
return originalEntryClientMod;
|
|
341
|
+
}
|
|
342
|
+
exports.updateEntryClientMod = updateEntryClientMod;
|
|
343
|
+
function initializeSentryOnEntryClient(dsn, isTS, selectedFeatures) {
|
|
290
344
|
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
-
var clientEntryFilename, originalEntryClient, originalEntryClientMod;
|
|
345
|
+
var clientEntryFilename, originalEntryClient, originalEntryClientMod, updatedEntryClientMod;
|
|
292
346
|
return __generator(this, function (_a) {
|
|
293
347
|
switch (_a.label) {
|
|
294
348
|
case 0:
|
|
@@ -300,28 +354,8 @@ function initializeSentryOnEntryClient(dsn, isTS) {
|
|
|
300
354
|
if ((0, utils_1.hasSentryContent)(originalEntryClient, originalEntryClientMod.$code)) {
|
|
301
355
|
return [2 /*return*/];
|
|
302
356
|
}
|
|
303
|
-
originalEntryClientMod
|
|
304
|
-
|
|
305
|
-
imported: '*',
|
|
306
|
-
local: 'Sentry',
|
|
307
|
-
});
|
|
308
|
-
originalEntryClientMod.imports.$add({
|
|
309
|
-
from: 'react',
|
|
310
|
-
imported: 'useEffect',
|
|
311
|
-
local: 'useEffect',
|
|
312
|
-
});
|
|
313
|
-
originalEntryClientMod.imports.$add({
|
|
314
|
-
from: '@remix-run/react',
|
|
315
|
-
imported: 'useLocation',
|
|
316
|
-
local: 'useLocation',
|
|
317
|
-
});
|
|
318
|
-
originalEntryClientMod.imports.$add({
|
|
319
|
-
from: '@remix-run/react',
|
|
320
|
-
imported: 'useMatches',
|
|
321
|
-
local: 'useMatches',
|
|
322
|
-
});
|
|
323
|
-
insertClientInitCall(dsn, originalEntryClientMod);
|
|
324
|
-
return [4 /*yield*/, (0, magicast_1.writeFile)(originalEntryClientMod.$ast, path.join(process.cwd(), 'app', clientEntryFilename))];
|
|
357
|
+
updatedEntryClientMod = updateEntryClientMod(originalEntryClientMod, dsn, selectedFeatures);
|
|
358
|
+
return [4 /*yield*/, (0, magicast_1.writeFile)(updatedEntryClientMod.$ast, path.join(process.cwd(), 'app', clientEntryFilename))];
|
|
325
359
|
case 2:
|
|
326
360
|
_a.sent();
|
|
327
361
|
prompts_1.default.log.success("Successfully initialized Sentry on client entry point ".concat(chalk_1.default.cyan(clientEntryFilename)));
|