@sentry/wizard 3.42.0 → 4.0.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/.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/CHANGELOG.md +30 -0
- package/COPYING +3575 -0
- package/bin.ts +85 -80
- package/dist/bin.js +44 -35
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/jest.config.js +1 -1
- package/dist/e2e-tests/jest.config.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +62 -147
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/nextjs.test.js +77 -175
- package/dist/e2e-tests/tests/nextjs.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +61 -162
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +62 -163
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +147 -189
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit.test.js +133 -187
- package/dist/e2e-tests/tests/sveltekit.test.js.map +1 -1
- package/dist/e2e-tests/utils/index.d.ts +1 -1
- package/dist/e2e-tests/utils/index.js +113 -195
- package/dist/e2e-tests/utils/index.js.map +1 -1
- package/dist/lib/Constants.js +5 -5
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/BottomBar.d.ts +1 -1
- package/dist/lib/Helper/BottomBar.js +14 -15
- package/dist/lib/Helper/BottomBar.js.map +1 -1
- package/dist/lib/Helper/Env.js +5 -2
- package/dist/lib/Helper/Env.js.map +1 -1
- package/dist/lib/Helper/File.js +14 -27
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Git.js +24 -59
- package/dist/lib/Helper/Git.js.map +1 -1
- package/dist/lib/Helper/Logging.js +2 -2
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/MergeConfig.js +4 -4
- package/dist/lib/Helper/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/Package.d.ts +4 -1
- package/dist/lib/Helper/Package.js +12 -38
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/SentryCli.js +77 -149
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +29 -124
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/File.js +4 -4
- package/dist/lib/Helper/__tests__/File.js.map +1 -1
- package/dist/lib/Helper/__tests__/MergeConfig.js +24 -24
- package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +33 -23
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.js +23 -85
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/BaseStep.js +8 -8
- package/dist/lib/Steps/BaseStep.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +80 -125
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/ConfigureProject.js +6 -66
- package/dist/lib/Steps/ConfigureProject.js.map +1 -1
- package/dist/lib/Steps/Initial.js +16 -104
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +24 -118
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +95 -183
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +87 -145
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +40 -148
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/OpenSentry.js +63 -126
- package/dist/lib/Steps/OpenSentry.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.js +110 -206
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/Result.js +19 -79
- package/dist/lib/Steps/Result.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js +57 -148
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/ShouldConfigure.js +6 -66
- package/dist/lib/Steps/ShouldConfigure.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.js +43 -120
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Steps/Welcome.js +17 -76
- package/dist/lib/Steps/Welcome.js.map +1 -1
- package/dist/lib/__tests__/Env.js +3 -3
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/src/android/android-wizard.js +100 -176
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/android/code-tools.js +24 -33
- package/dist/src/android/code-tools.js.map +1 -1
- package/dist/src/android/gradle.js +106 -165
- package/dist/src/android/gradle.js.map +1 -1
- package/dist/src/android/manifest.js +26 -27
- package/dist/src/android/manifest.js.map +1 -1
- package/dist/src/android/templates.js +76 -23
- package/dist/src/android/templates.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +129 -225
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/cocoapod.js +47 -109
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/apple/code-tools.js +32 -35
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/fastlane.js +51 -97
- package/dist/src/apple/fastlane.js.map +1 -1
- package/dist/src/apple/templates.js +41 -5
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +2 -2
- package/dist/src/apple/xcode-manager.js +93 -108
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/code-tools.js +79 -127
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +75 -136
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/flutter/templates.js +48 -12
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +527 -805
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +380 -40
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nextjs/utils.js +5 -5
- package/dist/src/nextjs/utils.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +91 -188
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-example.js +68 -137
- package/dist/src/nuxt/sdk-example.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.d.ts +4 -4
- package/dist/src/nuxt/sdk-setup.js +180 -336
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.js +195 -18
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/utils.js +29 -76
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/react-native/expo-env-file.js +41 -94
- package/dist/src/react-native/expo-env-file.js.map +1 -1
- package/dist/src/react-native/expo-metro.d.ts +1 -1
- package/dist/src/react-native/expo-metro.js +75 -130
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/expo.js +61 -114
- package/dist/src/react-native/expo.js.map +1 -1
- package/dist/src/react-native/git.js +23 -56
- package/dist/src/react-native/git.js.map +1 -1
- package/dist/src/react-native/glob.js +3 -3
- package/dist/src/react-native/glob.js.map +1 -1
- package/dist/src/react-native/gradle.js +4 -4
- package/dist/src/react-native/gradle.js.map +1 -1
- package/dist/src/react-native/javascript.js +51 -95
- package/dist/src/react-native/javascript.js.map +1 -1
- package/dist/src/react-native/metro.js +176 -296
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/react-native/react-native-wizard.js +267 -418
- package/dist/src/react-native/react-native-wizard.js.map +1 -1
- package/dist/src/react-native/uninstall.js +37 -80
- package/dist/src/react-native/uninstall.js.map +1 -1
- package/dist/src/react-native/xcode.js +57 -55
- package/dist/src/react-native/xcode.js.map +1 -1
- package/dist/src/remix/codemods/express-server.js +27 -82
- package/dist/src/remix/codemods/express-server.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +28 -31
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/codemods/root-common.js +11 -11
- package/dist/src/remix/codemods/root-common.js.map +1 -1
- package/dist/src/remix/codemods/root-v1.js +17 -67
- package/dist/src/remix/codemods/root-v1.js.map +1 -1
- package/dist/src/remix/codemods/root-v2.js +89 -140
- package/dist/src/remix/codemods/root-v2.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +181 -343
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +84 -66
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +161 -293
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/remix/templates.js +10 -2
- package/dist/src/remix/templates.js.map +1 -1
- package/dist/src/remix/utils.js +13 -14
- package/dist/src/remix/utils.js.map +1 -1
- package/dist/src/run.js +106 -178
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +248 -372
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.js +32 -66
- package/dist/src/sourcemaps/tools/angular.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.js +14 -59
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -1
- package/dist/src/sourcemaps/tools/esbuild.js +34 -77
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.d.ts +2 -2
- package/dist/src/sourcemaps/tools/nextjs.js +75 -102
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +53 -93
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +35 -76
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +157 -289
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.js +68 -134
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +111 -196
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.d.ts +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +158 -260
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +9 -54
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +77 -144
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sourcemaps/utils/sdk-version.js +112 -191
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sdk-example.js +20 -70
- package/dist/src/sveltekit/sdk-example.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +250 -411
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +107 -191
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/sveltekit/templates.js +147 -13
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/sveltekit/utils.js +3 -3
- package/dist/src/sveltekit/utils.js.map +1 -1
- package/dist/src/telemetry.d.ts +2 -2
- package/dist/src/telemetry.js +58 -108
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/ast-utils.js +39 -54
- package/dist/src/utils/ast-utils.js.map +1 -1
- package/dist/src/utils/bash.js +28 -75
- package/dist/src/utils/bash.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +3 -7
- package/dist/src/utils/clack-utils.js +688 -1083
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/debug.js +6 -10
- package/dist/src/utils/debug.js.map +1 -1
- package/dist/src/utils/package-json.js +5 -6
- package/dist/src/utils/package-json.js.map +1 -1
- package/dist/src/utils/package-manager.js +65 -139
- package/dist/src/utils/package-manager.js.map +1 -1
- package/dist/src/utils/release-registry.js +12 -59
- package/dist/src/utils/release-registry.js.map +1 -1
- package/dist/src/utils/semver.js +3 -4
- package/dist/src/utils/semver.js.map +1 -1
- package/dist/src/utils/sentrycli-utils.js +4 -4
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/url.js +5 -6
- package/dist/src/utils/url.js.map +1 -1
- package/dist/test/android/code-tools.test.js +18 -18
- package/dist/test/android/code-tools.test.js.map +1 -1
- package/dist/test/apple/cocoapod.test.js +154 -299
- package/dist/test/apple/cocoapod.test.js.map +1 -1
- package/dist/test/apple/code-tools.test.js +375 -263
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/fastfile.test.js +319 -271
- package/dist/test/apple/fastfile.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +114 -30
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/apple/xcode-manager.test.js +230 -234
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +119 -48
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +63 -20
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/templates.test.js +332 -43
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +161 -33
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-native/expo-metro.test.js +61 -15
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/expo.test.js +37 -17
- package/dist/test/react-native/expo.test.js.map +1 -1
- package/dist/test/react-native/gradle.test.js +260 -28
- package/dist/test/react-native/gradle.test.js.map +1 -1
- package/dist/test/react-native/javascript.test.js +85 -19
- package/dist/test/react-native/javascript.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +261 -187
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/react-native/xcode.test.js +243 -62
- package/dist/test/react-native/xcode.test.js.map +1 -1
- package/dist/test/remix/client-entry.test.js +81 -21
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/remix/server-instrumentation.test.js +21 -8
- package/dist/test/remix/server-instrumentation.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/sentry-cli.test.js +20 -72
- package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/tsc.test.js +142 -68
- package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/vite.test.js +106 -75
- package/dist/test/sourcemaps/tools/vite.test.js.map +1 -1
- package/dist/test/sourcemaps/tools/webpack.test.js +226 -102
- package/dist/test/sourcemaps/tools/webpack.test.js.map +1 -1
- package/dist/test/sveltekit/templates.test.js +117 -18
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/ast-utils.test.js +99 -58
- package/dist/test/utils/ast-utils.test.js.map +1 -1
- package/dist/test/utils/clack-utils.test.js +142 -247
- package/dist/test/utils/clack-utils.test.js.map +1 -1
- package/e2e-tests/package.json +1 -1
- package/e2e-tests/tests/flutter.test.ts +20 -20
- package/e2e-tests/tests/nextjs.test.ts +2 -2
- package/e2e-tests/tests/nuxt-3.test.ts +4 -4
- package/e2e-tests/tests/nuxt-4.test.ts +3 -3
- package/e2e-tests/tests/remix.test.ts +3 -3
- package/e2e-tests/tests/sveltekit.test.ts +3 -3
- package/e2e-tests/utils/index.ts +33 -15
- package/lib/Helper/BottomBar.ts +1 -1
- package/lib/Helper/Env.ts +1 -1
- package/lib/Helper/Package.ts +12 -10
- package/lib/Helper/SentryCli.ts +18 -27
- package/lib/Helper/Wizard.ts +1 -2
- package/lib/Setup.ts +4 -5
- package/lib/Steps/ChooseIntegration.ts +40 -8
- package/lib/Steps/Initial.ts +17 -26
- package/lib/Steps/Integrations/BaseIntegration.ts +2 -8
- package/lib/Steps/Integrations/Cordova.ts +9 -15
- package/lib/Steps/Integrations/Electron.ts +23 -20
- package/lib/Steps/Integrations/MobileProject.ts +18 -15
- package/lib/Steps/OpenSentry.ts +12 -7
- package/lib/Steps/PromptForParameters.ts +12 -19
- package/lib/Steps/SentryProjectSelector.ts +30 -29
- package/lib/Steps/WaitForSentry.ts +29 -23
- package/package.json +12 -8
- package/src/apple/xcode-manager.ts +10 -10
- package/src/nextjs/templates.ts +2 -6
- package/src/nuxt/sdk-setup.ts +21 -18
- package/src/react-native/expo-metro.ts +2 -2
- package/src/react-native/react-native-wizard.ts +1 -2
- package/src/react-native/uninstall.ts +1 -2
- package/src/react-native/xcode.ts +1 -1
- package/src/run.ts +12 -5
- package/src/sourcemaps/tools/nextjs.ts +2 -5
- package/src/sourcemaps/tools/webpack.ts +3 -3
- package/src/telemetry.ts +27 -7
- package/src/utils/clack-utils.ts +50 -47
- package/test/apple/cocoapod.test.ts +4 -0
- package/test/apple/fastfile.test.ts +12 -7
- package/test/apple/xcode-manager.test.ts +13 -11
- package/test/nextjs/templates.test.ts +0 -12
- package/test/utils/clack-utils.test.ts +40 -50
- package/types/read-env.d.ts +3 -0
- package/types/xcode.d.ts +1 -0
- package/dist/package.json +0 -128
|
@@ -22,150 +22,89 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
-
function step(op) {
|
|
39
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
-
switch (op[0]) {
|
|
44
|
-
case 0: case 1: t = op; break;
|
|
45
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
-
default:
|
|
49
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
-
if (t[2]) _.ops.pop();
|
|
54
|
-
_.trys.pop(); continue;
|
|
55
|
-
}
|
|
56
|
-
op = body.call(thisArg, _);
|
|
57
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
27
|
};
|
|
64
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
29
|
exports.runFlutterWizard = void 0;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
30
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
31
|
+
const codetools = __importStar(require("./code-tools"));
|
|
32
|
+
const fs = __importStar(require("fs"));
|
|
33
|
+
const path = __importStar(require("path"));
|
|
34
|
+
const clack_utils_1 = require("../utils/clack-utils");
|
|
35
|
+
const templates_1 = require("./templates");
|
|
36
|
+
const release_registry_1 = require("../utils/release-registry");
|
|
73
37
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
function runFlutterWizard(options) {
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
wizardOptions: options,
|
|
86
|
-
}, function () { return runFlutterWizardWithTelemetry(options); })];
|
|
87
|
-
});
|
|
88
|
-
});
|
|
38
|
+
const clack = __importStar(require("@clack/prompts"));
|
|
39
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
40
|
+
const clack_utils_2 = require("../utils/clack-utils");
|
|
41
|
+
const telemetry_1 = require("../telemetry");
|
|
42
|
+
const code_tools_1 = require("./code-tools");
|
|
43
|
+
async function runFlutterWizard(options) {
|
|
44
|
+
return (0, telemetry_1.withTelemetry)({
|
|
45
|
+
enabled: options.telemetryEnabled,
|
|
46
|
+
integration: 'flutter',
|
|
47
|
+
wizardOptions: options,
|
|
48
|
+
}, () => runFlutterWizardWithTelemetry(options));
|
|
89
49
|
}
|
|
90
50
|
exports.runFlutterWizard = runFlutterWizard;
|
|
91
|
-
function runFlutterWizardWithTelemetry(options) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
switch (_b.label) {
|
|
96
|
-
case 0:
|
|
97
|
-
(0, clack_utils_2.printWelcome)({
|
|
98
|
-
wizardName: 'Sentry Flutter Wizard',
|
|
99
|
-
promoCode: options.promoCode,
|
|
100
|
-
});
|
|
101
|
-
return [4 /*yield*/, (0, clack_utils_2.confirmContinueIfNoOrDirtyGitRepo)()];
|
|
102
|
-
case 1:
|
|
103
|
-
_b.sent();
|
|
104
|
-
return [4 /*yield*/, (0, clack_utils_2.getOrAskForProjectData)(options, 'flutter')];
|
|
105
|
-
case 2:
|
|
106
|
-
_a = _b.sent(), selectedProject = _a.selectedProject, selfHosted = _a.selfHosted, sentryUrl = _a.sentryUrl, authToken = _a.authToken;
|
|
107
|
-
projectDir = process.cwd();
|
|
108
|
-
pubspecFile = path.join(projectDir, 'pubspec.yaml');
|
|
109
|
-
if (!fs.existsSync(pubspecFile)) {
|
|
110
|
-
clack.log.error("Could not find ".concat(chalk_1.default.cyan('pubspec.yaml'), ". Make sure you run the wizard in the projects root folder."));
|
|
111
|
-
return [2 /*return*/];
|
|
112
|
-
}
|
|
113
|
-
// ======== STEP 1. Add sentry_flutter and sentry_dart_plugin to pubspec.yaml ============
|
|
114
|
-
clack.log.step("Adding ".concat(chalk_1.default.bold('Sentry'), " to your apps ").concat(chalk_1.default.cyan('pubspec.yaml'), " file."));
|
|
115
|
-
return [4 /*yield*/, (0, release_registry_1.fetchSdkVersion)('sentry.dart.flutter')];
|
|
116
|
-
case 3:
|
|
117
|
-
flutterVersion = _b.sent();
|
|
118
|
-
flutterVersionOrAny = flutterVersion ? "^".concat(flutterVersion) : 'any';
|
|
119
|
-
return [4 /*yield*/, (0, release_registry_1.fetchSdkVersion)('sentry.dart.plugin')];
|
|
120
|
-
case 4:
|
|
121
|
-
pluginVersion = _b.sent();
|
|
122
|
-
pluginVersionOrAny = pluginVersion ? "^".concat(pluginVersion) : 'any';
|
|
123
|
-
pubspecPatched = (0, telemetry_1.traceStep)('Patch pubspec.yaml', function () {
|
|
124
|
-
return codetools.patchPubspec(pubspecFile, flutterVersionOrAny, pluginVersionOrAny, selectedProject.slug, selectedProject.organization.slug);
|
|
125
|
-
});
|
|
126
|
-
if (!!pubspecPatched) return [3 /*break*/, 6];
|
|
127
|
-
clack.log.warn("Could not patch ".concat(chalk_1.default.cyan('pubspec.yaml'), ". Add the dependencies to it."));
|
|
128
|
-
return [4 /*yield*/, (0, clack_utils_1.showCopyPasteInstructions)('pubspec.yaml', (0, templates_1.pubspecSnippetColored)(flutterVersionOrAny, pluginVersionOrAny, selectedProject.slug, selectedProject.organization.slug), 'This ensures the Sentry SDK and plugin can be imported.')];
|
|
129
|
-
case 5:
|
|
130
|
-
_b.sent();
|
|
131
|
-
_b.label = 6;
|
|
132
|
-
case 6:
|
|
133
|
-
Sentry.setTag('pubspec-patched', pubspecPatched);
|
|
134
|
-
propertiesAdded = (0, telemetry_1.traceStep)('Add sentry.properties', function () {
|
|
135
|
-
return codetools.addProperties(pubspecFile, authToken);
|
|
136
|
-
});
|
|
137
|
-
if (!propertiesAdded) {
|
|
138
|
-
clack.log.warn("We could not add ".concat(chalk_1.default.cyan('sentry.properties'), " file in your project directory in order to provide an auth token for Sentry CLI. You'll have to add it manually, or you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information."));
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
clack.log.info("We created ".concat(chalk_1.default.cyan('sentry.properties'), " file in your project directory in order to provide an auth token for Sentry CLI.\nIt was also added to your \".gitignore\" file.\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information."));
|
|
142
|
-
}
|
|
143
|
-
Sentry.setTag('sentry-properties-added', pubspecPatched);
|
|
144
|
-
// ======== STEP 3. Patch main.dart with setup and a test error snippet ============
|
|
145
|
-
clack.log.step("Patching ".concat(chalk_1.default.cyan('main.dart'), " with setup and test error snippet."));
|
|
146
|
-
mainFile = (0, code_tools_1.findFile)("".concat(projectDir, "/lib"), 'main.dart');
|
|
147
|
-
dsn = selectedProject.keys[0].dsn.public;
|
|
148
|
-
canEnableProfiling = fs.existsSync("".concat(projectDir, "/ios")) || fs.existsSync("".concat(projectDir, "/macos"));
|
|
149
|
-
return [4 /*yield*/, (0, telemetry_1.traceStep)('Patch main.dart', function () {
|
|
150
|
-
return codetools.patchMain(mainFile, dsn, canEnableProfiling);
|
|
151
|
-
})];
|
|
152
|
-
case 7:
|
|
153
|
-
mainPatched = _b.sent();
|
|
154
|
-
if (!!mainPatched) return [3 /*break*/, 9];
|
|
155
|
-
clack.log.warn("Could not patch ".concat(chalk_1.default.cyan('main.dart'), " file. Place the following code snippet within the apps main function."));
|
|
156
|
-
return [4 /*yield*/, (0, clack_utils_1.showCopyPasteInstructions)('main.dart', (0, templates_1.initSnippetColored)(dsn), 'This ensures the Sentry SDK is ready to capture errors.')];
|
|
157
|
-
case 8:
|
|
158
|
-
_b.sent();
|
|
159
|
-
_b.label = 9;
|
|
160
|
-
case 9:
|
|
161
|
-
Sentry.setTag('main-patched', mainPatched);
|
|
162
|
-
issuesPageLink = selfHosted
|
|
163
|
-
? "".concat(sentryUrl, "organizations/").concat(selectedProject.organization.slug, "/issues/?project=").concat(selectedProject.id)
|
|
164
|
-
: "https://".concat(selectedProject.organization.slug, ".sentry.io/issues/?project=").concat(selectedProject.id);
|
|
165
|
-
clack.outro("\n ".concat(chalk_1.default.greenBright('Successfully installed the Sentry Flutter SDK!'), "\n \n ").concat(chalk_1.default.cyan("You can validate your setup by launching your application and checking Sentry issues page afterwards\n ".concat(issuesPageLink)), "\n \n Check out the SDK documentation for further configuration:\n https://docs.sentry.io/platforms/flutter/\n "));
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
51
|
+
async function runFlutterWizardWithTelemetry(options) {
|
|
52
|
+
(0, clack_utils_2.printWelcome)({
|
|
53
|
+
wizardName: 'Sentry Flutter Wizard',
|
|
54
|
+
promoCode: options.promoCode,
|
|
169
55
|
});
|
|
56
|
+
await (0, clack_utils_2.confirmContinueIfNoOrDirtyGitRepo)();
|
|
57
|
+
const { selectedProject, selfHosted, sentryUrl, authToken } = await (0, clack_utils_2.getOrAskForProjectData)(options, 'flutter');
|
|
58
|
+
const projectDir = process.cwd();
|
|
59
|
+
const pubspecFile = path.join(projectDir, 'pubspec.yaml');
|
|
60
|
+
if (!fs.existsSync(pubspecFile)) {
|
|
61
|
+
clack.log.error(`Could not find ${chalk_1.default.cyan('pubspec.yaml')}. Make sure you run the wizard in the projects root folder.`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// ======== STEP 1. Add sentry_flutter and sentry_dart_plugin to pubspec.yaml ============
|
|
65
|
+
clack.log.step(`Adding ${chalk_1.default.bold('Sentry')} to your apps ${chalk_1.default.cyan('pubspec.yaml')} file.`);
|
|
66
|
+
const flutterVersion = await (0, release_registry_1.fetchSdkVersion)('sentry.dart.flutter');
|
|
67
|
+
const flutterVersionOrAny = flutterVersion ? `^${flutterVersion}` : 'any';
|
|
68
|
+
const pluginVersion = await (0, release_registry_1.fetchSdkVersion)('sentry.dart.plugin');
|
|
69
|
+
const pluginVersionOrAny = pluginVersion ? `^${pluginVersion}` : 'any';
|
|
70
|
+
const pubspecPatched = (0, telemetry_1.traceStep)('Patch pubspec.yaml', () => codetools.patchPubspec(pubspecFile, flutterVersionOrAny, pluginVersionOrAny, selectedProject.slug, selectedProject.organization.slug));
|
|
71
|
+
if (!pubspecPatched) {
|
|
72
|
+
clack.log.warn(`Could not patch ${chalk_1.default.cyan('pubspec.yaml')}. Add the dependencies to it.`);
|
|
73
|
+
await (0, clack_utils_1.showCopyPasteInstructions)('pubspec.yaml', (0, templates_1.pubspecSnippetColored)(flutterVersionOrAny, pluginVersionOrAny, selectedProject.slug, selectedProject.organization.slug), 'This ensures the Sentry SDK and plugin can be imported.');
|
|
74
|
+
}
|
|
75
|
+
Sentry.setTag('pubspec-patched', pubspecPatched);
|
|
76
|
+
// ======== STEP 2. Add sentry.properties with auth token ============
|
|
77
|
+
const propertiesAdded = (0, telemetry_1.traceStep)('Add sentry.properties', () => codetools.addProperties(pubspecFile, authToken));
|
|
78
|
+
if (!propertiesAdded) {
|
|
79
|
+
clack.log.warn(`We could not add ${chalk_1.default.cyan('sentry.properties')} file in your project directory in order to provide an auth token for Sentry CLI. You'll have to add it manually, or you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
clack.log.info(`We created ${chalk_1.default.cyan('sentry.properties')} file in your project directory in order to provide an auth token for Sentry CLI.\nIt was also added to your ".gitignore" file.\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
|
|
83
|
+
}
|
|
84
|
+
Sentry.setTag('sentry-properties-added', pubspecPatched);
|
|
85
|
+
// ======== STEP 3. Patch main.dart with setup and a test error snippet ============
|
|
86
|
+
clack.log.step(`Patching ${chalk_1.default.cyan('main.dart')} with setup and test error snippet.`);
|
|
87
|
+
const mainFile = (0, code_tools_1.findFile)(`${projectDir}/lib`, 'main.dart');
|
|
88
|
+
const dsn = selectedProject.keys[0].dsn.public;
|
|
89
|
+
const canEnableProfiling = fs.existsSync(`${projectDir}/ios`) || fs.existsSync(`${projectDir}/macos`);
|
|
90
|
+
const mainPatched = await (0, telemetry_1.traceStep)('Patch main.dart', () => codetools.patchMain(mainFile, dsn, canEnableProfiling));
|
|
91
|
+
if (!mainPatched) {
|
|
92
|
+
clack.log.warn(`Could not patch ${chalk_1.default.cyan('main.dart')} file. Place the following code snippet within the apps main function.`);
|
|
93
|
+
await (0, clack_utils_1.showCopyPasteInstructions)('main.dart', (0, templates_1.initSnippetColored)(dsn), 'This ensures the Sentry SDK is ready to capture errors.');
|
|
94
|
+
}
|
|
95
|
+
Sentry.setTag('main-patched', mainPatched);
|
|
96
|
+
// ======== OUTRO ========
|
|
97
|
+
const issuesPageLink = selfHosted
|
|
98
|
+
? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`
|
|
99
|
+
: `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;
|
|
100
|
+
clack.outro(`
|
|
101
|
+
${chalk_1.default.greenBright('Successfully installed the Sentry Flutter SDK!')}
|
|
102
|
+
|
|
103
|
+
${chalk_1.default.cyan(`You can validate your setup by launching your application and checking Sentry issues page afterwards
|
|
104
|
+
${issuesPageLink}`)}
|
|
105
|
+
|
|
106
|
+
Check out the SDK documentation for further configuration:
|
|
107
|
+
https://docs.sentry.io/platforms/flutter/
|
|
108
|
+
`);
|
|
170
109
|
}
|
|
171
110
|
//# sourceMappingURL=flutter-wizard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flutter-wizard.js","sourceRoot":"","sources":["../../../src/flutter/flutter-wizard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"flutter-wizard.js","sourceRoot":"","sources":["../../../src/flutter/flutter-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAuC;AACvC,wDAA0C;AAC1C,uCAAyB;AACzB,2CAA6B;AAC7B,sDAAiE;AACjE,2CAAwE;AACxE,gEAA4D;AAC5D,yEAAyE;AACzE,sDAAwC;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ACR,eAAK,CAAC,WAAW,CAAC,gDAAgD,CAAC;;MAEnE,eAAK,CAAC,IAAI,CACV;MACA,cAAc,EAAE,CACjB;;;;GAIF,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport * as codetools from './code-tools';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { showCopyPasteInstructions } from '../utils/clack-utils';\nimport { pubspecSnippetColored, initSnippetColored } from './templates';\nimport { fetchSdkVersion } from '../utils/release-registry';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack-utils';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { findFile } from './code-tools';\n\nexport async function runFlutterWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'flutter',\n wizardOptions: options,\n },\n () => runFlutterWizardWithTelemetry(options),\n );\n}\n\nasync function runFlutterWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Flutter Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'flutter');\n\n const projectDir = process.cwd();\n const pubspecFile = path.join(projectDir, 'pubspec.yaml');\n if (!fs.existsSync(pubspecFile)) {\n clack.log.error(\n `Could not find ${chalk.cyan(\n 'pubspec.yaml',\n )}. Make sure you run the wizard in the projects root folder.`,\n );\n return;\n }\n\n // ======== STEP 1. Add sentry_flutter and sentry_dart_plugin to pubspec.yaml ============\n\n clack.log.step(\n `Adding ${chalk.bold('Sentry')} to your apps ${chalk.cyan(\n 'pubspec.yaml',\n )} file.`,\n );\n\n const flutterVersion = await fetchSdkVersion('sentry.dart.flutter');\n const flutterVersionOrAny = flutterVersion ? `^${flutterVersion}` : 'any';\n\n const pluginVersion = await fetchSdkVersion('sentry.dart.plugin');\n const pluginVersionOrAny = pluginVersion ? `^${pluginVersion}` : 'any';\n\n const pubspecPatched = traceStep('Patch pubspec.yaml', () =>\n codetools.patchPubspec(\n pubspecFile,\n flutterVersionOrAny,\n pluginVersionOrAny,\n selectedProject.slug,\n selectedProject.organization.slug,\n ),\n );\n if (!pubspecPatched) {\n clack.log.warn(\n `Could not patch ${chalk.cyan(\n 'pubspec.yaml',\n )}. Add the dependencies to it.`,\n );\n await showCopyPasteInstructions(\n 'pubspec.yaml',\n pubspecSnippetColored(\n flutterVersionOrAny,\n pluginVersionOrAny,\n selectedProject.slug,\n selectedProject.organization.slug,\n ),\n 'This ensures the Sentry SDK and plugin can be imported.',\n );\n }\n Sentry.setTag('pubspec-patched', pubspecPatched);\n\n // ======== STEP 2. Add sentry.properties with auth token ============\n\n const propertiesAdded = traceStep('Add sentry.properties', () =>\n codetools.addProperties(pubspecFile, authToken),\n );\n if (!propertiesAdded) {\n clack.log.warn(\n `We could not add ${chalk.cyan(\n 'sentry.properties',\n )} file in your project directory in order to provide an auth token for Sentry CLI. You'll have to add it manually, or you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`,\n );\n } else {\n clack.log.info(\n `We created ${chalk.cyan(\n 'sentry.properties',\n )} file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`,\n );\n }\n Sentry.setTag('sentry-properties-added', pubspecPatched);\n\n // ======== STEP 3. Patch main.dart with setup and a test error snippet ============\n\n clack.log.step(\n `Patching ${chalk.cyan('main.dart')} with setup and test error snippet.`,\n );\n\n const mainFile = findFile(`${projectDir}/lib`, 'main.dart');\n const dsn = selectedProject.keys[0].dsn.public;\n const canEnableProfiling =\n fs.existsSync(`${projectDir}/ios`) || fs.existsSync(`${projectDir}/macos`);\n\n const mainPatched = await traceStep('Patch main.dart', () =>\n codetools.patchMain(mainFile, dsn, canEnableProfiling),\n );\n if (!mainPatched) {\n clack.log.warn(\n `Could not patch ${chalk.cyan(\n 'main.dart',\n )} file. Place the following code snippet within the apps main function.`,\n );\n await showCopyPasteInstructions(\n 'main.dart',\n initSnippetColored(dsn),\n 'This ensures the Sentry SDK is ready to capture errors.',\n );\n }\n Sentry.setTag('main-patched', mainPatched);\n\n // ======== OUTRO ========\n\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n ${chalk.greenBright('Successfully installed the Sentry Flutter SDK!')}\n \n ${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n ${issuesPageLink}`,\n )}\n \n Check out the SDK documentation for further configuration:\n https://docs.sentry.io/platforms/flutter/\n `);\n}\n"]}
|
|
@@ -1,38 +1,74 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initSnippetColored = exports.pubspecSnippetColored = exports.initSnippet = exports.sentryProperties = exports.pubspecOptions = exports.sentryImport = void 0;
|
|
4
|
-
|
|
5
|
-
exports.sentryImport =
|
|
4
|
+
const clack_utils_1 = require("../utils/clack-utils");
|
|
5
|
+
exports.sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\n`;
|
|
6
6
|
function pubspecOptions(project, org) {
|
|
7
|
-
return
|
|
7
|
+
return `sentry:
|
|
8
|
+
upload_debug_symbols: true
|
|
9
|
+
upload_source_maps: true
|
|
10
|
+
project: ${project}
|
|
11
|
+
org: ${org}
|
|
12
|
+
`;
|
|
8
13
|
}
|
|
9
14
|
exports.pubspecOptions = pubspecOptions;
|
|
10
15
|
function sentryProperties(authToken) {
|
|
11
|
-
return
|
|
16
|
+
return `auth_token=${authToken}`;
|
|
12
17
|
}
|
|
13
18
|
exports.sentryProperties = sentryProperties;
|
|
14
19
|
function initSnippet(dsn, selectedFeaturesMap, runApp) {
|
|
15
|
-
|
|
20
|
+
let snippet = `await SentryFlutter.init(
|
|
21
|
+
(options) {
|
|
22
|
+
options.dsn = '${dsn}';`;
|
|
16
23
|
if (selectedFeaturesMap.tracing) {
|
|
17
|
-
snippet +=
|
|
24
|
+
snippet += `
|
|
25
|
+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
|
|
26
|
+
// We recommend adjusting this value in production.
|
|
27
|
+
options.tracesSampleRate = 1.0;`;
|
|
18
28
|
}
|
|
19
29
|
if (selectedFeaturesMap.profiling && selectedFeaturesMap.tracing) {
|
|
20
|
-
snippet +=
|
|
30
|
+
snippet += `
|
|
31
|
+
// The sampling rate for profiling is relative to tracesSampleRate
|
|
32
|
+
// Setting to 1.0 will profile 100% of sampled transactions:
|
|
33
|
+
options.profilesSampleRate = 1.0;`;
|
|
21
34
|
}
|
|
22
|
-
snippet +=
|
|
35
|
+
snippet += `
|
|
36
|
+
},
|
|
37
|
+
appRunner: () => runApp(SentryWidget(child: ${runApp})),
|
|
38
|
+
);
|
|
39
|
+
// TODO: Remove this line after sending the first sample event to sentry.
|
|
40
|
+
await Sentry.captureException(Exception('This is a sample exception.'));`;
|
|
23
41
|
return snippet;
|
|
24
42
|
}
|
|
25
43
|
exports.initSnippet = initSnippet;
|
|
26
44
|
function pubspecSnippetColored(sentryVersion, pluginVersion, project, org) {
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
const snippet = `dependencies:
|
|
46
|
+
sentry_flutter: ${sentryVersion}
|
|
47
|
+
|
|
48
|
+
dev_dependencies:
|
|
49
|
+
sentry_dart_plugin: ${pluginVersion}
|
|
50
|
+
|
|
51
|
+
${pubspecOptions(project, org)}`;
|
|
52
|
+
return (0, clack_utils_1.makeCodeSnippet)(true, (_unchanged, plus, _minus) => {
|
|
29
53
|
return plus(snippet);
|
|
30
54
|
});
|
|
31
55
|
}
|
|
32
56
|
exports.pubspecSnippetColored = pubspecSnippetColored;
|
|
33
57
|
function initSnippetColored(dsn) {
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
const snippet = `import 'package:sentry_flutter/sentry_flutter.dart';
|
|
59
|
+
|
|
60
|
+
Future<void>main() async {
|
|
61
|
+
await SentryFlutter.init(
|
|
62
|
+
(options) {
|
|
63
|
+
options.dsn = '${dsn}';
|
|
64
|
+
// Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.
|
|
65
|
+
// We recommend adjusting this value in production.
|
|
66
|
+
options.tracesSampleRate = 1.0;
|
|
67
|
+
},
|
|
68
|
+
appRunner: () => runApp(SentryWidget(child: YourApp())),
|
|
69
|
+
)
|
|
70
|
+
}`;
|
|
71
|
+
return (0, clack_utils_1.makeCodeSnippet)(true, (_unchanged, plus, _minus) => {
|
|
36
72
|
return plus(snippet);
|
|
37
73
|
});
|
|
38
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/flutter/templates.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/flutter/templates.ts"],"names":[],"mappings":";;;AAAA,sDAAuD;AAE1C,QAAA,YAAY,GAAG,wDAAwD,CAAC;AAErF,SAAgB,cAAc,CAAC,OAAe,EAAE,GAAW;IACzD,OAAO;;;aAGI,OAAO;SACX,GAAG;CACX,CAAC;AACF,CAAC;AAPD,wCAOC;AAED,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,cAAc,SAAS,EAAE,CAAC;AACnC,CAAC;AAFD,4CAEC;AAED,SAAgB,WAAW,CACzB,GAAW,EACX,mBAGC,EACD,MAAc;IAEd,IAAI,OAAO,GAAG;;uBAEO,GAAG,IAAI,CAAC;IAE7B,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAC/B,OAAO,IAAI;;;sCAGuB,CAAC;KACpC;IAED,IAAI,mBAAmB,CAAC,SAAS,IAAI,mBAAmB,CAAC,OAAO,EAAE;QAChE,OAAO,IAAI;;;wCAGyB,CAAC;KACtC;IAED,OAAO,IAAI;;kDAEqC,MAAM;;;2EAGmB,CAAC;IAE1E,OAAO,OAAO,CAAC;AACjB,CAAC;AAlCD,kCAkCC;AAED,SAAgB,qBAAqB,CACnC,aAAqB,EACrB,aAAqB,EACrB,OAAe,EACf,GAAW;IAEX,MAAM,OAAO,GAAG;oBACE,aAAa;;;wBAGT,aAAa;;EAEnC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;IAE/B,OAAO,IAAA,6BAAe,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,sDAiBC;AAED,SAAgB,kBAAkB,CAAC,GAAW;IAC5C,MAAM,OAAO,GAAG;;;;;uBAKK,GAAG;;;;;;;EAOxB,CAAC;IACD,OAAO,IAAA,6BAAe,EAAC,IAAI,EAAE,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC;AAjBD,gDAiBC","sourcesContent":["import { makeCodeSnippet } from '../utils/clack-utils';\n\nexport const sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\\n`;\n\nexport function pubspecOptions(project: string, org: string): string {\n return `sentry:\n upload_debug_symbols: true\n upload_source_maps: true\n project: ${project}\n org: ${org}\n`;\n}\n\nexport function sentryProperties(authToken: string): string {\n return `auth_token=${authToken}`;\n}\n\nexport function initSnippet(\n dsn: string,\n selectedFeaturesMap: {\n tracing: boolean;\n profiling: boolean;\n },\n runApp: string,\n): string {\n let snippet = `await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';`;\n\n if (selectedFeaturesMap.tracing) {\n snippet += `\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;`;\n }\n\n if (selectedFeaturesMap.profiling && selectedFeaturesMap.tracing) {\n snippet += `\n // The sampling rate for profiling is relative to tracesSampleRate\n // Setting to 1.0 will profile 100% of sampled transactions:\n options.profilesSampleRate = 1.0;`;\n }\n\n snippet += `\n },\n appRunner: () => runApp(SentryWidget(child: ${runApp})),\n );\n // TODO: Remove this line after sending the first sample event to sentry.\n await Sentry.captureException(Exception('This is a sample exception.'));`;\n\n return snippet;\n}\n\nexport function pubspecSnippetColored(\n sentryVersion: string,\n pluginVersion: string,\n project: string,\n org: string,\n): string {\n const snippet = `dependencies:\n sentry_flutter: ${sentryVersion}\n\ndev_dependencies:\n sentry_dart_plugin: ${pluginVersion}\n \n${pubspecOptions(project, org)}`;\n\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n\nexport function initSnippetColored(dsn: string): string {\n const snippet = `import 'package:sentry_flutter/sentry_flutter.dart';\n\nFuture<void>main() async {\n await SentryFlutter.init(\n (options) {\n options.dsn = '${dsn}';\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0;\n },\n appRunner: () => runApp(SentryWidget(child: YourApp())),\n )\n}`;\n return makeCodeSnippet(true, (_unchanged, plus, _minus) => {\n return plus(snippet);\n });\n}\n"]}
|