@sentry/wizard 2.0.2 → 2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.0
4
+
5
+ - feat(rn): Add support for RN TypeScript and other templates
6
+
3
7
  ## 2.0.2
4
8
 
5
9
  - fix(electron): Remove Electron symbols.js script
@@ -19,7 +19,7 @@ export interface Args {
19
19
  debug: boolean;
20
20
  uninstall: boolean;
21
21
  integration: Integration;
22
- platform: Platform;
22
+ platform: Platform[];
23
23
  skipConnect: boolean;
24
24
  quiet: boolean;
25
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;AACnB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,SAAgB,kBAAkB;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAC,QAAgB,IAAK,OAAA,CAAC;QACtD,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,sBAAsB,CAAC,QAAQ,CAAC;QACtC,KAAK,EAAE,QAAQ;KAChB,CAAC,EAJqD,CAIrD,CAAC,CAAC;AACN,CAAC;AAND,gDAMC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ,CAAC,GAAG;YACf,OAAO,KAAK,CAAC;QACf;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAPD,wDAOC;AAED,SAAgB,yBAAyB,CAAC,IAAY;IACpD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,UAAU,CAAC;QACpB,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AAbD,8DAaC;AAED,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAYY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.reactNative:\n return 'React Native';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n default:\n return 'React Native';\n }\n}\n\nexport function getIntegrationChoices(): any[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform;\n skipConnect: boolean;\n quiet: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;AACnB,CAAC,EALW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAKtB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,SAAgB,kBAAkB;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAC,QAAgB,IAAK,OAAA,CAAC;QACtD,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,sBAAsB,CAAC,QAAQ,CAAC;QACtC,KAAK,EAAE,QAAQ;KAChB,CAAC,EAJqD,CAIrD,CAAC,CAAC;AACN,CAAC;AAND,gDAMC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ,CAAC,GAAG;YACf,OAAO,KAAK,CAAC;QACf;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC;AAPD,wDAOC;AAED,SAAgB,yBAAyB,CAAC,IAAY;IACpD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,UAAU,CAAC;QACpB,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,SAAS,CAAC;QACnB;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AAbD,8DAaC;AAED,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAYY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.reactNative:\n return 'React Native';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n default:\n return 'React Native';\n }\n}\n\nexport function getIntegrationChoices(): any[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
@@ -1,3 +1,4 @@
1
1
  export declare function patchMatchingFile(globPattern: string, func: any, ...args: any[]): Promise<void>;
2
+ export declare function matchFiles(globPattern: string): string[];
2
3
  export declare function exists(globPattern: string): boolean;
3
4
  export declare function matchesContent(globPattern: string, contentPattern: RegExp): boolean;
@@ -7,9 +7,9 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
7
7
  return r;
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.matchesContent = exports.exists = exports.patchMatchingFile = void 0;
10
+ exports.matchesContent = exports.exists = exports.matchFiles = exports.patchMatchingFile = void 0;
11
11
  var fs = require("fs");
12
- var glob = require('glob');
12
+ var glob = require("glob");
13
13
  var IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];
