@sentry/wizard 3.12.0 → 3.14.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/lib/Steps/ChooseIntegration.js +1 -0
  3. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  4. package/dist/package.json +2 -2
  5. package/dist/src/android/android-wizard.js +8 -8
  6. package/dist/src/android/android-wizard.js.map +1 -1
  7. package/dist/src/apple/apple-wizard.js +1 -1
  8. package/dist/src/apple/apple-wizard.js.map +1 -1
  9. package/dist/src/nextjs/nextjs-wizard.d.ts +1 -0
  10. package/dist/src/nextjs/nextjs-wizard.js +257 -163
  11. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  12. package/dist/src/nextjs/templates.d.ts +1 -1
  13. package/dist/src/nextjs/templates.js +2 -2
  14. package/dist/src/nextjs/templates.js.map +1 -1
  15. package/dist/src/nextjs/utils.d.ts +1 -0
  16. package/dist/src/nextjs/utils.js +25 -0
  17. package/dist/src/nextjs/utils.js.map +1 -0
  18. package/dist/src/remix/remix-wizard.js +13 -11
  19. package/dist/src/remix/remix-wizard.js.map +1 -1
  20. package/dist/src/remix/sdk-setup.d.ts +5 -1
  21. package/dist/src/remix/sdk-setup.js +13 -6
  22. package/dist/src/remix/sdk-setup.js.map +1 -1
  23. package/dist/src/sourcemaps/sourcemaps-wizard.js +1 -1
  24. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  25. package/dist/src/sourcemaps/tools/sentry-cli.d.ts +9 -0
  26. package/dist/src/sourcemaps/tools/sentry-cli.js +26 -22
  27. package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
  28. package/dist/src/sourcemaps/tools/tsc.d.ts +6 -0
  29. package/dist/src/sourcemaps/tools/tsc.js +98 -17
  30. package/dist/src/sourcemaps/tools/tsc.js.map +1 -1
  31. package/dist/src/sourcemaps/tools/vite.js +3 -13
  32. package/dist/src/sourcemaps/tools/vite.js.map +1 -1
  33. package/dist/src/sourcemaps/tools/webpack.js +3 -13
  34. package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
  35. package/dist/src/sveltekit/sdk-setup.js +122 -48
  36. package/dist/src/sveltekit/sdk-setup.js.map +1 -1
  37. package/dist/src/sveltekit/sveltekit-wizard.d.ts +1 -0
  38. package/dist/src/sveltekit/sveltekit-wizard.js +113 -42
  39. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  40. package/dist/src/sveltekit/utils.d.ts +2 -0
  41. package/dist/src/sveltekit/utils.js +48 -0
  42. package/dist/src/sveltekit/utils.js.map +1 -0
  43. package/dist/src/telemetry.d.ts +1 -0
  44. package/dist/src/telemetry.js +27 -12
  45. package/dist/src/telemetry.js.map +1 -1
  46. package/dist/src/utils/ast-utils.d.ts +70 -0
  47. package/dist/src/utils/ast-utils.js +152 -1
  48. package/dist/src/utils/ast-utils.js.map +1 -1
  49. package/dist/src/utils/clack-utils.d.ts +49 -7
  50. package/dist/src/utils/clack-utils.js +238 -168
  51. package/dist/src/utils/clack-utils.js.map +1 -1
  52. package/dist/src/utils/package-manager.d.ts +5 -0
  53. package/dist/src/utils/package-manager.js +23 -14
  54. package/dist/src/utils/package-manager.js.map +1 -1
  55. package/dist/test/sourcemaps/tools/sentry-cli.test.d.ts +1 -0
  56. package/dist/test/sourcemaps/tools/sentry-cli.test.js +112 -0
  57. package/dist/test/sourcemaps/tools/sentry-cli.test.js.map +1 -0
  58. package/dist/test/sourcemaps/tools/tsc.test.d.ts +1 -0
  59. package/dist/test/sourcemaps/tools/tsc.test.js +121 -0
  60. package/dist/test/sourcemaps/tools/tsc.test.js.map +1 -0
  61. package/dist/test/utils/ast-utils.test.js +157 -26
  62. package/dist/test/utils/ast-utils.test.js.map +1 -1
  63. package/lib/Steps/ChooseIntegration.ts +1 -0
  64. package/package.json +2 -2
  65. package/src/android/android-wizard.ts +12 -10
  66. package/src/apple/apple-wizard.ts +2 -2
  67. package/src/nextjs/nextjs-wizard.ts +277 -198
  68. package/src/nextjs/templates.ts +3 -2
  69. package/src/nextjs/utils.ts +21 -0
  70. package/src/remix/remix-wizard.ts +15 -20
  71. package/src/remix/sdk-setup.ts +20 -5
  72. package/src/sourcemaps/sourcemaps-wizard.ts +2 -2
  73. package/src/sourcemaps/tools/sentry-cli.ts +16 -9
  74. package/src/sourcemaps/tools/tsc.ts +133 -28
  75. package/src/sourcemaps/tools/vite.ts +15 -39
  76. package/src/sourcemaps/tools/webpack.ts +16 -39
  77. package/src/sveltekit/sdk-setup.ts +109 -37
  78. package/src/sveltekit/sveltekit-wizard.ts +86 -21
  79. package/src/sveltekit/utils.ts +50 -0
  80. package/src/telemetry.ts +22 -11
  81. package/src/utils/ast-utils.ts +180 -0
  82. package/src/utils/clack-utils.ts +238 -149
  83. package/src/utils/package-manager.ts +24 -12
  84. package/test/sourcemaps/tools/sentry-cli.test.ts +51 -0
  85. package/test/sourcemaps/tools/tsc.test.ts +181 -0
  86. package/test/utils/ast-utils.test.ts +233 -32
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.14.0
4
+
5
+ feat(nextjs): Add telemetry collection to NextJS wizard (#458)
6
+ feat(wizard): Ask for confirmation to continue if git repo is not clean (#462)
7
+ fix(remix): Fix Remix version and TS checks (#464)
8
+
9
+ ## 3.13.0
10
+
11
+ - enh(android): Show link to issues page after setup is complete (#448)
12
+ - feat(remix): Pass `org`, `project`, `url` to `upload-sourcemaps` script (#434)
13
+ - feat(sourcemaps): Automatically enable source maps generation in `tsconfig.json` (#449)
14
+ - feat(sveltekit): Add telemetry collection (#455)
15
+ - fix(nextjs): Add selfhosted url in `next.config.js` (#438)
16
+ - fix(nextjs): Create necessary directories in app router (#439)
17
+ - fix(sourcemaps): Write package manager command instead of object to package.json (#453)
18
+ - ref(sveltekit): Check for minimum supported SvelteKit version (#456)
19
+
20
+ Work in this release contributed by @andreysam. Thank you for your contributions!
21
+
3
22
  ## 3.12.0
4
23
 
5
24
  - feat(sourcemaps): Automatically insert Sentry Webpack plugin (#432)
@@ -164,6 +164,7 @@ var ChooseIntegration = /** @class */ (function (_super) {
164
164
  message: 'What platform do you want to set up?',
165
165
  name: 'integration',
166
166
  type: 'list',
167
+ pageSize: 10,
167
168
  },
168
169
  ])];
169
170
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChooseIntegration.js","sourceRoot":"","sources":["../../../lib/Steps/ChooseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAElC,0CAKsB;AACtB,uCAAsC;AACtC,kDAAiD;AACjD,oDAAmD;AACnD,wDAAuD;AACvD,0DAAyD;AACzD,gEAA+D;AAC/D,8CAA6C;AAC7C,8DAA6D;AAC7D,6DAAmE;AACnE,8CAA6C;AAC7C,kDAAiD;AACjD,6CAAwC;AAExC,IAAI,cAAc,GAAQ,EAAE,CAAC;AAE7B,IAAI;IACF,qCAAqC;IACrC,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAChD;AAAC,WAAM;IACN,cAAc,GAAG,OAAO,CAAC,UAAG,OAAO,CAAC,GAAG,EAAE,kBAAe,CAAC,CAAC;CAC3D;AAMD;IAAuC,qCAAQ;IAA/C;;IAoFA,CAAC;IAnFc,gCAAI,GAAjB,UAAkB,QAAiB;;;;;4BACP,qBAAM,IAAI,CAAC,8BAA8B,EAAE,EAAA;;wBAA/D,iBAAiB,GAAG,SAA2C;wBAEjE,WAAW,GAAG,IAAI,CAAC;wBACvB,QAAQ,iBAAiB,CAAC,WAAW,EAAE;4BACrC,KAAK,uBAAW,CAAC,OAAO;gCACtB,WAAW,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gCACtC,MAAM;4BACR,KAAK,uBAAW,CAAC,OAAO;gCACtB,WAAW,GAAG,IAAI,iBAAO,CAAC,WA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E,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC;KACb;IAED,IAAI,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;IACvB,OAAO,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;IAC5C,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;IAEnB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\n\nimport {\n Args,\n DEFAULT_URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { NextJsShim } from './Integrations/NextJsShim';\nimport { ReactNative } from './Integrations/ReactNative';\nimport { SourceMapsShim } from './Integrations/SourceMapsShim';\nimport { Apple } from './Integrations/Apple';\nimport { SvelteKitShim } from './Integrations/SvelteKitShim';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { Remix } from './Integrations/Remix';\nimport { Android } from './Integrations/Android';\nimport { dim } from '../Helper/Logging';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.android:\n integration = new Android(this._argv);\n break;\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n case Integration.nextjs:\n integration = new NextJsShim(this._argv);\n break;\n case Integration.remix:\n integration = new Remix(this._argv);\n break;\n case Integration.sveltekit:\n integration = new SvelteKitShim(this._argv);\n break;\n case Integration.sourcemaps:\n integration = new SourceMapsShim(this._argv);\n break;\n case Integration.ios:\n integration = new Apple(this._argv);\n break;\n case Integration.reactNative:\n default:\n integration = new ReactNative(sanitizeUrl(this._argv));\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What platform do you want to set up?',\n name: 'integration',\n type: 'list',\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
1
+ {"version":3,"file":"ChooseIntegration.js","sourceRo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,EAAE,KAAK,CAAC,CAAC;IAC/C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC;IAEnB,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\n\nimport {\n Args,\n DEFAULT_URL,\n getIntegrationChoices,\n Integration,\n} from '../Constants';\nimport { BaseStep } from './BaseStep';\nimport { Cordova } from './Integrations/Cordova';\nimport { Electron } from './Integrations/Electron';\nimport { NextJsShim } from './Integrations/NextJsShim';\nimport { ReactNative } from './Integrations/ReactNative';\nimport { SourceMapsShim } from './Integrations/SourceMapsShim';\nimport { Apple } from './Integrations/Apple';\nimport { SvelteKitShim } from './Integrations/SvelteKitShim';\nimport { hasPackageInstalled } from '../../src/utils/package-json';\nimport { Remix } from './Integrations/Remix';\nimport { Android } from './Integrations/Android';\nimport { dim } from '../Helper/Logging';\n\nlet projectPackage: any = {};\n\ntry {\n // If we run directly in setup-wizard\n projectPackage = require('../../package.json');\n} catch {\n projectPackage = require(`${process.cwd()}/package.json`);\n}\n\ntype IntegrationPromptAnswer = {\n integration: Integration;\n};\n\nexport class ChooseIntegration extends BaseStep {\n public async emit(_answers: Answers): Promise<Answers> {\n const integrationPrompt = await this._getIntegrationPromptSelection();\n\n let integration = null;\n switch (integrationPrompt.integration) {\n case Integration.android:\n integration = new Android(this._argv);\n break;\n case Integration.cordova:\n integration = new Cordova(sanitizeUrl(this._argv));\n break;\n case Integration.electron:\n integration = new Electron(sanitizeUrl(this._argv));\n break;\n case Integration.nextjs:\n integration = new NextJsShim(this._argv);\n break;\n case Integration.remix:\n integration = new Remix(this._argv);\n break;\n case Integration.sveltekit:\n integration = new SvelteKitShim(this._argv);\n break;\n case Integration.sourcemaps:\n integration = new SourceMapsShim(this._argv);\n break;\n case Integration.ios:\n integration = new Apple(this._argv);\n break;\n case Integration.reactNative:\n default:\n integration = new ReactNative(sanitizeUrl(this._argv));\n break;\n }\n\n return { integration };\n }\n\n public tryDetectingIntegration(): Integration | undefined {\n if (hasPackageInstalled('react-native', projectPackage)) {\n return Integration.reactNative;\n }\n if (hasPackageInstalled('cordova', projectPackage)) {\n return Integration.cordova;\n }\n if (hasPackageInstalled('electron', projectPackage)) {\n return Integration.electron;\n }\n if (hasPackageInstalled('next', projectPackage)) {\n return Integration.nextjs;\n }\n if (hasPackageInstalled('remix-run', projectPackage)) {\n return Integration.remix;\n }\n if (hasPackageInstalled('@sveltejs/kit', projectPackage)) {\n return Integration.sveltekit;\n }\n\n return;\n }\n\n private async _getIntegrationPromptSelection(): Promise<IntegrationPromptAnswer> {\n // If we receive project type as an arg we skip asking\n if (this._argv.integration) {\n return { integration: this._argv.integration };\n } else {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n\n const detectedDefaultSelection = this.tryDetectingIntegration();\n\n return prompt([\n {\n choices: getIntegrationChoices(),\n default: detectedDefaultSelection,\n message: 'What platform do you want to set up?',\n name: 'integration',\n type: 'list',\n pageSize: 10,\n },\n ]);\n }\n }\n}\n\n/**\n * For the `clack`-based wizard flows, which we only shim here, we don't set\n * a default url value. For backwards-compatibility with the other flows,\n * we fill it here and sanitize a user-enterd url.\n */\nfunction sanitizeUrl(argv: Args): Args {\n if (!argv.url) {\n argv.url = DEFAULT_URL;\n dim(`no URL provided, fallback to ${argv.url}`);\n return argv;\n }\n\n let baseUrl = argv.url;\n baseUrl += baseUrl.endsWith('/') ? '' : '/';\n baseUrl = baseUrl.replace(/:\\/(?!\\/)/g, '://');\n argv.url = baseUrl;\n\n return argv;\n}\n"]}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.12.0",
3
+ "version": "3.14.0",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -26,7 +26,7 @@
26
26
  "@clack/core": "0.3.3",
27
27
  "@clack/prompts": "0.7.0",
28
28
  "@sentry/cli": "^1.72.0",
29
- "@sentry/node": "^7.57.0",
29
+ "@sentry/node": "^7.69.0",
30
30
  "axios": "1.3.5",
31
31
  "chalk": "^2.4.1",
32
32
  "glob": "^7.1.3",
@@ -105,7 +105,7 @@ function runAndroidWizard(options) {
105
105
  exports.runAndroidWizard = runAndroidWizard;
106
106
  function runAndroidWizardWithTelemetry(options) {
107
107
  return __awaiter(this, void 0, void 0, function () {
108
- var projectDir, buildGradleFiles, appFile, _a, selectedProject, authToken, pluginAdded, appDir, manifestFile, manifestUpdated, mainActivity, packageName, activityName, packageNameStable_1, activityFile_1, activityPatched;
108
+ var projectDir, buildGradleFiles, appFile, _a, selectedProject, selfHosted, sentryUrl, authToken, pluginAdded, appDir, manifestFile, manifestUpdated, mainActivity, packageName, activityName, packageNameStable_1, activityFile_1, activityPatched, issuesPageLink;
109
109
  return __generator(this, function (_b) {
110
110
  switch (_b.label) {
111
111
  case 0:
@@ -113,7 +113,7 @@ function runAndroidWizardWithTelemetry(options) {
113
113
  wizardName: 'Sentry Android Wizard',
114
114
  promoCode: options.promoCode,
115
115
  });
116
- return [4 /*yield*/, (0, clack_utils_1.confirmContinueEvenThoughNoGitRepo)()];
116
+ return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)()];
117
117
  case 1:
118
118
  _b.sent();
119
119
  projectDir = process.cwd();
@@ -135,7 +135,7 @@ function runAndroidWizardWithTelemetry(options) {
135
135
  appFile = _b.sent();
136
136
  return [4 /*yield*/, (0, clack_utils_1.getOrAskForProjectData)(options, 'android')];
137
137
  case 5:
138
- _a = _b.sent(), selectedProject = _a.selectedProject, authToken = _a.authToken;
138
+ _a = _b.sent(), selectedProject = _a.selectedProject, selfHosted = _a.selfHosted, sentryUrl = _a.sentryUrl, authToken = _a.authToken;
139
139
  // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============
140
140
  clack.log.step("Adding ".concat(chalk_1.default.bold('Sentry Gradle plugin'), " to your app's ").concat(chalk_1.default.cyan('build.gradle'), " file."));
141
141
  return [4 /*yield*/, (0, telemetry_1.traceStep)('Add Gradle Plugin', function () {
@@ -190,13 +190,13 @@ function runAndroidWizardWithTelemetry(options) {
190
190
  }
191
191
  // ======== STEP 4. Add sentry-cli config file ============
192
192
  clack.log.step("Configuring ".concat(chalk_1.default.bold('proguard mappings upload'), " via the ").concat(chalk_1.default.cyan('sentry.properties'), " file."));
193
- return [4 /*yield*/, (0, telemetry_1.traceStep)('Add SentryCli Config', function () {
194
- return (0, clack_utils_1.addSentryCliConfig)(authToken, proguardMappingCliSetupConfig);
195
- })];
193
+ return [4 /*yield*/, (0, clack_utils_1.addSentryCliConfig)(authToken, proguardMappingCliSetupConfig)];
196
194
  case 7:
197
195
  _b.sent();
198
- // ======== OUTRO ========
199
- clack.outro("\n".concat(chalk_1.default.greenBright('Successfully installed the Sentry Android SDK!'), "\n\n").concat(chalk_1.default.cyan('You can validate your setup by launching your application and checking Sentry issues page afterwards'), "\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n "));
196
+ issuesPageLink = selfHosted
197
+ ? "".concat(sentryUrl, "organizations/").concat(selectedProject.organization.slug, "/issues/?project=").concat(selectedProject.id)
198
+ : "https://".concat(selectedProject.organization.slug, ".sentry.io/issues/?project=").concat(selectedProject.id);
199
+ clack.outro("\n".concat(chalk_1.default.greenBright('Successfully installed the Sentry Android SDK!'), "\n\n").concat(chalk_1.default.cyan("You can validate your setup by launching your application and checking Sentry issues page afterwards\n".concat(issuesPageLink)), "\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n "));
200
200
  return [2 /*return*/];
201
201
  }
202
202
  });
@@ -1 +1 @@
1
- {"version":3,"file":"android-wizard.js","sourceRoot":"","sources":["../../../src/android/android-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,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IAElC,IAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;4BAChD,IAAI;QACb,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAvB,CAAuB,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;;IANH,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK;QAAnB,IAAM,IAAI,cAAA;gBAAJ,IAAI;KAOd;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport * as codetools from './code-tools';\nimport {\n CliSetupConfig,\n SENTRY_PROPERTIES_FILE,\n abort,\n addSentryCliConfig,\n confirmContinueEvenThoughNoGitRepo,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_PROPERTIES_FILE,\n name: 'proguard mappings',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const { selectedProject, authToken } = await getOrAskForProjectData(\n options,\n 'android',\n );\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n await traceStep('Add SentryCli Config', () =>\n addSentryCliConfig(authToken, proguardMappingCliSetupConfig),\n );\n\n // ======== OUTRO ========\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n 'You can validate your setup by launching your application and checking Sentry issues page afterwards',\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
1
+ {"version":3,"file":"android-wizard.js","sourceRoot":"","sources":["../../../src/android/android-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,qCAAyB;AACzB,yEAAyE;AACzE,oDAAwC;AACxC,yCAA6B;AAC7B,mDAAuC;AACvC,+CAAmC;AACnC,mDAAuC;AACvC,sDAA0C;AAC1C,oDAQ8B;AAE9B,0CAAwD;AACxD,gDAA0B;AAE1B,IAAM,6BAA6B,GAAmB;IACpD,QAAQ,EAAE,oCAAsB;IAChC,IAAI,EAAE,mBAAmB;IACzB,yBAAyB,YAAC,QAAgB;QACxC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;IACD,YAAY,YAAC,SAA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WAAW,EAAE,EAAE;YACtB,IAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,UAAC,GAAG,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAvB,CAAuB,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;;IANH,KAAmB,UAAK,EAAL,eAAK,EAAL,mBAAK,EAAL,IAAK;QAAnB,IAAM,IAAI,cAAA;gBAAJ,IAAI;KAOd;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as path from 'path';\nimport * as Sentry from '@sentry/node';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport * as codetools from './code-tools';\nimport {\n CliSetupConfig,\n SENTRY_PROPERTIES_FILE,\n abort,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_PROPERTIES_FILE,\n name: 'proguard mappings',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'android');\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n\n await addSentryCliConfig(authToken, proguardMappingCliSetupConfig);\n\n // ======== OUTRO ========\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n${issuesPageLink}`,\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
@@ -104,7 +104,7 @@ function runAppleWizardWithTelementry(options) {
104
104
  wizardName: 'Sentry Apple Wizard',
105
105
  promoCode: options.promoCode,
106
106
  });
107
- return [4 /*yield*/, (0, clack_utils_1.confirmContinueEvenThoughNoGitRepo)()];
107
+ return [4 /*yield*/, (0, clack_utils_1.confirmContinueIfNoOrDirtyGitRepo)()];
108
108
  case 1:
109
109
  _c.sent();
110
110
  hasCli = bash.hasSentryCLI();
@@ -1 +1 @@
1
- {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0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AI,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,OAAO,EAAE;QACd,IAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,IACE,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC5B,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EACxB;YACA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACnB;QACD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAxB,CAAwB,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\nconst xcode = require('xcode');\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueEvenThoughNoGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suttable target found in ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n return;\n }\n\n if (fastlane.fastFile(projectDir)) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
1
+ {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAExD,mDAAuC;AACvC,0CAAwD;AACxD,mDAAuC;AACvC,mDAAuC;AAEvC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,qDAAqD;AAErD,oDAO8B;AAE9B,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,KAAK;iBACnB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,CAAqC,CAC5C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,4BAA4B,CACzC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEpC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;yBAC7B,CAAC,MAAM,EAAP,wBAAO;oBAEL,qBAAM,IAAA,qBAAS,EAAC,mBAA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ines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\nconst xcode = require('xcode');\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suttable target found in ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n return;\n }\n\n if (fastlane.fastFile(projectDir)) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
@@ -1,2 +1,3 @@
1
1
  import { WizardOptions } from '../utils/types';
2
2
  export declare function runNextjsWizard(options: WizardOptions): Promise<void>;
3
+ export declare function runNextjsWizardWithTelemetry(options: WizardOptions): Promise<void>;