@sentry/wizard 4.9.0 → 5.1.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 (72) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.d.ts +1 -0
  3. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js +91 -0
  4. package/dist/e2e-tests/tests/cloudflare-wrangler-sourcemaps.test.js.map +1 -0
  5. package/dist/e2e-tests/tests/nextjs-14.test.js +27 -0
  6. package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -1
  7. package/dist/e2e-tests/utils/index.d.ts +1 -0
  8. package/dist/e2e-tests/utils/index.js +23 -1
  9. package/dist/e2e-tests/utils/index.js.map +1 -1
  10. package/dist/lib/Steps/Integrations/Cordova.js +13 -30
  11. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  12. package/dist/src/nextjs/nextjs-wizard.js +24 -10
  13. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  14. package/dist/src/nextjs/templates.d.ts +2 -0
  15. package/dist/src/nextjs/templates.js +47 -1
  16. package/dist/src/nextjs/templates.js.map +1 -1
  17. package/dist/src/nextjs/utils.d.ts +2 -0
  18. package/dist/src/nextjs/utils.js +42 -1
  19. package/dist/src/nextjs/utils.js.map +1 -1
  20. package/dist/src/react-native/gradle.d.ts +0 -1
  21. package/dist/src/react-native/gradle.js +1 -5
  22. package/dist/src/react-native/gradle.js.map +1 -1
  23. package/dist/src/react-native/metro.d.ts +0 -4
  24. package/dist/src/react-native/metro.js +1 -129
  25. package/dist/src/react-native/metro.js.map +1 -1
  26. package/dist/src/react-native/options.d.ts +1 -3
  27. package/dist/src/react-native/options.js.map +1 -1
  28. package/dist/src/react-native/react-native-wizard.d.ts +1 -23
  29. package/dist/src/react-native/react-native-wizard.js +25 -127
  30. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  31. package/dist/src/react-native/xcode.d.ts +0 -7
  32. package/dist/src/react-native/xcode.js +1 -109
  33. package/dist/src/react-native/xcode.js.map +1 -1
  34. package/dist/src/run.js +1 -4
  35. package/dist/src/run.js.map +1 -1
  36. package/dist/src/sourcemaps/sourcemaps-wizard.js +14 -0
  37. package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
  38. package/dist/src/sourcemaps/tools/wrangler.d.ts +28 -0
  39. package/dist/src/sourcemaps/tools/wrangler.js +276 -0
  40. package/dist/src/sourcemaps/tools/wrangler.js.map +1 -0
  41. package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
  42. package/dist/src/sourcemaps/utils/detect-tool.js +1 -0
  43. package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
  44. package/dist/src/sourcemaps/utils/sdk-version.js +3 -0
  45. package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
  46. package/dist/src/utils/ast-utils.d.ts +0 -7
  47. package/dist/src/utils/ast-utils.js +1 -27
  48. package/dist/src/utils/ast-utils.js.map +1 -1
  49. package/dist/src/utils/clack/index.d.ts +9 -1
  50. package/dist/src/utils/clack/index.js +8 -1
  51. package/dist/src/utils/clack/index.js.map +1 -1
  52. package/dist/src/version.d.ts +1 -1
  53. package/dist/src/version.js +1 -1
  54. package/dist/src/version.js.map +1 -1
  55. package/dist/test/nextjs/templates.test.js +98 -0
  56. package/dist/test/nextjs/templates.test.js.map +1 -1
  57. package/dist/test/nextjs/utils.test.d.ts +1 -0
  58. package/dist/test/nextjs/utils.test.js +104 -0
  59. package/dist/test/nextjs/utils.test.js.map +1 -0
  60. package/dist/test/react-native/gradle.test.js +0 -119
  61. package/dist/test/react-native/gradle.test.js.map +1 -1
  62. package/dist/test/react-native/metro.test.js +0 -90
  63. package/dist/test/react-native/metro.test.js.map +1 -1
  64. package/dist/test/react-native/xcode.test.js +0 -81
  65. package/dist/test/react-native/xcode.test.js.map +1 -1
  66. package/dist/test/sourcemaps/tools/wrangler.test.d.ts +1 -0
  67. package/dist/test/sourcemaps/tools/wrangler.test.js +132 -0
  68. package/dist/test/sourcemaps/tools/wrangler.test.js.map +1 -0
  69. package/package.json +2 -1
  70. package/dist/src/react-native/uninstall.d.ts +0 -2
  71. package/dist/src/react-native/uninstall.js +0 -94
  72. package/dist/src/react-native/uninstall.js.map +0 -1
