@sentry/wizard 3.30.0 → 3.32.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 (45) hide show
  1. package/CHANGELOG.md +19 -4
  2. package/README.md +18 -23
  3. package/bin.ts +18 -0
  4. package/dist/bin.js +18 -0
  5. package/dist/bin.js.map +1 -1
  6. package/dist/package.json +1 -1
  7. package/dist/src/android/android-wizard.js +1 -0
  8. package/dist/src/android/android-wizard.js.map +1 -1
  9. package/dist/src/apple/apple-wizard.js +1 -0
  10. package/dist/src/apple/apple-wizard.js.map +1 -1
  11. package/dist/src/nextjs/nextjs-wizard.js +1 -0
  12. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  13. package/dist/src/react-native/react-native-wizard.js +1 -0
  14. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  15. package/dist/src/remix/remix-wizard.js +1 -0
  16. package/dist/src/remix/remix-wizard.js.map +1 -1
  17. package/dist/src/run.d.ts +1 -0
  18. package/dist/src/run.js +7 -6
  19. package/dist/src/run.js.map +1 -1
  20. package/dist/src/sourcemaps/sourcemaps-wizard.js +1 -0
  21. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  22. package/dist/src/sourcemaps/utils/sdk-version.js +9 -0
  23. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  24. package/dist/src/sveltekit/sveltekit-wizard.js +2 -1
  25. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  26. package/dist/src/telemetry.d.ts +2 -0
  27. package/dist/src/telemetry.js +4 -0
  28. package/dist/src/telemetry.js.map +1 -1
  29. package/dist/src/utils/clack-utils.js +7 -2
  30. package/dist/src/utils/clack-utils.js.map +1 -1
  31. package/dist/src/utils/types.d.ts +5 -0
  32. package/dist/src/utils/types.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/android/android-wizard.ts +1 -0
  35. package/src/apple/apple-wizard.ts +1 -0
  36. package/src/nextjs/nextjs-wizard.ts +1 -0
  37. package/src/react-native/react-native-wizard.ts +1 -0
  38. package/src/remix/remix-wizard.ts +1 -0
  39. package/src/run.ts +8 -6
  40. package/src/sourcemaps/sourcemaps-wizard.ts +1 -0
  41. package/src/sourcemaps/utils/sdk-version.ts +9 -0
  42. package/src/sveltekit/sveltekit-wizard.ts +3 -2
  43. package/src/telemetry.ts +7 -0
  44. package/src/utils/clack-utils.ts +11 -2
  45. package/src/utils/types.ts +6 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.32.0
