@sentry/wizard 4.8.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/e2e-tests/tests/angular-17.test.js +41 -41
  3. package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
  4. package/dist/e2e-tests/tests/angular-19.test.js +39 -39
  5. package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
  6. package/dist/e2e-tests/tests/expo.test.js +10 -2
  7. package/dist/e2e-tests/tests/expo.test.js.map +1 -1
  8. package/dist/e2e-tests/tests/react-native.test.js +38 -3
  9. package/dist/e2e-tests/tests/react-native.test.js.map +1 -1
  10. package/dist/e2e-tests/utils/index.js +14 -6
  11. package/dist/e2e-tests/utils/index.js.map +1 -1
  12. package/dist/lib/Helper/SentryCli.d.ts +0 -11
  13. package/dist/lib/Helper/SentryCli.js +0 -52
  14. package/dist/lib/Helper/SentryCli.js.map +1 -1
  15. package/dist/lib/Steps/Integrations/Cordova.js +13 -30
  16. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  17. package/dist/src/android/templates.js +2 -0
  18. package/dist/src/android/templates.js.map +1 -1
  19. package/dist/src/angular/angular-wizard.js +1 -1
  20. package/dist/src/angular/angular-wizard.js.map +1 -1
  21. package/dist/src/angular/sdk-setup.d.ts +1 -1
  22. package/dist/src/angular/sdk-setup.js +3 -3
  23. package/dist/src/angular/sdk-setup.js.map +1 -1
  24. package/dist/src/apple/code-tools.d.ts +4 -2
  25. package/dist/src/apple/code-tools.js +21 -11
  26. package/dist/src/apple/code-tools.js.map +1 -1
  27. package/dist/src/apple/inject-code-snippet.js +5 -3
  28. package/dist/src/apple/inject-code-snippet.js.map +1 -1
  29. package/dist/src/apple/macos-system-helper.d.ts +5 -0
  30. package/dist/src/apple/macos-system-helper.js +86 -0
  31. package/dist/src/apple/macos-system-helper.js.map +1 -0
  32. package/dist/src/apple/templates.js +10 -0
  33. package/dist/src/apple/templates.js.map +1 -1
  34. package/dist/src/apple/xcode-manager.d.ts +237 -11
  35. package/dist/src/apple/xcode-manager.js +736 -65
  36. package/dist/src/apple/xcode-manager.js.map +1 -1
  37. package/dist/src/apple/xcode-project-object-with-id.d.ts +5 -0
  38. package/dist/src/apple/xcode-project-object-with-id.js +3 -0
  39. package/dist/src/apple/xcode-project-object-with-id.js.map +1 -0
  40. package/dist/src/flutter/templates.js +7 -1
  41. package/dist/src/flutter/templates.js.map +1 -1
  42. package/dist/src/nextjs/nextjs-wizard.js +1 -3
  43. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  44. package/dist/src/nuxt/nuxt-wizard.js +1 -3
  45. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  46. package/dist/src/react-native/expo-env-file.js +5 -0
  47. package/dist/src/react-native/expo-env-file.js.map +1 -1
  48. package/dist/src/react-native/expo-metro.js +18 -5
  49. package/dist/src/react-native/expo-metro.js.map +1 -1
  50. package/dist/src/react-native/expo.js +6 -0
  51. package/dist/src/react-native/expo.js.map +1 -1
  52. package/dist/src/react-native/glob.js +14 -4
  53. package/dist/src/react-native/glob.js.map +1 -1
  54. package/dist/src/react-native/gradle.d.ts +0 -1
  55. package/dist/src/react-native/gradle.js +15 -9
  56. package/dist/src/react-native/gradle.js.map +1 -1
  57. package/dist/src/react-native/javascript.d.ts +9 -4
  58. package/dist/src/react-native/javascript.js +44 -22
  59. package/dist/src/react-native/javascript.js.map +1 -1
  60. package/dist/src/react-native/metro.d.ts +1 -5
  61. package/dist/src/react-native/metro.js +18 -120
  62. package/dist/src/react-native/metro.js.map +1 -1
  63. package/dist/src/react-native/options.d.ts +1 -3
  64. package/dist/src/react-native/options.js.map +1 -1
  65. package/dist/src/react-native/react-native-wizard.d.ts +1 -19
  66. package/dist/src/react-native/react-native-wizard.js +27 -101
  67. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  68. package/dist/src/react-native/xcode.d.ts +0 -7
  69. package/dist/src/react-native/xcode.js +15 -108
  70. package/dist/src/react-native/xcode.js.map +1 -1
  71. package/dist/src/remix/remix-wizard.js +1 -3
  72. package/dist/src/remix/remix-wizard.js.map +1 -1
  73. package/dist/src/run.js +1 -4
  74. package/dist/src/run.js.map +1 -1
  75. package/dist/src/sourcemaps/utils/sdk-version.js +3 -0
  76. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  77. package/dist/src/sveltekit/sveltekit-wizard.js +1 -3
  78. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  79. package/dist/src/utils/ast-utils.d.ts +0 -7
  80. package/dist/src/utils/ast-utils.js +1 -27
  81. package/dist/src/utils/ast-utils.js.map +1 -1
  82. package/dist/src/utils/clack/index.d.ts +2 -12
  83. package/dist/src/utils/clack/index.js +8 -47
  84. package/dist/src/utils/clack/index.js.map +1 -1
  85. package/dist/src/utils/git.d.ts +11 -0
  86. package/dist/src/utils/git.js +69 -0
  87. package/dist/src/utils/git.js.map +1 -0
  88. package/dist/src/utils/sentrycli-utils.js +13 -4
  89. package/dist/src/utils/sentrycli-utils.js.map +1 -1
  90. package/dist/src/version.d.ts +1 -1
  91. package/dist/src/version.js +1 -1
  92. package/dist/src/version.js.map +1 -1
  93. package/dist/test/apple/code-tools.test.js +54 -35
  94. package/dist/test/apple/code-tools.test.js.map +1 -1
  95. package/dist/test/apple/configure-sentry-cli.test.d.ts +1 -0
  96. package/dist/test/apple/configure-sentry-cli.test.js +131 -0
  97. package/dist/test/apple/configure-sentry-cli.test.js.map +1 -0
  98. package/dist/test/apple/macos-system-helper-mocked.test.d.ts +1 -0
  99. package/dist/test/apple/macos-system-helper-mocked.test.js +46 -0
  100. package/dist/test/apple/macos-system-helper-mocked.test.js.map +1 -0
  101. package/dist/test/apple/macos-system-helper.test.d.ts +1 -0
  102. package/dist/test/apple/macos-system-helper.test.js +88 -0
  103. package/dist/test/apple/macos-system-helper.test.js.map +1 -0
  104. package/dist/test/apple/templates.test.js +10 -0
  105. package/dist/test/apple/templates.test.js.map +1 -1
  106. package/dist/test/apple/xcode-manager.test.js +745 -379
  107. package/dist/test/apple/xcode-manager.test.js.map +1 -1
  108. package/dist/test/flutter/templates.test.js +9 -0
  109. package/dist/test/flutter/templates.test.js.map +1 -1
  110. package/dist/test/react-native/gradle.test.js +0 -119
  111. package/dist/test/react-native/gradle.test.js.map +1 -1
  112. package/dist/test/react-native/javascript.test.js +119 -0
  113. package/dist/test/react-native/javascript.test.js.map +1 -1
  114. package/dist/test/react-native/metro.test.js +0 -90
  115. package/dist/test/react-native/metro.test.js.map +1 -1
  116. package/dist/test/react-native/xcode.test.js +0 -81
  117. package/dist/test/react-native/xcode.test.js.map +1 -1
  118. package/dist/test/utils/git.test.d.ts +1 -0
  119. package/dist/test/utils/git.test.js +70 -0
  120. package/dist/test/utils/git.test.js.map +1 -0
  121. package/package.json +1 -1
  122. package/dist/src/react-native/uninstall.d.ts +0 -2
  123. package/dist/src/react-native/uninstall.js +0 -94
  124. package/dist/src/react-native/uninstall.js.map +0 -1
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Checks if the current working directory is a git repository.
3
+ *
4
+ * @param opts.cwd The directory of the project. If undefined, the current process working directory will be used.
5
+ *
6
+ * @returns true if the current working directory is a git repository, false otherwise.
7
+ */
8
+ export declare function isInGitRepo(opts: {
9
+ cwd: string | undefined;
10
+ }): boolean;
11
+ export declare function getUncommittedOrUntrackedFiles(): string[];
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = void 0;
27
+ const childProcess = __importStar(require("child_process"));
28
+ const os = __importStar(require("os"));
29
+ /**
30
+ * Checks if the current working directory is a git repository.
31
+ *
32
+ * @param opts.cwd The directory of the project. If undefined, the current process working directory will be used.
33
+ *
34
+ * @returns true if the current working directory is a git repository, false otherwise.
35
+ */
36
+ function isInGitRepo(opts) {
37
+ try {
38
+ childProcess.execSync('git rev-parse --is-inside-work-tree', {
39
+ stdio: 'ignore',
40
+ cwd: opts.cwd,
41
+ });
42
+ return true;
43
+ }
44
+ catch {
45
+ return false;
46
+ }
47
+ }
48
+ exports.isInGitRepo = isInGitRepo;
49
+ function getUncommittedOrUntrackedFiles() {
50
+ try {
51
+ const gitStatus = childProcess
52
+ .execSync('git status --porcelain=v1', {
53
+ // we only care about stdout
54
+ stdio: ['ignore', 'pipe', 'ignore'],
55
+ })
56
+ .toString();
57
+ const files = gitStatus
58
+ .split(os.EOL)
59
+ .map((line) => line.trim())
60
+ .filter(Boolean)
61
+ .map((f) => `- ${f.split(/\s+/)[1]}`);
62
+ return files;
63
+ }
64
+ catch {
65
+ return [];
66
+ }
67
+ }
68
+ exports.getUncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles;
69
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../../src/utils/git.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8C;AAC9C,uCAAyB;AAEzB;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAiC;IAC3D,IAAI;QACF,YAAY,CAAC,QAAQ,CAAC,qCAAqC,EAAE;YAC3D,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE,IAAI,CAAC,GAAG;SACd,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;KACb;IAAC,MAAM;QACN,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAVD,kCAUC;AAED,SAAgB,8BAA8B;IAC5C,IAAI;QACF,MAAM,SAAS,GAAG,YAAY;aAC3B,QAAQ,CAAC,2BAA2B,EAAE;YACrC,4BAA4B;YAC5B,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC;aACD,QAAQ,EAAE,CAAC;QAEd,MAAM,KAAK,GAAG,SAAS;aACpB,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC;aACb,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;aAC1B,MAAM,CAAC,OAAO,CAAC;aACf,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAExC,OAAO,KAAK,CAAC;KACd;IAAC,MAAM;QACN,OAAO,EAAE,CAAC;KACX;AACH,CAAC;AAnBD,wEAmBC","sourcesContent":["import * as childProcess from 'child_process';\nimport * as os from 'os';\n\n/**\n * Checks if the current working directory is a git repository.\n *\n * @param opts.cwd The directory of the project. If undefined, the current process working directory will be used.\n *\n * @returns true if the current working directory is a git repository, false otherwise.\n */\nexport function isInGitRepo(opts: { cwd: string | undefined }) {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n cwd: opts.cwd,\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1', {\n // we only care about stdout\n stdio: ['ignore', 'pipe', 'ignore'],\n })\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n"]}
@@ -22,20 +22,29 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.createSentryCLIRC = void 0;
30
+ // @ts-expect-error - clack is ESM and TS complains about that. It works though
31
+ const prompts_1 = __importDefault(require("@clack/prompts"));
32
+ const chalk_1 = __importDefault(require("chalk"));
27
33
  const fs = __importStar(require("fs"));
28
34
  const path = __importStar(require("path"));
29
35
  function createSentryCLIRC(directory, params) {
30
36
  const rcPath = path.join(directory, '.sentryclirc');
31
37
  fs.writeFileSync(rcPath, '[auth]\ntoken=' + params.auth_token);
32
- if (!fs.existsSync('.gitignore')) {
33
- fs.writeFileSync('.gitignore', '.sentryclirc');
38
+ const gitignorePath = path.join(directory, '.gitignore');
39
+ if (!fs.existsSync(gitignorePath)) {
40
+ prompts_1.default.log.info(`Creating .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`);
41
+ fs.writeFileSync(gitignorePath, '.sentryclirc');
34
42
  }
35
43
  else {
36
- const gitIgnore = fs.readFileSync('.gitignore').toString();
44
+ const gitIgnore = fs.readFileSync(gitignorePath).toString();
37
45
  if (!gitIgnore.includes('.sentryclirc')) {
38
- fs.appendFileSync('.gitignore', '\n.sentryclirc');
46
+ prompts_1.default.log.info(`Appending .sentryclirc to .gitignore file at path: ${chalk_1.default.cyan(gitignorePath)}`);
47
+ fs.appendFileSync(gitignorePath, '\n.sentryclirc\n');
39
48
  }
40
49
  }
41
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sentrycli-utils.js","sourceRoot":"","sources":["../../../src/utils/sentrycli-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAM7B,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,MAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAChC,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;KAChD;SAAM;QACL,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACvC,EAAE,CAAC,cAAc,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;SACnD;KACF;AACH,CAAC;AAfD,8CAeC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n\nexport interface SentryCLIConfiguration {\n auth_token: string;\n}\n\nexport function createSentryCLIRC(\n directory: string,\n params: SentryCLIConfiguration,\n) {\n const rcPath = path.join(directory, '.sentryclirc');\n fs.writeFileSync(rcPath, '[auth]\\ntoken=' + params.auth_token);\n\n if (!fs.existsSync('.gitignore')) {\n fs.writeFileSync('.gitignore', '.sentryclirc');\n } else {\n const gitIgnore = fs.readFileSync('.gitignore').toString();\n if (!gitIgnore.includes('.sentryclirc')) {\n fs.appendFileSync('.gitignore', '\\n.sentryclirc');\n }\n }\n}\n"]}
1
+ {"version":3,"file":"sentrycli-utils.js","sourceRoot":"","sources":["../../../src/utils/sentrycli-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAM7B,SAAgB,iBAAiB,CAC/B,SAAiB,EACjB,MAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QACjC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,qCAAqC,eAAK,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,CACjE,CAAC;QACF,EAAE,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;KACjD;SAAM;QACL,MAAM,SAAS,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE,CAAC;QAC5D,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACvC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,sDAAsD,eAAK,CAAC,IAAI,CAC9D,aAAa,CACd,EAAE,CACJ,CAAC;YACF,EAAE,CAAC,cAAc,CAAC,aAAa,EAAE,kBAAkB,CAAC,CAAC;SACtD;KACF;AACH,CAAC;AAxBD,8CAwBC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as path from 'path';\n\nexport interface SentryCLIConfiguration {\n auth_token: string;\n}\n\nexport function createSentryCLIRC(\n directory: string,\n params: SentryCLIConfiguration,\n) {\n const rcPath = path.join(directory, '.sentryclirc');\n fs.writeFileSync(rcPath, '[auth]\\ntoken=' + params.auth_token);\n\n const gitignorePath = path.join(directory, '.gitignore');\n if (!fs.existsSync(gitignorePath)) {\n clack.log.info(\n `Creating .gitignore file at path: ${chalk.cyan(gitignorePath)}`,\n );\n fs.writeFileSync(gitignorePath, '.sentryclirc');\n } else {\n const gitIgnore = fs.readFileSync(gitignorePath).toString();\n if (!gitIgnore.includes('.sentryclirc')) {\n clack.log.info(\n `Appending .sentryclirc to .gitignore file at path: ${chalk.cyan(\n gitignorePath,\n )}`,\n );\n fs.appendFileSync(gitignorePath, '\\n.sentryclirc\\n');\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- export declare const WIZARD_VERSION = "4.8.0";
1
+ export declare const WIZARD_VERSION = "5.0.0";
@@ -3,5 +3,5 @@
3
3
  // This is file is updated at release time.
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.WIZARD_VERSION = void 0;
6
- exports.WIZARD_VERSION = '4.8.0';
6
+ exports.WIZARD_VERSION = '5.0.0';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '4.8.0';\n"]}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA,oCAAoC;AACpC,2CAA2C;;;AAE9B,QAAA,cAAc,GAAG,OAAO,CAAC","sourcesContent":["// DO NOT modify this file manually!\n// This is file is updated at release time.\n\nexport const WIZARD_VERSION = '5.0.0';\n"]}
@@ -56,6 +56,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
56
56
  SentrySDK.start { options in
57
57
  options.dsn = "https://example.com/sentry-dsn"
58
58
  options.debug = true // Enabled debug when first installing is always helpful
59
+
60
+ // Adds IP for users.
61
+ // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
62
+ options.sendDefaultPii = true
63
+
59
64
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
60
65
  // We recommend adjusting this value in production.
61
66
  options.tracesSampleRate = 1.0
@@ -110,6 +115,11 @@ const validAppDelegateObjCWithSentry = `@import Sentry;
110
115
  [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
111
116
  options.dsn = @"https://example.com/sentry-dsn";
112
117
  options.debug = YES; // Enabled debug when first installing is always helpful
118
+
119
+ // Adds IP for users.
120
+ // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
121
+ options.sendDefaultPii = YES;
122
+
113
123
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
114
124
  // We recommend adjusting this value in production.
115
125
  options.tracesSampleRate = @1.0;
@@ -160,6 +170,11 @@ struct TestApp: App {
160
170
  SentrySDK.start { options in
161
171
  options.dsn = "https://example.com/sentry-dsn"
162
172
  options.debug = true // Enabled debug when first installing is always helpful
173
+
174
+ // Adds IP for users.
175
+ // For more information, visit: https://docs.sentry.io/platforms/apple/data-management/data-collected/
176
+ options.sendDefaultPii = true
177
+
163
178
  // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
164
179
  // We recommend adjusting this value in production.
165
180
  options.tracesSampleRate = 1.0
@@ -395,14 +410,14 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
395
410
  });
396
411
  });
397
412
  });
398
- (0, vitest_1.describe)('#findAppDidFinishLaunchingWithOptions', () => {
413
+ (0, vitest_1.describe)('#findAppDidFinishLaunchingWithOptionsInDirectory', () => {
399
414
  (0, vitest_1.describe)('no files given', () => {
400
415
  (0, vitest_1.it)('should check files in directory', () => {
401
416
  // -- Arrange --
402
417
  const tempDir = prepareTempDir();
403
418
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
404
419
  // -- Act --
405
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
420
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
406
421
  // -- Assert --
407
422
  (0, vitest_1.expect)(result).toBe(filePath);
408
423
  });
@@ -414,7 +429,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
414
429
  const tempDir = prepareTempDir();
415
430
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftUI, 'swift');
416
431
  // -- Act --
417
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
432
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
418
433
  // -- Assert --
419
434
  (0, vitest_1.expect)(result).toBe(filePath);
420
435
  });
@@ -425,7 +440,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
425
440
  const tempDir = prepareTempDir();
426
441
  prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');
427
442
  // -- Act --
428
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
443
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
429
444
  // -- Assert --
430
445
  (0, vitest_1.expect)(result).toBeNull();
431
446
  });
@@ -438,7 +453,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
438
453
  const tempDir = prepareTempDir();
439
454
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
440
455
  // -- Act --
441
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
456
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
442
457
  // -- Assert --
443
458
  (0, vitest_1.expect)(result).toBe(filePath);
444
459
  });
@@ -449,7 +464,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
449
464
  const tempDir = prepareTempDir();
450
465
  prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
451
466
  // -- Act --
452
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
467
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
453
468
  // -- Assert --
454
469
  (0, vitest_1.expect)(result).toBeNull();
455
470
  });
@@ -462,7 +477,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
462
477
  const tempDir = prepareTempDir();
463
478
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
464
479
  // -- Act --
465
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
480
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
466
481
  // -- Assert --
467
482
  (0, vitest_1.expect)(result).toBe(filePath);
468
483
  });
@@ -473,7 +488,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
473
488
  const tempDir = prepareTempDir();
474
489
  prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'm');
475
490
  // -- Act --
476
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
491
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
477
492
  // -- Assert --
478
493
  (0, vitest_1.expect)(result).toBeNull();
479
494
  });
@@ -486,7 +501,9 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
486
501
  const tempDir = prepareTempDir();
487
502
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'mm');
488
503
  // -- Act --
489
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
504
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions([
505
+ filePath,
506
+ ]);
490
507
  // -- Assert --
491
508
  (0, vitest_1.expect)(result).toBe(filePath);
492
509
  });
@@ -497,7 +514,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
497
514
  const tempDir = prepareTempDir();
498
515
  prepareAppDelegateFile(tempDir, invalidAppDelegateObjC, 'mm');
499
516
  // -- Act --
500
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
517
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
501
518
  // -- Assert --
502
519
  (0, vitest_1.expect)(result).toBeNull();
503
520
  });
@@ -509,7 +526,9 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
509
526
  const tempDir = prepareTempDir();
510
527
  const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
511
528
  // -- Act --
512
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
529
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions([
530
+ filePath,
531
+ ]);
513
532
  // -- Assert --
514
533
  (0, vitest_1.expect)(result).toBeNull();
515
534
  });
@@ -520,7 +539,9 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
520
539
  const tempDir = prepareTempDir();
521
540
  const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwift, 'swift');
522
541
  // -- Act --
523
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, [filePath]);
542
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions([
543
+ filePath,
544
+ ]);
524
545
  // -- Assert --
525
546
  (0, vitest_1.expect)(result).toBeNull();
526
547
  });
@@ -534,7 +555,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
534
555
  fs.mkdirSync(hiddenDir);
535
556
  prepareAppDelegateFile(hiddenDir, validAppDelegateSwift, 'swift');
536
557
  // -- Act --
537
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
558
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
538
559
  // -- Assert --
539
560
  (0, vitest_1.expect)(result).toBeNull();
540
561
  });
@@ -547,7 +568,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
547
568
  fs.mkdirSync(xcodeDir);
548
569
  prepareAppDelegateFile(xcodeDir, validAppDelegateSwift, 'swift');
549
570
  // -- Act --
550
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
571
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
551
572
  // -- Assert --
552
573
  (0, vitest_1.expect)(result).toBeNull();
553
574
  });
@@ -560,7 +581,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
560
581
  fs.mkdirSync(xcassetsDir);
561
582
  prepareAppDelegateFile(xcassetsDir, validAppDelegateSwift, 'swift');
562
583
  // -- Act --
563
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
584
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
564
585
  // -- Assert --
565
586
  (0, vitest_1.expect)(result).toBeNull();
566
587
  });
@@ -572,7 +593,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
572
593
  const filePath = path.join(tempDir, 'some-file');
573
594
  fs.writeFileSync(filePath, validAppDelegateSwift, 'utf8');
574
595
  // -- Act --
575
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
596
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
576
597
  // -- Assert --
577
598
  (0, vitest_1.expect)(result).toBeNull();
578
599
  });
@@ -585,7 +606,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
585
606
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
586
607
  prepareAppDelegateFile(tempDir, validAppDelegateSwift, 'swift');
587
608
  // -- Act --
588
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
609
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
589
610
  // -- Assert --
590
611
  (0, vitest_1.expect)(result).toBe(filePath);
591
612
  });
@@ -601,7 +622,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
601
622
  fs.mkdirSync(nestedDir2);
602
623
  prepareAppDelegateFile(nestedDir2, validAppDelegateSwift, 'swift');
603
624
  // -- Act --
604
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir);
625
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
605
626
  // -- Assert --
606
627
  (0, vitest_1.expect)(result).toBe(nestedFilePath);
607
628
  });
@@ -611,7 +632,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
611
632
  // -- Arrange --
612
633
  const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'code-tools-test'));
613
634
  // -- Act --
614
- const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptions(tempDir, []);
635
+ const result = code_tools_1.exportForTesting.findAppDidFinishLaunchingWithOptionsInDirectory(tempDir);
615
636
  // -- Assert --
616
637
  (0, vitest_1.expect)(result).toBeNull();
617
638
  });
@@ -620,10 +641,8 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
620
641
  (0, vitest_1.describe)('#addCodeSnippetToProject', () => {
621
642
  (0, vitest_1.describe)('app delegate file is not found', () => {
622
643
  (0, vitest_1.it)('should return false', () => {
623
- // -- Arrange --
624
- const tempDir = prepareTempDir();
625
644
  // -- Act --
626
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, ['AppDelegate.swift'], 'https://example.com/sentry-dsn');
645
+ const result = (0, code_tools_1.addCodeSnippetToProject)(['AppDelegate.swift'], 'https://example.com/sentry-dsn');
627
646
  // -- Assert --
628
647
  (0, vitest_1.expect)(result).toBeFalsy();
629
648
  });
@@ -647,7 +666,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
647
666
  });
648
667
  (0, vitest_1.it)('should add the code snippet', () => {
649
668
  // -- Act --
650
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
669
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
651
670
  // -- Assert --
652
671
  (0, vitest_1.expect)(result).toBeTruthy();
653
672
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -655,14 +674,14 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
655
674
  });
656
675
  (0, vitest_1.it)("should set tag 'code-language'", () => {
657
676
  // -- Act --
658
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
677
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
659
678
  // -- Assert --
660
679
  (0, vitest_1.expect)(result).toBeTruthy();
661
680
  (0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('code-language', 'swift');
662
681
  });
663
682
  (0, vitest_1.it)("should set tag 'ui-engine'", () => {
664
683
  // -- Act --
665
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
684
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
666
685
  // -- Assert --
667
686
  (0, vitest_1.expect)(result).toBeTruthy();
668
687
  (0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('ui-engine', 'uikit');
@@ -674,7 +693,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
674
693
  const tempDir = prepareTempDir();
675
694
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftWithSentry, 'swift');
676
695
  // -- Act --
677
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
696
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
678
697
  // -- Assert --
679
698
  (0, vitest_1.expect)(result).toBeTruthy();
680
699
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -691,7 +710,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
691
710
  });
692
711
  (0, vitest_1.it)('should add the code snippet', () => {
693
712
  // -- Act --
694
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
713
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
695
714
  // -- Assert --
696
715
  (0, vitest_1.expect)(result).toBeTruthy();
697
716
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -699,14 +718,14 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
699
718
  });
700
719
  (0, vitest_1.it)("should set tag 'code-language'", () => {
701
720
  // -- Act --
702
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
721
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
703
722
  // -- Assert --
704
723
  (0, vitest_1.expect)(result).toBeTruthy();
705
724
  (0, vitest_1.expect)(Sentry.setTag).toHaveBeenNthCalledWith(1, 'code-language', 'swift');
706
725
  });
707
726
  (0, vitest_1.it)("should set tag 'ui-engine'", () => {
708
727
  // -- Act --
709
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
728
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
710
729
  // -- Assert --
711
730
  (0, vitest_1.expect)(result).toBeTruthy();
712
731
  (0, vitest_1.expect)(Sentry.setTag).toHaveBeenNthCalledWith(2, 'ui-engine', 'swiftui');
@@ -718,7 +737,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
718
737
  const tempDir = prepareTempDir();
719
738
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateSwiftUIWithSentry, 'swift');
720
739
  // -- Act --
721
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
740
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
722
741
  // -- Assert --
723
742
  (0, vitest_1.expect)(result).toBeTruthy();
724
743
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -732,7 +751,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
732
751
  const tempDir = prepareTempDir();
733
752
  const filePath = prepareAppDelegateFile(tempDir, invalidAppDelegateSwiftUI, 'swift');
734
753
  // -- Act --
735
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
754
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
736
755
  // -- Assert --
737
756
  (0, vitest_1.expect)(result).toBeFalsy();
738
757
  });
@@ -745,7 +764,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
745
764
  const tempDir = prepareTempDir();
746
765
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
747
766
  // -- Act --
748
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
767
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
749
768
  // -- Assert --
750
769
  (0, vitest_1.expect)(result).toBeTruthy();
751
770
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -761,7 +780,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
761
780
  });
762
781
  (0, vitest_1.it)('should not add the code snippet', () => {
763
782
  // -- Act --
764
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
783
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
765
784
  // -- Assert --
766
785
  (0, vitest_1.expect)(result).toBeTruthy();
767
786
  const modifiedFileContent = fs.readFileSync(filePath, 'utf8');
@@ -769,7 +788,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
769
788
  });
770
789
  (0, vitest_1.it)('should log info', () => {
771
790
  // -- Act --
772
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
791
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
773
792
  // -- Assert --
774
793
  (0, vitest_1.expect)(result).toBeTruthy();
775
794
  (0, vitest_1.expect)(clack.log.info).toHaveBeenCalledWith('Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.');
@@ -780,7 +799,7 @@ vitest_1.vi.spyOn(Sentry, 'captureException').mockImplementation(() => 'id');
780
799
  const tempDir = prepareTempDir();
781
800
  const filePath = prepareAppDelegateFile(tempDir, validAppDelegateObjC, 'm');
782
801
  // -- Act --
783
- const result = (0, code_tools_1.addCodeSnippetToProject)(tempDir, [filePath], dsn);
802
+ const result = (0, code_tools_1.addCodeSnippetToProject)([filePath], dsn);
784
803
  // -- Assert --
785
804
  (0, vitest_1.expect)(result).toBeTruthy();
786
805
  (0, vitest_1.expect)(Sentry.setTag).toHaveBeenCalledWith('code-language', 'objc');