@sentry/wizard 3.0.0 → 3.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 +4 -0
- package/bin.ts +9 -2
- package/dist/bin.js +10 -2
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/MergeConfig.js +1 -0
- package/dist/lib/Helper/MergeConfig.js.map +1 -1
- package/dist/lib/Steps/BaseStep.js.map +1 -1
- package/dist/lib/Steps/Initial.js +1 -0
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.js +2 -0
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +1 -0
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -0
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +1 -0
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/Integrations/NextJs.js +1 -0
- package/dist/lib/Steps/Integrations/NextJs.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.js +2 -1
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/dist/lib/Steps/Result.js +1 -0
- package/dist/lib/Steps/Result.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.js +42 -47
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Steps/Welcome.js +1 -0
- package/dist/lib/Steps/Welcome.js.map +1 -1
- package/dist/src/clack-utils.d.ts +40 -0
- package/dist/src/clack-utils.js +329 -0
- package/dist/src/clack-utils.js.map +1 -0
- package/dist/src/nextjs-wizard.d.ts +5 -0
- package/dist/src/nextjs-wizard.js +321 -0
- package/dist/src/nextjs-wizard.js.map +1 -0
- package/dist/src/templates/nextjs-templates.d.ts +13 -0
- package/dist/src/templates/nextjs-templates.js +54 -0
- package/dist/src/templates/nextjs-templates.js.map +1 -0
- package/lib/Helper/MergeConfig.ts +1 -0
- package/lib/Steps/BaseStep.ts +1 -1
- package/lib/Steps/Initial.ts +1 -0
- package/lib/Steps/Integrations/BaseIntegration.ts +2 -0
- package/lib/Steps/Integrations/Cordova.ts +2 -1
- package/lib/Steps/Integrations/Electron.ts +3 -1
- package/lib/Steps/Integrations/MobileProject.ts +1 -0
- package/lib/Steps/Integrations/NextJs.ts +1 -0
- package/lib/Steps/Integrations/ReactNative.ts +3 -2
- package/lib/Steps/Result.ts +1 -0
- package/lib/Steps/WaitForSentry.ts +1 -1
- package/lib/Steps/Welcome.ts +2 -1
- package/package.json +10 -3
- package/src/clack-utils.ts +346 -0
- package/src/nextjs-wizard.ts +422 -0
- package/src/templates/nextjs-templates.ts +252 -0
package/CHANGELOG.md
CHANGED
package/bin.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { DEFAULT_URL, Integration, Platform } from './lib/Constants';
|
|
3
3
|
import { run } from './lib/Setup';
|
|
4
|
+
import { runNextjsWizard } from './src/nextjs-wizard';
|
|
4
5
|
export * from './lib/Setup';
|
|
5
6
|
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
6
8
|
const argv = require('yargs')
|
|
7
9
|
.option('debug', {
|
|
8
10
|
default: false,
|
|
@@ -53,5 +55,10 @@ const argv = require('yargs')
|
|
|
53
55
|
describe: 'A promo code that will be applied during signup',
|
|
54
56
|
}).argv;
|
|
55
57
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
if (argv.i === 'nextjs') {
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
runNextjsWizard({ promoCode: argv['promo-code'] }).catch(console.error);
|
|
61
|
+
} else {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
63
|
+
run(argv);
|
|
64
|
+
}
|
package/dist/bin.js
CHANGED
|
@@ -17,7 +17,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
var Constants_1 = require("./lib/Constants");
|
|
19
19
|
var Setup_1 = require("./lib/Setup");
|
|
20
|
+
var nextjs_wizard_1 = require("./src/nextjs-wizard");
|
|
20
21
|
__exportStar(require("./lib/Setup"), exports);
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
|
|
21
23
|
var argv = require('yargs')
|
|
22
24
|
.option('debug', {
|
|
23
25
|
default: false,
|
|
@@ -65,6 +67,12 @@ var argv = require('yargs')
|
|
|
65
67
|
alias: 'promo-code',
|
|
66
68
|
describe: 'A promo code that will be applied during signup',
|
|
67
69
|
}).argv;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
if (argv.i === 'nextjs') {
|
|
71
|
+
// eslint-disable-next-line no-console
|
|
72
|
+
(0, nextjs_wizard_1.runNextjsWizard)({ promoCode: argv['promo-code'] }).catch(console.error);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
76
|
+
(0, Setup_1.run)(argv);
|
|
77
|
+
}
|
|
70
78
|
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACA,6CAAqE;AACrE,qCAAkC;AAClC,8CAA4B;AAE5B,IAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;KAC1B,MAAM,CAAC,OAAO,EAAE;IACf,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,kDAAkD;IAC5D,IAAI,EAAE,SAAS;CAChB,CAAC;KAC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sC;IACtC,IAAA,+BAAe,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;CACzE;KAAM;IACL,mEAAmE;IACnE,IAAA,WAAG,EAAC,IAAI,CAAC,CAAC;CACX","sourcesContent":["#!/usr/bin/env node\nimport { DEFAULT_URL, Integration, Platform } from './lib/Constants';\nimport { run } from './lib/Setup';\nimport { runNextjsWizard } from './src/nextjs-wizard';\nexport * from './lib/Setup';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = require('yargs')\n .option('debug', {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n })\n .option('uninstall', {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n })\n .option('skip-connect', {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n })\n .option('quiet', {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n })\n .option('i', {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe: 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n })\n .option('p', {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n })\n .option('u', {\n alias: 'url',\n default: DEFAULT_URL,\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n })\n .option('s', {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n })\n .option('promo-code', {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n }).argv;\n\nif (argv.i === 'nextjs') {\n // eslint-disable-next-line no-console\n runNextjsWizard({ promoCode: argv['promo-code'] }).catch(console.error);\n} else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n run(argv);\n}\n"]}
|
|
@@ -8,6 +8,7 @@ function mergeConfigFile(sourcePath, templatePath) {
|
|
|
8
8
|
var templateFile = fs.readFileSync(templatePath, 'utf8');
|
|
9
9
|
var sourceFile = fs.readFileSync(sourcePath, 'utf8');
|
|
10
10
|
var newText = templateFile.replace('// ORIGINAL CONFIG', sourceFile);
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
11
12
|
Function(newText); // check if the file is valid javascript
|
|
12
13
|
fs.writeFileSync(sourcePath, newText);
|
|
13
14
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MergeConfig.js","sourceRoot":"","sources":["../../../lib/Helper/MergeConfig.ts"],"names":[],"mappings":";;;AAAA,uBAAyB;AAEzB,0BAA0B;AAC1B,SAAgB,eAAe,CAC7B,UAAkB,EAClB,YAAoB;IAEpB,IAAI;QACF,IAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAC3D,IAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACvD,IAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;QACvE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC;QAC3D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"MergeConfig.js","sourceRoot":"","sources":["../../../lib/Helper/MergeConfig.ts"],"names":[],"mappings":";;;AAAA,uBAAyB;AAEzB,0BAA0B;AAC1B,SAAgB,eAAe,CAC7B,UAAkB,EAClB,YAAoB;IAEpB,IAAI;QACF,IAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QAC3D,IAAM,UAAU,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACvD,IAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;QACvE,8DAA8D;QAC9D,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,wCAAwC;QAC3D,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC;KACb;IAAC,OAAO,KAAK,EAAE;QACd,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAfD,0CAeC","sourcesContent":["import * as fs from 'fs';\n\n// merges the config files\nexport function mergeConfigFile(\n sourcePath: string,\n templatePath: string,\n): boolean {\n try {\n const templateFile = fs.readFileSync(templatePath, 'utf8');\n const sourceFile = fs.readFileSync(sourcePath, 'utf8');\n const newText = templateFile.replace('// ORIGINAL CONFIG', sourceFile);\n // eslint-disable-next-line @typescript-eslint/no-implied-eval\n Function(newText); // check if the file is valid javascript\n fs.writeFileSync(sourcePath, newText);\n return true;\n } catch (error) {\n return false;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseStep.js","sourceRoot":"","sources":["../../../lib/Steps/BaseStep.ts"],"names":[],"mappings":";;;AAGA,6CAA8C;AAE9C;IAEE,kBAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAD9B,aAAQ,
|
|
1
|
+
{"version":3,"file":"BaseStep.js","sourceRoot":"","sources":["../../../lib/Steps/BaseStep.ts"],"names":[],"mappings":";;;AAGA,6CAA8C;AAE9C;IAEE,kBAA6B,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAD9B,aAAQ,GAAG,KAAK,CAAC;QAEzB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;IAC9B,CAAC;IAEM,wBAAK,GAAZ,UAAa,GAAQ;QACnB,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAA,YAAE,GAAE,CAAC;YACL,IAAA,eAAK,EAAC,GAAG,CAAC,CAAC;YACX,IAAA,YAAE,GAAE,CAAC;SACN;IACH,CAAC;IAGH,eAAC;AAAD,CAAC,AAfD,IAeC;AAfqB,4BAAQ","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport type { Args } from '../Constants';\nimport { debug, nl } from '../Helper/Logging';\n\nexport abstract class BaseStep implements IStep {\n protected _isDebug = false;\n public constructor(protected _argv: Args) {\n this._isDebug = _argv.debug;\n }\n\n public debug(msg: any): void {\n if (this._isDebug) {\n nl();\n debug(msg);\n nl();\n }\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n\nexport interface IStep {\n emit(answers?: Answers): Promise<Answers>;\n}\n"]}
|
|
@@ -75,6 +75,7 @@ var Initial = /** @class */ (function (_super) {
|
|
|
75
75
|
function Initial() {
|
|
76
76
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
77
77
|
}
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
78
79
|
Initial.prototype.emit = function (_answers) {
|
|
79
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
81
|
return __generator(this, function (_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Initial.js","sourceRoot":"","sources":["../../../lib/Steps/Initial.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0BAA4B;AAC5B,2BAA6B;AAE7B,6CAAwC;AACxC,uCAAsC;AAEtC,IAAI,aAAa,GAAQ,EAAE,CAAC;AAC5B,IAAI,gBAAgB,GAAQ,EAAE,CAAC;AAE/B,IAAI;IACF,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,IAA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0BAA0B,CAAC,CAAC;gBAChC,IAAA,aAAG,EACD,mBAAY,CAAC,CAAC,GAAG,CACf,aAAa,EACb,SAAS,EACT,KAAK,CACN,oCAA0B,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,SAAS,EAAE,KAAK,CAAC,CAAE,CACvE,CAAC;gBACF,sBAAO,EAAE,EAAC;;;KACX;IACH,cAAC;AAAD,CAAC,AAbD,CAA6B,mBAAQ,GAapC;AAbY,0BAAO","sourcesContent":["import type { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { dim } from '../Helper/Logging';\nimport { BaseStep } from './BaseStep';\n\nlet wizardPackage: any = {};\nlet sentryCliPackage: any = {};\n\ntry {\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n} catch {\n // We don't need to have this\n}\n\ntry {\n sentryCliPackage = require(path.join(\n path.dirname(require.resolve('@sentry/cli')),\n '..',\n 'package.json',\n ));\n} catch {\n // We don't need to have tahis\n}\n\nexport class Initial extends BaseStep {\n // eslint-disable-next-line @typescript-eslint/require-await\n public async emit(_answers: Answers): Promise<Answers> {\n dim('Running Sentry Wizard...');\n dim(\n `version: ${_.get(\n wizardPackage,\n 'version',\n 'DEV',\n )} | sentry-cli version: ${_.get(sentryCliPackage, 'version', 'DEV')}`,\n );\n return {};\n }\n}\n"]}
|
|
@@ -63,6 +63,7 @@ var BaseIntegration = /** @class */ (function (_super) {
|
|
|
63
63
|
_this.type = _this.construct;
|
|
64
64
|
return _this;
|
|
65
65
|
}
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
66
67
|
BaseIntegration.prototype.uninstall = function (_answers) {
|
|
67
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
68
69
|
return __generator(this, function (_a) {
|
|
@@ -78,6 +79,7 @@ var BaseIntegration = /** @class */ (function (_super) {
|
|
|
78
79
|
BaseIntegration.prototype.shouldConfigure = function (_answers) {
|
|
79
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
80
81
|
return __generator(this, function (_a) {
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
81
83
|
if (this._shouldConfigure) {
|
|
82
84
|
return [2 /*return*/, this._shouldConfigure];
|
|
83
85
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseIntegration.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/BaseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0BAA4B;AAG5B,wCAAuC;AAEvC;IAA8C,mCAAQ;IAIpD,yBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAGb;QAJ4B,WAAK,GAAL,KAAK,CAAM;QAEtC,kEAAkE;QAClE,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,SAAS,CAAC;;IAC7B,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseIntegration.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/BaseIntegration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0BAA4B;AAG5B,wCAAuC;AAEvC;IAA8C,mCAAQ;IAIpD,yBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAGb;QAJ4B,WAAK,GAAL,KAAK,CAAM;QAEtC,kEAAkE;QAClE,KAAI,CAAC,IAAI,GAAG,KAAI,CAAC,SAAS,CAAC;;IAC7B,CAAC;IAED,4DAA4D;IAC/C,mCAAS,GAAtB,UAAuB,QAAiB;;;gBACtC,sBAAO,EAAE,EAAC;;;KACX;IAED;;;;OAIG;IACU,yCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,kEAAkE;gBAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC5D,sBAAO,IAAI,CAAC,gBAAgB,EAAC;;;KAC9B;IAEY,oCAAU,GAAvB,UAAwB,QAAiB;;;;;;wBAErC,KAAA,CAAA,KAAA,CAAC,CAAA,CAAC,IAAI,CAAA;wBACJ,KAAA,CAAA,KAAA,CAAC,CAAA,CAAC,MAAM,CAAA;wBACN,qBAAM,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAA;4BAH1C,sBAAO,CACL,cACE,cACE,SAAoC,EACpC,UAAC,MAAe,IAAK,OAAA,MAAM,EAAN,CAAM,EAC5B,EACF,CAAC,MAAM,GAAG,CAAC,CACb,EAAC;;;;KACH;IAGH,sBAAC;AAAD,CAAC,AAzCD,CAA8C,mBAAQ,GAyCrD;AAzCqB,0CAAe","sourcesContent":["import type { Answers } from 'inquirer';\nimport * as _ from 'lodash';\n\nimport type { Args } from '../../Constants';\nimport { BaseStep } from '../BaseStep';\n\nexport abstract class BaseIntegration extends BaseStep {\n public type: string;\n protected _shouldConfigure: Promise<Answers>;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n // @ts-ignore property construct does not exist on BaseIntegration\n this.type = this.construct;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n public async uninstall(_answers: Answers): Promise<Answers> {\n return {};\n }\n\n /**\n * This can be used for example for platform:boolean to determine\n * if we should configure iOS/Android.\n * Basically this will be merged into answers so it can be checked by a later step.\n */\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n this._shouldConfigure = Promise.resolve({ platform: true });\n return this._shouldConfigure;\n }\n\n public async shouldEmit(_answers: Answers): Promise<boolean> {\n return (\n _.keys(\n _.pickBy(\n await this.shouldConfigure(_answers),\n (active: boolean) => active,\n ),\n ).length > 0\n );\n }\n\n public abstract emit(answers: Answers): Promise<Answers>;\n}\n"]}
|
|
@@ -107,6 +107,7 @@ var Cordova = /** @class */ (function (_super) {
|
|
|
107
107
|
return __awaiter(this, void 0, void 0, function () {
|
|
108
108
|
var result;
|
|
109
109
|
return __generator(this, function (_a) {
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
110
111
|
if (this._shouldConfigure) {
|
|
111
112
|
return [2 /*return*/, this._shouldConfigure];
|
|
112
113
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cordova.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Cordova.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AAEzB,2BAA6B;AAG7B,0CAA8E;AAC9E,gDAA6C;AAC7C,oDAAmD;AACnD,qDAAoD;AAEpD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B;IAA6B,2BAAe;IAK1C,iBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAEb;QAH4B,WAAK,GAAL,KAAK,CAAM;QAH9B,mBAAa,GAAW,WAAW,CAAC;QACpC,mBAAa,GAAa,CAAC,GAAG,CAAC,CAAC;QAIxC,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,sBAAI,GAAjB,UAAkB,OAAgB;;;;;;wBAChC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;4BACxB,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;yBAChC;wBAEK,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,0BAA0B,CACpE,OAAO,CACR,CAAC;wBAEF,qBAAM,IAAA,wBAAiB,EACrB,UAAG,IAAI,CAAC,aAAa,qCAAkC,EACvD,IAAI,CAAC,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C,AAxQD,CAA6B,iCAAe,GAwQ3C;AAxQY,0BAAO","sourcesContent":["import * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { exists, matchesContent, patchMatchingFile } from '../../Helper/File';\nimport { green } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst xcode = require('xcode');\n\nexport class Cordova extends BaseIntegration {\n protected _sentryCli: SentryCli;\n protected _folderPrefix: string = 'platforms';\n protected _pluginFolder: string[] = ['.'];\n\n public 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\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n await patchMatchingFile(\n `${this._folderPrefix}/ios/*.xcodeproj/project.pbxproj`,\n this._patchXcodeProj.bind(this),\n );\n\n await this._addSentryProperties(sentryCliProperties);\n green('Successfully set up for cordova');\n\n return {};\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n let result = false;\n if (!exists(path.join('sentry.properties'))) {\n result = true;\n this.debug('sentry.properties not exists');\n }\n\n if (\n !matchesContent('**/*.xcodeproj/project.pbxproj', /SENTRY_PROPERTIES/gi)\n ) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj 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 result = !result;\n }\n\n this._shouldConfigure = Promise.resolve({ cordova: result });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private _unpatchXcodeProj(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 this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\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 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(/SENTRY_PROPERTIES/) ||\n script.shellScript.match(/SENTRY_FRAMEWORK_PATCH/)\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 _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<void | 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 this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n this._addNewXcodeBuildPhaseForStripping(buildScripts, proj);\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 _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/SENTRY_PROPERTIES/)) {\n return;\n }\n }\n const cwd = path.join(process.cwd(), 'sentry.properties');\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n // eslint-disable-next-line prefer-template\n 'echo \"warning: uploading debug symbols - set SENTRY_SKIP_DSYM_UPLOAD=true to skip this\"\\\\n' +\n 'if [ -n \"$SENTRY_SKIP_DSYM_UPLOAD\" ]; then\\\\n' +\n ' echo \"warning: skipping debug symbol upload\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'export SENTRY_PROPERTIES=' +\n cwd +\n '\\\\n' +\n 'function getProperty {\\\\n' +\n ' PROP_KEY=$1\\\\n' +\n ' PROP_VALUE=`cat $SENTRY_PROPERTIES | grep \"$PROP_KEY\" | cut -d\\'=\\' -f2`\\\\n' +\n ' echo $PROP_VALUE\\\\n' +\n '}\\\\n' +\n 'if [ ! -f $SENTRY_PROPERTIES ]; then\\\\n' +\n ' echo \"warning: SENTRY: sentry.properties file not found! Skipping symbol upload.\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'echo \"# Reading property from $SENTRY_PROPERTIES\"\\\\n' +\n 'SENTRY_CLI=$(getProperty \"cli.executable\")\\\\n' +\n 'SENTRY_COMMAND=\"../../$SENTRY_CLI upload-dsym\"\\\\n' +\n '$SENTRY_COMMAND',\n },\n );\n }\n\n private _addNewXcodeBuildPhaseForStripping(\n buildScripts: any,\n proj: any,\n ): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/SENTRY_FRAMEWORK_PATCH/)) {\n return;\n }\n }\n // http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Sentry strip unused archs from Framework',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n '# SENTRY_FRAMEWORK_PATCH \\\\n' +\n 'echo \"warning: patching framework - set SENTRY_SKIP_FRAMEWORK_PATCH=true to skip this\"\\\\n' +\n 'if [ -n \"$SENTRY_SKIP_FRAMEWORK_PATCH\" ]; then\\\\n' +\n ' echo \"warning: skipping framework patch\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'APP_PATH=\"${TARGET_BUILD_DIR}/${WRAPPER_NAME}\"\\\\n' +\n 'find \"$APP_PATH\" -name \\'Sentry*.framework\\' -type d | while read -r FRAMEWORK\\\\n' +\n 'do\\\\n' +\n 'FRAMEWORK_EXECUTABLE_NAME=$(defaults read \"$FRAMEWORK/Info.plist\" CFBundleExecutable)\\\\n' +\n 'FRAMEWORK_EXECUTABLE_PATH=\"$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME\"\\\\n' +\n 'echo \"Executable is $FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'EXTRACTED_ARCHS=()\\\\n' +\n 'for ARCH in $ARCHS\\\\n' +\n 'do\\\\n' +\n 'echo \"Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME\"\\\\n' +\n 'lipo -extract \"$ARCH\" \"$FRAMEWORK_EXECUTABLE_PATH\" -o \"$FRAMEWORK_EXECUTABLE_PATH-$ARCH\"\\\\n' +\n 'EXTRACTED_ARCHS+=(\"$FRAMEWORK_EXECUTABLE_PATH-$ARCH\")\\\\n' +\n 'done\\\\n' +\n 'echo \"Merging extracted architectures: ${ARCHS}\"\\\\n' +\n 'lipo -o \"$FRAMEWORK_EXECUTABLE_PATH-merged\" -create \"${EXTRACTED_ARCHS[@]}\"\\\\n' +\n 'rm \"${EXTRACTED_ARCHS[@]}\"\\\\n' +\n 'echo \"Replacing original executable with thinned version\"\\\\n' +\n 'rm \"$FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'mv \"$FRAMEWORK_EXECUTABLE_PATH-merged\" \"$FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'done',\n },\n );\n }\n\n private _addSentryProperties(properties: any): Promise<void> {\n let rv = Promise.resolve();\n const fn = path.join('sentry.properties');\n if (exists(fn)) {\n return rv;\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Cordova.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Cordova.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AAEzB,2BAA6B;AAG7B,0CAA8E;AAC9E,gDAA6C;AAC7C,oDAAmD;AACnD,qDAAoD;AAEpD,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAE/B;IAA6B,2BAAe;IAK1C,iBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAEb;QAH4B,WAAK,GAAL,KAAK,CAAM;QAH9B,mBAAa,GAAG,WAAW,CAAC;QAC5B,mBAAa,GAAa,CAAC,GAAG,CAAC,CAAC;QAIxC,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,sBAAI,GAAjB,UAAkB,OAAgB;;;;;;wBAChC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;4BACxB,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;yBAChC;wBAEK,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,0BAA0B,CACpE,OAAO,CACR,CAAC;wBAEF,qBAAM,IAAA,wBAAiB,EACrB,UAAG,IAAI,CAAC,aAAa,qCAAkC,EACvD,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,CAAC;IACH,cAAC;AAAD,CAAC,AAzQD,CAA6B,iCAAe,GAyQ3C;AAzQY,0BAAO","sourcesContent":["import * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { exists, matchesContent, patchMatchingFile } from '../../Helper/File';\nimport { green } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst xcode = require('xcode');\n\nexport class Cordova extends BaseIntegration {\n protected _sentryCli: SentryCli;\n protected _folderPrefix = 'platforms';\n protected _pluginFolder: string[] = ['.'];\n\n public 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\n const sentryCliProperties = this._sentryCli.convertAnswersToProperties(\n answers,\n );\n\n await patchMatchingFile(\n `${this._folderPrefix}/ios/*.xcodeproj/project.pbxproj`,\n this._patchXcodeProj.bind(this),\n );\n\n await this._addSentryProperties(sentryCliProperties);\n green('Successfully set up for cordova');\n\n return {};\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n let result = false;\n if (!exists(path.join('sentry.properties'))) {\n result = true;\n this.debug('sentry.properties not exists');\n }\n\n if (\n !matchesContent('**/*.xcodeproj/project.pbxproj', /SENTRY_PROPERTIES/gi)\n ) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj 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 result = !result;\n }\n\n this._shouldConfigure = Promise.resolve({ cordova: result });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private _unpatchXcodeProj(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 this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\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 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(/SENTRY_PROPERTIES/) ||\n script.shellScript.match(/SENTRY_FRAMEWORK_PATCH/)\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 _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<void | 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 this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n this._addNewXcodeBuildPhaseForStripping(buildScripts, proj);\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 _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/SENTRY_PROPERTIES/)) {\n return;\n }\n }\n const cwd = path.join(process.cwd(), 'sentry.properties');\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n // eslint-disable-next-line prefer-template\n 'echo \"warning: uploading debug symbols - set SENTRY_SKIP_DSYM_UPLOAD=true to skip this\"\\\\n' +\n 'if [ -n \"$SENTRY_SKIP_DSYM_UPLOAD\" ]; then\\\\n' +\n ' echo \"warning: skipping debug symbol upload\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'export SENTRY_PROPERTIES=' +\n cwd +\n '\\\\n' +\n 'function getProperty {\\\\n' +\n ' PROP_KEY=$1\\\\n' +\n ' PROP_VALUE=`cat $SENTRY_PROPERTIES | grep \"$PROP_KEY\" | cut -d\\'=\\' -f2`\\\\n' +\n ' echo $PROP_VALUE\\\\n' +\n '}\\\\n' +\n 'if [ ! -f $SENTRY_PROPERTIES ]; then\\\\n' +\n ' echo \"warning: SENTRY: sentry.properties file not found! Skipping symbol upload.\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'echo \"# Reading property from $SENTRY_PROPERTIES\"\\\\n' +\n 'SENTRY_CLI=$(getProperty \"cli.executable\")\\\\n' +\n 'SENTRY_COMMAND=\"../../$SENTRY_CLI upload-dsym\"\\\\n' +\n '$SENTRY_COMMAND',\n },\n );\n }\n\n private _addNewXcodeBuildPhaseForStripping(\n buildScripts: any,\n proj: any,\n ): void {\n for (const script of buildScripts) {\n if (script.shellScript.match(/SENTRY_FRAMEWORK_PATCH/)) {\n return;\n }\n }\n // http://ikennd.ac/blog/2015/02/stripping-unwanted-architectures-from-dynamic-libraries-in-xcode/\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Sentry strip unused archs from Framework',\n null,\n {\n shellPath: '/bin/sh',\n shellScript:\n '# SENTRY_FRAMEWORK_PATCH \\\\n' +\n 'echo \"warning: patching framework - set SENTRY_SKIP_FRAMEWORK_PATCH=true to skip this\"\\\\n' +\n 'if [ -n \"$SENTRY_SKIP_FRAMEWORK_PATCH\" ]; then\\\\n' +\n ' echo \"warning: skipping framework patch\"\\\\n' +\n ' exit 0\\\\n' +\n 'fi\\\\n' +\n 'APP_PATH=\"${TARGET_BUILD_DIR}/${WRAPPER_NAME}\"\\\\n' +\n 'find \"$APP_PATH\" -name \\'Sentry*.framework\\' -type d | while read -r FRAMEWORK\\\\n' +\n 'do\\\\n' +\n 'FRAMEWORK_EXECUTABLE_NAME=$(defaults read \"$FRAMEWORK/Info.plist\" CFBundleExecutable)\\\\n' +\n 'FRAMEWORK_EXECUTABLE_PATH=\"$FRAMEWORK/$FRAMEWORK_EXECUTABLE_NAME\"\\\\n' +\n 'echo \"Executable is $FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'EXTRACTED_ARCHS=()\\\\n' +\n 'for ARCH in $ARCHS\\\\n' +\n 'do\\\\n' +\n 'echo \"Extracting $ARCH from $FRAMEWORK_EXECUTABLE_NAME\"\\\\n' +\n 'lipo -extract \"$ARCH\" \"$FRAMEWORK_EXECUTABLE_PATH\" -o \"$FRAMEWORK_EXECUTABLE_PATH-$ARCH\"\\\\n' +\n 'EXTRACTED_ARCHS+=(\"$FRAMEWORK_EXECUTABLE_PATH-$ARCH\")\\\\n' +\n 'done\\\\n' +\n 'echo \"Merging extracted architectures: ${ARCHS}\"\\\\n' +\n 'lipo -o \"$FRAMEWORK_EXECUTABLE_PATH-merged\" -create \"${EXTRACTED_ARCHS[@]}\"\\\\n' +\n 'rm \"${EXTRACTED_ARCHS[@]}\"\\\\n' +\n 'echo \"Replacing original executable with thinned version\"\\\\n' +\n 'rm \"$FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'mv \"$FRAMEWORK_EXECUTABLE_PATH-merged\" \"$FRAMEWORK_EXECUTABLE_PATH\"\\\\n' +\n 'done',\n },\n );\n }\n\n private _addSentryProperties(properties: any): Promise<void> {\n let rv = Promise.resolve();\n const fn = path.join('sentry.properties');\n if (exists(fn)) {\n return rv;\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n}\n"]}
|
|
@@ -86,6 +86,7 @@ var Electron = /** @class */ (function (_super) {
|
|
|
86
86
|
_this._sentryCli = new SentryCli_1.SentryCli(_this._argv);
|
|
87
87
|
return _this;
|
|
88
88
|
}
|
|
89
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
89
90
|
Electron.prototype.emit = function (answers) {
|
|
90
91
|
return __awaiter(this, void 0, void 0, function () {
|
|
91
92
|
var dsn, sentryCliProps;
|
|
@@ -109,6 +110,7 @@ var Electron = /** @class */ (function (_super) {
|
|
|
109
110
|
return __generator(this, function (_a) {
|
|
110
111
|
switch (_a.label) {
|
|
111
112
|
case 0:
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
112
114
|
if (this._shouldConfigure) {
|
|
113
115
|
return [2 /*return*/, this._shouldConfigure];
|
|
114
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Electron.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Electron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uBAAyB;AAEzB,qCAAkC;AAClC,0BAA4B;AAC5B,2BAA6B;AAG7B,gDAA8D;AAC9D,oDAAmD;AACnD,qDAAoD;AAEpD,IAAM,2BAA2B,GAAG,OAA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AK,CAAC,EAC3D;YACA,IAAA,aAAG,EAAC,iBAAK,WAAW,gCAA6B,CAAC,CAAC;YACnD,IAAA,aAAG,EAAC,mCAAmC,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC;SACd;aAAM,IACL,UAAU;YACV,UAAU,GAAG,oBAAoB;YACjC,aAAa,GAAG,oBAAoB,EACpC;YACA,IAAA,aAAG,EACD,2CAA+B,WAAW,0BAAgB,2BAA2B,YAAS,CAC/F,CAAC;YACF,OAAO,KAAK,CAAC;SACd;aAAM;YACL,oEAAoE;YACpE,UAAU;gBACR,CAAC,CAAC,IAAA,eAAK,EAAC,iBAAK,WAAW,gBAAM,UAAU,kBAAe,CAAC;gBACxD,CAAC,CAAC,IAAA,eAAK,EAAC,iBAAK,WAAW,kBAAe,CAAC,CAAC;YAC3C,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IACH,eAAC;AAAD,CAAC,AAxGD,CAA8B,iCAAe,GAwG5C;AAxGY,4BAAQ","sourcesContent":["import * as fs from 'fs';\nimport type { Answers} from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst MIN_ELECTRON_VERSION_STRING = '2.0.0';\nconst MIN_ELECTRON_VERSION = parseInt(\n MIN_ELECTRON_VERSION_STRING.replace(/\\D+/g, ''),\n 10,\n);\n\nconst CODE_EXAMPLE = `const Sentry = require('@sentry/electron');\n\nSentry.init({\n dsn: '___DSN___',\n});`;\n\n\nlet appPackage: any = {};\n\nfunction printExample(example: string, title = ''): void {\n if (title) {\n l(title);\n }\n\n nl();\n dim(example.replace(/^/gm, ' '));\n nl();\n}\n\ntry {\n appPackage = require(path.join(process.cwd(), 'package.json'));\n} catch {\n // We don't need to have this\n}\n\nexport class Electron extends BaseIntegration {\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this._sentryCli = new SentryCli(this._argv);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n public async emit(answers: Answers): Promise<Answers> {\n const dsn = _.get(answers, ['config', 'dsn', 'public'], null);\n nl();\n\n const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);\n fs.writeFileSync(\n './sentry.properties',\n this._sentryCli.dumpProperties(sentryCliProps),\n );\n green('Successfully created sentry.properties');\n nl();\n\n printExample(\n CODE_EXAMPLE.replace('___DSN___', dsn),\n 'Put these lines in to your main and renderer processes to setup Sentry:',\n );\n\n l('For more information, see https://docs.sentry.io/clients/electron/');\n nl();\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n let success = true;\n nl();\n\n success =\n this._checkDep('electron', MIN_ELECTRON_VERSION_STRING) && success;\n success = this._checkDep('@sentry/electron') && success;\n\n let continued: Answers = { continue: true };\n if (!success && !this._argv.quiet) {\n continued = await prompt({\n message:\n 'There were errors during your project checkup, do you still want to continue?',\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n }\n\n nl();\n\n if (!_.get(continued, 'continue', false)) {\n throw new Error('Please install the required dependencies to continue.');\n }\n\n this._shouldConfigure = Promise.resolve({ electron: true });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private _checkDep(packageName: string, minVersion?: string): boolean {\n const depVersion = parseInt(\n _.get(appPackage, ['dependencies', packageName], '0').replace(/\\D+/g, ''),\n 10,\n );\n const devDepVersion = parseInt(\n _.get(appPackage, ['devDependencies', packageName], '0').replace(\n /\\D+/g,\n '',\n ),\n 10,\n );\n\n if (\n !_.get(appPackage, `dependencies.${packageName}`, false) &&\n !_.get(appPackage, `devDependencies.${packageName}`, false)\n ) {\n red(`✗ ${packageName} isn't in your dependencies`);\n red(' please install it with yarn/npm');\n return false;\n } else if (\n minVersion &&\n depVersion < MIN_ELECTRON_VERSION &&\n devDepVersion < MIN_ELECTRON_VERSION\n ) {\n red(\n `✗ Your installed version of ${packageName} is to old, >${MIN_ELECTRON_VERSION_STRING} needed`,\n );\n return false;\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n minVersion\n ? green(`✓ ${packageName} > ${minVersion} is installed`)\n : green(`✓ ${packageName} is installed`);\n return true;\n }\n }\n}\n"]}
|
|
@@ -93,6 +93,7 @@ var MobileProject = /** @class */ (function (_super) {
|
|
|
93
93
|
case 3:
|
|
94
94
|
_a._platforms = _b;
|
|
95
95
|
shouldConfigurePlatforms = {};
|
|
96
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
96
97
|
_.keys(Constants_1.Platform).forEach(function (platform) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
98
|
var _a, _b, _c;
|
|
98
99
|
return __generator(this, function (_d) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileProject.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/MobileProject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAClC,0BAA4B;AAE5B,6CAA+D;AAC/D,gDAA2C;AAC3C,qDAAoD;AAEpD;IAA4C,iCAAe;IAA3D;;
|
|
1
|
+
{"version":3,"file":"MobileProject.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/MobileProject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qCAAkC;AAClC,0BAA4B;AAE5B,6CAA+D;AAC/D,gDAA2C;AAC3C,qDAAoD;AAEpD;IAA4C,iCAAe;IAA3D;;IA4DA,CAAC;IAzDQ,oCAAY,GAAnB,UAAoB,OAAgB;QAClC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,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,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,EAAA;;wCAA7C,KAAA,SAA6C,CAAA;;;wCAC7C,KAAA,KAAK,CAAA;;;wCAHX,MAAkC,KAGvB,CAAC;wCACZ,IACE,wBAAwB,CAAC,QAAQ,CAAC,KAAK,KAAK;4CAC5C,IAAI,CAAC,KAAK,CAAC,SAAS,KAAK,KAAK,EAC9B;4CACA,IAAA,aAAG,EAAC,6BAAsB,QAAQ,CAAE,CAAC,CAAC;yCACvC;;;;6BACF,CAAC,CAAC;wBACH,sBAAO,EAAE,wBAAwB,0BAAA,EAAE,EAAC;;;;KACrC;IAES,yCAAiB,GAA3B;QACE,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;SAClD;QACD,OAAO,IAAA,iBAAM,EAAC;YACZ;gBACE,OAAO,EAAE,IAAA,8BAAkB,GAAE;gBAC7B,OAAO,EAAE,0CAA0C;gBACnD,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,UAAU;aACjB;SACF,CAAC,CAAC;IACL,CAAC;IAKH,oBAAC;AAAD,CAAC,AA5DD,CAA4C,iCAAe,GA4D1D;AA5DqB,sCAAa","sourcesContent":["import type { Answers} from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\n\nimport { getPlatformChoices, Platform } from '../../Constants';\nimport { dim } from '../../Helper/Logging';\nimport { BaseIntegration } from './BaseIntegration';\n\nexport abstract class MobileProject extends BaseIntegration {\n protected _platforms: Platform[];\n\n public getPlatforms(answers: Answers): string[] {\n if (!_.has(answers, 'shouldConfigurePlatforms')) {\n throw new Error('No platform selected');\n }\n const shouldConfigurePlatforms = _.get(answers, 'shouldConfigurePlatforms');\n return _.keys(\n _.pickBy(shouldConfigurePlatforms, (active: boolean) => active),\n );\n }\n\n public async shouldConfigure(answers: Answers): Promise<Answers> {\n if (_.get(answers, 'shouldConfigurePlatforms')) {\n return _.get(answers, 'shouldConfigurePlatforms');\n }\n const isPlatformSet =\n this._argv.platform &&\n Array.isArray(this._argv.platform) &&\n this._argv.platform.length;\n\n this._platforms = isPlatformSet\n ? this._argv.platform\n : (await this._platformSelector()).platform;\n\n const shouldConfigurePlatforms: any = {};\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n _.keys(Platform).forEach(async (platform: Platform) => {\n shouldConfigurePlatforms[platform] =\n _.indexOf(this._platforms, platform) >= 0\n ? await this._shouldConfigurePlatform(platform)\n : false;\n if (\n shouldConfigurePlatforms[platform] === false &&\n this._argv.uninstall === false\n ) {\n dim(`will not configure ${platform}`);\n }\n });\n return { shouldConfigurePlatforms };\n }\n\n protected _platformSelector(): Promise<Answers> {\n if (this._argv.quiet) {\n throw new Error('You need to choose a platform');\n }\n return prompt([\n {\n choices: getPlatformChoices(),\n message: 'Select the platforms you like to set up:',\n name: 'platform',\n type: 'checkbox',\n },\n ]);\n }\n\n protected abstract _shouldConfigurePlatform(\n platform: Platform,\n ): Promise<boolean>;\n}\n"]}
|
|
@@ -163,6 +163,7 @@ var NextJs = /** @class */ (function (_super) {
|
|
|
163
163
|
return __generator(this, function (_a) {
|
|
164
164
|
switch (_a.label) {
|
|
165
165
|
case 0:
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
166
167
|
if (this._shouldConfigure) {
|
|
167
168
|
return [2 /*return*/, this._shouldConfigure];
|
|
168
169
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+BAA0B;AAC1B,uBAAyB;AAEzB,qCAAkC;AAClC,0BAA4B;AAC5B,2BAA6B;AAG7B,gDAAgE;AAChE,wDAA2D;AAC3D,gDAA2D;AA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AAE,CAAC;;;wBAIC,gBAAgB,GAAG,IAAI,CAAC,cAAc,CAC1C,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,EACvB,CAAC,CAAC,EACF,CAAC,EACD,UAAU,CACX,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;wBACN,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;wBACrE,wCAAwC;wBACxC,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;wBACrE,qBAAM,IAAI,CAAC,eAAe,CACxB,gBAAgB,EAChB,oDAAoD,CACrD,EAAA;;wBAHD,SAGC,CAAC;wBAEI,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAClC,eAAe,EACf,yBAAyB,CAC1B,CAAC;6BAEE,IAAA,6BAAe,EAAC,eAAe,EAAE,kBAAkB,CAAC,EAApD,wBAAoD;wBACtD,IAAA,eAAK,EACH,mBAAa,YAAY,yCAAgC,YAAY,+CAA8C;4BACjH,0JAA0J,CAC7J,CAAC;wBACF,IAAA,YAAE,GAAE,CAAC;;;wBAEL,6FAA6F;wBAC7F,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;wBACjD,qBAAM,IAAI,CAAC,eAAe,CACxB,iBAAiB,EACjB,2DAA2D,CAC5D,EAAA;;wBAHD,SAGC,CAAC;wBACF,IAAA,aAAG,EACD,4BAAsB,YAAY,4BAAoB,iBAAiB,SAAO;4BAC5E,4FAA4F,CAC/F,CAAC;wBACF,IAAA,YAAE,GAAE,CAAC;;;;;;KAGV;IACH,aAAC;AAAD,CAAC,AAtXD,CAA4B,iCAAe,GAsX1C;AAtXY,wBAAM","sourcesContent":["/* eslint-disable max-lines */\nimport Chalk from 'chalk';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { debug, green, l, nl, red } from '../../Helper/Logging';\nimport { mergeConfigFile } from '../../Helper/MergeConfig';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport { getPackageMangerChoice } from '../../Helper/PackageManager';\nimport type { SentryCliProps } from '../../Helper/SentryCli';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <14.0.0';\nconst COMPATIBLE_SDK_VERSIONS = '>=7.3.0';\nconst PROPERTIES_FILENAME = 'sentry.properties';\nconst SENTRYCLIRC_FILENAME = '.sentryclirc';\nconst GITIGNORE_FILENAME = '.gitignore';\nconst CONFIG_DIR = 'configs/';\nconst MERGEABLE_CONFIG_INFIX = 'wizardcopy';\n\n// for those files which can go in more than one place, the list of places they\n// could go (the first one which works will be used)\nconst TEMPLATE_DESTINATIONS: { [key: string]: string[] } = {\n '_error.js': ['pages', 'src/pages'],\n 'next.config.js': ['.'],\n 'sentry.server.config.js': ['.'],\n 'sentry.client.config.js': ['.'],\n 'sentry.edge.config.js': ['.'],\n};\n\nlet appPackage: any = {};\n\ntry {\n appPackage = require(path.join(process.cwd(), 'package.json'));\n} catch {\n // We don't need to have this\n}\n\nexport class NextJs extends BaseIntegration {\n protected _sentryCli: SentryCli;\n\n public 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 const dsn = _.get(answers, ['config', 'dsn', 'public'], null);\n nl();\n\n const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);\n await this._createSentryCliConfig(sentryCliProps);\n\n const templateDirectory = path.join(__dirname, '..', '..', '..', 'NextJs');\n const configDirectory = path.join(templateDirectory, CONFIG_DIR);\n\n if (fs.existsSync(configDirectory)) {\n await this._createNextConfig(configDirectory, dsn);\n } else {\n debug(\n `Couldn't find ${configDirectory}, probably because you ran this from inside of \\`/lib\\` rather than \\`/dist\\``,\n );\n nl();\n }\n\n const selectedProjectSlug: string | null = answers.config?.project?.slug;\n if (selectedProjectSlug) {\n const hasFirstEvent = answers.wizard?.projects?.find?.(\n (p: { slug: string }) => p.slug === selectedProjectSlug,\n )?.firstEvent;\n if (!hasFirstEvent) {\n await this._setTemplate(\n templateDirectory,\n 'sentry_sample_error.js',\n ['pages', 'src/pages'],\n dsn,\n );\n l(\n Chalk.bgYellowBright(`\n|------------------------------------------------------------------------|\n| Installation Complete |\n| To verify your installation and finish onboarding, launch your Next.js |\n| application, navigate to http://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\n`),\n );\n }\n }\n\n l(\n 'For more information, see https://docs.sentry.io/platforms/javascript/guides/nextjs/',\n );\n nl();\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n nl();\n\n let userAnswers: Answers = { continue: true };\n const hasCompatibleNextjsVersion = checkPackageVersion(\n appPackage,\n 'next',\n COMPATIBLE_NEXTJS_VERSIONS,\n true,\n );\n\n const packageManager = getPackageMangerChoice();\n const hasSdkInstalled = this._hasPackageInstalled('@sentry/nextjs');\n\n let hasCompatibleSdkVersion = false;\n // if no package but we have nextjs, let's add it if we can\n if (!hasSdkInstalled && packageManager && hasCompatibleNextjsVersion) {\n await packageManager.installPackage('@sentry/nextjs');\n // can assume it's compatible since we just installed it\n hasCompatibleSdkVersion = true;\n } else {\n // otherwise, let's check the version and spit out the appropriate error\n hasCompatibleSdkVersion = checkPackageVersion(\n appPackage,\n '@sentry/nextjs',\n COMPATIBLE_SDK_VERSIONS,\n true,\n );\n }\n const hasAllPackagesCompatible =\n hasCompatibleNextjsVersion && hasCompatibleSdkVersion;\n\n if (!hasAllPackagesCompatible && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n 'There were errors during your project checkup, do you still want to continue?',\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n }\n\n nl();\n\n if (!userAnswers['continue']) {\n throw new Error('Please install the required dependencies to continue.');\n }\n\n this._shouldConfigure = Promise.resolve({ nextjs: true });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private async _createSentryCliConfig(\n cliProps: SentryCliProps,\n ): Promise<void> {\n const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;\n\n /**\n * To not commit the auth token to the VCS, instead of adding it to the\n * properties file (like the rest of props), it's added to the Sentry CLI\n * config, which is added to the gitignore. This way makes the properties\n * file safe to commit without exposing any auth tokens.\n */\n if (authToken) {\n try {\n await fs.promises.appendFile(\n SENTRYCLIRC_FILENAME,\n this._sentryCli.dumpConfig({ auth: { token: authToken } }),\n );\n green(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);\n } catch {\n red(\n `⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +\n `please add it to identify your user account:\\n${authToken}`,\n );\n nl();\n }\n } else {\n red(\n `⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`,\n );\n l(\n 'To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/',\n );\n l(\n 'To learn how to configure Sentry CLI, visit ' +\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n\n await this._addToGitignore(\n SENTRYCLIRC_FILENAME,\n `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, ` +\n 'please add it to not commit your auth key.',\n );\n\n try {\n await fs.promises.writeFile(\n `./${PROPERTIES_FILENAME}`,\n this._sentryCli.dumpProperties(cliPropsToWrite),\n );\n green('✓ Successfully created sentry.properties');\n } catch {\n red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);\n l(\n 'See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n nl();\n }\n\n private async _addToGitignore(\n filepath: string,\n errorMsg: string,\n ): Promise<void> {\n /**\n * Don't check whether the given file is ignored because:\n * 1. It's tricky to check it without git.\n * 2. Git might not be installed or accessible.\n * 3. It's convenient to use a module to interact with git, but it would\n * increase the size x2 approximately. Docs say to run the Wizard without\n * installing it, and duplicating the size would slow the set-up down.\n * 4. The Wizard is meant to be run once.\n * 5. A message is logged informing users it's been added to the gitignore.\n * 6. It will be added to the gitignore as many times as it runs - not a big\n * deal.\n * 7. It's straightforward to remove it from the gitignore.\n */\n try {\n await fs.promises.appendFile(\n GITIGNORE_FILENAME,\n `\\n# Sentry\\n${filepath}\\n`,\n );\n green(`✓ ${filepath} added to ${GITIGNORE_FILENAME}`);\n } catch {\n red(errorMsg);\n }\n }\n\n private async _createNextConfig(\n configDirectory: string,\n dsn: any,\n ): Promise<void> {\n const templates = fs.readdirSync(configDirectory);\n // next.config.template.js used for merging next.config.js , not its own template,\n // so it shouldn't have a setTemplate call\n const filteredTemplates = templates.filter(\n (template) => template !== 'next.config.template.js',\n );\n for (const template of filteredTemplates) {\n await this._setTemplate(\n configDirectory,\n template,\n TEMPLATE_DESTINATIONS[template],\n dsn,\n );\n }\n red(\n '⚠ Performance monitoring is enabled capturing 100% of transactions.\\n' +\n ' Learn more in https://docs.sentry.io/product/performance/',\n );\n nl();\n }\n\n private async _setTemplate(\n configDirectory: string,\n templateFile: string,\n destinationOptions: string[],\n dsn: string,\n ): Promise<void> {\n const templatePath = path.join(configDirectory, templateFile);\n\n for (const destinationDir of destinationOptions) {\n if (!fs.existsSync(destinationDir)) {\n continue;\n }\n const destinationPath = path.join(destinationDir, templateFile);\n // in case the file in question already exists, we'll make a copy with\n // `MERGEABLE_CONFIG_INFIX` inserted just before the extension, so as not\n // to overwrite the existing file\n const mergeableFilePath = path.join(\n destinationDir,\n this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n MERGEABLE_CONFIG_INFIX,\n ).join('.'),\n );\n\n if (templateFile === 'next.config.js') {\n await this._mergeNextConfig(\n destinationPath,\n templatePath,\n destinationDir,\n templateFile,\n configDirectory,\n mergeableFilePath,\n );\n return;\n } else {\n if (!fs.existsSync(destinationPath)) {\n this._fillAndCopyTemplate(templatePath, destinationPath, dsn);\n } else if (!fs.existsSync(mergeableFilePath)) {\n this._fillAndCopyTemplate(templatePath, mergeableFilePath, dsn);\n red(\n `File \\`${templateFile}\\` already exists, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please merge those files.',\n );\n nl();\n } else {\n red(\n `Both \\`${templateFile}\\` and \\`${mergeableFilePath}\\` already exist.\\n` +\n 'Please merge those files.',\n );\n nl();\n }\n return;\n }\n }\n\n red(\n `Could not find appropriate destination for \\`${templateFile}\\`. Tried: ${destinationOptions}.`,\n );\n nl();\n }\n\n private _fillAndCopyTemplate(\n sourcePath: string,\n targetPath: string,\n dsn: string,\n ): void {\n const templateContent = fs.readFileSync(sourcePath).toString();\n const filledTemplate = templateContent.replace('___DSN___', dsn);\n fs.writeFileSync(targetPath, filledTemplate);\n }\n\n private _hasPackageInstalled(packageName: string): boolean {\n const depsVersion = _.get(appPackage, ['dependencies', packageName]);\n const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);\n return !!depsVersion || !!devDepsVersion;\n }\n\n private _spliceInPlace(\n arr: Array<any>,\n start: number,\n deleteCount: number,\n ...inserts: any[]\n ): Array<any> {\n arr.splice(start, deleteCount, ...inserts);\n return arr;\n }\n\n private async _mergeNextConfig(\n destinationPath: string,\n templatePath: string,\n destinationDir: string,\n templateFile: string,\n configDirectory: string,\n mergeableFilePath: string,\n ): Promise<void> {\n // if no next.config.js exists, we'll create one\n if (!fs.existsSync(destinationPath)) {\n fs.copyFileSync(templatePath, destinationPath);\n green('Created File `next.config.js`');\n nl();\n } else {\n // creates a file name for the copy of the original next.config.js file\n // with the name `next.config.original.js`\n const originalFileName = this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n 'original',\n ).join('.');\n const originalFilePath = path.join(destinationDir, originalFileName);\n // makes copy of original next.config.js\n fs.writeFileSync(originalFilePath, fs.readFileSync(destinationPath));\n await this._addToGitignore(\n originalFilePath,\n 'Unable to add next.config.original.js to gitignore',\n );\n\n const mergedTemplatePath = path.join(\n configDirectory,\n 'next.config.template.js',\n );\n // attempts to merge with existing next.config.js, if true -> success\n if (mergeConfigFile(destinationPath, mergedTemplatePath)) {\n green(\n `Updated \\`${templateFile}\\` with Sentry. The original ${templateFile} was saved as \\`next.config.original.js\\`.\\n` +\n 'Information on the changes made to the Next.js configuration file an be found at https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/',\n );\n nl();\n } else {\n // if merge fails, we'll create a copy of the `next.config.js` template and ask them to merge\n fs.copyFileSync(templatePath, mergeableFilePath);\n await this._addToGitignore(\n mergeableFilePath,\n 'Unable to add next.config.wizard.js template to gitignore',\n );\n red(\n `Unable to merge \\`${templateFile}\\`, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please integrate next.config.wizardcopy.js into your next.config.js or next.config.ts file',\n );\n nl();\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+BAA0B;AAC1B,uBAAyB;AAEzB,qCAAkC;AAClC,0BAA4B;AAC5B,2BAA6B;AAG7B,gDAAgE;AAChE,wDAA2D;AAC3D,gDAA2D;AAC3D,8DAAqE;AAErE,oDAAmD;AACnD,qDAAoD;AAEpD,IAAM,0BAA0B,GAAG,kBAAkB,CAAC;AACtD,IAAM,uBAAuB,GAAG,SAAS,CAAC;AAC1C,IAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAChD,IAAM,oBAAoB,GAAG,cAAc,CAAC;AAC5C,IAAM,kBAAkB,GAAG,YAAY,CAAC;AACxC,IAAM,UAAU,GAAG,UAAU,CAAC;AAC9B,I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ACxC,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,EAAE,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;wBACrE,qBAAM,IAAI,CAAC,eAAe,CACxB,gBAAgB,EAChB,oDAAoD,CACrD,EAAA;;wBAHD,SAGC,CAAC;wBAEI,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAClC,eAAe,EACf,yBAAyB,CAC1B,CAAC;6BAEE,IAAA,6BAAe,EAAC,eAAe,EAAE,kBAAkB,CAAC,EAApD,wBAAoD;wBACtD,IAAA,eAAK,EACH,mBAAa,YAAY,yCAAgC,YAAY,+CAA8C;4BACjH,0JAA0J,CAC7J,CAAC;wBACF,IAAA,YAAE,GAAE,CAAC;;;wBAEL,6FAA6F;wBAC7F,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;wBACjD,qBAAM,IAAI,CAAC,eAAe,CACxB,iBAAiB,EACjB,2DAA2D,CAC5D,EAAA;;wBAHD,SAGC,CAAC;wBACF,IAAA,aAAG,EACD,4BAAsB,YAAY,4BAAoB,iBAAiB,SAAO;4BAC5E,4FAA4F,CAC/F,CAAC;wBACF,IAAA,YAAE,GAAE,CAAC;;;;;;KAGV;IACH,aAAC;AAAD,CAAC,AAvXD,CAA4B,iCAAe,GAuX1C;AAvXY,wBAAM","sourcesContent":["/* eslint-disable max-lines */\nimport Chalk from 'chalk';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { debug, green, l, nl, red } from '../../Helper/Logging';\nimport { mergeConfigFile } from '../../Helper/MergeConfig';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport { getPackageMangerChoice } from '../../Helper/PackageManager';\nimport type { SentryCliProps } from '../../Helper/SentryCli';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <14.0.0';\nconst COMPATIBLE_SDK_VERSIONS = '>=7.3.0';\nconst PROPERTIES_FILENAME = 'sentry.properties';\nconst SENTRYCLIRC_FILENAME = '.sentryclirc';\nconst GITIGNORE_FILENAME = '.gitignore';\nconst CONFIG_DIR = 'configs/';\nconst MERGEABLE_CONFIG_INFIX = 'wizardcopy';\n\n// for those files which can go in more than one place, the list of places they\n// could go (the first one which works will be used)\nconst TEMPLATE_DESTINATIONS: { [key: string]: string[] } = {\n '_error.js': ['pages', 'src/pages'],\n 'next.config.js': ['.'],\n 'sentry.server.config.js': ['.'],\n 'sentry.client.config.js': ['.'],\n 'sentry.edge.config.js': ['.'],\n};\n\nlet appPackage: any = {};\n\ntry {\n appPackage = require(path.join(process.cwd(), 'package.json'));\n} catch {\n // We don't need to have this\n}\n\nexport class NextJs extends BaseIntegration {\n protected _sentryCli: SentryCli;\n\n public 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 const dsn = _.get(answers, ['config', 'dsn', 'public'], null);\n nl();\n\n const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);\n await this._createSentryCliConfig(sentryCliProps);\n\n const templateDirectory = path.join(__dirname, '..', '..', '..', 'NextJs');\n const configDirectory = path.join(templateDirectory, CONFIG_DIR);\n\n if (fs.existsSync(configDirectory)) {\n await this._createNextConfig(configDirectory, dsn);\n } else {\n debug(\n `Couldn't find ${configDirectory}, probably because you ran this from inside of \\`/lib\\` rather than \\`/dist\\``,\n );\n nl();\n }\n\n const selectedProjectSlug: string | null = answers.config?.project?.slug;\n if (selectedProjectSlug) {\n const hasFirstEvent = answers.wizard?.projects?.find?.(\n (p: { slug: string }) => p.slug === selectedProjectSlug,\n )?.firstEvent;\n if (!hasFirstEvent) {\n await this._setTemplate(\n templateDirectory,\n 'sentry_sample_error.js',\n ['pages', 'src/pages'],\n dsn,\n );\n l(\n Chalk.bgYellowBright(`\n|------------------------------------------------------------------------|\n| Installation Complete |\n| To verify your installation and finish onboarding, launch your Next.js |\n| application, navigate to http://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\n`),\n );\n }\n }\n\n l(\n 'For more information, see https://docs.sentry.io/platforms/javascript/guides/nextjs/',\n );\n nl();\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n nl();\n\n let userAnswers: Answers = { continue: true };\n const hasCompatibleNextjsVersion = checkPackageVersion(\n appPackage,\n 'next',\n COMPATIBLE_NEXTJS_VERSIONS,\n true,\n );\n\n const packageManager = getPackageMangerChoice();\n const hasSdkInstalled = this._hasPackageInstalled('@sentry/nextjs');\n\n let hasCompatibleSdkVersion = false;\n // if no package but we have nextjs, let's add it if we can\n if (!hasSdkInstalled && packageManager && hasCompatibleNextjsVersion) {\n await packageManager.installPackage('@sentry/nextjs');\n // can assume it's compatible since we just installed it\n hasCompatibleSdkVersion = true;\n } else {\n // otherwise, let's check the version and spit out the appropriate error\n hasCompatibleSdkVersion = checkPackageVersion(\n appPackage,\n '@sentry/nextjs',\n COMPATIBLE_SDK_VERSIONS,\n true,\n );\n }\n const hasAllPackagesCompatible =\n hasCompatibleNextjsVersion && hasCompatibleSdkVersion;\n\n if (!hasAllPackagesCompatible && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n 'There were errors during your project checkup, do you still want to continue?',\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n }\n\n nl();\n\n if (!userAnswers['continue']) {\n throw new Error('Please install the required dependencies to continue.');\n }\n\n this._shouldConfigure = Promise.resolve({ nextjs: true });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private async _createSentryCliConfig(\n cliProps: SentryCliProps,\n ): Promise<void> {\n const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;\n\n /**\n * To not commit the auth token to the VCS, instead of adding it to the\n * properties file (like the rest of props), it's added to the Sentry CLI\n * config, which is added to the gitignore. This way makes the properties\n * file safe to commit without exposing any auth tokens.\n */\n if (authToken) {\n try {\n await fs.promises.appendFile(\n SENTRYCLIRC_FILENAME,\n this._sentryCli.dumpConfig({ auth: { token: authToken } }),\n );\n green(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);\n } catch {\n red(\n `⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +\n `please add it to identify your user account:\\n${authToken}`,\n );\n nl();\n }\n } else {\n red(\n `⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`,\n );\n l(\n 'To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/',\n );\n l(\n 'To learn how to configure Sentry CLI, visit ' +\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n\n await this._addToGitignore(\n SENTRYCLIRC_FILENAME,\n `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, ` +\n 'please add it to not commit your auth key.',\n );\n\n try {\n await fs.promises.writeFile(\n `./${PROPERTIES_FILENAME}`,\n this._sentryCli.dumpProperties(cliPropsToWrite),\n );\n green('✓ Successfully created sentry.properties');\n } catch {\n red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);\n l(\n 'See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n nl();\n }\n\n private async _addToGitignore(\n filepath: string,\n errorMsg: string,\n ): Promise<void> {\n /**\n * Don't check whether the given file is ignored because:\n * 1. It's tricky to check it without git.\n * 2. Git might not be installed or accessible.\n * 3. It's convenient to use a module to interact with git, but it would\n * increase the size x2 approximately. Docs say to run the Wizard without\n * installing it, and duplicating the size would slow the set-up down.\n * 4. The Wizard is meant to be run once.\n * 5. A message is logged informing users it's been added to the gitignore.\n * 6. It will be added to the gitignore as many times as it runs - not a big\n * deal.\n * 7. It's straightforward to remove it from the gitignore.\n */\n try {\n await fs.promises.appendFile(\n GITIGNORE_FILENAME,\n `\\n# Sentry\\n${filepath}\\n`,\n );\n green(`✓ ${filepath} added to ${GITIGNORE_FILENAME}`);\n } catch {\n red(errorMsg);\n }\n }\n\n private async _createNextConfig(\n configDirectory: string,\n dsn: any,\n ): Promise<void> {\n const templates = fs.readdirSync(configDirectory);\n // next.config.template.js used for merging next.config.js , not its own template,\n // so it shouldn't have a setTemplate call\n const filteredTemplates = templates.filter(\n (template) => template !== 'next.config.template.js',\n );\n for (const template of filteredTemplates) {\n await this._setTemplate(\n configDirectory,\n template,\n TEMPLATE_DESTINATIONS[template],\n dsn,\n );\n }\n red(\n '⚠ Performance monitoring is enabled capturing 100% of transactions.\\n' +\n ' Learn more in https://docs.sentry.io/product/performance/',\n );\n nl();\n }\n\n private async _setTemplate(\n configDirectory: string,\n templateFile: string,\n destinationOptions: string[],\n dsn: string,\n ): Promise<void> {\n const templatePath = path.join(configDirectory, templateFile);\n\n for (const destinationDir of destinationOptions) {\n if (!fs.existsSync(destinationDir)) {\n continue;\n }\n const destinationPath = path.join(destinationDir, templateFile);\n // in case the file in question already exists, we'll make a copy with\n // `MERGEABLE_CONFIG_INFIX` inserted just before the extension, so as not\n // to overwrite the existing file\n const mergeableFilePath = path.join(\n destinationDir,\n this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n MERGEABLE_CONFIG_INFIX,\n ).join('.'),\n );\n\n if (templateFile === 'next.config.js') {\n await this._mergeNextConfig(\n destinationPath,\n templatePath,\n destinationDir,\n templateFile,\n configDirectory,\n mergeableFilePath,\n );\n return;\n } else {\n if (!fs.existsSync(destinationPath)) {\n this._fillAndCopyTemplate(templatePath, destinationPath, dsn);\n } else if (!fs.existsSync(mergeableFilePath)) {\n this._fillAndCopyTemplate(templatePath, mergeableFilePath, dsn);\n red(\n `File \\`${templateFile}\\` already exists, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please merge those files.',\n );\n nl();\n } else {\n red(\n `Both \\`${templateFile}\\` and \\`${mergeableFilePath}\\` already exist.\\n` +\n 'Please merge those files.',\n );\n nl();\n }\n return;\n }\n }\n\n red(\n `Could not find appropriate destination for \\`${templateFile}\\`. Tried: ${destinationOptions}.`,\n );\n nl();\n }\n\n private _fillAndCopyTemplate(\n sourcePath: string,\n targetPath: string,\n dsn: string,\n ): void {\n const templateContent = fs.readFileSync(sourcePath).toString();\n const filledTemplate = templateContent.replace('___DSN___', dsn);\n fs.writeFileSync(targetPath, filledTemplate);\n }\n\n private _hasPackageInstalled(packageName: string): boolean {\n const depsVersion = _.get(appPackage, ['dependencies', packageName]);\n const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);\n return !!depsVersion || !!devDepsVersion;\n }\n\n private _spliceInPlace(\n arr: Array<any>,\n start: number,\n deleteCount: number,\n ...inserts: any[]\n ): Array<any> {\n arr.splice(start, deleteCount, ...inserts);\n return arr;\n }\n\n private async _mergeNextConfig(\n destinationPath: string,\n templatePath: string,\n destinationDir: string,\n templateFile: string,\n configDirectory: string,\n mergeableFilePath: string,\n ): Promise<void> {\n // if no next.config.js exists, we'll create one\n if (!fs.existsSync(destinationPath)) {\n fs.copyFileSync(templatePath, destinationPath);\n green('Created File `next.config.js`');\n nl();\n } else {\n // creates a file name for the copy of the original next.config.js file\n // with the name `next.config.original.js`\n const originalFileName = this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n 'original',\n ).join('.');\n const originalFilePath = path.join(destinationDir, originalFileName);\n // makes copy of original next.config.js\n fs.writeFileSync(originalFilePath, fs.readFileSync(destinationPath));\n await this._addToGitignore(\n originalFilePath,\n 'Unable to add next.config.original.js to gitignore',\n );\n\n const mergedTemplatePath = path.join(\n configDirectory,\n 'next.config.template.js',\n );\n // attempts to merge with existing next.config.js, if true -> success\n if (mergeConfigFile(destinationPath, mergedTemplatePath)) {\n green(\n `Updated \\`${templateFile}\\` with Sentry. The original ${templateFile} was saved as \\`next.config.original.js\\`.\\n` +\n 'Information on the changes made to the Next.js configuration file an be found at https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/',\n );\n nl();\n } else {\n // if merge fails, we'll create a copy of the `next.config.js` template and ask them to merge\n fs.copyFileSync(templatePath, mergeableFilePath);\n await this._addToGitignore(\n mergeableFilePath,\n 'Unable to add next.config.wizard.js template to gitignore',\n );\n red(\n `Unable to merge \\`${templateFile}\\`, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please integrate next.config.wizardcopy.js into your next.config.js or next.config.ts file',\n );\n nl();\n }\n }\n }\n}\n"]}
|
|
@@ -196,6 +196,7 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
|
|
|
196
196
|
});
|
|
197
197
|
});
|
|
198
198
|
};
|
|
199
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
199
200
|
ReactNative.prototype._shouldConfigurePlatform = function (platform) {
|
|
200
201
|
return __awaiter(this, void 0, void 0, function () {
|
|
201
202
|
var result, regex;
|
|
@@ -353,7 +354,7 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
|
|
|
353
354
|
}
|
|
354
355
|
var code = JSON.parse(script.shellScript);
|
|
355
356
|
code =
|
|
356
|
-
// eslint-disable-next-line prefer-template
|
|
357
|
+
// eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands
|
|
357
358
|
'export SENTRY_PROPERTIES=sentry.properties\n' +
|
|
358
359
|
'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
|
|
359
360
|
code.replace('$REACT_NATIVE_XCODE', function () {
|