@@ -46,47 +46,6 @@ vitest_1.vi.mock('@clack/prompts', async () => ({
46
46
  (0, vitest_1.afterEach)(() => {
47
47
  vitest_1.vi.clearAllMocks();
48
48
  });
49
- (0, vitest_1.describe)('addSentryWithCliToBundleShellScript', () => {
50
- (0, vitest_1.it)('adds sentry cli to rn bundle build phase', () => {
51
- const input = `set -e
52
-
53
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
54
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
55
-
56
- /bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"`;
57
- // actual shell script looks like this:
58
- // /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""
59
- // but during parsing xcode library removes the quotes
60
- const expectedOutput = `export SENTRY_PROPERTIES=sentry.properties
61
- export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
62
- set -e
63
-
64
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
65
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
66
-
67
- /bin/sh -c "$WITH_ENVIRONMENT \\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\""
68
- /bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"
69
- `;
70
- (0, vitest_1.expect)((0, xcode_1.addSentryWithCliToBundleShellScript)(input)).toBe(expectedOutput);
71
- });
72
- (0, vitest_1.it)('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {
73
- const input = `set -e
74
-
75
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
76
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
77
-
78
- /bin/sh -c "$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE"`;
79
- (0, vitest_1.expect)((0, xcode_1.addSentryWithCliToBundleShellScript)(input)).toEqual(new xcode_1.ErrorPatchSnippet((0, clack_1.makeCodeSnippet)(true, (unchanged, plus, _minus) => {
80
- return unchanged(`${plus(`export SENTRY_PROPERTIES=sentry.properties
81
- export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
82
- `)}
83
- /bin/sh -c "$WITH_ENVIRONMENT ${plus(`\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode`)} $REACT_NATIVE_XCODE${plus(`\\"`)}"
84
- ${plus(`/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh`)}"
85
- `);
86
- })));
87
- (0, vitest_1.expect)(clack.log.error).toHaveBeenCalledWith(`Could not find $REACT_NATIVE_XCODE in ${chalk_1.default.cyan('Bundle React Native code and images')} build phase. Skipping patching.`);
88
- });
89
- });
90
49
  (0, vitest_1.describe)('addSentryBundledScriptsToBundleShellScript', () => {
91
50
  (0, vitest_1.it)('adds sentry cli to rn bundle build phase', () => {
92
51
  const input = `set -e
@@ -233,46 +192,6 @@ fi
233
192
  (0, vitest_1.expect)(clack.log.error).toHaveBeenCalledWith(`Failed to patch ${chalk_1.default.cyan('Bundle React Native code and images')} build phase.`);
234
193
  });
235
194
  });
236
- (0, vitest_1.describe)('removeSentryFromBundleShellScript', () => {
237
- (0, vitest_1.it)('removes sentry cli from rn bundle build phase', () => {
238
- const input = `export SENTRY_PROPERTIES=sentry.properties
239
- export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
240
- set -e
241
-
242
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
243
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
244
-
245
- /bin/sh -c "$WITH_ENVIRONMENT \"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\""
246
-
247
- /bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"
248
- `;
249
- const expectedOutput = `export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"
250
- set -e
251
-
252
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
253
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
254
-
255
- /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""
256
-
257
- `;
258
- (0, vitest_1.expect)((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
259
- });
260
- (0, vitest_1.it)('removes sentry bundled scripts from rn bundle build phase', () => {
261
- const input = `set -e
262
-
263
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
264
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
265
-
266
- /bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""`;
267
- const expectedOutput = `set -e
268
-
269
- WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
270
- REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
271
-
272
- /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""`;
273
- (0, vitest_1.expect)((0, xcode_1.removeSentryFromBundleShellScript)(input)).toBe(expectedOutput);
274
- });
275
- });
276
195
  (0, vitest_1.describe)('findBundlePhase', () => {
277
196
  (0, vitest_1.it)('returns build phase with react native xcode shell script', () => {
278
197
  const inputMap = {
@@ -1 +1 @@
1
- {"version":3,"file":"xcode.test.js","sourceRoot":"","sources":["../../../test/react-native/xcode.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,mCAAyE;AACzE,wDAQsC;AACtC,kDAA0B;AAC1B,iDAAwD;AACxD,+EAA+E;AAC/E,sDAAwC;AAExC,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,IAAI;IAChB,GAAG,CAAC,MAAM,WAAE,CAAC,YAAY,CAAe,gBAAgB,CAAC,CAAC;CAC3D,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACnD,WAAW;QACb,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAA,kBAAS,EAAC,GAAG,EAAE;QACb,WAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,IAAA,iBAAQ,EAAC,qCAAqC,EAAE,GAAG,EAAE;QACnD,IAAA,WAAE,EAAC,0CAA0C,EAAE,GAAG,EAAE;YAClD,MAAM,KAAK,GAAG;;;;;mDAK+B,CAAC;YAC9C,uCAAuC;YACvC,yDAAyD;YACzD,sDAAsD;YACtD,MAAM,cAAc,GAAG;;;;;;;;;CAS5B,CAAC;YAEI,IAAA,eAAM,EAAC,IAAA,2CAAmC,EAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,+GAA+G,EAAE,GAAG,EAAE;YACvH,MAAM,KAAK,GAAG;;;;;uDAKmC,CA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gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,GAAG;gBACH;oBACE,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,KAAK,GAAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,gDAAgD;oBAChD,WAAW,EAAE,8BAA8B;iBAC5C;aACF,CAAC;YAEF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-useless-escape */\nimport { describe, expect, it, afterEach, beforeEach, vi } from 'vitest';\nimport {\n addSentryWithBundledScriptsToBundleShellScript,\n addSentryWithCliToBundleShellScript,\n doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\n removeSentryFromBundleShellScript,\n ErrorPatchSnippet,\n} from '../../src/react-native/xcode';\nimport chalk from 'chalk';\nimport { makeCodeSnippet } from '../../src/utils/clack';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\nvi.mock('@clack/prompts', async () => ({\n __esModule: true,\n ...(await vi.importActual<typeof clack>('@clack/prompts')),\n}));\n\ndescribe('react-native xcode', () => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'error').mockImplementation(() => {\n /* empty */\n });\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('addSentryWithCliToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"\"\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n\n expect(addSentryWithCliToBundleShellScript(input)).toBe(expectedOutput);\n });\n\n it('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE\"`;\n\n expect(addSentryWithCliToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`${plus(`export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\n`)}\n/bin/sh -c \"$WITH_ENVIRONMENT ${plus(\n `\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode`,\n )} $REACT_NATIVE_XCODE${plus(`\\\\\"`)}\"\n${plus(\n `/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh`,\n)}\"\n`);\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Could not find $REACT_NATIVE_XCODE in ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase. Skipping patching.`,\n );\n });\n });\n\n describe('addSentryBundledScriptsToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {\n const input = `set -e\n \n WITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\n REACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n \n /bin/sh -c \"$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ${plus(\n `\\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh `,\n )}$REACT_NATIVE_XCODE${plus(`\\\\\"`)}\"\n`);\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n\n it('adds sentry cli to expo bundle build phase', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n\\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n const expectedOutput = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\` \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('if patching fails it does not add sentry cli to expo bundle build phase and shows code snippet', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n`;\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(\n `${plus(\n `/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\``,\n )} \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\``,\n );\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n });\n\n describe('removeSentryFromBundleShellScript', () => {\n it('removes sentry cli from rn bundle build phase', () => {\n const input = `export SENTRY_PROPERTIES=sentry.properties\nexport EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\"\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\n`;\n const expectedOutput = `export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\nset -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n\n it('removes sentry bundled scripts from rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\"\"`;\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"`;\n\n expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);\n });\n });\n\n describe('findBundlePhase', () => {\n it('returns build phase with react native xcode shell script', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n const expected = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n };\n\n expect(findBundlePhase(inputMap)).toEqual(expected);\n });\n\n it('returns undefined if bundle phase not present', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n // note different path to the script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/unknown/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n expect(findBundlePhase(inputMap)).toBeUndefined();\n });\n });\n\n describe('doesBundlePhaseIncludeSentry', () => {\n it('returns true for script containing sentry cli calling react native xcode command', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI $REACT_NATIVE_XCODE\\\"\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns true for script containing sentry bundled script', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"\\\\\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns false', () => {\n const input = {\n // note sentry-cli can be part of the script but doesn't call react native xcode script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\nsentry-cli --version\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeFalsy();\n });\n });\n\n describe('findDebugFilesUploadPhase', () => {\n it('returns debug files build phase using debug files command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase with sentry-cli absolute path', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using dsym command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using bundled scripts', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns undefined if build phase not present', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n // sentry-cli present but with different command\n shellScript: 'sentry-cli sourcempas upload',\n },\n };\n\n expect(findDebugFilesUploadPhase(input)).toBeUndefined();\n });\n });\n});\n"]}
1
+ {"version":3,"file":"xcode.test.js","sourceRoot":"","sources":["../../../test/react-native/xcode.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sCAAsC;AACtC,mCAAyE;AACzE,wDAMsC;AACtC,kDAA0B;AAC1B,iDAAwD;AACxD,+EAA+E;AAC/E,sDAAwC;AAExC,WAAE,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE,IAAI;IAChB,GAAG,CAAC,MAAM,WAAE,CAAC,YAAY,CAAe,gBAAgB,CAAC,CAAC;CAC3D,CAAC,CAAC,CAAC;AAEJ,IAAA,iBAAQ,EAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,IAAA,mBAAU,EAAC,GAAG,EAAE;QACd,WAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,OAA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AAW,EAAE;;CAEtB;iBACQ;aACF,CAAC;YACF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,KAAK,GAAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,MAAM,QAAQ,GAAG;gBACf,GAAG;gBACH;oBACE,WAAW,EAAE,kFAAkF;iBAChG;aACF,CAAC;YACF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,8CAA8C,EAAE,GAAG,EAAE;YACtD,MAAM,KAAK,GAAG;gBACZ,CAAC,EAAE;oBACD,WAAW,EAAE,KAAK;iBACnB;gBACD,CAAC,EAAE;oBACD,gDAAgD;oBAChD,WAAW,EAAE,8BAA8B;iBAC5C;aACF,CAAC;YAEF,IAAA,eAAM,EAAC,IAAA,iCAAyB,EAAC,KAAK,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable no-useless-escape */\nimport { describe, expect, it, afterEach, beforeEach, vi } from 'vitest';\nimport {\n addSentryWithBundledScriptsToBundleShellScript,\n doesBundlePhaseIncludeSentry,\n findBundlePhase,\n findDebugFilesUploadPhase,\n ErrorPatchSnippet,\n} from '../../src/react-native/xcode';\nimport chalk from 'chalk';\nimport { makeCodeSnippet } from '../../src/utils/clack';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\nvi.mock('@clack/prompts', async () => ({\n __esModule: true,\n ...(await vi.importActual<typeof clack>('@clack/prompts')),\n}));\n\ndescribe('react-native xcode', () => {\n beforeEach(() => {\n vi.spyOn(clack.log, 'error').mockImplementation(() => {\n /* empty */\n });\n });\n\n afterEach(() => {\n vi.clearAllMocks();\n });\n\n describe('addSentryBundledScriptsToBundleShellScript', () => {\n it('adds sentry cli to rn bundle build phase', () => {\n const input = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"`;\n // actual shell script looks like this:\n // /bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n // but during parsing xcode library removes the quotes\n const expectedOutput = `set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\\\\"\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('does not add sentry cli to rn bundle build phase if $REACT_NATIVE_XCODE is not present and shows code snippet', () => {\n const input = `set -e\n \n WITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\n REACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n \n /bin/sh -c \"$WITH_ENVIRONMENT $NOT_REACT_NATIVE_XCODE\"`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(`WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT ${plus(\n `\\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh `,\n )}$REACT_NATIVE_XCODE${plus(`\\\\\"`)}\"\n`);\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n\n it('adds sentry cli to expo bundle build phase', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n\\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n const expectedOutput = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n\nif [[ -z \"$CLI_PATH\" ]]; then\n # Use Expo CLI\n export CLI_PATH=\"$(\"$NODE_BINARY\" --print \"require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })\")\"\nfi\nif [[ -z \"$BUNDLE_COMMAND\" ]]; then\n # Default Expo CLI command for bundling\n export BUNDLE_COMMAND=\"export:embed\"\nfi\n\n# Source .xcode.env.updates if it exists to allow\n# SKIP_BUNDLING to be unset if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.updates\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.updates\"\nfi\n# Source local changes to allow overrides\n# if needed\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\` \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\`\n`;\n\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(\n expectedOutput,\n );\n });\n\n it('if patching fails it does not add sentry cli to expo bundle build phase and shows code snippet', () => {\n const input = `\nif [[ -f \"$PODS_ROOT/../.xcode.env\" ]]; then\n source \"$PODS_ROOT/../.xcode.env\"\nfi\nif [[ -f \"$PODS_ROOT/../.xcode.env.local\" ]]; then\n source \"$PODS_ROOT/../.xcode.env.local\"\nfi\n\n# The project root by default is one level up from the ios directory\nexport PROJECT_ROOT=\"$PROJECT_DIR\"/..\n\nif [[ \"$CONFIGURATION\" = *Debug* ]]; then\n export SKIP_BUNDLING=1\nfi\nif [[ -z \"$ENTRY_FILE\" ]]; then\n # Set the entry JS file using the bundler's entry resolution.\n export ENTRY_FILE=\"$(\"$NODE_BINARY\" -e \"require('expo/scripts/resolveAppEntry')\" \"$PROJECT_ROOT\" ios absolute | tail -n 1)\"\nfi\n`;\n expect(addSentryWithBundledScriptsToBundleShellScript(input)).toEqual(\n new ErrorPatchSnippet(\n makeCodeSnippet(true, (unchanged, plus, _minus) => {\n return unchanged(\n `${plus(\n `/bin/sh \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('@sentry/react-native/package.json')) + '/scripts/sentry-xcode.sh'\"\\``,\n )} \\`\"$NODE_BINARY\" --print \"require('path').dirname(require.resolve('react-native/package.json')) + '/scripts/react-native-xcode.sh'\"\\``,\n );\n }),\n ),\n );\n expect(clack.log.error).toHaveBeenCalledWith(\n `Failed to patch ${chalk.cyan(\n 'Bundle React Native code and images',\n )} build phase.`,\n );\n });\n });\n\n describe('findBundlePhase', () => {\n it('returns build phase with react native xcode shell script', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n const expected = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n };\n\n expect(findBundlePhase(inputMap)).toEqual(expected);\n });\n\n it('returns undefined if bundle phase not present', () => {\n const inputMap = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: 'bar',\n },\n 3: {\n // note different path to the script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/unknown/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\n`,\n },\n 4: {\n shellScript: 'qux',\n },\n };\n\n expect(findBundlePhase(inputMap)).toBeUndefined();\n });\n });\n\n describe('doesBundlePhaseIncludeSentry', () => {\n it('returns true for script containing sentry cli calling react native xcode command', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$SENTRY_CLI $REACT_NATIVE_XCODE\\\"\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns true for script containing sentry bundled script', () => {\n const input = {\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\nSENTRY_CLI=\"sentry-cli react-native xcode\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\\\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"\\\\\"\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();\n });\n\n it('returns false', () => {\n const input = {\n // note sentry-cli can be part of the script but doesn't call react native xcode script\n shellScript: `set -e\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT \\\"$REACT_NATIVE_XCODE\\\"\"\n\nsentry-cli --version\n`,\n };\n expect(doesBundlePhaseIncludeSentry(input)).toBeFalsy();\n });\n });\n\n describe('findDebugFilesUploadPhase', () => {\n it('returns debug files build phase using debug files command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase with sentry-cli absolute path', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\n/path/to/bin/sentry-cli debug-files upload path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using dsym command', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `set -e\nsentry-cli upload-dsym path/to/dsym --include-sources\n`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns debug files build phase using bundled scripts', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n };\n const expected = [\n '2',\n {\n shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,\n },\n ];\n expect(findDebugFilesUploadPhase(input)).toEqual(expected);\n });\n\n it('returns undefined if build phase not present', () => {\n const input = {\n 1: {\n shellScript: 'foo',\n },\n 2: {\n // sentry-cli present but with different command\n shellScript: 'sentry-cli sourcempas upload',\n },\n };\n\n expect(findDebugFilesUploadPhase(input)).toBeUndefined();\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const wrangler_1 = require("../../../src/sourcemaps/tools/wrangler");
4
+ const vitest_1 = require("vitest");
5
+ (0, vitest_1.describe)('getSentryCliCommand', () => {
6
+ (0, vitest_1.it)('returns correct command for SaaS', () => {
7
+ const command = (0, wrangler_1.getSentryCliCommand)({
8
+ selfHosted: false,
9
+ orgSlug: 'myOrg',
10
+ projectSlug: 'myProject',
11
+ url: 'https://sentry.io',
12
+ authToken: '_ignore',
13
+ outDir: 'dist',
14
+ });
15
+ (0, vitest_1.expect)(command).toBe("_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist");
16
+ });
17
+ (0, vitest_1.it)('returns correct command for self-hosted', () => {
18
+ const command = (0, wrangler_1.getSentryCliCommand)({
19
+ selfHosted: true,
20
+ orgSlug: 'myOrg',
21
+ projectSlug: 'myProject',
22
+ url: 'https://santry.io',
23
+ authToken: '_ignore',
24
+ outDir: 'someplace',
25
+ });
26
+ (0, vitest_1.expect)(command).toBe("_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli --url https://santry.io releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli --url https://santry.io sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'someplace/..' someplace");
27
+ });
28
+ });
29
+ (0, vitest_1.describe)('safeInsertArgsToWranglerDeployCommand', () => {
30
+ (0, vitest_1.it)('correctly inserts args into default command', () => {
31
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler deploy', 'dist');
32
+ (0, vitest_1.expect)(newCommand).toBe('wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
33
+ });
34
+ vitest_1.it.each([
35
+ '--outdir someplace',
36
+ '--outdir=someplace',
37
+ '--outdir="./someplace"',
38
+ ])('retains existing %s arg', (arg) => {
39
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(`wrangler deploy ${arg}`, 'dist');
40
+ (0, vitest_1.expect)(newCommand).toBe(`wrangler deploy ${arg} --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`);
41
+ });
42
+ vitest_1.it.each([
43
+ '--upload-source-maps',
44
+ '--upload-source-maps=true',
45
+ '--upload-source-maps true',
46
+ '--upload-source-maps=false',
47
+ '--upload-source-maps false',
48
+ ])('retains existing %s arg', (arg) => {
49
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(`wrangler deploy ${arg}`, 'dist');
50
+ (0, vitest_1.expect)(newCommand).toBe(`wrangler deploy ${arg} --outdir dist --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`);
51
+ });
52
+ (0, vitest_1.it)('appends to the "wrangler deploy" command', () => {
53
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && postcheck', 'dist');
54
+ (0, vitest_1.expect)(newCommand).toBe('precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && postcheck');
55
+ });
56
+ (0, vitest_1.it)('handles multiple wrangler commands', () => {
57
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && wrangler someothercommand', 'dist');
58
+ (0, vitest_1.expect)(newCommand).toBe('wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && wrangler someothercommand');
59
+ });
60
+ (0, vitest_1.it)('handles wrangler deploy command with global args', () => {
61
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('wrangler --version --env production deploy --outdir someplace', 'dist');
62
+ (0, vitest_1.expect)(newCommand).toBe('wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
63
+ });
64
+ (0, vitest_1.it)('handles multiple commands and wrangler deploy command with global args', () => {
65
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)('notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace', 'dist');
66
+ (0, vitest_1.expect)(newCommand).toBe('notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)');
67
+ });
68
+ vitest_1.it.each([
69
+ 'notwrangler deploy',
70
+ 'wrangler dev',
71
+ 'wrangler dev && notwrangler deploy',
72
+ 'wrangler dev ; notwrangler deploy',
73
+ 'wrangler dev; notwrangler deploy',
74
+ 'wrangler dev ;notwrangler deploy',
75
+ 'wrangler --env dev dev && notwrangler deploy',
76
+ 'some completely different command',
77
+ ])('returns undefined if deploy command is not found', (command) => {
78
+ const newCommand = (0, wrangler_1.safeInsertArgsToWranglerDeployCommand)(command, 'dist');
79
+ (0, vitest_1.expect)(newCommand).toBeUndefined();
80
+ });
81
+ });
82
+ (0, vitest_1.describe)('findOutDir', () => {
83
+ (0, vitest_1.it)('returns dist dir if no outdir arg is found', () => {
84
+ const outDir = (0, wrangler_1.findOutDir)('wrangler deploy');
85
+ (0, vitest_1.expect)(outDir).toBe(wrangler_1.DIST_DIR);
86
+ });
87
+ (0, vitest_1.it)('returns outdir arg if it is found', () => {
88
+ const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir someplace');
89
+ (0, vitest_1.expect)(outDir).toBe('someplace');
90
+ });
91
+ (0, vitest_1.it)('handles --outdir "./someplace"', () => {
92
+ const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir "./someplace"');
93
+ (0, vitest_1.expect)(outDir).toBe('./someplace');
94
+ });
95
+ (0, vitest_1.it)('handles --outdir=someplace', () => {
96
+ const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir=someplace');
97
+ (0, vitest_1.expect)(outDir).toBe('someplace');
98
+ });
99
+ (0, vitest_1.it)("handles --outdir='./someplace'", () => {
100
+ const outDir = (0, wrangler_1.findOutDir)('wrangler deploy --outdir="./someplace"');
101
+ (0, vitest_1.expect)(outDir).toBe('./someplace');
102
+ });
103
+ (0, vitest_1.it)('returns dist dir if deploy command is not found', () => {
104
+ const outDir = (0, wrangler_1.findOutDir)('wrangler --environment testing dev --outdir someplace');
105
+ (0, vitest_1.expect)(outDir).toBe(wrangler_1.DIST_DIR);
106
+ });
107
+ });
108
+ (0, vitest_1.describe)('getWranglerDeployCommand', () => {
109
+ (0, vitest_1.it)('returns the deploy command', () => {
110
+ const deployCommand = (0, wrangler_1.getWranglerDeployCommand)('wrangler deploy --outdir someplace');
111
+ (0, vitest_1.expect)(deployCommand).toBe('wrangler deploy --outdir someplace');
112
+ });
113
+ (0, vitest_1.it)('returns undefined if deploy command is not found', () => {
114
+ const deployCommand = (0, wrangler_1.getWranglerDeployCommand)('wrangler --environment testing dev --outdir someplace');
115
+ (0, vitest_1.expect)(deployCommand).toBeUndefined();
116
+ });
117
+ vitest_1.it.each([
118
+ 'wrangler deploy --outdir someplace && some other command',
119
+ 'wrangler deploy --outdir someplace || some other command',
120
+ 'wrangler deploy --outdir someplace ; some other command',
121
+ 'wrangler deploy --outdir someplace && some other command || some other command',
122
+ 'yarn precheck && wrangler deploy --outdir someplace && some other command',
123
+ 'yarn precheck || wrangler deploy --outdir someplace && some other command',
124
+ 'npm run test; wrangler deploy --outdir someplace && some other command',
125
+ 'npm run test; wrangler version > text && wrangler deploy --outdir someplace && some other command',
126
+ 'wrangler deploy --outdir someplace > deployment.txt',
127
+ ])('returns the deploy command for `%s`', (command) => {
128
+ const deployCommand = (0, wrangler_1.getWranglerDeployCommand)(command)?.trim();
129
+ (0, vitest_1.expect)(deployCommand).toBe('wrangler deploy --outdir someplace');
130
+ });
131
+ });
132
+ //# sourceMappingURL=wrangler.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrangler.test.js","sourceRoot":"","sources":["../../../../test/sourcemaps/tools/wrangler.test.ts"],"names":[],"mappings":";;AAAA,qEAMgD;AAChD,mCAA8C;AAE9C,IAAA,iBAAQ,EAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAA,WAAE,EAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,GAAG,IAAA,8BAAmB,EAAC;YAClC,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,WAAW;YACxB,GAAG,EAAE,mBAAmB;YACxB,SAAS,EAAE,SAAS;YACpB,MAAM,EAAE,MAAM;SACf,CAAC,CAAC;QAEH,IAAA,eAAM,EAAC,OAAO,CAAC,CAAC,IAAI,CAClB,6PAA6P,CAC9P,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,yCAAyC,EAAE,GAAG,EAAE;QACjD,MAAM,OAAO,GAAG,IAAA,8BAAmB,EAAC;YAClC,UAAU,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AAE;QACzD,MAAM,MAAM,GAAG,IAAA,qBAAU,EACvB,uDAAuD,CACxD,CAAC;QAEF,IAAA,eAAM,EAAC,MAAM,CAAC,CAAC,IAAI,CAAC,mBAAQ,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,IAAA,iBAAQ,EAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAA,WAAE,EAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,aAAa,GAAG,IAAA,mCAAwB,EAC5C,oCAAoC,CACrC,CAAC;QAEF,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,IAAA,WAAE,EAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,aAAa,GAAG,IAAA,mCAAwB,EAC5C,uDAAuD,CACxD,CAAC;QAEF,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC,CAAC,CAAC;IAEH,WAAE,CAAC,IAAI,CAAC;QACN,0DAA0D;QAC1D,0DAA0D;QAC1D,yDAAyD;QACzD,gFAAgF;QAChF,2EAA2E;QAC3E,2EAA2E;QAC3E,wEAAwE;QACxE,mGAAmG;QACnG,qDAAqD;KACtD,CAAC,CAAC,qCAAqC,EAAE,CAAC,OAAO,EAAE,EAAE;QACpD,MAAM,aAAa,GAAG,IAAA,mCAAwB,EAAC,OAAO,CAAC,EAAE,IAAI,EAAE,CAAC;QAEhE,IAAA,eAAM,EAAC,aAAa,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {\n DIST_DIR,\n findOutDir,\n getSentryCliCommand,\n getWranglerDeployCommand,\n safeInsertArgsToWranglerDeployCommand,\n} from '../../../src/sourcemaps/tools/wrangler';\nimport { describe, expect, it } from 'vitest';\n\ndescribe('getSentryCliCommand', () => {\n it('returns correct command for SaaS', () => {\n const command = getSentryCliCommand({\n selfHosted: false,\n orgSlug: 'myOrg',\n projectSlug: 'myProject',\n url: 'https://sentry.io',\n authToken: '_ignore',\n outDir: 'dist',\n });\n\n expect(command).toBe(\n \"_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist\",\n );\n });\n\n it('returns correct command for self-hosted', () => {\n const command = getSentryCliCommand({\n selfHosted: true,\n orgSlug: 'myOrg',\n projectSlug: 'myProject',\n url: 'https://santry.io',\n authToken: '_ignore',\n outDir: 'someplace',\n });\n\n expect(command).toBe(\n \"_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli --url https://santry.io releases new $_SENTRY_RELEASE --org=myOrg --project=myProject && sentry-cli --url https://santry.io sourcemaps upload --org=myOrg --project=myProject --release=$_SENTRY_RELEASE --strip-prefix 'someplace/..' someplace\",\n );\n });\n});\n\ndescribe('safeInsertArgsToWranglerDeployCommand', () => {\n it('correctly inserts args into default command', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler deploy',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler deploy --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it.each([\n '--outdir someplace',\n '--outdir=someplace',\n '--outdir=\"./someplace\"',\n ])('retains existing %s arg', (arg) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n `wrangler deploy ${arg}`,\n 'dist',\n );\n\n expect(newCommand).toBe(\n `wrangler deploy ${arg} --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`,\n );\n });\n\n it.each([\n '--upload-source-maps',\n '--upload-source-maps=true',\n '--upload-source-maps true',\n '--upload-source-maps=false',\n '--upload-source-maps false',\n ])('retains existing %s arg', (arg) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n `wrangler deploy ${arg}`,\n 'dist',\n );\n\n expect(newCommand).toBe(\n `wrangler deploy ${arg} --outdir dist --var SENTRY_RELEASE:$(sentry-cli releases propose-version)`,\n );\n });\n\n it('appends to the \"wrangler deploy\" command', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && postcheck',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'precheck && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && postcheck',\n );\n });\n\n it('handles multiple wrangler commands', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue && wrangler someothercommand',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler whoami && wrangler deploy --outdir dist --upload-source-maps --var SOMEVAR:someValue --var SENTRY_RELEASE:$(sentry-cli releases propose-version) && wrangler someothercommand',\n );\n });\n\n it('handles wrangler deploy command with global args', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'wrangler --version --env production deploy --outdir someplace',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it('handles multiple commands and wrangler deploy command with global args', () => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(\n 'notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace',\n 'dist',\n );\n\n expect(newCommand).toBe(\n 'notwrangler --version deploy && wrangler --version --env whoami && wrangler --version --env production deploy --outdir someplace --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)',\n );\n });\n\n it.each([\n 'notwrangler deploy',\n 'wrangler dev',\n 'wrangler dev && notwrangler deploy',\n 'wrangler dev ; notwrangler deploy',\n 'wrangler dev; notwrangler deploy',\n 'wrangler dev ;notwrangler deploy',\n 'wrangler --env dev dev && notwrangler deploy',\n 'some completely different command',\n ])('returns undefined if deploy command is not found', (command) => {\n const newCommand = safeInsertArgsToWranglerDeployCommand(command, 'dist');\n\n expect(newCommand).toBeUndefined();\n });\n});\n\ndescribe('findOutDir', () => {\n it('returns dist dir if no outdir arg is found', () => {\n const outDir = findOutDir('wrangler deploy');\n\n expect(outDir).toBe(DIST_DIR);\n });\n\n it('returns outdir arg if it is found', () => {\n const outDir = findOutDir('wrangler deploy --outdir someplace');\n\n expect(outDir).toBe('someplace');\n });\n\n it('handles --outdir \"./someplace\"', () => {\n const outDir = findOutDir('wrangler deploy --outdir \"./someplace\"');\n\n expect(outDir).toBe('./someplace');\n });\n\n it('handles --outdir=someplace', () => {\n const outDir = findOutDir('wrangler deploy --outdir=someplace');\n\n expect(outDir).toBe('someplace');\n });\n\n it(\"handles --outdir='./someplace'\", () => {\n const outDir = findOutDir('wrangler deploy --outdir=\"./someplace\"');\n\n expect(outDir).toBe('./someplace');\n });\n\n it('returns dist dir if deploy command is not found', () => {\n const outDir = findOutDir(\n 'wrangler --environment testing dev --outdir someplace',\n );\n\n expect(outDir).toBe(DIST_DIR);\n });\n});\n\ndescribe('getWranglerDeployCommand', () => {\n it('returns the deploy command', () => {\n const deployCommand = getWranglerDeployCommand(\n 'wrangler deploy --outdir someplace',\n );\n\n expect(deployCommand).toBe('wrangler deploy --outdir someplace');\n });\n\n it('returns undefined if deploy command is not found', () => {\n const deployCommand = getWranglerDeployCommand(\n 'wrangler --environment testing dev --outdir someplace',\n );\n\n expect(deployCommand).toBeUndefined();\n });\n\n it.each([\n 'wrangler deploy --outdir someplace && some other command',\n 'wrangler deploy --outdir someplace || some other command',\n 'wrangler deploy --outdir someplace ; some other command',\n 'wrangler deploy --outdir someplace && some other command || some other command',\n 'yarn precheck && wrangler deploy --outdir someplace && some other command',\n 'yarn precheck || wrangler deploy --outdir someplace && some other command',\n 'npm run test; wrangler deploy --outdir someplace && some other command',\n 'npm run test; wrangler version > text && wrangler deploy --outdir someplace && some other command',\n 'wrangler deploy --outdir someplace > deployment.txt',\n ])('returns the deploy command for `%s`', (command) => {\n const deployCommand = getWranglerDeployCommand(command)?.trim();\n\n expect(deployCommand).toBe('wrangler deploy --outdir someplace');\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "4.9.0",
3
+ "version": "5.1.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",
@@ -57,6 +57,7 @@
57
57
  "@typescript-eslint/eslint-plugin": "^5.13.0",
58
58
  "@typescript-eslint/parser": "^5.13.0",
59
59
  "@vitest/coverage-v8": "3.0.9",
60
+ "clifty": "0.2.7",
60
61
  "dotenv": "^16.4.5",
61
62
  "eslint": "^8.18.0",
62
63
  "eslint-config-prettier": "^8.3.0",
@@ -1,2 +0,0 @@
1
- import { ReactNativeWizardOptions } from './options';
2
- export declare function runReactNativeUninstall(options: ReactNativeWizardOptions): Promise<void>;
@@ -1,94 +0,0 @@
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
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.runReactNativeUninstall = void 0;
30
- const fs = __importStar(require("fs"));
31
- // @ts-expect-error - clack is ESM and TS complains about that. It works though
32
- const prompts_1 = __importDefault(require("@clack/prompts"));
33
- const chalk_1 = __importDefault(require("chalk"));
34
- const clack_1 = require("../utils/clack");
35
- const glob_1 = require("./glob");
36
- const gradle_1 = require("./gradle");
37
- const metro_1 = require("./metro");
38
- const xcode_1 = require("./xcode");
39
- const xcode_2 = __importDefault(require("xcode"));
40
- async function runReactNativeUninstall(options) {
41
- (0, clack_1.printWelcome)({
42
- wizardName: 'Sentry React Native Uninstall Wizard',
43
- message: 'This wizard will remove Sentry from your React Native project.',
44
- telemetryEnabled: options.telemetryEnabled,
45
- });
46
- await (0, clack_1.confirmContinueIfNoOrDirtyGitRepo)({
47
- ignoreGitChanges: options.ignoreGitChanges,
48
- cwd: undefined,
49
- });
50
- await (0, metro_1.unPatchMetroConfig)();
51
- unPatchXcodeFiles();
52
- unPatchAndroidFiles();
53
- prompts_1.default.note(`To make sure your project builds after removing Sentry please run:
54
-
55
- 1. ${chalk_1.default.bold('yarn remove @sentry/react-native')}
56
- 2. ${chalk_1.default.bold('cd ios && pod install')}
57
- 3. Remove all occurrences of ${chalk_1.default.bold('@sentry/react-native')} from your application code.`);
58
- prompts_1.default.outro(`${chalk_1.default.green('Uninstall is done!')}
59
-
60
- ${chalk_1.default.dim('If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues')}`);
61
- }
62
- exports.runReactNativeUninstall = runReactNativeUninstall;
63
- function unPatchXcodeFiles() {
64
- const xcodeProjectPath = (0, glob_1.getFirstMatchedPath)(glob_1.XCODE_PROJECT);
65
- if (!xcodeProjectPath) {
66
- prompts_1.default.log.warn(`Could not find Xcode project file using ${chalk_1.default.bold(glob_1.XCODE_PROJECT)}.`);
67
- return;
68
- }
69
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
70
- const xcodeProject = xcode_2.default.project(xcodeProjectPath);
71
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
72
- xcodeProject.parseSync();
73
- const buildPhases = (0, xcode_1.getValidExistingBuildPhases)(xcodeProject);
74
- const bundlePhase = (0, xcode_1.findBundlePhase)(buildPhases);
75
- (0, xcode_1.unPatchBundlePhase)(bundlePhase);
76
- (0, xcode_1.unPatchDebugFilesUploadPhase)(xcodeProject);
77
- (0, xcode_1.writeXcodeProject)(xcodeProjectPath, xcodeProject);
78
- }
79
- function unPatchAndroidFiles() {
80
- const appBuildGradlePath = (0, glob_1.getFirstMatchedPath)(glob_1.APP_BUILD_GRADLE);
81
- if (!appBuildGradlePath) {
82
- prompts_1.default.log.warn(`Could not find Android app/build.gradle file using ${chalk_1.default.bold(glob_1.APP_BUILD_GRADLE)}.`);
83
- return;
84
- }
85
- const appBuildGradle = fs.readFileSync(appBuildGradlePath, 'utf-8');
86
- const includesSentry = (0, gradle_1.doesAppBuildGradleIncludeRNSentryGradlePlugin)(appBuildGradle);
87
- if (!includesSentry) {
88
- prompts_1.default.log.warn(`Sentry not found in Android app/build.gradle.`);
89
- return;
90
- }
91
- const patchedAppBuildGradle = (0, gradle_1.removeRNSentryGradlePlugin)(appBuildGradle);
92
- (0, gradle_1.writeAppBuildGradle)(appBuildGradlePath, patchedAppBuildGradle);
93
- }
94
- //# sourceMappingURL=uninstall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../../src/react-native/uninstall.ts"],"names":[],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CAAC,gBAAgB,CAAC,CAAC;IACrD,yGAAyG;IACzG,YAAY,CAAC,SAAS,EAAE,CAAC;IACzB,MAAM,WAAW,GAAG,IAAA,mCAA2B,EAAC,YAAY,CAAC,CAAC;IAE9D,MAAM,WAAW,GAAG,IAAA,uBAAe,EAAC,WAAW,CAAC,CAAC;IACjD,IAAA,0BAAkB,EAAC,WAAW,CAAC,CAAC;IAEhC,IAAA,oCAA4B,EAAC,YAAY,CAAC,CAAC;IAE3C,IAAA,yBAAiB,EAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,mBAAmB;IAC1B,MAAM,kBAAkB,GAAG,IAAA,0BAAmB,EAAC,uBAAgB,CAAC,CAAC;IACjE,IAAI,CAAC,kBAAkB,EAAE;QACvB,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,sDAAsD,eAAK,CAAC,IAAI,CAC9D,uBAAgB,CACjB,GAAG,CACL,CAAC;QACF,OAAO;KACR;IAED,MAAM,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IACpE,MAAM,cAAc,GAClB,IAAA,sDAA6C,EAAC,cAAc,CAAC,CAAC;IAChE,IAAI,CAAC,cAAc,EAAE;QACnB,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;QAChE,OAAO;KACR;IAED,MAAM,qBAAqB,GAAG,IAAA,mCAA0B,EAAC,cAAc,CAAC,CAAC;IAEzE,IAAA,4BAAmB,EAAC,kBAAkB,EAAE,qBAAqB,CAAC,CAAC;AACjE,CAAC","sourcesContent":["import * as fs from 'fs';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n printWelcome,\n} from '../utils/clack';\nimport { APP_BUILD_GRADLE, XCODE_PROJECT, getFirstMatchedPath } from './glob';\nimport {\n doesAppBuildGradleIncludeRNSentryGradlePlugin,\n removeRNSentryGradlePlugin,\n writeAppBuildGradle,\n} from './gradle';\nimport { unPatchMetroConfig } from './metro';\nimport { ReactNativeWizardOptions } from './options';\nimport {\n findBundlePhase,\n getValidExistingBuildPhases,\n unPatchBundlePhase,\n unPatchDebugFilesUploadPhase,\n writeXcodeProject,\n} from './xcode';\n\nimport xcode from 'xcode';\n\nexport async function runReactNativeUninstall(\n options: ReactNativeWizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry React Native Uninstall Wizard',\n message: 'This wizard will remove Sentry from your React Native project.',\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n await unPatchMetroConfig();\n\n unPatchXcodeFiles();\n\n unPatchAndroidFiles();\n\n clack.note(\n `To make sure your project builds after removing Sentry please run:\n\n1. ${chalk.bold('yarn remove @sentry/react-native')}\n2. ${chalk.bold('cd ios && pod install')}\n3. Remove all occurrences of ${chalk.bold(\n '@sentry/react-native',\n )} from your application code.`,\n );\n\n clack.outro(\n `${chalk.green('Uninstall is done!')}\n\n ${chalk.dim(\n 'If you encounter any issues, let us know here: https://github.com/getsentry/sentry-react-native/issues',\n )}`,\n );\n}\n\nfunction unPatchXcodeFiles() {\n const xcodeProjectPath = getFirstMatchedPath(XCODE_PROJECT);\n if (!xcodeProjectPath) {\n clack.log.warn(\n `Could not find Xcode project file using ${chalk.bold(XCODE_PROJECT)}.`,\n );\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n const xcodeProject = xcode.project(xcodeProjectPath);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n xcodeProject.parseSync();\n const buildPhases = getValidExistingBuildPhases(xcodeProject);\n\n const bundlePhase = findBundlePhase(buildPhases);\n unPatchBundlePhase(bundlePhase);\n\n unPatchDebugFilesUploadPhase(xcodeProject);\n\n writeXcodeProject(xcodeProjectPath, xcodeProject);\n}\n\nfunction unPatchAndroidFiles() {\n const appBuildGradlePath = getFirstMatchedPath(APP_BUILD_GRADLE);\n if (!appBuildGradlePath) {\n clack.log.warn(\n `Could not find Android app/build.gradle file using ${chalk.bold(\n APP_BUILD_GRADLE,\n )}.`,\n );\n return;\n }\n\n const appBuildGradle = fs.readFileSync(appBuildGradlePath, 'utf-8');\n const includesSentry =\n doesAppBuildGradleIncludeRNSentryGradlePlugin(appBuildGradle);\n if (!includesSentry) {\n clack.log.warn(`Sentry not found in Android app/build.gradle.`);\n return;\n }\n\n const patchedAppBuildGradle = removeRNSentryGradlePlugin(appBuildGradle);\n\n writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle);\n}\n"]}