14
14
  function patchMatchingFile(globPattern, func) {
15
15
  var args = [];
@@ -37,6 +37,12 @@ function patchMatchingFile(globPattern, func) {
37
37
  return rv;
38
38
  }
39
39
  exports.patchMatchingFile = patchMatchingFile;
40
+ function matchFiles(globPattern) {
41
+ return glob.sync(globPattern, {
42
+ ignore: IGNORE_PATTERN,
43
+ });
44
+ }
45
+ exports.matchFiles = matchFiles;
40
46
  function exists(globPattern) {
41
47
  var matches = glob.sync(globPattern, {
42
48
  ignore: IGNORE_PATTERN,
@@ -57,7 +63,7 @@ function matchesContent(globPattern, contentPattern) {
57
63
  return false;
58
64
  }
59
65
  return matches.reduce(function (prev, match) {
60
- return (prev &&
66
+ return !!(prev &&
61
67
  fs
62
68
  .readFileSync(match)
63
69
  .toString()
@@ -1 +1 @@
1
- {"version":3,"file":"File.js","sourceRoot":"","sources":["../../../lib/Helper/File.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uBAAyB;AACzB,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,IAAM,cAAc,GAAG,CAAC,iBAAiB,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AAExE,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,IAAS;IACT,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;IAEd,IAAM,OAAO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,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAC,IAAa,EAAE,KAAa;QACjD,OAAO,CACL,IAAI;YACJ,EAAE;iBACC,YAAY,CAAC,KAAK,CAAC;iBACnB,QAAQ,EAAE;iBACV,KAAK,CAAC,cAAc,CAAC,CACzB,CAAC;IACJ,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAnBD,wCAmBC","sourcesContent":["import * as fs from 'fs';\nconst glob = require('glob');\n\nconst IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];\n\nexport function patchMatchingFile(\n globPattern: string,\n func: any,\n ...args: any[]\n): Promise<void> {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n let rv = Promise.resolve();\n matches.forEach((match: string) => {\n const contents = fs.readFileSync(match, {\n encoding: 'utf-8',\n });\n rv = rv\n .then(() => func(contents, match, ...args))\n .then(newContents => {\n if (\n newContents !== null &&\n newContents !== undefined &&\n contents !== newContents\n ) {\n fs.writeFileSync(match, newContents);\n }\n });\n });\n return rv;\n}\n\nexport function exists(globPattern: string): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return prev && fs.existsSync(match);\n }, true);\n}\n\nexport function matchesContent(\n globPattern: string,\n contentPattern: RegExp,\n): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return (\n prev &&\n fs\n .readFileSync(match)\n .toString()\n .match(contentPattern)\n );\n }, true);\n}\n"]}
1
+ {"version":3,"file":"File.js","sourceRoot":"","sources":["../../../lib/Helper/File.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,uBAAyB;AACzB,2BAA6B;AAE7B,IAAM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;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAC,IAAa,EAAE,KAAa;QACjD,OAAO,IAAI,IAAI,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAVD,wBAUC;AAED,SAAgB,cAAc,CAC5B,WAAmB,EACnB,cAAsB;IAEtB,IAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;QACrC,MAAM,EAAE,cAAc;KACvB,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,CAAC,MAAM,CAAC,UAAC,IAAa,EAAE,KAAa;QACjD,OAAO,CAAC,CAAC,CACP,IAAI;YACJ,EAAE;iBACC,YAAY,CAAC,KAAK,CAAC;iBACnB,QAAQ,EAAE;iBACV,KAAK,CAAC,cAAc,CAAC,CACzB,CAAC;IACJ,CAAC,EAAE,IAAI,CAAC,CAAC;AACX,CAAC;AAnBD,wCAmBC","sourcesContent":["import * as fs from 'fs';\nimport * as glob from 'glob';\n\nconst IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];\n\nexport function patchMatchingFile(\n globPattern: string,\n func: any,\n ...args: any[]\n): Promise<void> {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n let rv = Promise.resolve();\n matches.forEach((match: string) => {\n const contents = fs.readFileSync(match, {\n encoding: 'utf-8',\n });\n rv = rv\n .then(() => func(contents, match, ...args))\n .then(newContents => {\n if (\n newContents !== null &&\n newContents !== undefined &&\n contents !== newContents\n ) {\n fs.writeFileSync(match, newContents);\n }\n });\n });\n return rv;\n}\n\nexport function matchFiles(globPattern: string): string[] {\n return glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n}\n\nexport function exists(globPattern: string): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return prev && fs.existsSync(match);\n }, true);\n}\n\nexport function matchesContent(\n globPattern: string,\n contentPattern: RegExp,\n): boolean {\n const matches = glob.sync(globPattern, {\n ignore: IGNORE_PATTERN,\n });\n if (matches.length === 0) {\n return false;\n }\n return matches.reduce((prev: boolean, match: string) => {\n return !!(\n prev &&\n fs\n .readFileSync(match)\n .toString()\n .match(contentPattern)\n );\n }, true);\n}\n"]}
@@ -3,4 +3,5 @@ export declare function nl(): void;
3
3
  export declare function green(msg: string): void;
4
4
  export declare function red(msg: string): void;
5
5
  export declare function dim(msg: string): void;
6
+ export declare function yellow(msg: string): void;
6
7
  export declare function debug(msg: any): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debug = exports.dim = exports.red = exports.green = exports.nl = exports.l = void 0;
3
+ exports.debug = exports.yellow = exports.dim = exports.red = exports.green = exports.nl = exports.l = void 0;
4
4
  var chalk_1 = require("chalk");
5
5
  function prepareMessage(msg) {
6
6
  if (typeof msg === 'string') {
@@ -32,6 +32,10 @@ function dim(msg) {
32
32
  return l(chalk_1.default.dim(prepareMessage(msg)));
33
33
  }
34
34
  exports.dim = dim;
35
+ function yellow(msg) {
36
+ return l(chalk_1.default.yellow(prepareMessage(msg)));
37
+ }
38
+ exports.yellow = yellow;
35
39
  function debug(msg) {
36
40
  return l(chalk_1.default.italic.yellow(prepareMessage(msg)));
37
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Logging.js","sourceRoot":"","sources":["../../../lib/Helper/Logging.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,MAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAE,CAAC;KAC7B;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,CAAC,CAAC,GAAW;IAC3B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAHD,cAGC;AAED,SAAgB,EAAE;IAChB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACf,CAAC;AAFD,gBAEC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,KAAK,CAAC,GAAQ;IAC5B,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,sBAEC","sourcesContent":["import Chalk from 'chalk';\n\nfunction prepareMessage(msg: unknown): string {\n if (typeof msg === 'string') {\n return msg;\n }\n if (msg instanceof Error) {\n return `${msg.stack || ''}`;\n }\n return JSON.stringify(msg, null, '\\t');\n}\n\nexport function l(msg: string): void {\n // eslint-disable-next-line no-console\n console.log(msg);\n}\n\nexport function nl(): void {\n return l('');\n}\n\nexport function green(msg: string): void {\n return l(Chalk.green(prepareMessage(msg)));\n}\n\nexport function red(msg: string): void {\n return l(Chalk.red(prepareMessage(msg)));\n}\n\nexport function dim(msg: string): void {\n return l(Chalk.dim(prepareMessage(msg)));\n}\n\nexport function debug(msg: any): void {\n return l(Chalk.italic.yellow(prepareMessage(msg)));\n}\n"]}
1
+ {"version":3,"file":"Logging.js","sourceRoot":"","sources":["../../../lib/Helper/Logging.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAE1B,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,OAAO,GAAG,CAAC;KACZ;IACD,IAAI,GAAG,YAAY,KAAK,EAAE;QACxB,OAAO,MAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAE,CAAC;KAC7B;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,CAAC,CAAC,GAAW;IAC3B,sCAAsC;IACtC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACnB,CAAC;AAHD,cAGC;AAED,SAAgB,EAAE;IAChB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC;AACf,CAAC;AAFD,gBAEC;AAED,SAAgB,KAAK,CAAC,GAAW;IAC/B,OAAO,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC7C,CAAC;AAFD,sBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,GAAG,CAAC,GAAW;IAC7B,OAAO,CAAC,CAAC,eAAK,CAAC,GAAG,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC3C,CAAC;AAFD,kBAEC;AAED,SAAgB,MAAM,CAAC,GAAW;IAChC,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAFD,wBAEC;AAED,SAAgB,KAAK,CAAC,GAAQ;IAC5B,OAAO,CAAC,CAAC,eAAK,CAAC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,sBAEC","sourcesContent":["import Chalk from 'chalk';\n\nfunction prepareMessage(msg: unknown): string {\n if (typeof msg === 'string') {\n return msg;\n }\n if (msg instanceof Error) {\n return `${msg.stack || ''}`;\n }\n return JSON.stringify(msg, null, '\\t');\n}\n\nexport function l(msg: string): void {\n // eslint-disable-next-line no-console\n console.log(msg);\n}\n\nexport function nl(): void {\n return l('');\n}\n\nexport function green(msg: string): void {\n return l(Chalk.green(prepareMessage(msg)));\n}\n\nexport function red(msg: string): void {\n return l(Chalk.red(prepareMessage(msg)));\n}\n\nexport function dim(msg: string): void {\n return l(Chalk.dim(prepareMessage(msg)));\n}\n\nexport function yellow(msg: string): void {\n return l(Chalk.yellow(prepareMessage(msg)));\n}\n\nexport function debug(msg: any): void {\n return l(Chalk.italic.yellow(prepareMessage(msg)));\n}\n"]}
@@ -5,7 +5,7 @@ var SentryCli_1 = require("../SentryCli");
5
5
  var args = {
6
6
  debug: false,
7
7
  integration: Constants_1.Integration.reactNative,
8
- platform: Constants_1.Platform.ios,
8
+ platform: [Constants_1.Platform.ios],
9
9
  quiet: false,
10
10
  skipConnect: false,
11
11
  uninstall: false,
@@ -1 +1 @@
1
- {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/SentryCli.ts"],"names":[],"mappings":";;AAGA,6CAA8D;AAC9D,0CAAyC;AAEzC,IAAM,IAAI,GAAS;IACjB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,uBAAW,CAAC,WAAW;IACpC,QAAQ,EAAE,oBAAQ,CAAC,GAAG;IACtB,KAAK,EAAE,KAAK;IACZ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,WAAW,CAAC,CAAC;QACvC,IAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aACjC,IAAI,CAAC,yJAKX,CAAC,CAAC;IACD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\nimport { Answers } from 'inquirer';\n\nimport { Args, Integration, Platform } from '../../Constants';\nimport { SentryCli } from '../SentryCli';\n\nconst args: Args = {\n debug: false,\n integration: Integration.reactNative,\n platform: Platform.ios,\n quiet: false,\n skipConnect: false,\n uninstall: false,\n url: 'https://localhost:1234',\n};\n\nconst demoAnswers: Answers = {\n config: {\n auth: {\n token: 'abcd',\n },\n organization: {\n slug: 'test_org',\n },\n project: {\n slug: 'test_proj',\n },\n },\n};\n\ndescribe('SentryCli', () => {\n test('convertAnswersToProperties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules/sentry/cli');\n });\n\n test('dump properties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules/sentry/cli\n`);\n });\n\n test('convertAnswersToProperties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules\\\\\\\\sentry\\\\\\\\cli');\n });\n\n test('dump properties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules\\\\\\\\sentry\\\\\\\\cli\n`);\n });\n});\n"]}
1
+ {"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../../lib/Helper/__tests__/SentryCli.ts"],"names":[],"mappings":";;AAGA,6CAA8D;AAC9D,0CAAyC;AAEzC,IAAM,IAAI,GAAS;IACjB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,uBAAW,CAAC,WAAW;IACpC,QAAQ,EAAE,CAAC,oBAAQ,CAAC,GAAG,CAAC;IACxB,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,GAAG,EAAE,wBAAwB;CAC9B,CAAC;AAEF,IAAM,WAAW,GAAY;IAC3B,MAAM,EAAE;QACN,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;SACd;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,UAAU;SACjB;QACD,OAAO,EAAE;YACP,IAAI,EAAE,WAAW;SAClB;KACF;CACF,CAAC;AAEF,QAAQ,CAAC,WAAW,EAAE;IACpB,IAAI,CAAC,4BAA4B,EAAE;QACjC,IAAM,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,yBAAyB,CAAC,CAAC;QACzE,I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C;QACnC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACvC,IAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QAC7D,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/C,MAAM,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE;QAC9B,IAAM,WAAW,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,2BAA2B,CAAC,CAAC;QAC3E,IAAM,MAAM,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;QACvC,IAAM,KAAK,GAAG,MAAM,CAAC,0BAA0B,CAAC,WAAW,CAAC,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;aACjC,IAAI,CAAC,yJAKX,CAAC,CAAC;IACD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/// <reference types=\"jest\" />\nimport { Answers } from 'inquirer';\n\nimport { Args, Integration, Platform } from '../../Constants';\nimport { SentryCli } from '../SentryCli';\n\nconst args: Args = {\n debug: false,\n integration: Integration.reactNative,\n platform: [Platform.ios],\n quiet: false,\n skipConnect: false,\n uninstall: false,\n url: 'https://localhost:1234',\n};\n\nconst demoAnswers: Answers = {\n config: {\n auth: {\n token: 'abcd',\n },\n organization: {\n slug: 'test_org',\n },\n project: {\n slug: 'test_proj',\n },\n },\n};\n\ndescribe('SentryCli', () => {\n test('convertAnswersToProperties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules/sentry/cli');\n });\n\n test('dump properties', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules/sentry/cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules/sentry/cli\n`);\n });\n\n test('convertAnswersToProperties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(props['defaults/url']).toBe('https://localhost:1234');\n expect(props['defaults/org']).toBe('test_org');\n expect(props['defaults/project']).toBe('test_proj');\n expect(props['auth/token']).toBe('abcd');\n expect(props['cli/executable']).toBe('node_modules\\\\\\\\sentry\\\\\\\\cli');\n });\n\n test('dump properties windows', () => {\n const resolveFunc = jest.fn().mockReturnValue('node_modules\\\\sentry\\\\cli');\n const sentry = new SentryCli(args);\n sentry.setResolveFunction(resolveFunc);\n const props = sentry.convertAnswersToProperties(demoAnswers);\n expect(sentry.dumpProperties(props))\n .toBe(`defaults.url=https://localhost:1234\ndefaults.org=test_org\ndefaults.project=test_proj\nauth.token=abcd\ncli.executable=node_modules\\\\\\\\sentry\\\\\\\\cli\n`);\n });\n});\n"]}
@@ -10,6 +10,7 @@ export declare class ReactNative extends MobileProject {
10
10
  emit(answers: Answers): Promise<Answers>;
11
11
  uninstall(_answers: Answers): Promise<Answers>;
12
12
  protected _shouldConfigurePlatform(platform: string): Promise<boolean>;
13
+ private _patchJsSentryInit;
13
14
  private _addSentryProperties;
14
15
  private _patchJs;
15
16
  private _patchBuildGradle;
@@ -93,7 +93,7 @@ var ReactNative = /** @class */ (function (_super) {
93
93
  return __generator(this, function (_a) {
94
94
  switch (_a.label) {
95
95
  case 0:
96
- _a.trys.push([0, 8, , 9]);
96
+ _a.trys.push([0, 7, , 8]);
97
97
  if (!(platform === 'ios')) return [3 /*break*/, 2];
98
98
  return [4 /*yield*/, File_1.patchMatchingFile('ios/*.xcodeproj/project.pbxproj', this._patchXcodeProj.bind(this))];
99
99
  case 1:
@@ -105,26 +105,20 @@ var ReactNative = /** @class */ (function (_super) {
105
105
  _a.sent();
106
106
  Logging_1.dim("\u2705 Patched build.gradle file.");
107
107
  _a.label = 4;
108
- case 4: return [4 /*yield*/, File_1.patchMatchingFile("index." + platform + ".js", this._patchJs.bind(this), answers, platform)];
108
+ case 4: return [4 /*yield*/, this._patchJsSentryInit(platform, answers)];
109
109
  case 5:
110
110
  _a.sent();
111
- // rm 0.49 introduced an App.js for both platforms
112
- return [4 /*yield*/, File_1.patchMatchingFile('App.js', this._patchJs.bind(this), answers, platform)];
113
- case 6:
114
- // rm 0.49 introduced an App.js for both platforms
115
- _a.sent();
116
- Logging_1.dim("\u2705 Patched App.js file.");
117
111
  return [4 /*yield*/, this._addSentryProperties(platform, sentryCliProperties)];
118
- case 7:
112
+ case 6:
119
113
  _a.sent();
120
114
  Logging_1.dim("\u2705 Added sentry.properties file to " + platform);
121
115
  Logging_1.green("Successfully set up " + platform + " for react-native");
122
- return [3 /*break*/, 9];
123
- case 8:
116
+ return [3 /*break*/, 8];
117
+ case 7:
124
118
  e_1 = _a.sent();
125
119
  Logging_1.red(e_1);
126
- return [3 /*break*/, 9];
127
- case 9: return [2 /*return*/];
120
+ return [3 /*break*/, 8];
121
+ case 8: return [2 /*return*/];
128
122
  }
129
123
  });
130
124
  }); });
@@ -189,6 +183,33 @@ var ReactNative = /** @class */ (function (_super) {
189
183
  });
190
184
  });
191
185
  };
186
+ ReactNative.prototype._patchJsSentryInit = function (platform, answers) {
187
+ return __awaiter(this, void 0, void 0, function () {
188
+ var prefixGlob, suffixGlob, platformGlob, universalGlob, jsFileGlob, jsFileToPatch;
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0:
192
+ prefixGlob = '{.,./src}';
193
+ suffixGlob = '@(j|t|cj|mj)s?(x)';
194
+ platformGlob = "index." + platform + "." + suffixGlob;
195
+ universalGlob = "App." + suffixGlob;
196
+ jsFileGlob = prefixGlob + "/+(" + platformGlob + "|" + universalGlob + ")";
197
+ jsFileToPatch = File_1.matchFiles(jsFileGlob);
198
+ if (!(jsFileToPatch.length !== 0)) return [3 /*break*/, 2];
199
+ return [4 /*yield*/, File_1.patchMatchingFile(jsFileGlob, this._patchJs.bind(this), answers, platform)];
200
+ case 1:
201
+ _a.sent();
202
+ Logging_1.dim("\u2705 Patched " + jsFileToPatch.join(', ') + " file(s).");
203
+ return [3 /*break*/, 3];
204
+ case 2:
205
+ Logging_1.dim("\uD83D\uDEA8 Could not find " + platformGlob + " nor " + universalGlob + " files.");
206
+ Logging_1.yellow('❓ Please, visit https://docs.sentry.io/platforms/react-native');
207
+ _a.label = 3;
208
+ case 3: return [2 /*return*/];
209
+ }
210
+ });
211
+ });
212
+ };
192
213
  ReactNative.prototype._addSentryProperties = function (platform, properties) {
193
214
  var _this = this;
194
215
  var rv = Promise.resolve();
@@ -1 +1 @@
1
- {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,EAAE;4BAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;4BACpB,MAAM;yBACP;qBACF;iBACF;gBACD,SAAS;aACV;SACF;IACH,CAAC;IAEO,uCAAiB,GAAzB,UACE,SAAiB,EACjB,QAAgB;QAFlB,iBAgBC;QAZC,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,CAAC,KAAK,CAAC,UAAC,GAAQ;gBAClB,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AA3YD,CAAiC,6BAAa,GA2Y7C;AA3YY,kCAAW","sourcesContent":["/* eslint-disable max-lines */\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { Args } from '../../Constants';\nimport { exists, matchesContent, patchMatchingFile } from '../../Helper/File';\nimport { dim, green, red } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\n\nconst xcode = require('xcode');\n\nexport class ReactNative extends MobileProject {\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n constructor(protected _argv: Args) {\n super(_argv);\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n dim(`✅ Patched build script in Xcode project.`);\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n dim(`✅ Patched build.gradle file.`);\n }\n await patchMatchingFile(\n `index.${platform}.js`,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n // rm 0.49 introduced an App.js for both platforms\n await patchMatchingFile(\n 'App.js',\n this._patchJs.bind(this),\n answers,\n platform,\n );\n dim(`✅ Patched App.js file.`);\n await this._addSentryProperties(platform, sentryCliProperties);\n dim(`✅ Added sentry.properties file to ${platform}`);\n\n green(`Successfully set up ${platform} for react-native`);\n } catch (e) {\n red(e);\n }\n },\n );\n Promise.all(promises)\n .then(resolve)\n .catch(reject);\n });\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n match =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n `Sentry.init({ \\n` +\n ` dsn: '${dsn}', \\n` +\n `});\\n`,\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n return Promise.resolve(\n contents.replace(\n /^apply from: \"..\\/..\\/node_modules\\/react-native\\/react.gradle\"/m,\n // eslint-disable-next-line prefer-template\n match => match + '\\n' + applyFrom,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(\n /\\/scripts\\/react-native-xcode\\.sh/i,\n ) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\\\"',\n );\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/sentry-cli\\s+upload-dsym/)) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n 'export SENTRY_PROPERTIES=sentry.properties\\\\n' +\n '../node_modules/@sentry/cli/bin/sentry-cli upload-dsym',\n },\n );\n }\n\n private _patchXcodeProj(contents: string, filename: string): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve();\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+upload-dsym\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,uBAAyB;AAEzB,0BAA4B;AAC5B,2BAA6B;AAG7B,0CAA0F;AAC1F,gDAA+D;AAC/D,oDAAmD;AACnD,iDAAgD;AAEhD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B;IAAiC,+BAAa;IAI5C,qBAAsB,KAAW;QAAjC,YACE,kBAAM,KAAK,CAAC,SAEb;QAHqB,WAAK,GAAL,KAAK,CAAM;QAE/B,KAA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AAC,CAAC;gBACjC,IAAM,MAAM,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAAC;gBACtD,IAAI,MAAM,EAAE;oBACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;wBACtC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,KAAK,GAAG,EAAE;4BAC3B,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;4BACpB,MAAM;yBACP;qBACF;iBACF;gBACD,SAAS;aACV;SACF;IACH,CAAC;IAEO,uCAAiB,GAAzB,UACE,SAAiB,EACjB,QAAgB;QAFlB,iBAgBC;QAZC,IAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;YACjC,IAAI,CAAC,KAAK,CAAC,UAAC,GAAQ;gBAClB,IAAI,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IACH,kBAAC;AAAD,CAAC,AAxZD,CAAiC,6BAAa,GAwZ7C;AAxZY,kCAAW","sourcesContent":["/* eslint-disable max-lines */\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { Args } from '../../Constants';\nimport { exists, matchesContent, matchFiles, patchMatchingFile } from '../../Helper/File';\nimport { dim, green, red, yellow } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\n\nconst xcode = require('xcode');\n\nexport class ReactNative extends MobileProject {\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n constructor(protected _argv: Args) {\n super(_argv);\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n dim(`✅ Patched build script in Xcode project.`);\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n dim(`✅ Patched build.gradle file.`);\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n dim(`✅ Added sentry.properties file to ${platform}`);\n\n green(`Successfully set up ${platform} for react-native`);\n } catch (e) {\n red(e);\n }\n },\n );\n Promise.all(promises)\n .then(resolve)\n .catch(reject);\n });\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private async _patchJsSentryInit(\n platform: string,\n answers: Answers,\n ): Promise<void> {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const platformGlob = `index.${platform}.${suffixGlob}`;\n // rm 0.49 introduced an App.js for both platforms\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;\n\n const jsFileToPatch = matchFiles(jsFileGlob);\n if (jsFileToPatch.length !== 0) {\n await patchMatchingFile(\n jsFileGlob,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n dim(`✅ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n dim(`🚨 Could not find ${platformGlob} nor ${universalGlob} files.`);\n yellow('❓ Please, visit https://docs.sentry.io/platforms/react-native');\n }\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n match =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n `Sentry.init({ \\n` +\n ` dsn: '${dsn}', \\n` +\n `});\\n`,\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n return Promise.resolve(\n contents.replace(\n /^apply from: \"..\\/..\\/node_modules\\/react-native\\/react.gradle\"/m,\n // eslint-disable-next-line prefer-template\n match => match + '\\n' + applyFrom,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(\n /\\/scripts\\/react-native-xcode\\.sh/i,\n ) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\\\"',\n );\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/sentry-cli\\s+upload-dsym/)) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n 'export SENTRY_PROPERTIES=sentry.properties\\\\n' +\n '../node_modules/@sentry/cli/bin/sentry-cli upload-dsym',\n },\n );\n }\n\n private _patchXcodeProj(contents: string, filename: string): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve();\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+upload-dsym\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the output
40
+ var fs = require("fs");
41
+ var process = require("process");
42
+ var rimraf = require("rimraf");
43
+ var Constants_1 = require("../../../Constants");
44
+ var ReactNative_1 = require("../ReactNative");
45
+ var testDir = 'rn-test';
46
+ var iosIndexJs = 'index.ios.js';
47
+ var appTsx = 'src/App.tsx';
48
+ var dummyJsContent = 'import React from "react";\n';
49
+ var testArgs = {
50
+ debug: false,
51
+ integration: Constants_1.Integration.reactNative,
52
+ platform: [Constants_1.Platform.ios],
53
+ quiet: true,
54
+ skipConnect: true,
55
+ uninstall: false,
56
+ url: 'https://not.used',
57
+ };
58
+ var testAnswers = {
59
+ shouldConfigurePlatforms: { 'ios': true },
60
+ config: {
61
+ dsn: {
62
+ public: 'dns.public.com',
63
+ },
64
+ },
65
+ };
66
+ describe('ReactNative', function () {
67
+ var defaultCwd = process.cwd();
68
+ beforeEach(function () {
69
+ rimraf.sync(testDir);
70
+ fs.mkdirSync(testDir);
71
+ process.chdir(testDir);
72
+ fs.writeFileSync(iosIndexJs, dummyJsContent);
73
+ fs.mkdirSync('src');
74
+ fs.writeFileSync(appTsx, dummyJsContent);
75
+ });
76
+ afterEach(function () {
77
+ process.chdir(defaultCwd);
78
+ rimraf.sync(testDir);
79
+ });
80
+ test('patches js files', function () { return __awaiter(void 0, void 0, void 0, function () {
81
+ var project, patchedIosIndexJs, patchedAppTsx, expectedPatch;
82
+ return __generator(this, function (_a) {
83
+ switch (_a.label) {
84
+ case 0:
85
+ project = new ReactNative_1.ReactNative(testArgs);
86
+ return [4 /*yield*/, project.emit(testAnswers)];
87
+ case 1:
88
+ _a.sent();
89
+ patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');
90
+ patchedAppTsx = fs.readFileSync(appTsx, 'utf8');
91
+ expectedPatch = 'import React from "react";\n\n' +
92
+ 'import * as Sentry from \'@sentry/react-native\';\n\n' +
93
+ 'Sentry.init({ \n' +
94
+ ' dsn: \'dns.public.com\', \n' +
95
+ '});\n\n';
96
+ expect(patchedIosIndexJs).toEqual(expectedPatch);
97
+ expect(patchedAppTsx).toEqual(expectedPatch);
98
+ return [2 /*return*/];
99
+ }
100
+ });
101
+ }); });
102
+ });
103
+ //# sourceMappingURL=ReactNative.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../../lib/Steps/Integrations/__tests__/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC,CAAC,4CAA4C;AACrF,uBAAyB;AAEzB,iCAAmC;AACnC,+BAAiC;AAEjC,gDAAiE;AACjE,8CAA6C;AAE7C,IAAM,OAAO,GAAG,SAAS,CAAC;AAC1B,IAAM,UAAU,GAAG,cAAc,CAAC;AAClC,IAAM,MAAM,GAAG,aAAa,CAAC;AAE7B,IAAM,cAAc,GAAG,8BAA8B,CAAC;AAEtD,IAAM,QAAQ,GAAG;IACf,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,uBAAW,CAAC,WAAW;IACpC,QAAQ,EAAE,CAAC,oBAAQ,CAAC,GAAG,CAAC;IACxB,KAAK,EAAE,IAAI;IACX,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,KAAK;IAChB,GAAG,EAAE,kBAAkB;CACxB,CAAC;AAEF,IAAM,WAAW,GAAY;IAC3B,wBAAwB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;IACzC,MAAM,EAAE;QACN,GAAG,EAAE;YACH,MAAM,EAAE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('../../../Helper/Logging.ts'); // We mock logging to not pollute the output\nimport * as fs from 'fs';\nimport { Answers } from 'inquirer';\nimport * as process from 'process';\nimport * as rimraf from 'rimraf';\n\nimport { Args, Integration, Platform } from '../../../Constants';\nimport { ReactNative } from '../ReactNative';\n\nconst testDir = 'rn-test';\nconst iosIndexJs = 'index.ios.js';\nconst appTsx = 'src/App.tsx';\n\nconst dummyJsContent = 'import React from \"react\";\\n';\n\nconst testArgs = {\n debug: false,\n integration: Integration.reactNative,\n platform: [Platform.ios],\n quiet: true,\n skipConnect: true,\n uninstall: false,\n url: 'https://not.used',\n};\n\nconst testAnswers: Answers = {\n shouldConfigurePlatforms: { 'ios': true },\n config: {\n dsn: {\n public: 'dns.public.com',\n },\n },\n};\n\ndescribe('ReactNative', () => {\n\n const defaultCwd = process.cwd();\n\n beforeEach(() => {\n rimraf.sync(testDir);\n fs.mkdirSync(testDir);\n process.chdir(testDir);\n fs.writeFileSync(iosIndexJs, dummyJsContent);\n fs.mkdirSync('src');\n fs.writeFileSync(appTsx, dummyJsContent);\n });\n\n afterEach(() => {\n process.chdir(defaultCwd);\n rimraf.sync(testDir);\n });\n\n test('patches js files', async () => {\n const project = new ReactNative(testArgs as Args);\n await project.emit(testAnswers);\n\n const patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');\n const patchedAppTsx = fs.readFileSync(appTsx, 'utf8');\n const expectedPatch = 'import React from \"react\";\\n\\n' +\n 'import * as Sentry from \\'@sentry/react-native\\';\\n\\n' +\n 'Sentry.init({ \\n' +\n ' dsn: \\'dns.public.com\\', \\n' +\n '});\\n\\n';\n expect(patchedIosIndexJs).toEqual(expectedPatch);\n expect(patchedAppTsx).toEqual(expectedPatch);\n });\n});\n"]}
package/lib/Constants.ts CHANGED
@@ -56,7 +56,7 @@ export interface Args {
56
56
  debug: boolean;
57
57
  uninstall: boolean;
58
58
  integration: Integration;
59
- platform: Platform;
59
+ platform: Platform[];
60
60
  skipConnect: boolean;
61
61
  quiet: boolean;
62
62
  }
@@ -1,5 +1,5 @@
1
1
  import * as fs from 'fs';
2
- const glob = require('glob');
2
+ import * as glob from 'glob';
3
3
 
4
4
  const IGNORE_PATTERN = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];
5
5
 
@@ -31,6 +31,12 @@ export function patchMatchingFile(
31
31
  return rv;
32
32
  }
33
33
 
34
+ export function matchFiles(globPattern: string): string[] {
35
+ return glob.sync(globPattern, {
36
+ ignore: IGNORE_PATTERN,
37
+ });
38
+ }
39
+
34
40
  export function exists(globPattern: string): boolean {
35
41
  const matches = glob.sync(globPattern, {
36
42
  ignore: IGNORE_PATTERN,
@@ -54,7 +60,7 @@ export function matchesContent(
54
60
  return false;
55
61
  }
56
62
  return matches.reduce((prev: boolean, match: string) => {
57
- return (
63
+ return !!(
58
64
  prev &&
59
65
  fs
60
66
  .readFileSync(match)
@@ -31,6 +31,10 @@ export function dim(msg: string): void {
31
31
  return l(Chalk.dim(prepareMessage(msg)));
32
32
  }
33
33
 
34
+ export function yellow(msg: string): void {
35
+ return l(Chalk.yellow(prepareMessage(msg)));
36
+ }
37
+
34
38
  export function debug(msg: any): void {
35
39
  return l(Chalk.italic.yellow(prepareMessage(msg)));
36
40
  }
@@ -7,7 +7,7 @@ import { SentryCli } from '../SentryCli';
7
7
  const args: Args = {
8
8
  debug: false,
9
9
  integration: Integration.reactNative,
10
- platform: Platform.ios,
10
+ platform: [Platform.ios],
11
11
  quiet: false,
12
12
  skipConnect: false,
13
13
  uninstall: false,
@@ -5,8 +5,8 @@ import * as _ from 'lodash';
5
5
  import * as path from 'path';
6
6
 
7
7
  import { Args } from '../../Constants';
8
- import { exists, matchesContent, patchMatchingFile } from '../../Helper/File';
9
- import { dim, green, red } from '../../Helper/Logging';
8
+ import { exists, matchesContent, matchFiles, patchMatchingFile } from '../../Helper/File';
9
+ import { dim, green, red, yellow } from '../../Helper/Logging';
10
10
  import { SentryCli } from '../../Helper/SentryCli';
11
11
  import { MobileProject } from './MobileProject';
12
12
 
@@ -51,20 +51,7 @@ export class ReactNative extends MobileProject {
51
51
  );
52
52
  dim(`✅ Patched build.gradle file.`);
53
53
  }
54
- await patchMatchingFile(
55
- `index.${platform}.js`,
56
- this._patchJs.bind(this),
57
- answers,
58
- platform,
59
- );
60
- // rm 0.49 introduced an App.js for both platforms
61
- await patchMatchingFile(
62
- 'App.js',
63
- this._patchJs.bind(this),
64
- answers,
65
- platform,
66
- );
67
- dim(`✅ Patched App.js file.`);
54
+ await this._patchJsSentryInit(platform, answers);
68
55
  await this._addSentryProperties(platform, sentryCliProperties);
69
56
  dim(`✅ Added sentry.properties file to ${platform}`);
70
57
 
@@ -132,6 +119,32 @@ export class ReactNative extends MobileProject {
132
119
  return result;
133
120
  }
134
121
 
122
+ private async _patchJsSentryInit(
123
+ platform: string,
124
+ answers: Answers,
125
+ ): Promise<void> {
126
+ const prefixGlob = '{.,./src}';
127
+ const suffixGlob = '@(j|t|cj|mj)s?(x)';
128
+ const platformGlob = `index.${platform}.${suffixGlob}`;
129
+ // rm 0.49 introduced an App.js for both platforms
130
+ const universalGlob = `App.${suffixGlob}`;
131
+ const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;
132
+
133
+ const jsFileToPatch = matchFiles(jsFileGlob);
134
+ if (jsFileToPatch.length !== 0) {
135
+ await patchMatchingFile(
136
+ jsFileGlob,
137
+ this._patchJs.bind(this),
138
+ answers,
139
+ platform,
140
+ );
141
+ dim(`✅ Patched ${jsFileToPatch.join(', ')} file(s).`);
142
+ } else {
143
+ dim(`🚨 Could not find ${platformGlob} nor ${universalGlob} files.`);
144
+ yellow('❓ Please, visit https://docs.sentry.io/platforms/react-native');
145
+ }
146
+ }
147
+
135
148
  private _addSentryProperties(
136
149
  platform: string,
137
150
  properties: any,
@@ -0,0 +1,67 @@
1
+ jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the output
2
+ import * as fs from 'fs';
3
+ import { Answers } from 'inquirer';
4
+ import * as process from 'process';
5
+ import * as rimraf from 'rimraf';
6
+
7
+ import { Args, Integration, Platform } from '../../../Constants';
8
+ import { ReactNative } from '../ReactNative';
9
+
10
+ const testDir = 'rn-test';
11
+ const iosIndexJs = 'index.ios.js';
12
+ const appTsx = 'src/App.tsx';
13
+
14
+ const dummyJsContent = 'import React from "react";\n';
15
+
16
+ const testArgs = {
17
+ debug: false,
18
+ integration: Integration.reactNative,
19
+ platform: [Platform.ios],
20
+ quiet: true,
21
+ skipConnect: true,
22
+ uninstall: false,
23
+ url: 'https://not.used',
24
+ };
25
+
26
+ const testAnswers: Answers = {
27
+ shouldConfigurePlatforms: { 'ios': true },
28
+ config: {
29
+ dsn: {
30
+ public: 'dns.public.com',
31
+ },
32
+ },
33
+ };
34
+
35
+ describe('ReactNative', () => {
36
+
37
+ const defaultCwd = process.cwd();
38
+
39
+ beforeEach(() => {
40
+ rimraf.sync(testDir);
41
+ fs.mkdirSync(testDir);
42
+ process.chdir(testDir);
43
+ fs.writeFileSync(iosIndexJs, dummyJsContent);
44
+ fs.mkdirSync('src');
45
+ fs.writeFileSync(appTsx, dummyJsContent);
46
+ });
47
+
48
+ afterEach(() => {
49
+ process.chdir(defaultCwd);
50
+ rimraf.sync(testDir);
51
+ });
52
+
53
+ test('patches js files', async () => {
54
+ const project = new ReactNative(testArgs as Args);
55
+ await project.emit(testAnswers);
56
+
57
+ const patchedIosIndexJs = fs.readFileSync(iosIndexJs, 'utf8');
58
+ const patchedAppTsx = fs.readFileSync(appTsx, 'utf8');
59
+ const expectedPatch = 'import React from "react";\n\n' +
60
+ 'import * as Sentry from \'@sentry/react-native\';\n\n' +
61
+ 'Sentry.init({ \n' +
62
+ ' dsn: \'dns.public.com\', \n' +
63
+ '});\n\n';
64
+ expect(patchedIosIndexJs).toEqual(expectedPatch);
65
+ expect(patchedAppTsx).toEqual(expectedPatch);
66
+ });
67
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "2.0.2",
3
+ "version": "2.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",
@@ -37,14 +37,17 @@
37
37
  },
38
38
  "devDependencies": {
39
39
  "@sentry-internal/eslint-config-sdk": "^6.2.1",
40
+ "@types/glob": "^7.2.0",
40
41
  "@types/inquirer": "^0.0.43",
41
42
  "@types/jest": "^23.3.2",
42
43
  "@types/lodash": "^4.14.144",
43
44
  "@types/node": "^10.11.0",
45
+ "@types/rimraf": "^3.0.2",
44
46
  "@types/semver": "^7.3.7",
45
47
  "eslint": "^7.21.0",
46
48
  "jest": "^26.6.3",
47
49
  "prettier": "^1.14.3",
50
+ "rimraf": "^3.0.2",
48
51
  "ts-jest": "^26.5.5",
49
52
  "ts-node": "^7.0.1",
50
53
  "tslint": "^5.11.0",