@sentry/wizard 4.0.0 → 4.0.1
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 +6 -2
- package/dist/lib/Steps/Integrations/Electron.js +1 -1
- package/dist/lib/Steps/Integrations/Electron.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
|
@@ -1,192 +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 chalk from 'chalk';
|
|
4
|
-
|
|
5
|
-
import * as Sentry from '@sentry/node';
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
abort,
|
|
9
|
-
abortIfCancelled,
|
|
10
|
-
addDotEnvSentryBuildPluginFile,
|
|
11
|
-
askShouldCreateExamplePage,
|
|
12
|
-
confirmContinueIfNoOrDirtyGitRepo,
|
|
13
|
-
ensurePackageIsInstalled,
|
|
14
|
-
getOrAskForProjectData,
|
|
15
|
-
getPackageDotJson,
|
|
16
|
-
installPackage,
|
|
17
|
-
printWelcome,
|
|
18
|
-
runPrettierIfInstalled,
|
|
19
|
-
} from '../utils/clack-utils';
|
|
20
|
-
import { getPackageVersion, hasPackageInstalled } from '../utils/package-json';
|
|
21
|
-
import type { WizardOptions } from '../utils/types';
|
|
22
|
-
import { createExamplePage } from './sdk-example';
|
|
23
|
-
import { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';
|
|
24
|
-
import { traceStep, withTelemetry } from '../telemetry';
|
|
25
|
-
import { getKitVersionBucket, getSvelteVersionBucket } from './utils';
|
|
26
|
-
import { NPM, detectPackageManger } from '../utils/package-manager';
|
|
27
|
-
|
|
28
|
-
export async function runSvelteKitWizard(
|
|
29
|
-
options: WizardOptions,
|
|
30
|
-
): Promise<void> {
|
|
31
|
-
return withTelemetry(
|
|
32
|
-
{
|
|
33
|
-
enabled: options.telemetryEnabled,
|
|
34
|
-
integration: 'sveltekit',
|
|
35
|
-
wizardOptions: options,
|
|
36
|
-
},
|
|
37
|
-
() => runSvelteKitWizardWithTelemetry(options),
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export async function runSvelteKitWizardWithTelemetry(
|
|
42
|
-
options: WizardOptions,
|
|
43
|
-
): Promise<void> {
|
|
44
|
-
const { promoCode, telemetryEnabled, forceInstall } = options;
|
|
45
|
-
|
|
46
|
-
printWelcome({
|
|
47
|
-
wizardName: 'Sentry SvelteKit Wizard',
|
|
48
|
-
promoCode,
|
|
49
|
-
telemetryEnabled,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
await confirmContinueIfNoOrDirtyGitRepo();
|
|
53
|
-
|
|
54
|
-
const packageJson = await getPackageDotJson();
|
|
55
|
-
|
|
56
|
-
await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');
|
|
57
|
-
|
|
58
|
-
const kitVersion = getPackageVersion('@sveltejs/kit', packageJson);
|
|
59
|
-
const kitVersionBucket = getKitVersionBucket(kitVersion);
|
|
60
|
-
Sentry.setTag('sveltekit-version', kitVersionBucket);
|
|
61
|
-
|
|
62
|
-
if (kitVersionBucket === '0.x') {
|
|
63
|
-
clack.log.warn(
|
|
64
|
-
"It seems you're using a SvelteKit version <1.0.0 which is not supported by Sentry.\nWe recommend upgrading to the latest 1.x version before you continue.",
|
|
65
|
-
);
|
|
66
|
-
const shouldContinue = await abortIfCancelled(
|
|
67
|
-
clack.select({
|
|
68
|
-
message: 'Do you want to continue anyway?',
|
|
69
|
-
options: [
|
|
70
|
-
{
|
|
71
|
-
label: 'Yes, continue',
|
|
72
|
-
hint: 'The SDK might not work correctly',
|
|
73
|
-
value: true,
|
|
74
|
-
},
|
|
75
|
-
{ label: "No, I'll upgrade first", value: false },
|
|
76
|
-
],
|
|
77
|
-
}),
|
|
78
|
-
);
|
|
79
|
-
if (!shouldContinue) {
|
|
80
|
-
await abort('Exiting Wizard', 0);
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
Sentry.setTag(
|
|
86
|
-
'svelte-version',
|
|
87
|
-
getSvelteVersionBucket(getPackageVersion('svelte', packageJson)),
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const { selectedProject, selfHosted, sentryUrl, authToken } =
|
|
91
|
-
await getOrAskForProjectData(options, 'javascript-sveltekit');
|
|
92
|
-
|
|
93
|
-
const sdkAlreadyInstalled = hasPackageInstalled(
|
|
94
|
-
'@sentry/sveltekit',
|
|
95
|
-
packageJson,
|
|
96
|
-
);
|
|
97
|
-
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
98
|
-
|
|
99
|
-
await installPackage({
|
|
100
|
-
packageName: '@sentry/sveltekit@^9',
|
|
101
|
-
packageNameDisplayLabel: '@sentry/sveltekit',
|
|
102
|
-
alreadyInstalled: sdkAlreadyInstalled,
|
|
103
|
-
forceInstall,
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
await addDotEnvSentryBuildPluginFile(authToken);
|
|
107
|
-
|
|
108
|
-
const svelteConfig = await traceStep('load-svelte-config', loadSvelteConfig);
|
|
109
|
-
|
|
110
|
-
try {
|
|
111
|
-
await traceStep('configure-sdk', () =>
|
|
112
|
-
createOrMergeSvelteKitFiles(
|
|
113
|
-
{
|
|
114
|
-
dsn: selectedProject.keys[0].dsn.public,
|
|
115
|
-
org: selectedProject.organization.slug,
|
|
116
|
-
project: selectedProject.slug,
|
|
117
|
-
selfHosted,
|
|
118
|
-
url: sentryUrl,
|
|
119
|
-
},
|
|
120
|
-
svelteConfig,
|
|
121
|
-
),
|
|
122
|
-
);
|
|
123
|
-
} catch (e: unknown) {
|
|
124
|
-
clack.log.error('Error while setting up the SvelteKit SDK:');
|
|
125
|
-
clack.log.info(
|
|
126
|
-
chalk.dim(
|
|
127
|
-
typeof e === 'object' && e != null && 'toString' in e
|
|
128
|
-
? e.toString()
|
|
129
|
-
: typeof e === 'string'
|
|
130
|
-
? e
|
|
131
|
-
: 'Unknown error',
|
|
132
|
-
),
|
|
133
|
-
);
|
|
134
|
-
Sentry.captureException('Error while setting up the SvelteKit SDK');
|
|
135
|
-
await abort('Exiting Wizard');
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const shouldCreateExamplePage = await askShouldCreateExamplePage(
|
|
140
|
-
'/sentry-example',
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
if (shouldCreateExamplePage) {
|
|
144
|
-
try {
|
|
145
|
-
await traceStep('create-example-page', () =>
|
|
146
|
-
createExamplePage(svelteConfig, {
|
|
147
|
-
selfHosted,
|
|
148
|
-
url: sentryUrl,
|
|
149
|
-
orgSlug: selectedProject.organization.slug,
|
|
150
|
-
projectId: selectedProject.id,
|
|
151
|
-
}),
|
|
152
|
-
);
|
|
153
|
-
} catch (e: unknown) {
|
|
154
|
-
clack.log.error('Error while creating an example page to test Sentry:');
|
|
155
|
-
clack.log.info(
|
|
156
|
-
chalk.dim(
|
|
157
|
-
typeof e === 'object' && e != null && 'toString' in e
|
|
158
|
-
? e.toString()
|
|
159
|
-
: typeof e === 'string'
|
|
160
|
-
? e
|
|
161
|
-
: 'Unknown error',
|
|
162
|
-
),
|
|
163
|
-
);
|
|
164
|
-
Sentry.captureException(
|
|
165
|
-
'Error while creating an example Svelte page to test Sentry',
|
|
166
|
-
);
|
|
167
|
-
await abort('Exiting Wizard');
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
await runPrettierIfInstalled();
|
|
173
|
-
|
|
174
|
-
clack.outro(buildOutroMessage(shouldCreateExamplePage));
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
function buildOutroMessage(shouldCreateExamplePage: boolean): string {
|
|
178
|
-
const packageManager = detectPackageManger() || NPM;
|
|
179
|
-
|
|
180
|
-
let msg = chalk.green('\nSuccessfully installed the Sentry SvelteKit SDK!');
|
|
181
|
-
|
|
182
|
-
if (shouldCreateExamplePage) {
|
|
183
|
-
msg += `\n\nYou can validate your setup by starting your dev environment (${chalk.cyan(
|
|
184
|
-
`\`${packageManager.runScriptCommand} dev\``,
|
|
185
|
-
)}) and visiting ${chalk.cyan('"/sentry-example"')}.`;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
msg += `\n\nCheck out the SDK documentation for further configuration:
|
|
189
|
-
https://docs.sentry.io/platforms/javascript/guides/sveltekit/`;
|
|
190
|
-
|
|
191
|
-
return msg;
|
|
192
|
-
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
export function getClientHooksTemplate(
|
|
2
|
-
dsn: string,
|
|
3
|
-
selectedFeatures: {
|
|
4
|
-
performance: boolean;
|
|
5
|
-
replay: boolean;
|
|
6
|
-
},
|
|
7
|
-
) {
|
|
8
|
-
return `import { handleErrorWithSentry, replayIntegration } from "@sentry/sveltekit";
|
|
9
|
-
import * as Sentry from '@sentry/sveltekit';
|
|
10
|
-
|
|
11
|
-
Sentry.init({
|
|
12
|
-
dsn: '${dsn}',
|
|
13
|
-
${
|
|
14
|
-
selectedFeatures.performance
|
|
15
|
-
? `
|
|
16
|
-
tracesSampleRate: 1.0,
|
|
17
|
-
`
|
|
18
|
-
: ''
|
|
19
|
-
}
|
|
20
|
-
${
|
|
21
|
-
selectedFeatures.replay
|
|
22
|
-
? ` // This sets the sample rate to be 10%. You may want this to be 100% while
|
|
23
|
-
// in development and sample at a lower rate in production
|
|
24
|
-
replaysSessionSampleRate: 0.1,
|
|
25
|
-
|
|
26
|
-
// If the entire session is not sampled, use the below sample rate to sample
|
|
27
|
-
// sessions when an error occurs.
|
|
28
|
-
replaysOnErrorSampleRate: 1.0,
|
|
29
|
-
|
|
30
|
-
// If you don't want to use Session Replay, just remove the line below:
|
|
31
|
-
integrations: [replayIntegration()],`
|
|
32
|
-
: ''
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
37
|
-
export const handleError = handleErrorWithSentry();
|
|
38
|
-
`;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function getServerHooksTemplate(
|
|
42
|
-
dsn: string,
|
|
43
|
-
selectedFeatures: {
|
|
44
|
-
performance: boolean;
|
|
45
|
-
replay: boolean;
|
|
46
|
-
},
|
|
47
|
-
) {
|
|
48
|
-
return `import { sequence } from "@sveltejs/kit/hooks";
|
|
49
|
-
import { handleErrorWithSentry, sentryHandle } from "@sentry/sveltekit";
|
|
50
|
-
import * as Sentry from '@sentry/sveltekit';
|
|
51
|
-
|
|
52
|
-
Sentry.init({
|
|
53
|
-
dsn: '${dsn}',
|
|
54
|
-
${
|
|
55
|
-
selectedFeatures.performance
|
|
56
|
-
? `
|
|
57
|
-
tracesSampleRate: 1.0,
|
|
58
|
-
`
|
|
59
|
-
: ''
|
|
60
|
-
}
|
|
61
|
-
// uncomment the line below to enable Spotlight (https://spotlightjs.com)
|
|
62
|
-
// spotlight: import.meta.env.DEV,
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
// If you have custom handlers, make sure to place them after \`sentryHandle()\` in the \`sequence\` function.
|
|
66
|
-
export const handle = sequence(sentryHandle());
|
|
67
|
-
|
|
68
|
-
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
69
|
-
export const handleError = handleErrorWithSentry();
|
|
70
|
-
`;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* +page.svelte with Sentry example
|
|
75
|
-
*/
|
|
76
|
-
export function getSentryExampleSveltePage(options: {
|
|
77
|
-
selfHosted: boolean;
|
|
78
|
-
url: string;
|
|
79
|
-
orgSlug: string;
|
|
80
|
-
projectId: string;
|
|
81
|
-
}) {
|
|
82
|
-
const issuesPageLink = options.selfHosted
|
|
83
|
-
? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`
|
|
84
|
-
: `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;
|
|
85
|
-
|
|
86
|
-
return `<!--
|
|
87
|
-
This is just a very simple page with a button to throw an example error.
|
|
88
|
-
Feel free to delete this file and the entire sentry route.
|
|
89
|
-
-->
|
|
90
|
-
|
|
91
|
-
<script>
|
|
92
|
-
import * as Sentry from '@sentry/sveltekit';
|
|
93
|
-
|
|
94
|
-
function getSentryData() {
|
|
95
|
-
Sentry.startSpan(
|
|
96
|
-
{
|
|
97
|
-
name: 'Example Frontend Span',
|
|
98
|
-
op: 'test'
|
|
99
|
-
},
|
|
100
|
-
async () => {
|
|
101
|
-
const res = await fetch('/sentry-example');
|
|
102
|
-
if (!res.ok) {
|
|
103
|
-
throw new Error('Sentry Example Frontend Error');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
<title>Sentry Onboarding</title>
|
|
111
|
-
|
|
112
|
-
<div>
|
|
113
|
-
<main>
|
|
114
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 44">
|
|
115
|
-
<path
|
|
116
|
-
fill="currentColor"
|
|
117
|
-
d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"
|
|
118
|
-
/>
|
|
119
|
-
</svg>
|
|
120
|
-
<p>
|
|
121
|
-
Get Started with this <strong>simple Example:</strong>
|
|
122
|
-
</p>
|
|
123
|
-
|
|
124
|
-
<p>1. Send us a sample error:</p>
|
|
125
|
-
<button type="button" on:click={getSentryData}> Throw error! </button>
|
|
126
|
-
|
|
127
|
-
<p>
|
|
128
|
-
2. Look for the error on the
|
|
129
|
-
<a href="${issuesPageLink}">Issues Page</a>.
|
|
130
|
-
</p>
|
|
131
|
-
<p style="margin-top: 24px;">
|
|
132
|
-
For more information, take a look at the
|
|
133
|
-
<a href="https://docs.sentry.io/platforms/javascript/guides/sveltekit/">
|
|
134
|
-
Sentry SvelteKit Documentation
|
|
135
|
-
</a>
|
|
136
|
-
</p>
|
|
137
|
-
</main>
|
|
138
|
-
</div>
|
|
139
|
-
|
|
140
|
-
<style>
|
|
141
|
-
main {
|
|
142
|
-
display: flex;
|
|
143
|
-
flex-direction: column;
|
|
144
|
-
justify-content: center;
|
|
145
|
-
align-items: center;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
svg {
|
|
149
|
-
font-size: 4rem;
|
|
150
|
-
margin: 14px 0;
|
|
151
|
-
height: 1em;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
button {
|
|
155
|
-
padding: 12px;
|
|
156
|
-
cursor: pointer;
|
|
157
|
-
background-color: rgb(54, 45, 89);
|
|
158
|
-
border-radius: 4px;
|
|
159
|
-
border: none;
|
|
160
|
-
color: white;
|
|
161
|
-
font-size: 1em;
|
|
162
|
-
margin: 1em;
|
|
163
|
-
transition: all 0.25s ease-in-out;
|
|
164
|
-
}
|
|
165
|
-
button:hover {
|
|
166
|
-
background-color: #8c5393;
|
|
167
|
-
box-shadow: 4px;
|
|
168
|
-
box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);
|
|
169
|
-
}
|
|
170
|
-
button:active {
|
|
171
|
-
background-color: #c73852;
|
|
172
|
-
}
|
|
173
|
-
</style>
|
|
174
|
-
`;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export function getSentryExampleApiRoute() {
|
|
178
|
-
return `// This is just a very simple API route that throws an example error.
|
|
179
|
-
// Feel free to delete this file and the entire sentry route.
|
|
180
|
-
|
|
181
|
-
export const GET = async () => {
|
|
182
|
-
throw new Error("Sentry Example API Route Error");
|
|
183
|
-
};
|
|
184
|
-
`;
|
|
185
|
-
}
|
package/src/sveltekit/utils.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { lt, minVersion } from 'semver';
|
|
2
|
-
|
|
3
|
-
export function getKitVersionBucket(
|
|
4
|
-
version: string | undefined,
|
|
5
|
-
): 'none' | 'invalid' | '0.x' | '>=1.0.0 <1.24.0' | '>=1.24.0' {
|
|
6
|
-
if (!version) {
|
|
7
|
-
return 'none';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const minVer = minVersion(version);
|
|
11
|
-
if (!minVer) {
|
|
12
|
-
return 'invalid';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (lt(minVer, '1.0.0')) {
|
|
16
|
-
return '0.x';
|
|
17
|
-
} else if (lt(minVer, '1.24.0')) {
|
|
18
|
-
return '>=1.0.0 <1.24.0';
|
|
19
|
-
} else {
|
|
20
|
-
// This is the version when the client-side invalidation fix was released
|
|
21
|
-
// https://github.com/sveltejs/kit/releases/tag/%40sveltejs%2Fkit%401.24.0
|
|
22
|
-
// https://github.com/sveltejs/kit/pull/10576
|
|
23
|
-
return '>=1.24.0';
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getSvelteVersionBucket(
|
|
28
|
-
version: string | undefined,
|
|
29
|
-
): 'none' | 'invalid' | '<3.0.0' | '3.x' | '4.x' | '>4.x' {
|
|
30
|
-
if (!version) {
|
|
31
|
-
return 'none';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const minVer = minVersion(version);
|
|
35
|
-
if (!minVer) {
|
|
36
|
-
return 'invalid';
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (lt(minVer, '3.0.0')) {
|
|
40
|
-
return '<3.0.0';
|
|
41
|
-
}
|
|
42
|
-
if (lt(minVer, '4.0.0')) {
|
|
43
|
-
return '3.x';
|
|
44
|
-
}
|
|
45
|
-
if (lt(minVer, '5.0.0')) {
|
|
46
|
-
return '4.x';
|
|
47
|
-
}
|
|
48
|
-
// Svelte 5 isn't released yet but it's being worked on
|
|
49
|
-
return '>4.x';
|
|
50
|
-
}
|
package/src/telemetry.ts
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Hub,
|
|
3
|
-
Integrations,
|
|
4
|
-
NodeClient,
|
|
5
|
-
type Span,
|
|
6
|
-
defaultStackParser,
|
|
7
|
-
flush,
|
|
8
|
-
makeMain,
|
|
9
|
-
makeNodeTransport,
|
|
10
|
-
runWithAsyncContext,
|
|
11
|
-
setTag,
|
|
12
|
-
startSpan,
|
|
13
|
-
} from '@sentry/node';
|
|
14
|
-
import { readFileSync } from 'node:fs';
|
|
15
|
-
import { dirname, join } from 'node:path';
|
|
16
|
-
import type { WizardOptions } from './utils/types';
|
|
17
|
-
|
|
18
|
-
export async function withTelemetry<F>(
|
|
19
|
-
options: {
|
|
20
|
-
enabled: boolean;
|
|
21
|
-
integration: string;
|
|
22
|
-
wizardOptions: WizardOptions;
|
|
23
|
-
},
|
|
24
|
-
callback: () => F | Promise<F>,
|
|
25
|
-
): Promise<F> {
|
|
26
|
-
const { sentryHub, sentryClient } = createSentryInstance(
|
|
27
|
-
options.enabled,
|
|
28
|
-
options.integration,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
makeMain(sentryHub);
|
|
32
|
-
|
|
33
|
-
const sentrySession = sentryHub.startSession();
|
|
34
|
-
sentryHub.captureSession();
|
|
35
|
-
|
|
36
|
-
// Set tag for passed CLI args
|
|
37
|
-
sentryHub.setTag('args.project', !!options.wizardOptions.projectSlug);
|
|
38
|
-
sentryHub.setTag('args.org', !!options.wizardOptions.orgSlug);
|
|
39
|
-
sentryHub.setTag('args.saas', !!options.wizardOptions.saas);
|
|
40
|
-
|
|
41
|
-
try {
|
|
42
|
-
return await startSpan(
|
|
43
|
-
{
|
|
44
|
-
name: 'sentry-wizard-execution',
|
|
45
|
-
status: 'ok',
|
|
46
|
-
op: 'wizard.flow',
|
|
47
|
-
},
|
|
48
|
-
async () => {
|
|
49
|
-
updateProgress('start');
|
|
50
|
-
const res = await runWithAsyncContext(callback);
|
|
51
|
-
updateProgress('finished');
|
|
52
|
-
|
|
53
|
-
return res;
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
sentryHub.captureException('Error during wizard execution.');
|
|
58
|
-
sentrySession.status = 'crashed';
|
|
59
|
-
throw e;
|
|
60
|
-
} finally {
|
|
61
|
-
sentryHub.endSession();
|
|
62
|
-
await sentryClient.flush(3000).then(null, () => {
|
|
63
|
-
// If telemetry flushing fails we generally don't care
|
|
64
|
-
});
|
|
65
|
-
await flush(3000).then(null, () => {
|
|
66
|
-
// If telemetry flushing fails we generally don't care
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function createSentryInstance(enabled: boolean, integration: string) {
|
|
72
|
-
let version: string | undefined = process.env.npm_package_version;
|
|
73
|
-
if (!version) {
|
|
74
|
-
try {
|
|
75
|
-
const pathToPackageJson = join(
|
|
76
|
-
dirname(require.resolve('@sentry/wizard')),
|
|
77
|
-
'..',
|
|
78
|
-
'package.json',
|
|
79
|
-
);
|
|
80
|
-
const packageJsonData = readFileSync(pathToPackageJson, 'utf-8');
|
|
81
|
-
const parsedPackageJson = JSON.parse(packageJsonData) as {
|
|
82
|
-
version?: string;
|
|
83
|
-
};
|
|
84
|
-
version = parsedPackageJson.version;
|
|
85
|
-
} catch {
|
|
86
|
-
// If we fail to read the package.json file, we don't want to crash the wizard
|
|
87
|
-
// so we just don't set the version
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const client = new NodeClient({
|
|
92
|
-
dsn: 'https://8871d3ff64814ed8960c96d1fcc98a27@o1.ingest.sentry.io/4505425820712960',
|
|
93
|
-
enabled: enabled,
|
|
94
|
-
|
|
95
|
-
environment: `production-${integration}`,
|
|
96
|
-
|
|
97
|
-
tracesSampleRate: 1,
|
|
98
|
-
sampleRate: 1,
|
|
99
|
-
|
|
100
|
-
release: version,
|
|
101
|
-
integrations: [new Integrations.Http()],
|
|
102
|
-
tracePropagationTargets: [/^https:\/\/sentry.io\//],
|
|
103
|
-
|
|
104
|
-
stackParser: defaultStackParser,
|
|
105
|
-
|
|
106
|
-
beforeSendTransaction: (event) => {
|
|
107
|
-
delete event.server_name; // Server name might contain PII
|
|
108
|
-
return event;
|
|
109
|
-
},
|
|
110
|
-
|
|
111
|
-
beforeSend: (event) => {
|
|
112
|
-
event.exception?.values?.forEach((exception) => {
|
|
113
|
-
delete exception.stacktrace;
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
delete event.server_name; // Server name might contain PII
|
|
117
|
-
return event;
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
transport: makeNodeTransport,
|
|
121
|
-
|
|
122
|
-
debug: true,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
const hub = new Hub(client);
|
|
126
|
-
|
|
127
|
-
hub.setTag('integration', integration);
|
|
128
|
-
hub.setTag('node', process.version);
|
|
129
|
-
hub.setTag('platform', process.platform);
|
|
130
|
-
|
|
131
|
-
return { sentryHub: hub, sentryClient: client };
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export function traceStep<T>(
|
|
135
|
-
step: string,
|
|
136
|
-
callback: (span: Span | undefined) => T,
|
|
137
|
-
): T {
|
|
138
|
-
updateProgress(step);
|
|
139
|
-
return startSpan({ name: step, op: 'wizard.step' }, (span) => callback(span));
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export function updateProgress(step: string) {
|
|
143
|
-
setTag('progress', step);
|
|
144
|
-
}
|