@sentry/wizard 3.42.1 → 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 +26 -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 -3
- 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 -2
- 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/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,69 +22,33 @@ 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
|
-
exports.askShouldAddPackageOverride = exports.askShouldInstallPackage = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE =
|
|
29
|
+
exports.askShouldAddPackageOverride = exports.askShouldInstallPackage = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
|
|
30
|
+
const childProcess = __importStar(require("node:child_process"));
|
|
31
|
+
const fs = __importStar(require("node:fs"));
|
|
32
|
+
const os = __importStar(require("node:os"));
|
|
33
|
+
const node_path_1 = require("node:path");
|
|
34
|
+
const node_timers_1 = require("node:timers");
|
|
35
|
+
const node_url_1 = require("node:url");
|
|
66
36
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
var package_json_1 = require("./package-json");
|
|
78
|
-
var telemetry_1 = require("../telemetry");
|
|
79
|
-
var package_manager_1 = require("./package-manager");
|
|
80
|
-
var debug_1 = require("./debug");
|
|
81
|
-
var semver_1 = require("./semver");
|
|
82
|
-
exports.opn = require('opn');
|
|
37
|
+
const clack = __importStar(require("@clack/prompts"));
|
|
38
|
+
const Sentry = __importStar(require("@sentry/node"));
|
|
39
|
+
const axios_1 = __importDefault(require("axios"));
|
|
40
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
41
|
+
const opn_1 = __importDefault(require("opn"));
|
|
42
|
+
const telemetry_1 = require("../telemetry");
|
|
43
|
+
const debug_1 = require("./debug");
|
|
44
|
+
const package_json_1 = require("./package-json");
|
|
45
|
+
const package_manager_1 = require("./package-manager");
|
|
46
|
+
const semver_1 = require("./semver");
|
|
83
47
|
exports.SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';
|
|
84
48
|
exports.SENTRY_CLI_RC_FILE = '.sentryclirc';
|
|
85
49
|
exports.SENTRY_PROPERTIES_FILE = 'sentry.properties';
|
|
86
|
-
|
|
87
|
-
|
|
50
|
+
const SAAS_URL = 'https://sentry.io/';
|
|
51
|
+
const DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';
|
|
88
52
|
exports.rcCliSetupConfig = {
|
|
89
53
|
filename: exports.SENTRY_CLI_RC_FILE,
|
|
90
54
|
name: 'source maps',
|
|
@@ -93,7 +57,7 @@ exports.rcCliSetupConfig = {
|
|
|
93
57
|
return !!(contents.includes('[auth]') && contents.match(/token=./g));
|
|
94
58
|
},
|
|
95
59
|
tokenContent: function (authToken) {
|
|
96
|
-
return
|
|
60
|
+
return `[auth]\ntoken=${authToken}`;
|
|
97
61
|
},
|
|
98
62
|
likelyAlreadyHasOrgAndProject: function (contents) {
|
|
99
63
|
return !!(contents.includes('[defaults]') &&
|
|
@@ -101,156 +65,122 @@ exports.rcCliSetupConfig = {
|
|
|
101
65
|
contents.match(/project=./g));
|
|
102
66
|
},
|
|
103
67
|
orgAndProjContent: function (org, project) {
|
|
104
|
-
return
|
|
68
|
+
return `[defaults]\norg=${org}\nproject=${project}`;
|
|
105
69
|
},
|
|
106
70
|
};
|
|
107
71
|
exports.propertiesCliSetupConfig = {
|
|
108
72
|
filename: exports.SENTRY_PROPERTIES_FILE,
|
|
109
73
|
gitignore: true,
|
|
110
74
|
name: 'debug files',
|
|
111
|
-
likelyAlreadyHasAuthToken
|
|
75
|
+
likelyAlreadyHasAuthToken(contents) {
|
|
112
76
|
return !!contents.match(/auth\.token=./g);
|
|
113
77
|
},
|
|
114
|
-
tokenContent
|
|
115
|
-
return
|
|
78
|
+
tokenContent(authToken) {
|
|
79
|
+
return `auth.token=${authToken}`;
|
|
116
80
|
},
|
|
117
|
-
likelyAlreadyHasOrgAndProject
|
|
81
|
+
likelyAlreadyHasOrgAndProject(contents) {
|
|
118
82
|
return !!(contents.match(/defaults\.org=./g) &&
|
|
119
83
|
contents.match(/defaults\.project=./g));
|
|
120
84
|
},
|
|
121
|
-
orgAndProjContent
|
|
122
|
-
return
|
|
85
|
+
orgAndProjContent(org, project) {
|
|
86
|
+
return `defaults.org=${org}\ndefaults.project=${project}`;
|
|
123
87
|
},
|
|
124
|
-
likelyAlreadyHasUrl
|
|
88
|
+
likelyAlreadyHasUrl(contents) {
|
|
125
89
|
return !!contents.match(/defaults\.url=./g);
|
|
126
90
|
},
|
|
127
|
-
urlContent
|
|
128
|
-
return
|
|
91
|
+
urlContent(url) {
|
|
92
|
+
return `defaults.url=${url}`;
|
|
129
93
|
},
|
|
130
94
|
};
|
|
131
|
-
function abort(message, status) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
sentrySession.status = status === 0 ? 'abnormal' : 'crashed';
|
|
145
|
-
sentryHub.captureSession(true);
|
|
146
|
-
}
|
|
147
|
-
return [4 /*yield*/, Sentry.flush(3000)];
|
|
148
|
-
case 1:
|
|
149
|
-
_a.sent();
|
|
150
|
-
return [2 /*return*/, process.exit(status !== null && status !== void 0 ? status : 1)];
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
});
|
|
95
|
+
async function abort(message, status) {
|
|
96
|
+
clack.outro(message ?? 'Wizard setup cancelled.');
|
|
97
|
+
const sentryHub = Sentry.getCurrentHub();
|
|
98
|
+
const sentryTransaction = sentryHub.getScope().getTransaction();
|
|
99
|
+
sentryTransaction?.setStatus('aborted');
|
|
100
|
+
sentryTransaction?.finish();
|
|
101
|
+
const sentrySession = sentryHub.getScope().getSession();
|
|
102
|
+
if (sentrySession) {
|
|
103
|
+
sentrySession.status = status === 0 ? 'abnormal' : 'crashed';
|
|
104
|
+
sentryHub.captureSession(true);
|
|
105
|
+
}
|
|
106
|
+
await Sentry.flush(3000);
|
|
107
|
+
return process.exit(status ?? 1);
|
|
154
108
|
}
|
|
155
109
|
exports.abort = abort;
|
|
156
|
-
function abortIfCancelled(input) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
sentryTransaction === null || sentryTransaction === void 0 ? void 0 : sentryTransaction.finish();
|
|
171
|
-
sentryHub.captureSession(true);
|
|
172
|
-
return [4 /*yield*/, Sentry.flush(3000)];
|
|
173
|
-
case 2:
|
|
174
|
-
_c.sent();
|
|
175
|
-
process.exit(0);
|
|
176
|
-
return [3 /*break*/, 4];
|
|
177
|
-
case 3: return [2 /*return*/, input];
|
|
178
|
-
case 4: return [2 /*return*/];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
});
|
|
110
|
+
async function abortIfCancelled(input) {
|
|
111
|
+
if (clack.isCancel(await input)) {
|
|
112
|
+
clack.cancel('Wizard setup cancelled.');
|
|
113
|
+
const sentryHub = Sentry.getCurrentHub();
|
|
114
|
+
const sentryTransaction = sentryHub.getScope().getTransaction();
|
|
115
|
+
sentryTransaction?.setStatus('cancelled');
|
|
116
|
+
sentryTransaction?.finish();
|
|
117
|
+
sentryHub.captureSession(true);
|
|
118
|
+
await Sentry.flush(3000);
|
|
119
|
+
process.exit(0);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return input;
|
|
123
|
+
}
|
|
182
124
|
}
|
|
183
125
|
exports.abortIfCancelled = abortIfCancelled;
|
|
184
126
|
function printWelcome(options) {
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
127
|
+
let wizardVersion = process.env.npm_package_version;
|
|
128
|
+
if (!wizardVersion) {
|
|
129
|
+
try {
|
|
130
|
+
wizardVersion = JSON.parse(fs.readFileSync((0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@sentry/wizard')), '..', 'package.json'), 'utf-8')).version;
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// We don't need to have this
|
|
134
|
+
}
|
|
192
135
|
}
|
|
193
136
|
// eslint-disable-next-line no-console
|
|
194
137
|
console.log('');
|
|
195
|
-
clack.intro(chalk_1.default.inverse(
|
|
196
|
-
|
|
197
|
-
|
|
138
|
+
clack.intro(chalk_1.default.inverse(` ${options.wizardName} `));
|
|
139
|
+
let welcomeText = options.message ||
|
|
140
|
+
`The ${options.wizardName} will help you set up Sentry for your application.\nThank you for using Sentry :)`;
|
|
198
141
|
if (options.promoCode) {
|
|
199
|
-
welcomeText =
|
|
142
|
+
welcomeText = `${welcomeText}\n\nUsing promo-code: ${options.promoCode}`;
|
|
200
143
|
}
|
|
201
|
-
if (
|
|
202
|
-
welcomeText =
|
|
144
|
+
if (wizardVersion) {
|
|
145
|
+
welcomeText = `${welcomeText}\n\nVersion: ${wizardVersion}`;
|
|
203
146
|
}
|
|
204
147
|
if (options.telemetryEnabled) {
|
|
205
|
-
welcomeText =
|
|
148
|
+
welcomeText = `${welcomeText}
|
|
149
|
+
|
|
150
|
+
This wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.
|
|
151
|
+
You can turn this off at any time by running ${chalk_1.default.cyanBright('sentry-wizard --disable-telemetry')}.`;
|
|
206
152
|
}
|
|
207
153
|
clack.note(welcomeText);
|
|
208
154
|
}
|
|
209
155
|
exports.printWelcome = printWelcome;
|
|
210
|
-
function confirmContinueIfNoOrDirtyGitRepo() {
|
|
211
|
-
return
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return [4 /*yield*/, abortIfCancelled(clack.confirm({
|
|
239
|
-
message: 'Do you want to continue anyway?',
|
|
240
|
-
}))];
|
|
241
|
-
case 5:
|
|
242
|
-
continueWithDirtyRepo = _a.sent();
|
|
243
|
-
Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);
|
|
244
|
-
if (!!continueWithDirtyRepo) return [3 /*break*/, 7];
|
|
245
|
-
return [4 /*yield*/, abort(undefined, 0)];
|
|
246
|
-
case 6:
|
|
247
|
-
_a.sent();
|
|
248
|
-
_a.label = 7;
|
|
249
|
-
case 7: return [2 /*return*/];
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
}); })];
|
|
253
|
-
});
|
|
156
|
+
async function confirmContinueIfNoOrDirtyGitRepo() {
|
|
157
|
+
return (0, telemetry_1.traceStep)('check-git-status', async () => {
|
|
158
|
+
if (!isInGitRepo()) {
|
|
159
|
+
const continueWithoutGit = await abortIfCancelled(clack.confirm({
|
|
160
|
+
message: 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',
|
|
161
|
+
}));
|
|
162
|
+
Sentry.setTag('continue-without-git', continueWithoutGit);
|
|
163
|
+
if (!continueWithoutGit) {
|
|
164
|
+
await abort(undefined, 0);
|
|
165
|
+
}
|
|
166
|
+
// return early to avoid checking for uncommitted files
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();
|
|
170
|
+
if (uncommittedOrUntrackedFiles.length) {
|
|
171
|
+
clack.log.warn(`You have uncommitted or untracked files in your repo:
|
|
172
|
+
|
|
173
|
+
${uncommittedOrUntrackedFiles.join('\n')}
|
|
174
|
+
|
|
175
|
+
The wizard will create and update files.`);
|
|
176
|
+
const continueWithDirtyRepo = await abortIfCancelled(clack.confirm({
|
|
177
|
+
message: 'Do you want to continue anyway?',
|
|
178
|
+
}));
|
|
179
|
+
Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);
|
|
180
|
+
if (!continueWithDirtyRepo) {
|
|
181
|
+
await abort(undefined, 0);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
254
184
|
});
|
|
255
185
|
}
|
|
256
186
|
exports.confirmContinueIfNoOrDirtyGitRepo = confirmContinueIfNoOrDirtyGitRepo;
|
|
@@ -261,105 +191,75 @@ function isInGitRepo() {
|
|
|
261
191
|
});
|
|
262
192
|
return true;
|
|
263
193
|
}
|
|
264
|
-
catch
|
|
194
|
+
catch {
|
|
265
195
|
return false;
|
|
266
196
|
}
|
|
267
197
|
}
|
|
268
198
|
exports.isInGitRepo = isInGitRepo;
|
|
269
199
|
function getUncommittedOrUntrackedFiles() {
|
|
270
200
|
try {
|
|
271
|
-
|
|
201
|
+
const gitStatus = childProcess
|
|
272
202
|
.execSync('git status --porcelain=v1', {
|
|
273
203
|
// we only care about stdout
|
|
274
204
|
stdio: ['ignore', 'pipe', 'ignore'],
|
|
275
205
|
})
|
|
276
206
|
.toString();
|
|
277
|
-
|
|
207
|
+
const files = gitStatus
|
|
278
208
|
.split(os.EOL)
|
|
279
|
-
.map(
|
|
209
|
+
.map((line) => line.trim())
|
|
280
210
|
.filter(Boolean)
|
|
281
|
-
.map(
|
|
211
|
+
.map((f) => `- ${f.split(/\s+/)[1]}`);
|
|
282
212
|
return files;
|
|
283
213
|
}
|
|
284
|
-
catch
|
|
214
|
+
catch {
|
|
285
215
|
return [];
|
|
286
216
|
}
|
|
287
217
|
}
|
|
288
218
|
exports.getUncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles;
|
|
289
|
-
function askToInstallSentryCLI() {
|
|
290
|
-
return
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
case 0: return [4 /*yield*/, abortIfCancelled(clack.confirm({
|
|
294
|
-
message: "You don't have Sentry CLI installed. Do you want to install it?",
|
|
295
|
-
}))];
|
|
296
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
297
|
-
}
|
|
298
|
-
});
|
|
299
|
-
});
|
|
219
|
+
async function askToInstallSentryCLI() {
|
|
220
|
+
return await abortIfCancelled(clack.confirm({
|
|
221
|
+
message: "You don't have Sentry CLI installed. Do you want to install it?",
|
|
222
|
+
}));
|
|
300
223
|
}
|
|
301
224
|
exports.askToInstallSentryCLI = askToInstallSentryCLI;
|
|
302
|
-
function askForItemSelection(items, message) {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
};
|
|
315
|
-
}),
|
|
316
|
-
}))];
|
|
317
|
-
case 1:
|
|
318
|
-
selection = _a.sent();
|
|
319
|
-
return [2 /*return*/, selection];
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
});
|
|
225
|
+
async function askForItemSelection(items, message) {
|
|
226
|
+
const selection = await abortIfCancelled(clack.select({
|
|
227
|
+
maxItems: 12,
|
|
228
|
+
message: message,
|
|
229
|
+
options: items.map((item, index) => {
|
|
230
|
+
return {
|
|
231
|
+
value: { value: item, index: index },
|
|
232
|
+
label: item,
|
|
233
|
+
};
|
|
234
|
+
}),
|
|
235
|
+
}));
|
|
236
|
+
return selection;
|
|
323
237
|
}
|
|
324
238
|
exports.askForItemSelection = askForItemSelection;
|
|
325
|
-
function confirmContinueIfPackageVersionNotSupported(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
return __generator(this, function (_a) {
|
|
333
|
-
switch (_a.label) {
|
|
334
|
-
case 0:
|
|
335
|
-
Sentry.setTag("".concat(packageName.toLowerCase(), "-version"), packageVersion);
|
|
336
|
-
isSupportedVersion = (0, semver_1.fulfillsVersionRange)({
|
|
337
|
-
acceptableVersions: acceptableVersions,
|
|
338
|
-
version: packageVersion,
|
|
339
|
-
canBeLatest: true,
|
|
340
|
-
});
|
|
341
|
-
if (isSupportedVersion) {
|
|
342
|
-
Sentry.setTag("".concat(packageName.toLowerCase(), "-supported"), true);
|
|
343
|
-
return [2 /*return*/];
|
|
344
|
-
}
|
|
345
|
-
clack.log.warn("You have an unsupported version of ".concat(packageName, " installed:\n\n ").concat(packageId, "@").concat(packageVersion));
|
|
346
|
-
clack.note(note !== null && note !== void 0 ? note : "Please upgrade to ".concat(acceptableVersions, " if you wish to use the Sentry Wizard."));
|
|
347
|
-
return [4 /*yield*/, abortIfCancelled(clack.confirm({
|
|
348
|
-
message: 'Do you want to continue anyway?',
|
|
349
|
-
}))];
|
|
350
|
-
case 1:
|
|
351
|
-
continueWithUnsupportedVersion = _a.sent();
|
|
352
|
-
Sentry.setTag("".concat(packageName.toLowerCase(), "-continue-with-unsupported-version"), continueWithUnsupportedVersion);
|
|
353
|
-
if (!!continueWithUnsupportedVersion) return [3 /*break*/, 3];
|
|
354
|
-
return [4 /*yield*/, abort(undefined, 0)];
|
|
355
|
-
case 2:
|
|
356
|
-
_a.sent();
|
|
357
|
-
_a.label = 3;
|
|
358
|
-
case 3: return [2 /*return*/];
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
}); })];
|
|
239
|
+
async function confirmContinueIfPackageVersionNotSupported({ packageId, packageName, packageVersion, acceptableVersions, note, }) {
|
|
240
|
+
return (0, telemetry_1.traceStep)(`check-package-version`, async () => {
|
|
241
|
+
Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);
|
|
242
|
+
const isSupportedVersion = (0, semver_1.fulfillsVersionRange)({
|
|
243
|
+
acceptableVersions,
|
|
244
|
+
version: packageVersion,
|
|
245
|
+
canBeLatest: true,
|
|
362
246
|
});
|
|
247
|
+
if (isSupportedVersion) {
|
|
248
|
+
Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
clack.log.warn(`You have an unsupported version of ${packageName} installed:
|
|
252
|
+
|
|
253
|
+
${packageId}@${packageVersion}`);
|
|
254
|
+
clack.note(note ??
|
|
255
|
+
`Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`);
|
|
256
|
+
const continueWithUnsupportedVersion = await abortIfCancelled(clack.confirm({
|
|
257
|
+
message: 'Do you want to continue anyway?',
|
|
258
|
+
}));
|
|
259
|
+
Sentry.setTag(`${packageName.toLowerCase()}-continue-with-unsupported-version`, continueWithUnsupportedVersion);
|
|
260
|
+
if (!continueWithUnsupportedVersion) {
|
|
261
|
+
await abort(undefined, 0);
|
|
262
|
+
}
|
|
363
263
|
});
|
|
364
264
|
}
|
|
365
265
|
exports.confirmContinueIfPackageVersionNotSupported = confirmContinueIfPackageVersionNotSupported;
|
|
@@ -369,122 +269,70 @@ exports.confirmContinueIfPackageVersionNotSupported = confirmContinueIfPackageVe
|
|
|
369
269
|
* IMPORTANT: This function modifies the `package.json`! Be sure to re-read
|
|
370
270
|
* it if you make additional modifications to it after calling this function!
|
|
371
271
|
*/
|
|
372
|
-
function installPackage(
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
// Write a log file so we can better troubleshoot issues
|
|
410
|
-
fs.writeFileSync(path.join(process.cwd(), "sentry-wizard-installation-error-".concat(Date.now(), ".log")), JSON.stringify({
|
|
411
|
-
stdout: stdout,
|
|
412
|
-
stderr: stderr,
|
|
413
|
-
}), { encoding: 'utf8' });
|
|
414
|
-
reject(err);
|
|
415
|
-
}
|
|
416
|
-
else {
|
|
417
|
-
resolve();
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
})];
|
|
421
|
-
case 6:
|
|
422
|
-
_b.sent();
|
|
423
|
-
return [3 /*break*/, 9];
|
|
424
|
-
case 7:
|
|
425
|
-
e_1 = _b.sent();
|
|
426
|
-
sdkInstallSpinner.stop('Installation failed.');
|
|
427
|
-
clack.log.error("".concat(chalk_1.default.red('Encountered the following error during installation:'), "\n\n").concat(e_1, "\n\n").concat(chalk_1.default.dim("The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues")));
|
|
428
|
-
return [4 /*yield*/, abort()];
|
|
429
|
-
case 8:
|
|
430
|
-
_b.sent();
|
|
431
|
-
return [3 /*break*/, 9];
|
|
432
|
-
case 9:
|
|
433
|
-
sdkInstallSpinner.stop("".concat(alreadyInstalled ? 'Updated' : 'Installed', " ").concat(chalk_1.default.bold.cyan(packageNameDisplayLabel !== null && packageNameDisplayLabel !== void 0 ? packageNameDisplayLabel : packageName), " with ").concat(chalk_1.default.bold(pkgManager.label), "."));
|
|
434
|
-
return [2 /*return*/, { packageManager: pkgManager }];
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}); })];
|
|
438
|
-
});
|
|
272
|
+
async function installPackage({ packageName, alreadyInstalled, askBeforeUpdating = true, packageNameDisplayLabel, packageManager, forceInstall = false, }) {
|
|
273
|
+
return (0, telemetry_1.traceStep)('install-package', async () => {
|
|
274
|
+
if (alreadyInstalled && askBeforeUpdating) {
|
|
275
|
+
const shouldUpdatePackage = await abortIfCancelled(clack.confirm({
|
|
276
|
+
message: `The ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} package is already installed. Do you want to update it to the latest version?`,
|
|
277
|
+
}));
|
|
278
|
+
if (!shouldUpdatePackage) {
|
|
279
|
+
return {};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
const sdkInstallSpinner = clack.spinner();
|
|
283
|
+
const pkgManager = packageManager || (await getPackageManager());
|
|
284
|
+
sdkInstallSpinner.start(`${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} with ${chalk_1.default.bold(pkgManager.label)}.`);
|
|
285
|
+
try {
|
|
286
|
+
await new Promise((resolve, reject) => {
|
|
287
|
+
childProcess.exec(`${pkgManager.installCommand} ${packageName} ${pkgManager.flags} ${forceInstall ? pkgManager.forceInstallFlag : ''}`, (err, stdout, stderr) => {
|
|
288
|
+
if (err) {
|
|
289
|
+
// Write a log file so we can better troubleshoot issues
|
|
290
|
+
fs.writeFileSync((0, node_path_1.join)(process.cwd(), `sentry-wizard-installation-error-${Date.now()}.log`), JSON.stringify({
|
|
291
|
+
stdout,
|
|
292
|
+
stderr,
|
|
293
|
+
}), { encoding: 'utf8' });
|
|
294
|
+
reject(err);
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
resolve();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
catch (e) {
|
|
303
|
+
sdkInstallSpinner.stop('Installation failed.');
|
|
304
|
+
clack.log.error(`${chalk_1.default.red('Encountered the following error during installation:')}\n\n${e}\n\n${chalk_1.default.dim("The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\nhttps://github.com/getsentry/sentry-wizard/issues")}`);
|
|
305
|
+
await abort();
|
|
306
|
+
}
|
|
307
|
+
sdkInstallSpinner.stop(`${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk_1.default.bold.cyan(packageNameDisplayLabel ?? packageName)} with ${chalk_1.default.bold(pkgManager.label)}.`);
|
|
308
|
+
return { packageManager: pkgManager };
|
|
439
309
|
});
|
|
440
310
|
}
|
|
441
311
|
exports.installPackage = installPackage;
|
|
442
|
-
function addSentryCliConfig(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
case 2:
|
|
467
|
-
_b.sent();
|
|
468
|
-
clack.log.success("".concat(configExists ? 'Saved' : 'Created', " ").concat(chalk_1.default.cyan(setupConfig.filename), "."));
|
|
469
|
-
return [3 /*break*/, 4];
|
|
470
|
-
case 3:
|
|
471
|
-
_a = _b.sent();
|
|
472
|
-
clack.log.warning("Failed to add auth token to ".concat(chalk_1.default.cyan(setupConfig.filename), ". Uploading ").concat(setupConfig.name, " during build will likely not work locally."));
|
|
473
|
-
return [3 /*break*/, 4];
|
|
474
|
-
case 4:
|
|
475
|
-
if (!setupConfig.gitignore) return [3 /*break*/, 6];
|
|
476
|
-
return [4 /*yield*/, addCliConfigFileToGitIgnore(setupConfig.filename)];
|
|
477
|
-
case 5:
|
|
478
|
-
_b.sent();
|
|
479
|
-
return [3 /*break*/, 7];
|
|
480
|
-
case 6:
|
|
481
|
-
clack.log.warn(chalk_1.default.yellow('DO NOT commit auth token to your repository!'));
|
|
482
|
-
_b.label = 7;
|
|
483
|
-
case 7: return [2 /*return*/];
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
}); })];
|
|
487
|
-
});
|
|
312
|
+
async function addSentryCliConfig({ authToken, org, project, url }, setupConfig = exports.rcCliSetupConfig) {
|
|
313
|
+
return (0, telemetry_1.traceStep)('add-sentry-cli-config', async () => {
|
|
314
|
+
const configPath = (0, node_path_1.join)(process.cwd(), setupConfig.filename);
|
|
315
|
+
const configExists = fs.existsSync(configPath);
|
|
316
|
+
let configContents = (configExists && fs.readFileSync(configPath, 'utf8')) || '';
|
|
317
|
+
configContents = addAuthTokenToSentryConfig(configContents, authToken, setupConfig);
|
|
318
|
+
configContents = addOrgAndProjectToSentryConfig(configContents, org, project, setupConfig);
|
|
319
|
+
configContents = addUrlToSentryConfig(configContents, url, setupConfig);
|
|
320
|
+
try {
|
|
321
|
+
await fs.promises.writeFile(configPath, configContents, {
|
|
322
|
+
encoding: 'utf8',
|
|
323
|
+
flag: 'w',
|
|
324
|
+
});
|
|
325
|
+
clack.log.success(`${configExists ? 'Saved' : 'Created'} ${chalk_1.default.cyan(setupConfig.filename)}.`);
|
|
326
|
+
}
|
|
327
|
+
catch {
|
|
328
|
+
clack.log.warning(`Failed to add auth token to ${chalk_1.default.cyan(setupConfig.filename)}. Uploading ${setupConfig.name} during build will likely not work locally.`);
|
|
329
|
+
}
|
|
330
|
+
if (setupConfig.gitignore) {
|
|
331
|
+
await addCliConfigFileToGitIgnore(setupConfig.filename);
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
clack.log.warn(chalk_1.default.yellow('DO NOT commit auth token to your repository!'));
|
|
335
|
+
}
|
|
488
336
|
});
|
|
489
337
|
}
|
|
490
338
|
exports.addSentryCliConfig = addSentryCliConfig;
|
|
@@ -493,11 +341,11 @@ function addAuthTokenToSentryConfig(configContents, authToken, setupConfig) {
|
|
|
493
341
|
return configContents;
|
|
494
342
|
}
|
|
495
343
|
if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {
|
|
496
|
-
clack.log.warn(
|
|
344
|
+
clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has auth token. Will not add one.`);
|
|
497
345
|
return configContents;
|
|
498
346
|
}
|
|
499
|
-
|
|
500
|
-
clack.log.success(
|
|
347
|
+
const newContents = `${configContents}\n${setupConfig.tokenContent(authToken)}\n`;
|
|
348
|
+
clack.log.success(`Added auth token to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
|
|
501
349
|
return newContents;
|
|
502
350
|
}
|
|
503
351
|
function addOrgAndProjectToSentryConfig(configContents, org, project, setupConfig) {
|
|
@@ -505,11 +353,11 @@ function addOrgAndProjectToSentryConfig(configContents, org, project, setupConfi
|
|
|
505
353
|
return configContents;
|
|
506
354
|
}
|
|
507
355
|
if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {
|
|
508
|
-
clack.log.warn(
|
|
356
|
+
clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has org and project. Will not add them.`);
|
|
509
357
|
return configContents;
|
|
510
358
|
}
|
|
511
|
-
|
|
512
|
-
clack.log.success(
|
|
359
|
+
const newContents = `${configContents}\n${setupConfig.orgAndProjContent(org, project)}\n`;
|
|
360
|
+
clack.log.success(`Added default org and project to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
|
|
513
361
|
return newContents;
|
|
514
362
|
}
|
|
515
363
|
function addUrlToSentryConfig(configContents, url, setupConfig) {
|
|
@@ -517,166 +365,120 @@ function addUrlToSentryConfig(configContents, url, setupConfig) {
|
|
|
517
365
|
return configContents;
|
|
518
366
|
}
|
|
519
367
|
if (setupConfig.likelyAlreadyHasUrl(configContents)) {
|
|
520
|
-
clack.log.warn(
|
|
368
|
+
clack.log.warn(`${chalk_1.default.cyan(setupConfig.filename)} already has url. Will not add one.`);
|
|
521
369
|
return configContents;
|
|
522
370
|
}
|
|
523
|
-
|
|
524
|
-
clack.log.success(
|
|
371
|
+
const newContents = `${configContents}\n${setupConfig.urlContent(url)}\n`;
|
|
372
|
+
clack.log.success(`Added default url to ${chalk_1.default.cyan(setupConfig.filename)} for you to test uploading ${setupConfig.name} locally.`);
|
|
525
373
|
return newContents;
|
|
526
374
|
}
|
|
527
|
-
function addDotEnvSentryBuildPluginFile(authToken) {
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
_c.sent();
|
|
550
|
-
clack.log.success("Added auth token to ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)));
|
|
551
|
-
return [3 /*break*/, 4];
|
|
552
|
-
case 3:
|
|
553
|
-
_a = _c.sent();
|
|
554
|
-
clack.log.warning("Failed to add auth token to ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), ". Uploading source maps during build will likely not work locally."));
|
|
555
|
-
return [3 /*break*/, 4];
|
|
556
|
-
case 4: return [3 /*break*/, 8];
|
|
557
|
-
case 5:
|
|
558
|
-
_c.trys.push([5, 7, , 8]);
|
|
559
|
-
return [4 /*yield*/, fs.promises.writeFile(dotEnvFilePath, envVarContent, {
|
|
560
|
-
encoding: 'utf8',
|
|
561
|
-
flag: 'w',
|
|
562
|
-
})];
|
|
563
|
-
case 6:
|
|
564
|
-
_c.sent();
|
|
565
|
-
clack.log.success("Created ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), " with auth token for you to test source map uploading locally."));
|
|
566
|
-
return [3 /*break*/, 8];
|
|
567
|
-
case 7:
|
|
568
|
-
_b = _c.sent();
|
|
569
|
-
clack.log.warning("Failed to create ".concat(chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE), " with auth token. Uploading source maps during build will likely not work locally."));
|
|
570
|
-
return [3 /*break*/, 8];
|
|
571
|
-
case 8: return [4 /*yield*/, addCliConfigFileToGitIgnore(exports.SENTRY_DOT_ENV_FILE)];
|
|
572
|
-
case 9:
|
|
573
|
-
_c.sent();
|
|
574
|
-
return [2 /*return*/];
|
|
375
|
+
async function addDotEnvSentryBuildPluginFile(authToken) {
|
|
376
|
+
const envVarContent = `# DO NOT commit this file to your repository!
|
|
377
|
+
# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.
|
|
378
|
+
# It's used for authentication when uploading source maps.
|
|
379
|
+
# You can also set this env variable in your own \`.env\` files and remove this file.
|
|
380
|
+
SENTRY_AUTH_TOKEN=${authToken}
|
|
381
|
+
`;
|
|
382
|
+
const dotEnvFilePath = (0, node_path_1.join)(process.cwd(), exports.SENTRY_DOT_ENV_FILE);
|
|
383
|
+
const dotEnvFileExists = fs.existsSync(dotEnvFilePath);
|
|
384
|
+
if (dotEnvFileExists) {
|
|
385
|
+
const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');
|
|
386
|
+
const hasAuthToken = !!dotEnvFileContent.match(/^\s*SENTRY_AUTH_TOKEN\s*=/g);
|
|
387
|
+
if (hasAuthToken) {
|
|
388
|
+
clack.log.warn(`${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} already has auth token. Will not add one.`);
|
|
389
|
+
}
|
|
390
|
+
else {
|
|
391
|
+
try {
|
|
392
|
+
await fs.promises.writeFile(dotEnvFilePath, `${dotEnvFileContent}\n${envVarContent}`, {
|
|
393
|
+
encoding: 'utf8',
|
|
394
|
+
flag: 'w',
|
|
395
|
+
});
|
|
396
|
+
clack.log.success(`Added auth token to ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)}`);
|
|
575
397
|
}
|
|
576
|
-
|
|
577
|
-
|
|
398
|
+
catch {
|
|
399
|
+
clack.log.warning(`Failed to add auth token to ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)}. Uploading source maps during build will likely not work locally.`);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
try {
|
|
405
|
+
await fs.promises.writeFile(dotEnvFilePath, envVarContent, {
|
|
406
|
+
encoding: 'utf8',
|
|
407
|
+
flag: 'w',
|
|
408
|
+
});
|
|
409
|
+
clack.log.success(`Created ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} with auth token for you to test source map uploading locally.`);
|
|
410
|
+
}
|
|
411
|
+
catch {
|
|
412
|
+
clack.log.warning(`Failed to create ${chalk_1.default.bold.cyan(exports.SENTRY_DOT_ENV_FILE)} with auth token. Uploading source maps during build will likely not work locally.`);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
await addCliConfigFileToGitIgnore(exports.SENTRY_DOT_ENV_FILE);
|
|
578
416
|
}
|
|
579
417
|
exports.addDotEnvSentryBuildPluginFile = addDotEnvSentryBuildPluginFile;
|
|
580
|
-
function addCliConfigFileToGitIgnore(filename) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
clack.log.info("".concat(chalk_1.default.bold('.gitignore'), " already has ").concat(chalk_1.default.bold(filename), ". Will not add it again."));
|
|
595
|
-
return [2 /*return*/];
|
|
596
|
-
}
|
|
597
|
-
return [4 /*yield*/, fs.promises.appendFile(gitignorePath, "\n# Sentry Config File\n".concat(filename, "\n"), { encoding: 'utf8' })];
|
|
598
|
-
case 3:
|
|
599
|
-
_b.sent();
|
|
600
|
-
clack.log.success("Added ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), "."));
|
|
601
|
-
return [3 /*break*/, 5];
|
|
602
|
-
case 4:
|
|
603
|
-
_a = _b.sent();
|
|
604
|
-
clack.log.error("Failed adding ".concat(chalk_1.default.cyan(filename), " to ").concat(chalk_1.default.cyan('.gitignore'), ". Please add it manually!"));
|
|
605
|
-
return [3 /*break*/, 5];
|
|
606
|
-
case 5: return [2 /*return*/];
|
|
607
|
-
}
|
|
608
|
-
});
|
|
609
|
-
});
|
|
418
|
+
async function addCliConfigFileToGitIgnore(filename) {
|
|
419
|
+
const gitignorePath = (0, node_path_1.join)(process.cwd(), '.gitignore');
|
|
420
|
+
try {
|
|
421
|
+
const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');
|
|
422
|
+
if (gitignoreContent.split(/\r?\n/).includes(filename)) {
|
|
423
|
+
clack.log.info(`${chalk_1.default.bold('.gitignore')} already has ${chalk_1.default.bold(filename)}. Will not add it again.`);
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
await fs.promises.appendFile(gitignorePath, `\n# Sentry Config File\n${filename}\n`, { encoding: 'utf8' });
|
|
427
|
+
clack.log.success(`Added ${chalk_1.default.cyan(filename)} to ${chalk_1.default.cyan('.gitignore')}.`);
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
clack.log.error(`Failed adding ${chalk_1.default.cyan(filename)} to ${chalk_1.default.cyan('.gitignore')}. Please add it manually!`);
|
|
431
|
+
}
|
|
610
432
|
}
|
|
611
|
-
function runPrettierIfInstalled() {
|
|
612
|
-
return
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
else {
|
|
661
|
-
resolve();
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
})];
|
|
665
|
-
case 4:
|
|
666
|
-
_a.sent();
|
|
667
|
-
return [3 /*break*/, 6];
|
|
668
|
-
case 5:
|
|
669
|
-
e_2 = _a.sent();
|
|
670
|
-
prettierSpinner.stop('Prettier failed to run.');
|
|
671
|
-
clack.log.warn('Prettier failed to run. There may be formatting issues in your updated files.');
|
|
672
|
-
return [2 /*return*/];
|
|
673
|
-
case 6:
|
|
674
|
-
prettierSpinner.stop('Prettier has formatted your files.');
|
|
675
|
-
return [2 /*return*/];
|
|
676
|
-
}
|
|
677
|
-
});
|
|
678
|
-
}); })];
|
|
679
|
-
});
|
|
433
|
+
async function runPrettierIfInstalled() {
|
|
434
|
+
return (0, telemetry_1.traceStep)('run-prettier', async () => {
|
|
435
|
+
if (!isInGitRepo()) {
|
|
436
|
+
// We only run formatting on changed files. If we're not in a git repo, we can't find
|
|
437
|
+
// changed files. So let's early-return without showing any formatting-related messages.
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()
|
|
441
|
+
.map((filename) => {
|
|
442
|
+
return filename.startsWith('- ') ? filename.slice(2) : filename;
|
|
443
|
+
})
|
|
444
|
+
.join(' ');
|
|
445
|
+
if (!changedOrUntrackedFiles.length) {
|
|
446
|
+
// Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
|
|
447
|
+
return;
|
|
448
|
+
}
|
|
449
|
+
const packageJson = await getPackageDotJson();
|
|
450
|
+
const prettierInstalled = (0, package_json_1.hasPackageInstalled)('prettier', packageJson);
|
|
451
|
+
Sentry.setTag('prettier-installed', prettierInstalled);
|
|
452
|
+
if (!prettierInstalled) {
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
// prompt the user if they want to run prettier
|
|
456
|
+
const shouldRunPrettier = await abortIfCancelled(clack.confirm({
|
|
457
|
+
message: 'Looks like you have Prettier in your project. Do you want to run it on your files?',
|
|
458
|
+
}));
|
|
459
|
+
if (!shouldRunPrettier) {
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
const prettierSpinner = clack.spinner();
|
|
463
|
+
prettierSpinner.start('Running Prettier on your files.');
|
|
464
|
+
try {
|
|
465
|
+
await new Promise((resolve, reject) => {
|
|
466
|
+
childProcess.exec(`npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`, (err) => {
|
|
467
|
+
if (err) {
|
|
468
|
+
reject(err);
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
resolve();
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
catch (e) {
|
|
477
|
+
prettierSpinner.stop('Prettier failed to run.');
|
|
478
|
+
clack.log.warn('Prettier failed to run. There may be formatting issues in your updated files.');
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
prettierSpinner.stop('Prettier has formatted your files.');
|
|
680
482
|
});
|
|
681
483
|
}
|
|
682
484
|
exports.runPrettierIfInstalled = runPrettierIfInstalled;
|
|
@@ -690,131 +492,78 @@ exports.runPrettierIfInstalled = runPrettierIfInstalled;
|
|
|
690
492
|
* @param packageId the npm name of the package
|
|
691
493
|
* @param packageName a human readable name of the package
|
|
692
494
|
*/
|
|
693
|
-
function ensurePackageIsInstalled(packageJson, packageId, packageName) {
|
|
694
|
-
return
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
message: "".concat(packageName, " does not seem to be installed. Do you still want to continue?"),
|
|
708
|
-
initialValue: false,
|
|
709
|
-
}))];
|
|
710
|
-
case 1:
|
|
711
|
-
continueWithoutPackage = _a.sent();
|
|
712
|
-
if (!!continueWithoutPackage) return [3 /*break*/, 3];
|
|
713
|
-
return [4 /*yield*/, abort(undefined, 0)];
|
|
714
|
-
case 2:
|
|
715
|
-
_a.sent();
|
|
716
|
-
_a.label = 3;
|
|
717
|
-
case 3: return [2 /*return*/];
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
}); })];
|
|
721
|
-
});
|
|
495
|
+
async function ensurePackageIsInstalled(packageJson, packageId, packageName) {
|
|
496
|
+
return (0, telemetry_1.traceStep)('ensure-package-installed', async () => {
|
|
497
|
+
const installed = (0, package_json_1.hasPackageInstalled)(packageId, packageJson);
|
|
498
|
+
Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);
|
|
499
|
+
if (!installed) {
|
|
500
|
+
Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);
|
|
501
|
+
const continueWithoutPackage = await abortIfCancelled(clack.confirm({
|
|
502
|
+
message: `${packageName} does not seem to be installed. Do you still want to continue?`,
|
|
503
|
+
initialValue: false,
|
|
504
|
+
}));
|
|
505
|
+
if (!continueWithoutPackage) {
|
|
506
|
+
await abort(undefined, 0);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
722
509
|
});
|
|
723
510
|
}
|
|
724
511
|
exports.ensurePackageIsInstalled = ensurePackageIsInstalled;
|
|
725
|
-
function getPackageDotJson() {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
.readFile(path.join(process.cwd(), 'package.json'), 'utf8')
|
|
732
|
-
.catch(function () {
|
|
733
|
-
clack.log.error('Could not find package.json. Make sure to run the wizard in the root of your app!');
|
|
734
|
-
return abort();
|
|
735
|
-
})];
|
|
736
|
-
case 1:
|
|
737
|
-
packageJsonFileContents = _b.sent();
|
|
738
|
-
packageJson = undefined;
|
|
739
|
-
_b.label = 2;
|
|
740
|
-
case 2:
|
|
741
|
-
_b.trys.push([2, 3, , 5]);
|
|
742
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
743
|
-
packageJson = JSON.parse(packageJsonFileContents);
|
|
744
|
-
return [3 /*break*/, 5];
|
|
745
|
-
case 3:
|
|
746
|
-
_a = _b.sent();
|
|
747
|
-
clack.log.error("Unable to parse your ".concat(chalk_1.default.cyan('package.json'), ". Make sure it has a valid format!"));
|
|
748
|
-
return [4 /*yield*/, abort()];
|
|
749
|
-
case 4:
|
|
750
|
-
_b.sent();
|
|
751
|
-
return [3 /*break*/, 5];
|
|
752
|
-
case 5: return [2 /*return*/, packageJson || {}];
|
|
753
|
-
}
|
|
754
|
-
});
|
|
512
|
+
async function getPackageDotJson() {
|
|
513
|
+
const packageJsonFileContents = await fs.promises
|
|
514
|
+
.readFile((0, node_path_1.join)(process.cwd(), 'package.json'), 'utf8')
|
|
515
|
+
.catch(() => {
|
|
516
|
+
clack.log.error('Could not find package.json. Make sure to run the wizard in the root of your app!');
|
|
517
|
+
return abort();
|
|
755
518
|
});
|
|
519
|
+
let packageJson = undefined;
|
|
520
|
+
try {
|
|
521
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
522
|
+
packageJson = JSON.parse(packageJsonFileContents);
|
|
523
|
+
}
|
|
524
|
+
catch {
|
|
525
|
+
clack.log.error(`Unable to parse your ${chalk_1.default.cyan('package.json')}. Make sure it has a valid format!`);
|
|
526
|
+
await abort();
|
|
527
|
+
}
|
|
528
|
+
return packageJson || {};
|
|
756
529
|
}
|
|
757
530
|
exports.getPackageDotJson = getPackageDotJson;
|
|
758
|
-
function updatePackageDotJson(packageDotJson) {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), 'package.json'),
|
|
766
|
-
// TODO: maybe figure out the original indentation
|
|
767
|
-
JSON.stringify(packageDotJson, null, 2), {
|
|
768
|
-
encoding: 'utf8',
|
|
769
|
-
flag: 'w',
|
|
770
|
-
})];
|
|
771
|
-
case 1:
|
|
772
|
-
_b.sent();
|
|
773
|
-
return [3 /*break*/, 4];
|
|
774
|
-
case 2:
|
|
775
|
-
_a = _b.sent();
|
|
776
|
-
clack.log.error("Unable to update your ".concat(chalk_1.default.cyan('package.json'), "."));
|
|
777
|
-
return [4 /*yield*/, abort()];
|
|
778
|
-
case 3:
|
|
779
|
-
_b.sent();
|
|
780
|
-
return [3 /*break*/, 4];
|
|
781
|
-
case 4: return [2 /*return*/];
|
|
782
|
-
}
|
|
531
|
+
async function updatePackageDotJson(packageDotJson) {
|
|
532
|
+
try {
|
|
533
|
+
await fs.promises.writeFile((0, node_path_1.join)(process.cwd(), 'package.json'),
|
|
534
|
+
// TODO: maybe figure out the original indentation
|
|
535
|
+
JSON.stringify(packageDotJson, null, 2), {
|
|
536
|
+
encoding: 'utf8',
|
|
537
|
+
flag: 'w',
|
|
783
538
|
});
|
|
784
|
-
}
|
|
539
|
+
}
|
|
540
|
+
catch {
|
|
541
|
+
clack.log.error(`Unable to update your ${chalk_1.default.cyan('package.json')}.`);
|
|
542
|
+
await abort();
|
|
543
|
+
}
|
|
785
544
|
}
|
|
786
545
|
exports.updatePackageDotJson = updatePackageDotJson;
|
|
787
|
-
function getPackageManager() {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
return
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
label: packageManager.label,
|
|
802
|
-
}); }),
|
|
803
|
-
}))];
|
|
804
|
-
case 1:
|
|
805
|
-
selectedPackageManager = _a.sent();
|
|
806
|
-
Sentry.setTag('package-manager', selectedPackageManager.name);
|
|
807
|
-
return [2 /*return*/, selectedPackageManager];
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
});
|
|
546
|
+
async function getPackageManager() {
|
|
547
|
+
const detectedPackageManager = (0, package_manager_1.detectPackageManger)();
|
|
548
|
+
if (detectedPackageManager) {
|
|
549
|
+
return detectedPackageManager;
|
|
550
|
+
}
|
|
551
|
+
const selectedPackageManager = await abortIfCancelled(clack.select({
|
|
552
|
+
message: 'Please select your package manager.',
|
|
553
|
+
options: package_manager_1.packageManagers.map((packageManager) => ({
|
|
554
|
+
value: packageManager,
|
|
555
|
+
label: packageManager.label,
|
|
556
|
+
})),
|
|
557
|
+
}));
|
|
558
|
+
Sentry.setTag('package-manager', selectedPackageManager.name);
|
|
559
|
+
return selectedPackageManager;
|
|
811
560
|
}
|
|
812
561
|
exports.getPackageManager = getPackageManager;
|
|
813
562
|
function isUsingTypeScript() {
|
|
814
563
|
try {
|
|
815
|
-
return fs.existsSync(
|
|
564
|
+
return fs.existsSync((0, node_path_1.join)(process.cwd(), 'tsconfig.json'));
|
|
816
565
|
}
|
|
817
|
-
catch
|
|
566
|
+
catch {
|
|
818
567
|
return false;
|
|
819
568
|
}
|
|
820
569
|
}
|
|
@@ -830,64 +579,49 @@ exports.isUsingTypeScript = isUsingTypeScript;
|
|
|
830
579
|
* @param platform the platform of the wizard
|
|
831
580
|
* @returns project data (org, project, token, url)
|
|
832
581
|
*/
|
|
833
|
-
function getOrAskForProjectData(options, platform) {
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
if (!token) {
|
|
877
|
-
clack.log.error("Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n".concat(chalk_1.default.cyan('https://github.com/getsentry/sentry-wizard/issues')));
|
|
878
|
-
clack.log.info("In the meantime, we'll add a dummy auth token (".concat(chalk_1.default.cyan("\"".concat(DUMMY_AUTH_TOKEN, "\"")), ") for you to replace later.\nCreate your auth token here:\n").concat(chalk_1.default.cyan(selfHosted
|
|
879
|
-
? "".concat(sentryUrl, "organizations/").concat(selectedProject.organization.slug, "/settings/auth-tokens")
|
|
880
|
-
: "https://".concat(selectedProject.organization.slug, ".sentry.io/settings/auth-tokens"))));
|
|
881
|
-
}
|
|
882
|
-
return [2 /*return*/, {
|
|
883
|
-
sentryUrl: sentryUrl,
|
|
884
|
-
selfHosted: selfHosted,
|
|
885
|
-
authToken: (apiKeys === null || apiKeys === void 0 ? void 0 : apiKeys.token) || DUMMY_AUTH_TOKEN,
|
|
886
|
-
selectedProject: selectedProject,
|
|
887
|
-
}];
|
|
888
|
-
}
|
|
889
|
-
});
|
|
890
|
-
});
|
|
582
|
+
async function getOrAskForProjectData(options, platform) {
|
|
583
|
+
if (options.preSelectedProject) {
|
|
584
|
+
return {
|
|
585
|
+
selfHosted: options.preSelectedProject.selfHosted,
|
|
586
|
+
sentryUrl: options.url ?? SAAS_URL,
|
|
587
|
+
authToken: options.preSelectedProject.authToken,
|
|
588
|
+
selectedProject: options.preSelectedProject.project,
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
const { url: sentryUrl, selfHosted } = await (0, telemetry_1.traceStep)('ask-self-hosted', () => askForSelfHosted(options.url, options.saas));
|
|
592
|
+
const { projects, apiKeys } = await (0, telemetry_1.traceStep)('login', () => askForWizardLogin({
|
|
593
|
+
promoCode: options.promoCode,
|
|
594
|
+
url: sentryUrl,
|
|
595
|
+
platform: platform,
|
|
596
|
+
orgSlug: options.orgSlug,
|
|
597
|
+
projectSlug: options.projectSlug,
|
|
598
|
+
}));
|
|
599
|
+
if (!projects || !projects.length) {
|
|
600
|
+
clack.log.error('No projects found. Please create a project in Sentry and try again.');
|
|
601
|
+
Sentry.setTag('no-projects-found', true);
|
|
602
|
+
await abort();
|
|
603
|
+
// This rejection won't return due to the abort call but TS doesn't know that
|
|
604
|
+
return Promise.reject();
|
|
605
|
+
}
|
|
606
|
+
const selectedProject = await (0, telemetry_1.traceStep)('select-project', () => askForProjectSelection(projects, options.orgSlug, options.projectSlug));
|
|
607
|
+
const { token } = apiKeys ?? {};
|
|
608
|
+
if (!token) {
|
|
609
|
+
clack.log.error(`Didn't receive an auth token. This shouldn't happen :(
|
|
610
|
+
|
|
611
|
+
Please let us know if you think this is a bug in the wizard:
|
|
612
|
+
${chalk_1.default.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);
|
|
613
|
+
clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk_1.default.cyan(`"${DUMMY_AUTH_TOKEN}"`)}) for you to replace later.
|
|
614
|
+
Create your auth token here:
|
|
615
|
+
${chalk_1.default.cyan(selfHosted
|
|
616
|
+
? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`
|
|
617
|
+
: `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`)}`);
|
|
618
|
+
}
|
|
619
|
+
return {
|
|
620
|
+
sentryUrl,
|
|
621
|
+
selfHosted,
|
|
622
|
+
authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,
|
|
623
|
+
selectedProject,
|
|
624
|
+
};
|
|
891
625
|
}
|
|
892
626
|
exports.getOrAskForProjectData = getOrAskForProjectData;
|
|
893
627
|
/**
|
|
@@ -899,225 +633,173 @@ exports.getOrAskForProjectData = getOrAskForProjectData;
|
|
|
899
633
|
*
|
|
900
634
|
* @param urlFromArgs the url passed via the --url arg
|
|
901
635
|
*/
|
|
902
|
-
function askForSelfHosted(urlFromArgs, saas) {
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return [4 /*yield*/, abortIfCancelled(clack.text({
|
|
940
|
-
message: "Please enter the URL of your ".concat(urlFromArgs ? '' : 'self-hosted ', "Sentry instance."),
|
|
941
|
-
placeholder: 'https://sentry.io/',
|
|
942
|
-
}))];
|
|
943
|
-
case 4:
|
|
944
|
-
_a = (_b.sent());
|
|
945
|
-
_b.label = 5;
|
|
946
|
-
case 5:
|
|
947
|
-
url = _a;
|
|
948
|
-
tmpUrlFromArgs = undefined;
|
|
949
|
-
try {
|
|
950
|
-
validUrl = new url_1.URL(url).toString();
|
|
951
|
-
// We assume everywhere else that the URL ends in a slash
|
|
952
|
-
if (!validUrl.endsWith('/')) {
|
|
953
|
-
validUrl += '/';
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
catch (_c) {
|
|
957
|
-
clack.log.error("Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ".concat(url, ")"));
|
|
958
|
-
}
|
|
959
|
-
return [3 /*break*/, 3];
|
|
960
|
-
case 6:
|
|
961
|
-
isSelfHostedUrl = new url_1.URL(validUrl).host !== new url_1.URL(SAAS_URL).host;
|
|
962
|
-
Sentry.setTag('url', validUrl);
|
|
963
|
-
Sentry.setTag('self-hosted', isSelfHostedUrl);
|
|
964
|
-
return [2 /*return*/, { url: validUrl, selfHosted: true }];
|
|
636
|
+
async function askForSelfHosted(urlFromArgs, saas) {
|
|
637
|
+
if (saas) {
|
|
638
|
+
Sentry.setTag('url', SAAS_URL);
|
|
639
|
+
Sentry.setTag('self-hosted', false);
|
|
640
|
+
return { url: SAAS_URL, selfHosted: false };
|
|
641
|
+
}
|
|
642
|
+
if (!urlFromArgs) {
|
|
643
|
+
const choice = await abortIfCancelled(clack.select({
|
|
644
|
+
message: 'Are you using Sentry SaaS or self-hosted Sentry?',
|
|
645
|
+
options: [
|
|
646
|
+
{ value: 'saas', label: 'Sentry SaaS (sentry.io)' },
|
|
647
|
+
{
|
|
648
|
+
value: 'self-hosted',
|
|
649
|
+
label: 'Self-hosted/on-premise/single-tenant',
|
|
650
|
+
},
|
|
651
|
+
],
|
|
652
|
+
}));
|
|
653
|
+
if (choice === 'saas') {
|
|
654
|
+
Sentry.setTag('url', SAAS_URL);
|
|
655
|
+
Sentry.setTag('self-hosted', false);
|
|
656
|
+
return { url: SAAS_URL, selfHosted: false };
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
let validUrl;
|
|
660
|
+
let tmpUrlFromArgs = urlFromArgs;
|
|
661
|
+
while (validUrl === undefined) {
|
|
662
|
+
const url = tmpUrlFromArgs ||
|
|
663
|
+
(await abortIfCancelled(clack.text({
|
|
664
|
+
message: `Please enter the URL of your ${urlFromArgs ? '' : 'self-hosted '}Sentry instance.`,
|
|
665
|
+
placeholder: 'https://sentry.io/',
|
|
666
|
+
})));
|
|
667
|
+
tmpUrlFromArgs = undefined;
|
|
668
|
+
try {
|
|
669
|
+
validUrl = new node_url_1.URL(url).toString();
|
|
670
|
+
// We assume everywhere else that the URL ends in a slash
|
|
671
|
+
if (!validUrl.endsWith('/')) {
|
|
672
|
+
validUrl += '/';
|
|
965
673
|
}
|
|
966
|
-
}
|
|
674
|
+
}
|
|
675
|
+
catch {
|
|
676
|
+
clack.log.error(`Please enter a valid URL. (It should look something like "https://sentry.mydomain.com/", got ${url})`);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
const isSelfHostedUrl = new node_url_1.URL(validUrl).host !== new node_url_1.URL(SAAS_URL).host;
|
|
680
|
+
Sentry.setTag('url', validUrl);
|
|
681
|
+
Sentry.setTag('self-hosted', isSelfHostedUrl);
|
|
682
|
+
return { url: validUrl, selfHosted: true };
|
|
683
|
+
}
|
|
684
|
+
async function askForWizardLogin(options) {
|
|
685
|
+
Sentry.setTag('has-promo-code', !!options.promoCode);
|
|
686
|
+
let hasSentryAccount = await clack.confirm({
|
|
687
|
+
message: 'Do you already have a Sentry account?',
|
|
967
688
|
});
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
return [4 /*yield*/, new Promise(function (resolve) {
|
|
1034
|
-
var pollingInterval = (0, timers_1.setInterval)(function () {
|
|
1035
|
-
axios_1.default
|
|
1036
|
-
.get("".concat(options.url, "api/0/wizard/").concat(wizardHash, "/"), {
|
|
1037
|
-
headers: {
|
|
1038
|
-
'Accept-Encoding': 'deflate',
|
|
1039
|
-
},
|
|
1040
|
-
})
|
|
1041
|
-
.then(function (result) {
|
|
1042
|
-
resolve(result.data);
|
|
1043
|
-
clearTimeout(timeout);
|
|
1044
|
-
clearInterval(pollingInterval);
|
|
1045
|
-
void axios_1.default.delete("".concat(options.url, "api/0/wizard/").concat(wizardHash, "/"));
|
|
1046
|
-
})
|
|
1047
|
-
.catch(function () {
|
|
1048
|
-
// noop - just try again
|
|
1049
|
-
});
|
|
1050
|
-
}, 500);
|
|
1051
|
-
var timeout = setTimeout(function () {
|
|
1052
|
-
clearInterval(pollingInterval);
|
|
1053
|
-
loginSpinner.stop('Login timed out. No worries - it happens to the best of us.');
|
|
1054
|
-
Sentry.setTag('opened-wizard-link', false);
|
|
1055
|
-
void abort('Please restart the Wizard and log in to complete the setup.');
|
|
1056
|
-
}, 180000);
|
|
1057
|
-
})];
|
|
1058
|
-
case 11:
|
|
1059
|
-
data = _a.sent();
|
|
1060
|
-
loginSpinner.stop('Login complete.');
|
|
1061
|
-
Sentry.setTag('opened-wizard-link', true);
|
|
1062
|
-
return [2 /*return*/, data];
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
689
|
+
hasSentryAccount = await abortIfCancelled(hasSentryAccount);
|
|
690
|
+
Sentry.setTag('already-has-sentry-account', hasSentryAccount);
|
|
691
|
+
let wizardHash;
|
|
692
|
+
try {
|
|
693
|
+
wizardHash = (await axios_1.default.get(`${options.url}api/0/wizard/`)).data.hash;
|
|
694
|
+
}
|
|
695
|
+
catch (e) {
|
|
696
|
+
if (options.url !== SAAS_URL) {
|
|
697
|
+
clack.log.error('Loading Wizard failed. Did you provide the right URL?');
|
|
698
|
+
clack.log.info(JSON.stringify(e, null, 2));
|
|
699
|
+
await abort(chalk_1.default.red('Please check your configuration and try again.\n\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues'));
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
clack.log.error('Loading Wizard failed.');
|
|
703
|
+
clack.log.info(JSON.stringify(e, null, 2));
|
|
704
|
+
await abort(chalk_1.default.red('Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues'));
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
const loginUrl = new node_url_1.URL(`${options.url}account/settings/wizard/${wizardHash}/`);
|
|
708
|
+
if (options.orgSlug) {
|
|
709
|
+
loginUrl.searchParams.set('org_slug', options.orgSlug);
|
|
710
|
+
}
|
|
711
|
+
if (options.projectSlug) {
|
|
712
|
+
loginUrl.searchParams.set('project_slug', options.projectSlug);
|
|
713
|
+
}
|
|
714
|
+
if (!hasSentryAccount) {
|
|
715
|
+
loginUrl.searchParams.set('signup', '1');
|
|
716
|
+
}
|
|
717
|
+
if (options.platform) {
|
|
718
|
+
loginUrl.searchParams.set('project_platform', options.platform);
|
|
719
|
+
}
|
|
720
|
+
if (options.promoCode) {
|
|
721
|
+
loginUrl.searchParams.set('code', options.promoCode);
|
|
722
|
+
}
|
|
723
|
+
const urlToOpen = loginUrl.toString();
|
|
724
|
+
clack.log.info(`${chalk_1.default.bold(`If the browser window didn't open automatically, please open the following link to ${hasSentryAccount ? 'log' : 'sign'} into Sentry:`)}\n\n${chalk_1.default.cyan(urlToOpen)}`);
|
|
725
|
+
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
726
|
+
const noop = () => { }; // eslint-disable-line @typescript-eslint/no-empty-function
|
|
727
|
+
(0, opn_1.default)(urlToOpen, { wait: false }).then((cp) => cp.on('error', noop), noop);
|
|
728
|
+
const loginSpinner = clack.spinner();
|
|
729
|
+
loginSpinner.start('Waiting for you to log in using the link above');
|
|
730
|
+
const data = await new Promise((resolve) => {
|
|
731
|
+
const pollingInterval = (0, node_timers_1.setInterval)(() => {
|
|
732
|
+
axios_1.default
|
|
733
|
+
.get(`${options.url}api/0/wizard/${wizardHash}/`, {
|
|
734
|
+
headers: {
|
|
735
|
+
'Accept-Encoding': 'deflate',
|
|
736
|
+
},
|
|
737
|
+
})
|
|
738
|
+
.then((result) => {
|
|
739
|
+
resolve(result.data);
|
|
740
|
+
clearTimeout(timeout);
|
|
741
|
+
clearInterval(pollingInterval);
|
|
742
|
+
void axios_1.default.delete(`${options.url}api/0/wizard/${wizardHash}/`);
|
|
743
|
+
})
|
|
744
|
+
.catch(() => {
|
|
745
|
+
// noop - just try again
|
|
746
|
+
});
|
|
747
|
+
}, 500);
|
|
748
|
+
const timeout = setTimeout(() => {
|
|
749
|
+
clearInterval(pollingInterval);
|
|
750
|
+
loginSpinner.stop('Login timed out. No worries - it happens to the best of us.');
|
|
751
|
+
Sentry.setTag('opened-wizard-link', false);
|
|
752
|
+
void abort('Please restart the Wizard and log in to complete the setup.');
|
|
753
|
+
}, 180000);
|
|
1065
754
|
});
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
return
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
sortedProjects.sort(function (a, b) {
|
|
1089
|
-
return label(a).localeCompare(label(b));
|
|
1090
|
-
});
|
|
1091
|
-
return [4 /*yield*/, abortIfCancelled(clack.select({
|
|
1092
|
-
maxItems: 12,
|
|
1093
|
-
message: 'Select your Sentry project.',
|
|
1094
|
-
options: sortedProjects.map(function (project) {
|
|
1095
|
-
return {
|
|
1096
|
-
value: project,
|
|
1097
|
-
label: label(project),
|
|
1098
|
-
};
|
|
1099
|
-
}),
|
|
1100
|
-
}))];
|
|
1101
|
-
case 1:
|
|
1102
|
-
selection = _a.sent();
|
|
1103
|
-
Sentry.setTag('project', selection.slug);
|
|
1104
|
-
Sentry.setUser({ id: selection.organization.slug });
|
|
1105
|
-
return [2 /*return*/, selection];
|
|
1106
|
-
}
|
|
1107
|
-
});
|
|
755
|
+
loginSpinner.stop('Login complete.');
|
|
756
|
+
Sentry.setTag('opened-wizard-link', true);
|
|
757
|
+
return data;
|
|
758
|
+
}
|
|
759
|
+
async function askForProjectSelection(projects, orgSlug, projectSlug) {
|
|
760
|
+
const label = (project) => {
|
|
761
|
+
return `${project.organization.slug}/${project.slug}`;
|
|
762
|
+
};
|
|
763
|
+
const filteredProjects = filterProjectsBySlugs(projects, orgSlug, projectSlug);
|
|
764
|
+
if (filteredProjects.length === 1) {
|
|
765
|
+
const selection = filteredProjects[0];
|
|
766
|
+
Sentry.setTag('project', selection.slug);
|
|
767
|
+
Sentry.setUser({ id: selection.organization.slug });
|
|
768
|
+
clack.log.step(`Selected project ${label(selection)}`);
|
|
769
|
+
return selection;
|
|
770
|
+
}
|
|
771
|
+
if (filteredProjects.length === 0) {
|
|
772
|
+
clack.log.warn('Could not find a project with the provided slugs.');
|
|
773
|
+
}
|
|
774
|
+
const sortedProjects = filteredProjects.length ? filteredProjects : projects;
|
|
775
|
+
sortedProjects.sort((a, b) => {
|
|
776
|
+
return label(a).localeCompare(label(b));
|
|
1108
777
|
});
|
|
778
|
+
const selection = await abortIfCancelled(clack.select({
|
|
779
|
+
maxItems: 12,
|
|
780
|
+
message: 'Select your Sentry project.',
|
|
781
|
+
options: sortedProjects.map((project) => {
|
|
782
|
+
return {
|
|
783
|
+
value: project,
|
|
784
|
+
label: label(project),
|
|
785
|
+
};
|
|
786
|
+
}),
|
|
787
|
+
}));
|
|
788
|
+
Sentry.setTag('project', selection.slug);
|
|
789
|
+
Sentry.setUser({ id: selection.organization.slug });
|
|
790
|
+
return selection;
|
|
1109
791
|
}
|
|
1110
792
|
function filterProjectsBySlugs(projects, orgSlug, projectSlug) {
|
|
1111
793
|
if (!orgSlug && !projectSlug) {
|
|
1112
794
|
return projects;
|
|
1113
795
|
}
|
|
1114
796
|
if (orgSlug && !projectSlug) {
|
|
1115
|
-
return projects.filter(
|
|
797
|
+
return projects.filter((p) => p.organization.slug === orgSlug);
|
|
1116
798
|
}
|
|
1117
799
|
if (!orgSlug && projectSlug) {
|
|
1118
|
-
return projects.filter(
|
|
800
|
+
return projects.filter((p) => p.slug === projectSlug);
|
|
1119
801
|
}
|
|
1120
|
-
return projects.filter(
|
|
802
|
+
return projects.filter((p) => p.organization.slug === orgSlug && p.slug === projectSlug);
|
|
1121
803
|
}
|
|
1122
804
|
/**
|
|
1123
805
|
* Asks users if they have a config file for @param tool (e.g. Vite).
|
|
@@ -1131,39 +813,29 @@ function filterProjectsBySlugs(projects, orgSlug, projectSlug) {
|
|
|
1131
813
|
*
|
|
1132
814
|
* @returns a user path to the config file or undefined if the user doesn't have a config file
|
|
1133
815
|
*/
|
|
1134
|
-
function askForToolConfigPath(toolName, configFileName) {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
return [4 /*yield*/, abortIfCancelled(clack.text({
|
|
1149
|
-
message: "Please enter the path to your ".concat(toolName, " config file:"),
|
|
1150
|
-
placeholder: path.join('.', configFileName),
|
|
1151
|
-
validate: function (value) {
|
|
1152
|
-
if (!value) {
|
|
1153
|
-
return 'Please enter a path.';
|
|
1154
|
-
}
|
|
1155
|
-
try {
|
|
1156
|
-
fs.accessSync(value);
|
|
1157
|
-
}
|
|
1158
|
-
catch (_a) {
|
|
1159
|
-
return 'Could not access the file at this path.';
|
|
1160
|
-
}
|
|
1161
|
-
},
|
|
1162
|
-
}))];
|
|
1163
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
816
|
+
async function askForToolConfigPath(toolName, configFileName) {
|
|
817
|
+
const hasConfig = await abortIfCancelled(clack.confirm({
|
|
818
|
+
message: `Do you have a ${toolName} config file (e.g. ${chalk_1.default.cyan(configFileName)})?`,
|
|
819
|
+
initialValue: true,
|
|
820
|
+
}));
|
|
821
|
+
if (!hasConfig) {
|
|
822
|
+
return undefined;
|
|
823
|
+
}
|
|
824
|
+
return await abortIfCancelled(clack.text({
|
|
825
|
+
message: `Please enter the path to your ${toolName} config file:`,
|
|
826
|
+
placeholder: (0, node_path_1.join)('.', configFileName),
|
|
827
|
+
validate: (value) => {
|
|
828
|
+
if (!value) {
|
|
829
|
+
return 'Please enter a path.';
|
|
1164
830
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
831
|
+
try {
|
|
832
|
+
fs.accessSync(value);
|
|
833
|
+
}
|
|
834
|
+
catch {
|
|
835
|
+
return 'Could not access the file at this path.';
|
|
836
|
+
}
|
|
837
|
+
},
|
|
838
|
+
}));
|
|
1167
839
|
}
|
|
1168
840
|
exports.askForToolConfigPath = askForToolConfigPath;
|
|
1169
841
|
/**
|
|
@@ -1191,28 +863,18 @@ exports.askForToolConfigPath = askForToolConfigPath;
|
|
|
1191
863
|
* TODO: refactor copy paste instructions across different wizards to use this function.
|
|
1192
864
|
* this might require adding a custom message parameter to the function
|
|
1193
865
|
*/
|
|
1194
|
-
function showCopyPasteInstructions(filename, codeSnippet, hint) {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
message: 'Did you apply the snippet above?',
|
|
1207
|
-
options: [{ label: 'Yes, continue!', value: true }],
|
|
1208
|
-
initialValue: true,
|
|
1209
|
-
}))];
|
|
1210
|
-
case 1:
|
|
1211
|
-
_a.sent();
|
|
1212
|
-
return [2 /*return*/];
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
});
|
|
866
|
+
async function showCopyPasteInstructions(filename, codeSnippet, hint) {
|
|
867
|
+
clack.log.step(`Add the following code to your ${chalk_1.default.cyan((0, node_path_1.basename)(filename))} file:${hint ? chalk_1.default.dim(` (${chalk_1.default.dim(hint)})`) : ''}`);
|
|
868
|
+
// Padding the code snippet to be printed with a \n at the beginning and end
|
|
869
|
+
// This makes it easier to distinguish the snippet from the rest of the output
|
|
870
|
+
// Intentionally logging directly to console here so that the code can be copied/pasted directly
|
|
871
|
+
// eslint-disable-next-line no-console
|
|
872
|
+
console.log(`\n${codeSnippet}\n`);
|
|
873
|
+
await abortIfCancelled(clack.select({
|
|
874
|
+
message: 'Did you apply the snippet above?',
|
|
875
|
+
options: [{ label: 'Yes, continue!', value: true }],
|
|
876
|
+
initialValue: true,
|
|
877
|
+
}));
|
|
1216
878
|
}
|
|
1217
879
|
exports.showCopyPasteInstructions = showCopyPasteInstructions;
|
|
1218
880
|
/**
|
|
@@ -1234,9 +896,9 @@ exports.showCopyPasteInstructions = showCopyPasteInstructions;
|
|
|
1234
896
|
* @returns a string containing the final, formatted code snippet.
|
|
1235
897
|
*/
|
|
1236
898
|
function makeCodeSnippet(colors, callback) {
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
899
|
+
const unchanged = (txt) => (colors ? chalk_1.default.grey(txt) : txt);
|
|
900
|
+
const plus = (txt) => (colors ? chalk_1.default.greenBright(txt) : txt);
|
|
901
|
+
const minus = (txt) => (colors ? chalk_1.default.redBright(txt) : txt);
|
|
1240
902
|
return callback(unchanged, plus, minus);
|
|
1241
903
|
}
|
|
1242
904
|
exports.makeCodeSnippet = makeCodeSnippet;
|
|
@@ -1257,149 +919,92 @@ exports.makeCodeSnippet = makeCodeSnippet;
|
|
|
1257
919
|
*
|
|
1258
920
|
* @returns true on success, false otherwise
|
|
1259
921
|
*/
|
|
1260
|
-
function createNewConfigFile(filepath, codeSnippet, moreInformation) {
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
return
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
clack.log.info(chalk_1.default.gray(moreInformation));
|
|
1280
|
-
}
|
|
1281
|
-
return [2 /*return*/, true];
|
|
1282
|
-
case 3:
|
|
1283
|
-
e_4 = _a.sent();
|
|
1284
|
-
(0, debug_1.debug)(e_4);
|
|
1285
|
-
clack.log.warn("Could not create a new ".concat(prettyFilename, " file. Please create one manually and follow the instructions below."));
|
|
1286
|
-
return [3 /*break*/, 4];
|
|
1287
|
-
case 4: return [2 /*return*/, false];
|
|
1288
|
-
}
|
|
1289
|
-
});
|
|
1290
|
-
});
|
|
922
|
+
async function createNewConfigFile(filepath, codeSnippet, moreInformation) {
|
|
923
|
+
if (!(0, node_path_1.isAbsolute)(filepath)) {
|
|
924
|
+
(0, debug_1.debug)(`createNewConfigFile: filepath is not absolute: ${filepath}`);
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
const prettyFilename = chalk_1.default.cyan((0, node_path_1.relative)(process.cwd(), filepath));
|
|
928
|
+
try {
|
|
929
|
+
await fs.promises.writeFile(filepath, codeSnippet);
|
|
930
|
+
clack.log.success(`Added new ${prettyFilename} file.`);
|
|
931
|
+
if (moreInformation) {
|
|
932
|
+
clack.log.info(chalk_1.default.gray(moreInformation));
|
|
933
|
+
}
|
|
934
|
+
return true;
|
|
935
|
+
}
|
|
936
|
+
catch (e) {
|
|
937
|
+
(0, debug_1.debug)(e);
|
|
938
|
+
clack.log.warn(`Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`);
|
|
939
|
+
}
|
|
940
|
+
return false;
|
|
1291
941
|
}
|
|
1292
942
|
exports.createNewConfigFile = createNewConfigFile;
|
|
1293
|
-
function askShouldCreateExamplePage(customRoute) {
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
},
|
|
1307
|
-
{ value: false, label: 'No' },
|
|
1308
|
-
],
|
|
1309
|
-
}));
|
|
1310
|
-
})];
|
|
1311
|
-
});
|
|
1312
|
-
});
|
|
943
|
+
async function askShouldCreateExamplePage(customRoute) {
|
|
944
|
+
const route = chalk_1.default.cyan(customRoute ?? '/sentry-example-page');
|
|
945
|
+
return (0, telemetry_1.traceStep)('ask-create-example-page', () => abortIfCancelled(clack.select({
|
|
946
|
+
message: `Do you want to create an example page ("${route}") to test your Sentry setup?`,
|
|
947
|
+
options: [
|
|
948
|
+
{
|
|
949
|
+
value: true,
|
|
950
|
+
label: 'Yes',
|
|
951
|
+
hint: 'Recommended - Check your git status before committing!',
|
|
952
|
+
},
|
|
953
|
+
{ value: false, label: 'No' },
|
|
954
|
+
],
|
|
955
|
+
})));
|
|
1313
956
|
}
|
|
1314
957
|
exports.askShouldCreateExamplePage = askShouldCreateExamplePage;
|
|
1315
|
-
function askShouldCreateExampleComponent() {
|
|
1316
|
-
return
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
{ value: false, label: 'No' },
|
|
1328
|
-
],
|
|
1329
|
-
}));
|
|
1330
|
-
})];
|
|
1331
|
-
});
|
|
1332
|
-
});
|
|
958
|
+
async function askShouldCreateExampleComponent() {
|
|
959
|
+
return (0, telemetry_1.traceStep)('ask-create-example-component', () => abortIfCancelled(clack.select({
|
|
960
|
+
message: `Do you want to create an example component to test your Sentry setup?`,
|
|
961
|
+
options: [
|
|
962
|
+
{
|
|
963
|
+
value: true,
|
|
964
|
+
label: 'Yes',
|
|
965
|
+
hint: 'Recommended - Check your git status before committing!',
|
|
966
|
+
},
|
|
967
|
+
{ value: false, label: 'No' },
|
|
968
|
+
],
|
|
969
|
+
})));
|
|
1333
970
|
}
|
|
1334
971
|
exports.askShouldCreateExampleComponent = askShouldCreateExampleComponent;
|
|
1335
|
-
function featureSelectionPrompt(features) {
|
|
1336
|
-
return
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
},
|
|
1359
|
-
{
|
|
1360
|
-
value: false,
|
|
1361
|
-
label: 'No',
|
|
1362
|
-
hint: feature.disabledHint,
|
|
1363
|
-
},
|
|
1364
|
-
],
|
|
1365
|
-
}))];
|
|
1366
|
-
case 2:
|
|
1367
|
-
selected = _a.sent();
|
|
1368
|
-
selectedFeatures[feature.id] = selected;
|
|
1369
|
-
_a.label = 3;
|
|
1370
|
-
case 3:
|
|
1371
|
-
_i++;
|
|
1372
|
-
return [3 /*break*/, 1];
|
|
1373
|
-
case 4: return [2 /*return*/, selectedFeatures];
|
|
1374
|
-
}
|
|
1375
|
-
});
|
|
1376
|
-
}); })];
|
|
1377
|
-
});
|
|
972
|
+
async function featureSelectionPrompt(features) {
|
|
973
|
+
return (0, telemetry_1.traceStep)('feature-selection', async () => {
|
|
974
|
+
const selectedFeatures = {};
|
|
975
|
+
for (const feature of features) {
|
|
976
|
+
const selected = await abortIfCancelled(clack.select({
|
|
977
|
+
message: feature.prompt,
|
|
978
|
+
initialValue: true,
|
|
979
|
+
options: [
|
|
980
|
+
{
|
|
981
|
+
value: true,
|
|
982
|
+
label: 'Yes',
|
|
983
|
+
hint: feature.enabledHint,
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
value: false,
|
|
987
|
+
label: 'No',
|
|
988
|
+
hint: feature.disabledHint,
|
|
989
|
+
},
|
|
990
|
+
],
|
|
991
|
+
}));
|
|
992
|
+
selectedFeatures[feature.id] = selected;
|
|
993
|
+
}
|
|
994
|
+
return selectedFeatures;
|
|
1378
995
|
});
|
|
1379
996
|
}
|
|
1380
997
|
exports.featureSelectionPrompt = featureSelectionPrompt;
|
|
1381
|
-
function askShouldInstallPackage(pkgName) {
|
|
1382
|
-
return
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
return abortIfCancelled(clack.confirm({
|
|
1386
|
-
message: "Do you want to install ".concat(chalk_1.default.cyan(pkgName), "?"),
|
|
1387
|
-
}));
|
|
1388
|
-
})];
|
|
1389
|
-
});
|
|
1390
|
-
});
|
|
998
|
+
async function askShouldInstallPackage(pkgName) {
|
|
999
|
+
return (0, telemetry_1.traceStep)(`ask-install-package`, () => abortIfCancelled(clack.confirm({
|
|
1000
|
+
message: `Do you want to install ${chalk_1.default.cyan(pkgName)}?`,
|
|
1001
|
+
})));
|
|
1391
1002
|
}
|
|
1392
1003
|
exports.askShouldInstallPackage = askShouldInstallPackage;
|
|
1393
|
-
function askShouldAddPackageOverride(pkgName, pkgVersion) {
|
|
1394
|
-
return
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
return abortIfCancelled(clack.confirm({
|
|
1398
|
-
message: "Do you want to add an override for ".concat(chalk_1.default.cyan(pkgName), " version ").concat(chalk_1.default.cyan(pkgVersion), "?"),
|
|
1399
|
-
}));
|
|
1400
|
-
})];
|
|
1401
|
-
});
|
|
1402
|
-
});
|
|
1004
|
+
async function askShouldAddPackageOverride(pkgName, pkgVersion) {
|
|
1005
|
+
return (0, telemetry_1.traceStep)(`ask-add-package-override`, () => abortIfCancelled(clack.confirm({
|
|
1006
|
+
message: `Do you want to add an override for ${chalk_1.default.cyan(pkgName)} version ${chalk_1.default.cyan(pkgVersion)}?`,
|
|
1007
|
+
})));
|
|
1403
1008
|
}
|
|
1404
1009
|
exports.askShouldAddPackageOverride = askShouldAddPackageOverride;
|
|
1405
1010
|
//# sourceMappingURL=clack-utils.js.map
|