@sentry/wizard 4.0.0 → 4.0.2
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 +11 -2
- package/dist/NextJs/configs/next.config.js +1 -1
- package/dist/bin.js +2 -1
- package/dist/bin.js.map +1 -1
- package/dist/bump-version.js +28 -0
- package/dist/craft-pre-release.sh +2 -0
- package/dist/lib/Steps/Initial.js +2 -12
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/nextjs/templates.js +1 -1
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/run.js +2 -18
- package/dist/src/run.js.map +1 -1
- package/dist/src/telemetry.js +2 -16
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +16 -0
- package/dist/src/utils/clack-utils.js +53 -45
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +7 -0
- package/dist/src/version.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +4 -4
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/utils/clack-utils.test.js +52 -0
- package/dist/test/utils/clack-utils.test.js.map +1 -1
- package/package.json +5 -2
- package/.node-cache/node-v22.14.0-darwin-arm64 +0 -0
- package/.node-cache/node-v22.14.0-darwin-x64 +0 -0
- package/.node-cache/node-v22.14.0-linux-arm64 +0 -0
- package/.node-cache/node-v22.14.0-linux-x64 +0 -0
- package/.node-cache/node-v22.14.0-win-x64.exe +0 -0
- package/COPYING +0 -3575
- package/bin.ts +0 -143
- package/codecov.yml +0 -15
- package/e2e-tests/.env.example +0 -11
- package/e2e-tests/README.md +0 -63
- package/e2e-tests/jest.config.ts +0 -22
- package/e2e-tests/package.json +0 -14
- package/e2e-tests/run.sh +0 -15
- package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/project.pbxproj +0 -52
- package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/project.pbxproj +0 -62
- package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/project.pbxproj +0 -470
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/Project1App.swift +0 -10
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/Project2App.swift +0 -10
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/project.pbxproj +0 -382
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/xcshareddata/xcschemes/Project.xcscheme +0 -78
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/ContentView.swift +0 -7
- package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/MainApp.swift +0 -10
- package/e2e-tests/test-applications/flutter-test-app/.metadata +0 -45
- package/e2e-tests/test-applications/flutter-test-app/README.md +0 -16
- package/e2e-tests/test-applications/flutter-test-app/analysis_options.yaml +0 -28
- package/e2e-tests/test-applications/flutter-test-app/android/app/build.gradle +0 -44
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/debug/AndroidManifest.xml +0 -7
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/AndroidManifest.xml +0 -45
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/kotlin/com/example/flutter_magic/MainActivity.kt +0 -5
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable/launch_background.xml +0 -12
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable-v21/launch_background.xml +0 -12
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values/styles.xml +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values-night/styles.xml +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/app/src/profile/AndroidManifest.xml +0 -7
- package/e2e-tests/test-applications/flutter-test-app/android/build.gradle +0 -18
- package/e2e-tests/test-applications/flutter-test-app/android/gradle/wrapper/gradle-wrapper.properties +0 -5
- package/e2e-tests/test-applications/flutter-test-app/android/gradle.properties +0 -3
- package/e2e-tests/test-applications/flutter-test-app/android/settings.gradle +0 -25
- package/e2e-tests/test-applications/flutter-test-app/lib/main.dart +0 -125
- package/e2e-tests/test-applications/flutter-test-app/linux/CMakeLists.txt +0 -145
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/CMakeLists.txt +0 -88
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.cc +0 -11
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.h +0 -15
- package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugins.cmake +0 -23
- package/e2e-tests/test-applications/flutter-test-app/linux/main.cc +0 -6
- package/e2e-tests/test-applications/flutter-test-app/linux/my_application.cc +0 -124
- package/e2e-tests/test-applications/flutter-test-app/linux/my_application.h +0 -18
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Debug.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Release.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/GeneratedPluginRegistrant.swift +0 -10
- package/e2e-tests/test-applications/flutter-test-app/macos/Podfile +0 -43
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/AppDelegate.swift +0 -9
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +0 -68
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Base.lproj/MainMenu.xib +0 -343
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/AppInfo.xcconfig +0 -14
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Debug.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Release.xcconfig +0 -2
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Warnings.xcconfig +0 -13
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/DebugProfile.entitlements +0 -12
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Info.plist +0 -32
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/MainFlutterWindow.swift +0 -15
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Release.entitlements +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.pbxproj +0 -705
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +0 -98
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/contents.xcworkspacedata +0 -7
- package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/e2e-tests/test-applications/flutter-test-app/macos/RunnerTests/RunnerTests.swift +0 -12
- package/e2e-tests/test-applications/flutter-test-app/pubspec.lock +0 -213
- package/e2e-tests/test-applications/flutter-test-app/pubspec.yaml +0 -89
- package/e2e-tests/test-applications/flutter-test-app/test/widget_test.dart +0 -30
- package/e2e-tests/test-applications/flutter-test-app/web/favicon.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-192.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-192.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-512.png +0 -0
- package/e2e-tests/test-applications/flutter-test-app/web/index.html +0 -38
- package/e2e-tests/test-applications/flutter-test-app/web/manifest.json +0 -35
- package/e2e-tests/test-applications/flutter-test-app/windows/CMakeLists.txt +0 -108
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/CMakeLists.txt +0 -109
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.cc +0 -11
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.h +0 -15
- package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugins.cmake +0 -23
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/CMakeLists.txt +0 -40
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/Runner.rc +0 -121
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.cpp +0 -71
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.h +0 -33
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/main.cpp +0 -43
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/resource.h +0 -16
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/resources/app_icon.ico +0 -0
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/runner.exe.manifest +0 -14
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.cpp +0 -65
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.h +0 -19
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.cpp +0 -288
- package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.h +0 -102
- package/e2e-tests/test-applications/nextjs-test-app/next.config.mjs +0 -4
- package/e2e-tests/test-applications/nextjs-test-app/package.json +0 -22
- package/e2e-tests/test-applications/nextjs-test-app/src/app/layout.tsx +0 -20
- package/e2e-tests/test-applications/nextjs-test-app/src/app/page.tsx +0 -90
- package/e2e-tests/test-applications/nuxt-3-test-app/README.md +0 -75
- package/e2e-tests/test-applications/nuxt-3-test-app/nuxt.config.ts +0 -5
- package/e2e-tests/test-applications/nuxt-3-test-app/package.json +0 -18
- package/e2e-tests/test-applications/nuxt-3-test-app/public/favicon.ico +0 -0
- package/e2e-tests/test-applications/nuxt-3-test-app/public/robots.txt +0 -1
- package/e2e-tests/test-applications/nuxt-4-test-app/README.md +0 -75
- package/e2e-tests/test-applications/nuxt-4-test-app/nuxt.config.ts +0 -6
- package/e2e-tests/test-applications/nuxt-4-test-app/package.json +0 -18
- package/e2e-tests/test-applications/nuxt-4-test-app/public/favicon.ico +0 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/public/robots.txt +0 -1
- package/e2e-tests/test-applications/remix-test-app/app/entry.client.tsx +0 -18
- package/e2e-tests/test-applications/remix-test-app/app/entry.server.tsx +0 -140
- package/e2e-tests/test-applications/remix-test-app/app/root.tsx +0 -30
- package/e2e-tests/test-applications/remix-test-app/app/routes/_index.tsx +0 -48
- package/e2e-tests/test-applications/remix-test-app/app/tailwind.css +0 -3
- package/e2e-tests/test-applications/remix-test-app/package.json +0 -37
- package/e2e-tests/test-applications/remix-test-app/postcss.config.js +0 -6
- package/e2e-tests/test-applications/remix-test-app/tailwind.config.ts +0 -9
- package/e2e-tests/test-applications/remix-test-app/vite.config.ts +0 -16
- package/e2e-tests/test-applications/sveltekit-test-app/package.json +0 -21
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.d.ts +0 -13
- package/e2e-tests/test-applications/sveltekit-test-app/src/app.html +0 -11
- package/e2e-tests/test-applications/sveltekit-test-app/src/lib/index.ts +0 -1
- package/e2e-tests/test-applications/sveltekit-test-app/src/routes/+page.svelte +0 -2
- package/e2e-tests/test-applications/sveltekit-test-app/svelte.config.js +0 -18
- package/e2e-tests/test-applications/sveltekit-test-app/vite.config.ts +0 -6
- package/e2e-tests/tests/flutter.test.ts +0 -127
- package/e2e-tests/tests/nextjs.test.ts +0 -161
- package/e2e-tests/tests/nuxt-3.test.ts +0 -189
- package/e2e-tests/tests/nuxt-4.test.ts +0 -188
- package/e2e-tests/tests/remix.test.ts +0 -277
- package/e2e-tests/tests/sveltekit.test.ts +0 -284
- package/e2e-tests/utils/index.ts +0 -456
- package/index.ts +0 -2
- package/lib/Constants.ts +0 -118
- package/lib/Helper/BottomBar.ts +0 -28
- package/lib/Helper/Env.ts +0 -7
- package/lib/Helper/File.ts +0 -65
- package/lib/Helper/Git.ts +0 -39
- package/lib/Helper/Logging.ts +0 -44
- package/lib/Helper/MergeConfig.ts +0 -19
- package/lib/Helper/Package.ts +0 -80
- package/lib/Helper/SentryCli.ts +0 -139
- package/lib/Helper/Wizard.ts +0 -58
- package/lib/Helper/__tests__/File.ts +0 -15
- package/lib/Helper/__tests__/MergeConfig.ts +0 -98
- package/lib/Helper/__tests__/SentryCli.ts +0 -86
- package/lib/Helper/test-fixtures/next.config.1-merged.js +0 -18
- package/lib/Helper/test-fixtures/next.config.1.js +0 -6
- package/lib/Helper/test-fixtures/next.config.2.js +0 -8
- package/lib/Helper/test-fixtures/next.config.3-merged.js +0 -21
- package/lib/Helper/test-fixtures/next.config.3.js +0 -9
- package/lib/Helper/test-fixtures/next.config.4-merged.js +0 -21
- package/lib/Helper/test-fixtures/next.config.4.js +0 -9
- package/lib/Setup.ts +0 -40
- package/lib/Steps/BaseStep.ts +0 -25
- package/lib/Steps/ChooseIntegration.ts +0 -144
- package/lib/Steps/ConfigureProject.ts +0 -10
- package/lib/Steps/Initial.ts +0 -35
- package/lib/Steps/Integrations/BaseIntegration.ts +0 -42
- package/lib/Steps/Integrations/Cordova.ts +0 -283
- package/lib/Steps/Integrations/Electron.ts +0 -164
- package/lib/Steps/Integrations/MobileProject.ts +0 -72
- package/lib/Steps/OpenSentry.ts +0 -80
- package/lib/Steps/PromptForParameters.ts +0 -200
- package/lib/Steps/Result.ts +0 -22
- package/lib/Steps/SentryProjectSelector.ts +0 -83
- package/lib/Steps/ShouldConfigure.ts +0 -10
- package/lib/Steps/WaitForSentry.ts +0 -56
- package/lib/Steps/Welcome.ts +0 -21
- package/lib/Steps/index.ts +0 -10
- package/lib/__tests__/Env.ts +0 -29
- package/scripts/NextJs/configs/_error.js +0 -39
- package/scripts/NextJs/configs/next.config.js +0 -36
- package/scripts/NextJs/configs/next.config.template.js +0 -12
- package/scripts/NextJs/configs/sentry.client.config.js +0 -17
- package/scripts/NextJs/configs/sentry.edge.config.js +0 -17
- package/scripts/NextJs/configs/sentry.server.config.js +0 -17
- package/scripts/NextJs/sentry_sample_error.js +0 -47
- package/scripts/craft-pre-release.sh +0 -10
- package/src/android/android-wizard.ts +0 -192
- package/src/android/code-tools.ts +0 -170
- package/src/android/gradle.ts +0 -250
- package/src/android/manifest.ts +0 -180
- package/src/android/templates.ts +0 -86
- package/src/apple/apple-wizard.ts +0 -269
- package/src/apple/cocoapod.ts +0 -73
- package/src/apple/code-tools.ts +0 -147
- package/src/apple/fastlane.ts +0 -170
- package/src/apple/templates.ts +0 -65
- package/src/apple/xcode-manager.ts +0 -404
- package/src/flutter/code-tools.ts +0 -284
- package/src/flutter/flutter-wizard.ts +0 -164
- package/src/flutter/templates.ts +0 -90
- package/src/nextjs/nextjs-wizard.ts +0 -1007
- package/src/nextjs/templates.ts +0 -525
- package/src/nextjs/utils.ts +0 -21
- package/src/nuxt/nuxt-wizard.ts +0 -188
- package/src/nuxt/sdk-example.ts +0 -135
- package/src/nuxt/sdk-setup.ts +0 -352
- package/src/nuxt/templates.ts +0 -303
- package/src/nuxt/types.ts +0 -8
- package/src/nuxt/utils.ts +0 -42
- package/src/react-native/expo-env-file.ts +0 -55
- package/src/react-native/expo-metro.ts +0 -212
- package/src/react-native/expo.ts +0 -175
- package/src/react-native/git.ts +0 -25
- package/src/react-native/glob.ts +0 -13
- package/src/react-native/gradle.ts +0 -26
- package/src/react-native/javascript.ts +0 -103
- package/src/react-native/metro.ts +0 -599
- package/src/react-native/options.ts +0 -5
- package/src/react-native/react-native-wizard.ts +0 -512
- package/src/react-native/uninstall.ts +0 -109
- package/src/react-native/xcode.ts +0 -302
- package/src/remix/codemods/express-server.ts +0 -44
- package/src/remix/codemods/handle-error.ts +0 -118
- package/src/remix/codemods/root-common.ts +0 -63
- package/src/remix/codemods/root-v1.ts +0 -41
- package/src/remix/codemods/root-v2.ts +0 -153
- package/src/remix/remix-wizard.ts +0 -261
- package/src/remix/sdk-example.ts +0 -120
- package/src/remix/sdk-setup.ts +0 -546
- package/src/remix/templates.ts +0 -11
- package/src/remix/utils.ts +0 -96
- package/src/run.ts +0 -211
- package/src/sourcemaps/sourcemaps-wizard.ts +0 -364
- package/src/sourcemaps/tools/angular.ts +0 -42
- package/src/sourcemaps/tools/create-react-app.ts +0 -19
- package/src/sourcemaps/tools/esbuild.ts +0 -65
- package/src/sourcemaps/tools/nextjs.ts +0 -114
- package/src/sourcemaps/tools/remix.ts +0 -90
- package/src/sourcemaps/tools/rollup.ts +0 -67
- package/src/sourcemaps/tools/sentry-cli.ts +0 -287
- package/src/sourcemaps/tools/tsc.ts +0 -144
- package/src/sourcemaps/tools/types.ts +0 -11
- package/src/sourcemaps/tools/vite.ts +0 -300
- package/src/sourcemaps/tools/webpack.ts +0 -383
- package/src/sourcemaps/utils/detect-tool.ts +0 -46
- package/src/sourcemaps/utils/other-wizards.ts +0 -167
- package/src/sourcemaps/utils/sdk-version.ts +0 -266
- package/src/sveltekit/sdk-example.ts +0 -56
- package/src/sveltekit/sdk-setup.ts +0 -667
- package/src/sveltekit/sveltekit-wizard.ts +0 -192
- package/src/sveltekit/templates.ts +0 -185
- package/src/sveltekit/utils.ts +0 -50
- package/src/telemetry.ts +0 -144
- package/src/utils/ast-utils.ts +0 -270
- package/src/utils/bash.ts +0 -57
- package/src/utils/clack-utils.ts +0 -1536
- package/src/utils/debug.ts +0 -20
- package/src/utils/package-json.ts +0 -51
- package/src/utils/package-manager.ts +0 -172
- package/src/utils/release-registry.ts +0 -19
- package/src/utils/semver.ts +0 -33
- package/src/utils/sentrycli-utils.ts +0 -24
- package/src/utils/string.ts +0 -7
- package/src/utils/types.ts +0 -77
- package/src/utils/url.ts +0 -27
- package/src/utils/vendor/is-unicorn-supported.ts +0 -29
- package/test/android/code-tools.test.ts +0 -49
- package/test/apple/cocoapod.test.ts +0 -310
- package/test/apple/code-tools.test.ts +0 -1042
- package/test/apple/fastfile.test.ts +0 -555
- package/test/apple/templates.test.ts +0 -191
- package/test/apple/xcode-manager.test.ts +0 -1068
- package/test/flutter/code-tools.test.ts +0 -212
- package/test/flutter/templates.test.ts +0 -100
- package/test/nextjs/templates.test.ts +0 -429
- package/test/nuxt/templates.test.ts +0 -255
- package/test/react-native/expo-metro.test.ts +0 -81
- package/test/react-native/expo.test.ts +0 -86
- package/test/react-native/gradle.test.ts +0 -310
- package/test/react-native/javascript.test.ts +0 -134
- package/test/react-native/metro.test.ts +0 -396
- package/test/react-native/xcode.test.ts +0 -401
- package/test/remix/client-entry.test.ts +0 -122
- package/test/remix/server-instrumentation.test.ts +0 -36
- package/test/sourcemaps/tools/sentry-cli.test.ts +0 -57
- package/test/sourcemaps/tools/tsc.test.ts +0 -181
- package/test/sourcemaps/tools/vite.test.ts +0 -149
- package/test/sourcemaps/tools/webpack.test.ts +0 -303
- package/test/sveltekit/templates.test.ts +0 -152
- package/test/utils/ast-utils.test.ts +0 -264
- package/test/utils/clack-utils.test.ts +0 -224
- package/types/read-env.d.ts +0 -3
- package/types/xcode.d.ts +0 -527
package/src/nuxt/nuxt-wizard.ts
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
2
|
-
import * as clack from '@clack/prompts';
|
|
3
|
-
import * as Sentry from '@sentry/node';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
import { lt, minVersion } from 'semver';
|
|
6
|
-
import type { WizardOptions } from '../utils/types';
|
|
7
|
-
import { traceStep, withTelemetry } from '../telemetry';
|
|
8
|
-
import {
|
|
9
|
-
abort,
|
|
10
|
-
abortIfCancelled,
|
|
11
|
-
addDotEnvSentryBuildPluginFile,
|
|
12
|
-
askShouldCreateExampleComponent,
|
|
13
|
-
askShouldCreateExamplePage,
|
|
14
|
-
confirmContinueIfNoOrDirtyGitRepo,
|
|
15
|
-
ensurePackageIsInstalled,
|
|
16
|
-
getOrAskForProjectData,
|
|
17
|
-
getPackageDotJson,
|
|
18
|
-
getPackageManager,
|
|
19
|
-
installPackage,
|
|
20
|
-
printWelcome,
|
|
21
|
-
runPrettierIfInstalled,
|
|
22
|
-
} from '../utils/clack-utils';
|
|
23
|
-
import { getPackageVersion, hasPackageInstalled } from '../utils/package-json';
|
|
24
|
-
import {
|
|
25
|
-
addSDKModule,
|
|
26
|
-
getNuxtConfig,
|
|
27
|
-
createConfigFiles,
|
|
28
|
-
addNuxtOverrides,
|
|
29
|
-
askDeploymentPlatform,
|
|
30
|
-
confirmReadImportDocs,
|
|
31
|
-
} from './sdk-setup';
|
|
32
|
-
import {
|
|
33
|
-
createExampleComponent,
|
|
34
|
-
createExamplePage,
|
|
35
|
-
supportsExamplePage,
|
|
36
|
-
} from './sdk-example';
|
|
37
|
-
import { isNuxtV4 } from './utils';
|
|
38
|
-
|
|
39
|
-
export function runNuxtWizard(options: WizardOptions) {
|
|
40
|
-
return withTelemetry(
|
|
41
|
-
{
|
|
42
|
-
enabled: options.telemetryEnabled,
|
|
43
|
-
integration: 'nuxt',
|
|
44
|
-
wizardOptions: options,
|
|
45
|
-
},
|
|
46
|
-
() => runNuxtWizardWithTelemetry(options),
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export async function runNuxtWizardWithTelemetry(
|
|
51
|
-
options: WizardOptions,
|
|
52
|
-
): Promise<void> {
|
|
53
|
-
const { promoCode, telemetryEnabled, forceInstall } = options;
|
|
54
|
-
|
|
55
|
-
printWelcome({
|
|
56
|
-
wizardName: 'Sentry Nuxt Wizard',
|
|
57
|
-
promoCode,
|
|
58
|
-
telemetryEnabled,
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
await confirmContinueIfNoOrDirtyGitRepo();
|
|
62
|
-
|
|
63
|
-
const packageJson = await getPackageDotJson();
|
|
64
|
-
|
|
65
|
-
await ensurePackageIsInstalled(packageJson, 'nuxt', 'Nuxt');
|
|
66
|
-
|
|
67
|
-
const nuxtVersion = getPackageVersion('nuxt', packageJson);
|
|
68
|
-
Sentry.setTag('nuxt-version', nuxtVersion);
|
|
69
|
-
|
|
70
|
-
const minVer = minVersion(nuxtVersion || '0.0.0');
|
|
71
|
-
|
|
72
|
-
if (!nuxtVersion || !minVer || lt(minVer, '3.7.0')) {
|
|
73
|
-
clack.log.warn(
|
|
74
|
-
"It seems you're using a Nuxt version <3.7.0 which is not supported by Sentry.\nWe recommend upgrading to the latest version before you continue.",
|
|
75
|
-
);
|
|
76
|
-
const shouldContinue = await abortIfCancelled(
|
|
77
|
-
clack.select({
|
|
78
|
-
message: 'Do you want to continue anyway?',
|
|
79
|
-
options: [
|
|
80
|
-
{
|
|
81
|
-
label: 'Yes, continue',
|
|
82
|
-
hint: 'The SDK might not work correctly',
|
|
83
|
-
value: true,
|
|
84
|
-
},
|
|
85
|
-
{ label: "No, I'll upgrade first", value: false },
|
|
86
|
-
],
|
|
87
|
-
}),
|
|
88
|
-
);
|
|
89
|
-
if (!shouldContinue) {
|
|
90
|
-
await abort('Exiting Wizard', 0);
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const { authToken, selectedProject, selfHosted, sentryUrl } =
|
|
96
|
-
await getOrAskForProjectData(options, 'javascript-nuxt');
|
|
97
|
-
|
|
98
|
-
const packageManager = await getPackageManager();
|
|
99
|
-
|
|
100
|
-
await addNuxtOverrides(packageJson, packageManager, minVer, forceInstall);
|
|
101
|
-
|
|
102
|
-
const sdkAlreadyInstalled = hasPackageInstalled('@sentry/nuxt', packageJson);
|
|
103
|
-
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
104
|
-
|
|
105
|
-
await installPackage({
|
|
106
|
-
packageName: '@sentry/nuxt@^9',
|
|
107
|
-
alreadyInstalled: sdkAlreadyInstalled,
|
|
108
|
-
packageManager,
|
|
109
|
-
forceInstall,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
await addDotEnvSentryBuildPluginFile(authToken);
|
|
113
|
-
|
|
114
|
-
const nuxtConfig = await traceStep('load-nuxt-config', getNuxtConfig);
|
|
115
|
-
|
|
116
|
-
const projectData = {
|
|
117
|
-
org: selectedProject.organization.slug,
|
|
118
|
-
project: selectedProject.slug,
|
|
119
|
-
projectId: selectedProject.id,
|
|
120
|
-
url: sentryUrl,
|
|
121
|
-
selfHosted,
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
const deploymentPlatform = await askDeploymentPlatform();
|
|
125
|
-
Sentry.setTag('deployment-platform', deploymentPlatform);
|
|
126
|
-
|
|
127
|
-
await traceStep('configure-sdk', async () => {
|
|
128
|
-
await addSDKModule(nuxtConfig, projectData, deploymentPlatform);
|
|
129
|
-
await createConfigFiles(selectedProject.keys[0].dsn.public);
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
let shouldCreateExamplePage = false;
|
|
133
|
-
let shouldCreateExampleButton = false;
|
|
134
|
-
|
|
135
|
-
const isV4 = await isNuxtV4(nuxtConfig, nuxtVersion);
|
|
136
|
-
const canCreateExamplePage = await supportsExamplePage(isV4);
|
|
137
|
-
Sentry.setTag('supports-example-page-creation', canCreateExamplePage);
|
|
138
|
-
|
|
139
|
-
if (canCreateExamplePage) {
|
|
140
|
-
shouldCreateExamplePage = await askShouldCreateExamplePage();
|
|
141
|
-
|
|
142
|
-
if (shouldCreateExamplePage) {
|
|
143
|
-
await traceStep('create-example-page', async () =>
|
|
144
|
-
createExamplePage(isV4, projectData),
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
} else {
|
|
148
|
-
shouldCreateExampleButton = await askShouldCreateExampleComponent();
|
|
149
|
-
|
|
150
|
-
if (shouldCreateExampleButton) {
|
|
151
|
-
await traceStep('create-example-component', async () =>
|
|
152
|
-
createExampleComponent(isV4),
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
await runPrettierIfInstalled();
|
|
158
|
-
|
|
159
|
-
await confirmReadImportDocs(deploymentPlatform);
|
|
160
|
-
|
|
161
|
-
clack.outro(
|
|
162
|
-
buildOutroMessage(shouldCreateExamplePage, shouldCreateExampleButton),
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function buildOutroMessage(
|
|
167
|
-
shouldCreateExamplePage: boolean,
|
|
168
|
-
shouldCreateExampleButton: boolean,
|
|
169
|
-
): string {
|
|
170
|
-
let msg = chalk.green('\nSuccessfully installed the Sentry Nuxt SDK!');
|
|
171
|
-
|
|
172
|
-
if (shouldCreateExamplePage) {
|
|
173
|
-
msg += `\n\nYou can validate your setup by visiting ${chalk.cyan(
|
|
174
|
-
'"/sentry-example-page"',
|
|
175
|
-
)}.`;
|
|
176
|
-
}
|
|
177
|
-
if (shouldCreateExampleButton) {
|
|
178
|
-
msg += `\n\nYou can validate your setup by adding the ${chalk.cyan(
|
|
179
|
-
'`SentryExampleButton`',
|
|
180
|
-
)} component to a page and triggering it.`;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
msg += `\n\nCheck out the SDK documentation for further configuration: ${chalk.underline(
|
|
184
|
-
'https://docs.sentry.io/platforms/javascript/guides/nuxt/',
|
|
185
|
-
)}`;
|
|
186
|
-
|
|
187
|
-
return msg;
|
|
188
|
-
}
|
package/src/nuxt/sdk-example.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import * as path from 'path';
|
|
3
|
-
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
4
|
-
import clack from '@clack/prompts';
|
|
5
|
-
import {
|
|
6
|
-
getIndexRouteTemplate,
|
|
7
|
-
getSentryExampleApiTemplate,
|
|
8
|
-
getSentryExamplePageTemplate,
|
|
9
|
-
getSentryErrorButtonTemplate,
|
|
10
|
-
} from './templates';
|
|
11
|
-
import { abort, isUsingTypeScript } from '../utils/clack-utils';
|
|
12
|
-
import chalk from 'chalk';
|
|
13
|
-
import * as Sentry from '@sentry/node';
|
|
14
|
-
|
|
15
|
-
function getSrcDirectory(isNuxtV4: boolean) {
|
|
16
|
-
// In nuxt v4, the src directory is `app/` unless
|
|
17
|
-
// users already had a `pages` directory
|
|
18
|
-
return isNuxtV4 && !fs.existsSync(path.resolve('pages')) ? 'app' : '.';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function supportsExamplePage(isNuxtV4: boolean) {
|
|
22
|
-
// We currently only support creating an example page
|
|
23
|
-
// if users can reliably access it without having to
|
|
24
|
-
// add code changes themselves.
|
|
25
|
-
//
|
|
26
|
-
// If users have an `app.vue` layout without the
|
|
27
|
-
// needed component to render routes (<NuxtPage/>),
|
|
28
|
-
// we bail out of creating an example page altogether.
|
|
29
|
-
const src = getSrcDirectory(isNuxtV4);
|
|
30
|
-
const app = path.join(src, 'app.vue');
|
|
31
|
-
|
|
32
|
-
// If there's no `app.vue` layout, nuxt automatically renders
|
|
33
|
-
// the routes.
|
|
34
|
-
if (!fs.existsSync(path.resolve(app))) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const content = await fs.promises.readFile(path.resolve(app), 'utf8');
|
|
39
|
-
return !!content.match(/<NuxtPage/g);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export async function createExamplePage(
|
|
43
|
-
isNuxtV4: boolean,
|
|
44
|
-
options: {
|
|
45
|
-
org: string;
|
|
46
|
-
project: string;
|
|
47
|
-
projectId: string;
|
|
48
|
-
url: string;
|
|
49
|
-
},
|
|
50
|
-
) {
|
|
51
|
-
try {
|
|
52
|
-
const src = getSrcDirectory(isNuxtV4);
|
|
53
|
-
const pages = path.join(src, 'pages');
|
|
54
|
-
|
|
55
|
-
if (!fs.existsSync(path.resolve(pages))) {
|
|
56
|
-
fs.mkdirSync(path.resolve(pages), { recursive: true });
|
|
57
|
-
|
|
58
|
-
const indexPage = path.join(pages, 'index.vue');
|
|
59
|
-
|
|
60
|
-
await fs.promises.writeFile(
|
|
61
|
-
path.resolve(indexPage),
|
|
62
|
-
getIndexRouteTemplate(),
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
clack.log.success(`Created ${chalk.cyan(indexPage)}.`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const examplePage = path.join(pages, 'sentry-example-page.vue');
|
|
69
|
-
|
|
70
|
-
if (fs.existsSync(path.resolve(examplePage))) {
|
|
71
|
-
clack.log.warn(
|
|
72
|
-
`It seems like a sentry example page already exists. Skipping creation of example page.`,
|
|
73
|
-
);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
await fs.promises.writeFile(
|
|
78
|
-
path.resolve(examplePage),
|
|
79
|
-
getSentryExamplePageTemplate(options),
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
clack.log.success(`Created ${chalk.cyan(examplePage)}.`);
|
|
83
|
-
|
|
84
|
-
const api = path.join('server', 'api');
|
|
85
|
-
|
|
86
|
-
if (!fs.existsSync(path.resolve(api))) {
|
|
87
|
-
fs.mkdirSync(path.resolve(api), { recursive: true });
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
const exampleApi = path.join(
|
|
91
|
-
api,
|
|
92
|
-
isUsingTypeScript() ? 'sentry-example-api.ts' : 'sentry-example-api.js',
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
await fs.promises.writeFile(
|
|
96
|
-
path.resolve(exampleApi),
|
|
97
|
-
getSentryExampleApiTemplate(),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
clack.log.success(`Created ${chalk.cyan(exampleApi)}.`);
|
|
101
|
-
} catch (e: unknown) {
|
|
102
|
-
clack.log.error('Error while creating an example page to test Sentry:');
|
|
103
|
-
clack.log.info(
|
|
104
|
-
chalk.dim(
|
|
105
|
-
typeof e === 'object' && e != null && 'toString' in e
|
|
106
|
-
? e.toString()
|
|
107
|
-
: typeof e === 'string'
|
|
108
|
-
? e
|
|
109
|
-
: 'Unknown error',
|
|
110
|
-
),
|
|
111
|
-
);
|
|
112
|
-
Sentry.captureException(
|
|
113
|
-
'Error while creating an example Nuxt page to test Sentry',
|
|
114
|
-
);
|
|
115
|
-
await abort('Exiting Wizard');
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export async function createExampleComponent(isNuxtV4: boolean) {
|
|
120
|
-
const src = getSrcDirectory(isNuxtV4);
|
|
121
|
-
const components = path.join(src, 'components');
|
|
122
|
-
|
|
123
|
-
if (!fs.existsSync(path.resolve(components))) {
|
|
124
|
-
fs.mkdirSync(path.resolve(components), { recursive: true });
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const exampleComponent = path.join(components, 'SentryErrorButton.vue');
|
|
128
|
-
|
|
129
|
-
await fs.promises.writeFile(
|
|
130
|
-
path.resolve(exampleComponent),
|
|
131
|
-
getSentryErrorButtonTemplate(),
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
clack.log.success(`Created ${chalk.cyan(exampleComponent)}.`);
|
|
135
|
-
}
|
package/src/nuxt/sdk-setup.ts
DELETED
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
4
|
-
import * as clack from '@clack/prompts';
|
|
5
|
-
import * as Sentry from '@sentry/node';
|
|
6
|
-
import chalk from 'chalk';
|
|
7
|
-
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
8
|
-
import { generateCode, loadFile } from 'magicast';
|
|
9
|
-
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
10
|
-
import { addNuxtModule } from 'magicast/helpers';
|
|
11
|
-
import opn from 'opn';
|
|
12
|
-
import { type SemVer, lt } from 'semver';
|
|
13
|
-
import { traceStep } from '../telemetry';
|
|
14
|
-
import {
|
|
15
|
-
abortIfCancelled,
|
|
16
|
-
askShouldAddPackageOverride,
|
|
17
|
-
askShouldInstallPackage,
|
|
18
|
-
featureSelectionPrompt,
|
|
19
|
-
installPackage,
|
|
20
|
-
isUsingTypeScript,
|
|
21
|
-
} from '../utils/clack-utils';
|
|
22
|
-
import {
|
|
23
|
-
type PackageDotJson,
|
|
24
|
-
hasPackageInstalled,
|
|
25
|
-
} from '../utils/package-json';
|
|
26
|
-
import { PNPM, type PackageManager } from '../utils/package-manager';
|
|
27
|
-
import {
|
|
28
|
-
getConfigBody,
|
|
29
|
-
getDefaultNuxtConfig,
|
|
30
|
-
getNuxtModuleFallbackTemplate,
|
|
31
|
-
getSentryConfigContents,
|
|
32
|
-
} from './templates';
|
|
33
|
-
import { type DeploymentPlatform, deploymentPlatforms } from './types';
|
|
34
|
-
|
|
35
|
-
const possibleNuxtConfig = [
|
|
36
|
-
'nuxt.config.js',
|
|
37
|
-
'nuxt.config.mjs',
|
|
38
|
-
'nuxt.config.cjs',
|
|
39
|
-
'nuxt.config.ts',
|
|
40
|
-
'nuxt.config.mts',
|
|
41
|
-
'nuxt.config.cts',
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
export async function getNuxtConfig(): Promise<string> {
|
|
45
|
-
let configFile = possibleNuxtConfig.find((fileName) =>
|
|
46
|
-
fs.existsSync(path.join(process.cwd(), fileName)),
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
if (!configFile) {
|
|
50
|
-
clack.log.info('No Nuxt config file found, creating a new one.');
|
|
51
|
-
Sentry.setTag('nuxt-config-strategy', 'create');
|
|
52
|
-
// nuxt recommends its config to be .ts by default
|
|
53
|
-
configFile = 'nuxt.config.ts';
|
|
54
|
-
|
|
55
|
-
await fs.promises.writeFile(
|
|
56
|
-
path.join(process.cwd(), configFile),
|
|
57
|
-
getDefaultNuxtConfig(),
|
|
58
|
-
{ encoding: 'utf-8', flag: 'w' },
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return path.join(process.cwd(), configFile);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export async function askDeploymentPlatform(): Promise<
|
|
68
|
-
DeploymentPlatform | symbol
|
|
69
|
-
> {
|
|
70
|
-
return await abortIfCancelled(
|
|
71
|
-
clack.select({
|
|
72
|
-
message: 'Please select your deployment platform.',
|
|
73
|
-
options: deploymentPlatforms.map((platform) => ({
|
|
74
|
-
value: platform,
|
|
75
|
-
label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,
|
|
76
|
-
})),
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function addSDKModule(
|
|
82
|
-
config: string,
|
|
83
|
-
options: { org: string; project: string; url: string; selfHosted: boolean },
|
|
84
|
-
deploymentPlatform: DeploymentPlatform | symbol,
|
|
85
|
-
): Promise<void> {
|
|
86
|
-
const shouldTopLevelImport =
|
|
87
|
-
deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';
|
|
88
|
-
|
|
89
|
-
if (shouldTopLevelImport) {
|
|
90
|
-
clack.log.warn(
|
|
91
|
-
`Sentry needs to be initialized before the application starts. ${chalk.cyan(
|
|
92
|
-
`${deploymentPlatform
|
|
93
|
-
.charAt(0)
|
|
94
|
-
.toUpperCase()}${deploymentPlatform.slice(1)}`,
|
|
95
|
-
)} does not support this yet.\n\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\n\nThis comes with some restrictions, for more info see:\n\n${chalk.underline(
|
|
96
|
-
'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',
|
|
97
|
-
)} `,
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const mod = await loadFile(config);
|
|
103
|
-
|
|
104
|
-
addNuxtModule(mod, '@sentry/nuxt/module', 'sentry', {
|
|
105
|
-
sourceMapsUploadOptions: {
|
|
106
|
-
org: options.org,
|
|
107
|
-
project: options.project,
|
|
108
|
-
...(options.selfHosted && { url: options.url }),
|
|
109
|
-
},
|
|
110
|
-
...(shouldTopLevelImport && {
|
|
111
|
-
autoInjectServerSentry: 'top-level-import',
|
|
112
|
-
}),
|
|
113
|
-
});
|
|
114
|
-
addNuxtModule(mod, '@sentry/nuxt/module', 'sourcemap', {
|
|
115
|
-
client: 'hidden',
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
const { code } = generateCode(mod);
|
|
119
|
-
|
|
120
|
-
await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });
|
|
121
|
-
|
|
122
|
-
clack.log.success(
|
|
123
|
-
`Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,
|
|
124
|
-
);
|
|
125
|
-
} catch (e: unknown) {
|
|
126
|
-
clack.log.error(
|
|
127
|
-
'Error while adding the Sentry Nuxt Module to the Nuxt config.',
|
|
128
|
-
);
|
|
129
|
-
clack.log.info(
|
|
130
|
-
chalk.dim(
|
|
131
|
-
typeof e === 'object' && e != null && 'toString' in e
|
|
132
|
-
? e.toString()
|
|
133
|
-
: typeof e === 'string'
|
|
134
|
-
? e
|
|
135
|
-
: 'Unknown error',
|
|
136
|
-
),
|
|
137
|
-
);
|
|
138
|
-
Sentry.captureException(
|
|
139
|
-
'Error while setting up the Nuxt Module in nuxt config',
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
clack.log.warn(
|
|
143
|
-
`Please add the following settings to ${chalk.cyan(
|
|
144
|
-
path.basename(config),
|
|
145
|
-
)}:`,
|
|
146
|
-
);
|
|
147
|
-
// eslint-disable-next-line no-console
|
|
148
|
-
console.log(
|
|
149
|
-
`\n\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\n\n`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export async function createConfigFiles(dsn: string) {
|
|
155
|
-
const selectedFeatures = await featureSelectionPrompt([
|
|
156
|
-
{
|
|
157
|
-
id: 'performance',
|
|
158
|
-
prompt: `Do you want to enable ${chalk.bold(
|
|
159
|
-
'Tracing',
|
|
160
|
-
)} to track the performance of your application?`,
|
|
161
|
-
enabledHint: 'recommended',
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
id: 'replay',
|
|
165
|
-
prompt: `Do you want to enable ${chalk.bold(
|
|
166
|
-
'Sentry Session Replay',
|
|
167
|
-
)} to get a video-like reproduction of errors during a user session?`,
|
|
168
|
-
enabledHint: 'recommended, but increases bundle size',
|
|
169
|
-
},
|
|
170
|
-
] as const);
|
|
171
|
-
|
|
172
|
-
const typeScriptDetected = isUsingTypeScript();
|
|
173
|
-
|
|
174
|
-
const configVariants = ['server', 'client'] as const;
|
|
175
|
-
|
|
176
|
-
for (const configVariant of configVariants) {
|
|
177
|
-
await traceStep(`create-sentry-${configVariant}-config`, async () => {
|
|
178
|
-
const jsConfig = `sentry.${configVariant}.config.js`;
|
|
179
|
-
const tsConfig = `sentry.${configVariant}.config.ts`;
|
|
180
|
-
|
|
181
|
-
const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));
|
|
182
|
-
const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));
|
|
183
|
-
|
|
184
|
-
let shouldWriteFile = true;
|
|
185
|
-
|
|
186
|
-
if (jsConfigExists || tsConfigExists) {
|
|
187
|
-
const existingConfigs = [];
|
|
188
|
-
|
|
189
|
-
if (jsConfigExists) {
|
|
190
|
-
existingConfigs.push(jsConfig);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (tsConfigExists) {
|
|
194
|
-
existingConfigs.push(tsConfig);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
const overwriteExistingConfigs = await abortIfCancelled(
|
|
198
|
-
clack.confirm({
|
|
199
|
-
message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(
|
|
200
|
-
', ',
|
|
201
|
-
)}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,
|
|
202
|
-
}),
|
|
203
|
-
);
|
|
204
|
-
Sentry.setTag(
|
|
205
|
-
`overwrite-${configVariant}-config`,
|
|
206
|
-
overwriteExistingConfigs,
|
|
207
|
-
);
|
|
208
|
-
|
|
209
|
-
shouldWriteFile = overwriteExistingConfigs;
|
|
210
|
-
|
|
211
|
-
if (overwriteExistingConfigs) {
|
|
212
|
-
if (jsConfigExists) {
|
|
213
|
-
fs.unlinkSync(path.join(process.cwd(), jsConfig));
|
|
214
|
-
clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);
|
|
215
|
-
}
|
|
216
|
-
if (tsConfigExists) {
|
|
217
|
-
fs.unlinkSync(path.join(process.cwd(), tsConfig));
|
|
218
|
-
clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
if (shouldWriteFile) {
|
|
224
|
-
await fs.promises.writeFile(
|
|
225
|
-
path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),
|
|
226
|
-
getSentryConfigContents(dsn, configVariant, selectedFeatures),
|
|
227
|
-
{ encoding: 'utf8', flag: 'w' },
|
|
228
|
-
);
|
|
229
|
-
clack.log.success(
|
|
230
|
-
`Created new ${chalk.cyan(
|
|
231
|
-
typeScriptDetected ? tsConfig : jsConfig,
|
|
232
|
-
)}.`,
|
|
233
|
-
);
|
|
234
|
-
Sentry.setTag(`created-${configVariant}-config`, true);
|
|
235
|
-
} else {
|
|
236
|
-
clack.log.info(
|
|
237
|
-
`Okay, here are the changes your ${chalk.cyan(
|
|
238
|
-
typeScriptDetected ? tsConfig : jsConfig,
|
|
239
|
-
)} should contain:`,
|
|
240
|
-
);
|
|
241
|
-
// eslint-disable-next-line no-console
|
|
242
|
-
console.log(
|
|
243
|
-
'\n\n ' +
|
|
244
|
-
getConfigBody(dsn, configVariant, selectedFeatures) +
|
|
245
|
-
'\n\n',
|
|
246
|
-
);
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export async function addNuxtOverrides(
|
|
253
|
-
packageJson: PackageDotJson,
|
|
254
|
-
packageManager: PackageManager,
|
|
255
|
-
nuxtMinVer: SemVer | null,
|
|
256
|
-
forceInstall?: boolean,
|
|
257
|
-
) {
|
|
258
|
-
const isPNPM = PNPM.detect();
|
|
259
|
-
|
|
260
|
-
const overrides = [
|
|
261
|
-
{
|
|
262
|
-
pkgName: '@vercel/nft',
|
|
263
|
-
pkgVersion: '^0.27.4',
|
|
264
|
-
},
|
|
265
|
-
...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')
|
|
266
|
-
? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]
|
|
267
|
-
: []),
|
|
268
|
-
];
|
|
269
|
-
|
|
270
|
-
clack.log.warn(
|
|
271
|
-
`To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${
|
|
272
|
-
isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'
|
|
273
|
-
}\n\nFor more info see: ${chalk.underline(
|
|
274
|
-
'https://github.com/getsentry/sentry-javascript/issues/14514',
|
|
275
|
-
)}${
|
|
276
|
-
isPNPM
|
|
277
|
-
? `\n\nand ${chalk.underline(
|
|
278
|
-
'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',
|
|
279
|
-
)}`
|
|
280
|
-
: ''
|
|
281
|
-
}`,
|
|
282
|
-
);
|
|
283
|
-
|
|
284
|
-
for (const { pkgName, pkgVersion } of overrides) {
|
|
285
|
-
const shouldAddOverride = await askShouldAddPackageOverride(
|
|
286
|
-
pkgName,
|
|
287
|
-
pkgVersion,
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
if (shouldAddOverride) {
|
|
291
|
-
await packageManager.addOverride(pkgName, pkgVersion);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (PNPM.detect()) {
|
|
296
|
-
// For pnpm, we want to install iitm
|
|
297
|
-
// See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle
|
|
298
|
-
const iitmAlreadyInstalled = hasPackageInstalled(
|
|
299
|
-
'import-in-the-middle',
|
|
300
|
-
packageJson,
|
|
301
|
-
);
|
|
302
|
-
Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);
|
|
303
|
-
|
|
304
|
-
const shouldInstallIitm = await askShouldInstallPackage(
|
|
305
|
-
'import-in-the-middle',
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
if (shouldInstallIitm) {
|
|
309
|
-
await installPackage({
|
|
310
|
-
packageName: 'import-in-the-middle',
|
|
311
|
-
alreadyInstalled: iitmAlreadyInstalled,
|
|
312
|
-
packageManager,
|
|
313
|
-
forceInstall,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
export async function confirmReadImportDocs(
|
|
320
|
-
deploymentPlatform: DeploymentPlatform | symbol,
|
|
321
|
-
) {
|
|
322
|
-
const canImportSentryServerConfigFile =
|
|
323
|
-
deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';
|
|
324
|
-
|
|
325
|
-
if (!canImportSentryServerConfigFile) {
|
|
326
|
-
// Nothing to do, users have been set up with automatic top-level-import instead
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
const docsUrl =
|
|
331
|
-
'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';
|
|
332
|
-
|
|
333
|
-
clack.log.info(
|
|
334
|
-
`After building your Nuxt app, you need to ${chalk.bold(
|
|
335
|
-
'--import',
|
|
336
|
-
)} the Sentry server config file when running your app.\n\nFor more info, see:\n\n${chalk.underline(
|
|
337
|
-
docsUrl,
|
|
338
|
-
)}`,
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
const shouldOpenDocs = await abortIfCancelled(
|
|
342
|
-
clack.confirm({ message: 'Do you want to open the docs?' }),
|
|
343
|
-
);
|
|
344
|
-
|
|
345
|
-
Sentry.setTag('init-with-import-docs-opened', shouldOpenDocs);
|
|
346
|
-
|
|
347
|
-
if (shouldOpenDocs) {
|
|
348
|
-
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
349
|
-
const noop = () => {}; // eslint-disable-line @typescript-eslint/no-empty-function
|
|
350
|
-
opn(docsUrl, { wait: false }).then((cp) => cp.on('error', noop), noop);
|
|
351
|
-
}
|
|
352
|
-
}
|