4
+
5
+ - feat: Add `--saas` CLI arg to skip self-hosted or SaaS selection step (#678)
6
+ - ref: Add `--project` and `--org` args to help message and update readme (#679)
7
+
8
+ ## 3.31.0
9
+
10
+ - fix(sveltekit): Create bundler plugin env file instead of sentryclirc (#675)
11
+ - fix(check-sdk-version): update sentry sdk packages (#676)
12
+ - feat(telemetry): Add telemetry for org and project CLI argument usage (#677)
13
+
3
14
  ## 3.30.0
4
15
 
5
16
  - feat: Allow passing org and project slug parameters (#671)
@@ -29,11 +40,14 @@ Work in this release contributed by @MaximAL. Thank you for your contributions!
29
40
 
30
41
  ## 3.26.0
31
42
 
32
- - fix(nextjs): Don't add '.env.sentry-build-plugin' to .gitignore if it's already there (#610)
43
+ - fix(nextjs): Don't add '.env.sentry-build-plugin' to .gitignore if it's
44
+ already there (#610)
33
45
  - feat(nextjs): Support all `next.config` file types (#630)
34
- - fix(nextjs): Update instrumentation and example creation logic for app or pages usage (#629)
46
+ - fix(nextjs): Update instrumentation and example creation logic for app or
47
+ pages usage (#629)
35
48
  - feat(nextjs): Prompt for `reactComponentAnnotation` (#634)
36
- - fix(nextjs): Add missing Error.getInitialProps calls in Next.js error page snippets (#632)
49
+ - fix(nextjs): Add missing Error.getInitialProps calls in Next.js error page
50
+ snippets (#632)
37
51
  - fix/feat: Improve error logging for package installation (#635)
38
52
  - fix: Properly close open handles (#638)
39
53
 
@@ -51,7 +65,8 @@ Work in this release contributed by @MaximAL. Thank you for your contributions!
51
65
 
52
66
  ## 3.24.1
53
67
 
54
- - fix(nextjs): Add trailing comma to `sentryUrl` option in `withSentryConfig` template (#601)
68
+ - fix(nextjs): Add trailing comma to `sentryUrl` option in `withSentryConfig`
69
+ template (#601)
55
70
 
56
71
  ## 3.24.0
57
72
 
package/README.md CHANGED
@@ -53,29 +53,24 @@ At the current moment, the wizard is meant to be used for React Native, Cordova,
53
53
 
54
54
  # Options
55
55
 
56
- ```
57
- Options:
58
- --help Show help [boolean]
59
- --version Show version number [boolean]
60
- --debug Enable verbose logging
61
- env: SENTRY_WIZARD_DEBUG [boolean]
62
- --uninstall Revert project set up process
63
- env: SENTRY_WIZARD_UNINSTALL [boolean]
64
- --skip-connect Skips the connection to the server
65
- env: SENTRY_WIZARD_SKIP_CONNECT [boolean]
66
- --quiet Do not fallback to prompting user asking questions
67
- env: SENTRY_WIZARD_QUIET [boolean]
68
- -i, --integration Choose the integration to set up
69
- env: SENTRY_WIZARD_INTEGRATION
70
- [choices: "reactNative", "cordova", "electron", "nextjs"]
71
- -p, --platform Choose platform(s)
72
- env: SENTRY_WIZARD_PLATFORM
73
- [array] [choices: "ios", "android"]
74
- -u, --url The url to your Sentry installation
75
- env: SENTRY_WIZARD_URL [default: "https://sentry.io/"]
76
- -s, --signup Redirect to signup page if not logged in
77
- Use if don't have a Sentry account [boolean]
78
- ```
56
+ The following CLI arguments are available:
57
+
58
+ | Option | Description | Type | Default | Choices | Environment Variable |
59
+ | --------------------- | ----------------------------------------------------------------- | ------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------- |
60
+ | `--help` | Show help | boolean | | | |
61
+ | `--version` | Show version number | boolean | | | |
62
+ | `--debug` | Enable verbose logging | boolean | `false` | | `SENTRY_WIZARD_DEBUG` |
63
+ | `--uninstall` | Revert project setup process. Not available for all integrations. | boolean | `false` | | `SENTRY_WIZARD_UNINSTALL` |
64
+ | `--skip-connect` | Skips the connection to the server | boolean | `false` | | `SENTRY_WIZARD_SKIP_CONNECT` |
65
+ | `--quiet` | Do not fallback to prompting user asking questions | boolean | `false` | | `SENTRY_WIZARD_QUIET` |
66
+ | `-i, --integration` | Choose the integration to setup | choices | Select integration during setup | "reactNative", "ios", "android", "cordova", "electron", "nextjs", "remix", "sveltekit", "sourcemaps" | `SENTRY_WIZARD_INTEGRATION` |
67
+ | `-p, --platform` | Choose platform(s) | array | Select platform(s) during setup | "ios", "android" | `SENTRY_WIZARD_PLATFORM` |
68
+ | `-u, --url` | The URL to your Sentry installation | string | `https://sentry.io` | | `SENTRY_WIZARD_URL` |
69
+ | `--project` | The Sentry project slug to use | string | Select project during setup | | |
70
+ | `--org` | The Sentry org slug to use | string | Select org during setup | | |
71
+ | `--saas` | Skip the self-hosted or SaaS URL selection process | boolean | Select self-hosted or SaaS during setup | | |
72
+ | `-s, --signup` | Redirect to signup page if not logged in | boolean | `false` | | |
73
+ | `--disable-telemetry` | Don't send telemetry data to Sentry | boolean | `false` | | |
79
74
 
80
75
  ## Resources
81
76
 
package/bin.ts CHANGED
@@ -60,6 +60,24 @@ const argv = yargs(hideBin(process.argv))
60
60
  alias: 'url',
61
61
  describe: 'The url to your Sentry installation\nenv: SENTRY_WIZARD_URL',
62
62
  })
63
+ .option('project', {
64
+ type: 'string',
65
+ describe: 'The Sentry project slug to use',
66
+ defaultDescription: 'Select project during setup',
67
+ default: undefined,
68
+ })
69
+ .option('org', {
70
+ type: 'string',
71
+ describe: 'The Sentry org slug to use',
72
+ defaultDescription: 'Select org during setup',
73
+ default: undefined,
74
+ })
75
+ .option('saas', {
76
+ default: false,
77
+ describe: 'Skip the self-hosted or SaaS URL selection process',
78
+ defaultDescription: 'Select self-hosted or SaaS during setup',
79
+ type: 'boolean',
80
+ })
63
81
  .option('s', {
64
82
  alias: 'signup',
65
83
  default: false,
package/dist/bin.js CHANGED
@@ -68,6 +68,24 @@ var argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
68
68
  .option('u', {
69
69
  alias: 'url',
70
70
  describe: 'The url to your Sentry installation\nenv: SENTRY_WIZARD_URL',
71
+ })
72
+ .option('project', {
73
+ type: 'string',
74
+ describe: 'The Sentry project slug to use',
75
+ defaultDescription: 'Select project during setup',
76
+ default: undefined,
77
+ })
78
+ .option('org', {
79
+ type: 'string',
80
+ describe: 'The Sentry org slug to use',
81
+ defaultDescription: 'Select org during setup',
82
+ default: undefined,
83
+ })
84
+ .option('saas', {
85
+ default: false,
86
+ describe: 'Skip the self-hosted or SaaS URL selection process',
87
+ defaultDescription: 'Select self-hosted or SaaS during setup',
88
+ type: 'boolean',
71
89
  })
72
90
  .option('s', {
73
91
  alias: 'signup',
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,iCAAmC;AACnC,gDAA2C;AAE3C,gDAA0B;AAC1B,yCAAwC;AAExC,IAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,yCAAkC,kBAAkB,qCAA2B,OAAO,CAAC,OAAO,2CAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,6CAAwD;AACxD,iCAAgC;AAEhC,8CAA4B;AAE5B,kJAAkJ;AAClJ,IAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACtC,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,kDAAkD;IAC5D,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,WAAW,EAAE;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,4DAA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';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=14.18.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\n\nexport * from './lib/Setup';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv))\n .option('debug', {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n })\n .option('uninstall', {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n })\n .option('skip-connect', {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n })\n .option('quiet', {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n })\n .option('i', {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe: 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n })\n .option('p', {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n })\n .option('u', {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n })\n .option('s', {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n })\n .option('disable-telemetry', {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n })\n .option('promo-code', {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n }).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,iCAAmC;AACnC,gDAA2C;AAE3C,gDAA0B;AAC1B,yCAAwC;AAExC,IAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,yCAAkC,kBAAkB,qCAA2B,OAAO,CAAC,OAAO,2CAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,6CAAwD;AACxD,iCAAgC;AAEhC,8CAA4B;AAE5B,kJAAkJ;AAClJ,IAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACtC,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,kDAAkD;IAC5D,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,WAAW,EAAE;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,4DAA4D;IACtE,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,cAAc,EAAE;IACtB,OAAO,EAAE,KAAK;IACd,QAAQ,EACN,qEAAqE;IACvE,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EACN,8EAA8E;IAChF,IAAI,EAAE,SAAS;CAChB,CAAC;KACD,MAAM,CAAC,GAAG,EAAE;I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C1F,sFAAsF;AACtF,mEAAmE;AACnE,KAAK,IAAA,SAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=14.18.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\n\nexport * from './lib/Setup';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv))\n .option('debug', {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n })\n .option('uninstall', {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n })\n .option('skip-connect', {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n })\n .option('quiet', {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n })\n .option('i', {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe: 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n })\n .option('p', {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n })\n .option('u', {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n })\n .option('project', {\n type: 'string',\n describe: 'The Sentry project slug to use',\n defaultDescription: 'Select project during setup',\n default: undefined,\n })\n .option('org', {\n type: 'string',\n describe: 'The Sentry org slug to use',\n defaultDescription: 'Select org during setup',\n default: undefined,\n })\n .option('saas', {\n default: false,\n describe: 'Skip the self-hosted or SaaS URL selection process',\n defaultDescription: 'Select self-hosted or SaaS during setup',\n type: 'boolean',\n })\n .option('s', {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n })\n .option('disable-telemetry', {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n })\n .option('promo-code', {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n }).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.30.0",
3
+ "version": "3.32.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",
@@ -93,6 +93,7 @@ function runAndroidWizard(options) {
93
93
  return [2 /*return*/, (0, telemetry_1.withTelemetry)({
94
94
  enabled: options.telemetryEnabled,
95
95
  integration: 'android',
96
+ wizardOptions: options,
96
97
  }, function () { return runAndroidWizardWithTelemetry(options); })];
97
98
  });
98
99
  });
@@ -1 +1 @@
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,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C,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 abort,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n ...propertiesCliSetupConfig,\n name: 'proguard mappings',\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"]}
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,yBAC9B,sCAAwB,KAC3B,IAAI,EAAE,mBAAmB,GAC1B,CAAC;AAEF,SAAsB,gBAAgB,CAAC,OAAsB;;;YAC3D,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,SAAS;oBACtB,aAAa,EAAE,OAAO;iBACvB,EACD,cAAM,OAAA,6BAA6B,CAAC,OAAO,CAAC,EAAtC,CAAsC,CAC7C,EAAC;;;CACH;AATD,4CASC;AAED,SAAe,6BAA6B,CAC1C,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,uBAAuB;wBACnC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEpC,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;oBAC3B,gBAAgB,GAAG,uBAAuB,CAAC,UAAU,EAAE;wBAC3D,SAAS;wBACT,YAAY;qBACb,CAAC,CAAC;yBAEC,CA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CAAC;;;;;CACJ;AAED,qCAAqC;AACrC,SAAS,uBAAuB,CAC9B,GAAW,EACX,UAAoB,EACpB,mBAAkC;IAAlC,oCAAA,EAAA,wBAAkC;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 abort,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack-utils';\nimport { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport chalk from 'chalk';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n ...propertiesCliSetupConfig,\n name: 'proguard mappings',\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n wizardOptions: options,\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"]}
@@ -89,6 +89,7 @@ function runAppleWizard(options) {
89
89
  return [2 /*return*/, (0, telemetry_1.withTelemetry)({
90
90
  enabled: options.telemetryEnabled,
91
91
  integration: 'ios',
92
+ wizardOptions: options,
92
93
  }, function () { return runAppleWizardWithTelementry(options); })];
93
94
  });
94
95
  });
@@ -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,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAEx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\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 Sentry.setTag('No-Target', true);\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 Sentry.setTag('cocoapod-exists', hasCocoa);\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 Sentry.setTag('cocoapod-added', podAdded);\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 Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\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\n Sentry.setTag('Snippet-Added', codeAdded);\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 }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\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 Sentry.setTag('fastlane-desired', addLane);\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 Sentry.setTag('fastlane-added', added);\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,q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,CAAC;KACX;IAED,IAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAC/B,EAAE,EACF,SAAS,CAAC,CAAC,CAAC,EACZ,0BAA0B,CAC3B,CAAC;IACF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE;QACnC,OAAO,EAAE,CAAC;KACX;IACD,IAAM,UAAU,GAAG,iCAAiC,CAAC;IACrD,IAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IACzD,IAAI,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 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 wizardOptions: options,\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 Sentry.setTag('No-Target', true);\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 Sentry.setTag('cocoapod-exists', hasCocoa);\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 Sentry.setTag('cocoapod-added', podAdded);\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 Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\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\n Sentry.setTag('Snippet-Added', codeAdded);\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 }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\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 Sentry.setTag('fastlane-desired', addLane);\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 Sentry.setTag('fastlane-added', added);\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"]}
@@ -91,6 +91,7 @@ function runNextjsWizard(options) {
91
91
  return (0, telemetry_1.withTelemetry)({
92
92
  enabled: options.telemetryEnabled,
93
93
  integration: 'nextjs',
94
+ wizardOptions: options,
94
95
  }, function () { return runNextjsWizardWithTelemetry(options); });
95
96
  }
96
97
  exports.runNextjsWizard = runNextjsWizard;