@sentry/wizard 3.16.5 → 3.17.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 (39) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/package.json +2 -2
  3. package/dist/src/apple/cocoapod.js +2 -0
  4. package/dist/src/apple/cocoapod.js.map +1 -1
  5. package/dist/src/react-native/metro.d.ts +13 -0
  6. package/dist/src/react-native/metro.js +398 -0
  7. package/dist/src/react-native/metro.js.map +1 -0
  8. package/dist/src/react-native/react-native-wizard.d.ts +2 -0
  9. package/dist/src/react-native/react-native-wizard.js +139 -38
  10. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  11. package/dist/src/react-native/uninstall.js +4 -0
  12. package/dist/src/react-native/uninstall.js.map +1 -1
  13. package/dist/src/react-native/xcode.d.ts +7 -3
  14. package/dist/src/react-native/xcode.js +43 -11
  15. package/dist/src/react-native/xcode.js.map +1 -1
  16. package/dist/src/remix/remix-wizard.js +80 -37
  17. package/dist/src/remix/remix-wizard.js.map +1 -1
  18. package/dist/src/remix/sdk-setup.d.ts +1 -0
  19. package/dist/src/remix/sdk-setup.js +21 -1
  20. package/dist/src/remix/sdk-setup.js.map +1 -1
  21. package/dist/src/utils/ast-utils.d.ts +14 -0
  22. package/dist/src/utils/ast-utils.js +49 -1
  23. package/dist/src/utils/ast-utils.js.map +1 -1
  24. package/dist/test/react-native/metro.test.d.ts +1 -0
  25. package/dist/test/react-native/metro.test.js +125 -0
  26. package/dist/test/react-native/metro.test.js.map +1 -0
  27. package/dist/test/react-native/xcode.test.js +40 -2
  28. package/dist/test/react-native/xcode.test.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/apple/cocoapod.ts +2 -0
  31. package/src/react-native/metro.ts +409 -0
  32. package/src/react-native/react-native-wizard.ts +103 -7
  33. package/src/react-native/uninstall.ts +3 -0
  34. package/src/react-native/xcode.ts +70 -12
  35. package/src/remix/remix-wizard.ts +51 -15
  36. package/src/remix/sdk-setup.ts +31 -0
  37. package/src/utils/ast-utils.ts +52 -0
  38. package/test/react-native/metro.test.ts +283 -0
  39. package/test/react-native/xcode.test.ts +76 -3
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable no-useless-escape */
2
2
  import {
3
- addSentryToBundleShellScript,
3
+ addSentryWithBundledScriptsToBundleShellScript,
4
+ addSentryWithCliToBundleShellScript,
4
5
  doesBundlePhaseIncludeSentry,
5
6
  findBundlePhase,
6
7
  findDebugFilesUploadPhase,
@@ -8,7 +9,7 @@ import {
8
9
  } from '../../src/react-native/xcode';
9
10
 
10
11
  describe('react-native xcode', () => {
11
- describe('addSentryToBundleShellScript', () => {
12
+ describe('addSentryWithCliToBundleShellScript', () => {
12
13
  it('adds sentry cli to rn bundle build phase', () => {
13
14
  const input = `set -e
14
15
 
@@ -30,7 +31,31 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
30
31
  /bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"
31
32
  `;
32
33
 
33
- expect(addSentryToBundleShellScript(input)).toBe(expectedOutput);
34
+ expect(addSentryWithCliToBundleShellScript(input)).toBe(expectedOutput);
35
+ });
36
+ });
37
+
38
+ describe('addSentryBundledScriptsToBundleShellScript', () => {
39
+ it('adds sentry cli to rn bundle build phase', () => {
40
+ const input = `set -e
41
+
42
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
43
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
44
+
45
+ /bin/sh -c "$WITH_ENVIRONMENT $REACT_NATIVE_XCODE"`;
46
+ // actual shell script looks like this:
47
+ // /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""
48
+ // but during parsing xcode library removes the quotes
49
+ const expectedOutput = `set -e
50
+
51
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
52
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
53
+
54
+ /bin/sh -c "$WITH_ENVIRONMENT \\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\\""`;
55
+
56
+ expect(addSentryWithBundledScriptsToBundleShellScript(input)).toBe(
57
+ expectedOutput,
58
+ );
34
59
  });
35
60
  });
36
61
 
@@ -59,6 +84,23 @@ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
59
84
 
60
85
  expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);
61
86
  });
87
+
88
+ it('removes sentry bundled scripts from rn bundle build phase', () => {
89
+ const input = `set -e
90
+
91
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
92
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
93
+
94
+ /bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""`;
95
+ const expectedOutput = `set -e
96
+
97
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
98
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
99
+
100
+ /bin/sh -c "$WITH_ENVIRONMENT \"$REACT_NATIVE_XCODE\""`;
101
+
102
+ expect(removeSentryFromBundleShellScript(input)).toBe(expectedOutput);
103
+ });
62
104
  });
63
105
 
64
106
  describe('findBundlePhase', () => {
@@ -138,6 +180,19 @@ SENTRY_CLI="sentry-cli react-native xcode"
138
180
  expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();
139
181
  });
140
182
 
183
+ it('returns true for script containing sentry bundled script', () => {
184
+ const input = {
185
+ shellScript: `set -e
186
+ WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
187
+ REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
188
+ SENTRY_CLI="sentry-cli react-native xcode"
189
+
190
+ /bin/sh -c "$WITH_ENVIRONMENT \\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE"\\"
191
+ `,
192
+ };
193
+ expect(doesBundlePhaseIncludeSentry(input)).toBeTruthy();
194
+ });
195
+
141
196
  it('returns false', () => {
142
197
  const input = {
143
198
  // note sentry-cli can be part of the script but doesn't call react native xcode script
@@ -221,6 +276,24 @@ sentry-cli upload-dsym path/to/dsym --include-sources
221
276
  expect(findDebugFilesUploadPhase(input)).toEqual(expected);
222
277
  });
223
278
 
279
+ it('returns debug files build phase using bundled scripts', () => {
280
+ const input = {
281
+ 1: {
282
+ shellScript: 'foo',
283
+ },
284
+ 2: {
285
+ shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,
286
+ },
287
+ };
288
+ const expected = [
289
+ '2',
290
+ {
291
+ shellScript: `/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh`,
292
+ },
293
+ ];
294
+ expect(findDebugFilesUploadPhase(input)).toEqual(expected);
295
+ });
296
+
224
297
  it('returns undefined if build phase not present', () => {
225
298
  const input = {
226
299
  1: {