@sentry/wizard 2.2.2 → 2.3.1
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 +10 -0
- package/dist/lib/Helper/SentryCli.js +3 -1
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Steps/Integrations/NextJs.js +5 -4
- package/dist/lib/Steps/Integrations/NextJs.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.js +3 -4
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/lib/Helper/SentryCli.ts +3 -1
- package/lib/Steps/Integrations/NextJs.ts +5 -9
- package/lib/Steps/Integrations/ReactNative.ts +7 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
- fix(nextjs): Always check for both, `next` and `@sentry/nextjs` presence and version (#209)
|
|
6
|
+
- fix: `cli.executable` property should be resolved from cwd (#211)
|
|
7
|
+
|
|
8
|
+
## 2.3.0
|
|
9
|
+
|
|
10
|
+
- feat(react-native): Xcode plugin debug files upload can include source using env
|
|
11
|
+
- chore(ci): remove jira workflow (#204)
|
|
12
|
+
|
|
3
13
|
## 2.2.2
|
|
4
14
|
|
|
5
15
|
- feat(nextjs): Remove option to auto-wrap data fetchers and API routes (#196)
|
|
@@ -19,7 +19,9 @@ var SentryCli = /** @class */ (function () {
|
|
|
19
19
|
props['defaults/project'] = _.get(answers, 'config.project.slug', null);
|
|
20
20
|
props['auth/token'] = _.get(answers, 'config.auth.token', null);
|
|
21
21
|
try {
|
|
22
|
-
var cliPath = this._resolve('@sentry/cli/bin/sentry-cli'
|
|
22
|
+
var cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {
|
|
23
|
+
paths: [process.cwd()],
|
|
24
|
+
});
|
|
23
25
|
props['cli/executable'] = path
|
|
24
26
|
.relative(process.cwd(), cliPath)
|
|
25
27
|
.replace(/\\/g, '\\\\');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../lib/Helper/SentryCli.ts"],"names":[],"mappings":";;;AACA,0BAA4B;AAC5B,2BAA6B;AAU7B;IAIE,mBAAsB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAHjC,sDAAsD;QAC9C,aAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAEC,CAAC;IAE9B,sCAAkB,GAAzB,UAA0B,OAAiC;QACzD,IAAI,CAAC,QAAQ,GAAG,OAAc,CAAC;IACjC,CAAC;IAEM,8CAA0B,GAAjC,UAAkC,OAAgB;QAChD,IAAM,KAAK,GAAmB,EAAE,CAAC;QACjC,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;QACvC,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,0BAA0B,EAAE,IAAI,CAAC,CAAC;QACzE,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,EAAE,IAAI,CAAC,CAAC;QACxE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;QAChE,IAAI;YACF,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,4BAA4B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"SentryCli.js","sourceRoot":"","sources":["../../../lib/Helper/SentryCli.ts"],"names":[],"mappings":";;;AACA,0BAA4B;AAC5B,2BAA6B;AAU7B;IAIE,mBAAsB,KAAW;QAAX,UAAK,GAAL,KAAK,CAAM;QAHjC,sDAAsD;QAC9C,aAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;IAEC,CAAC;IAE9B,sCAAkB,GAAzB,UA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AAC,CAAC;gBAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;oBACzC,kDAAkD;oBAClD,EAAE,CAAC,IAAI,CAAC,MAAI,GAAG,MAAG,CAAC,CAAC;iBACrB;qBAAM;oBACL,EAAE,CAAC,IAAI,CAAI,GAAG,SAAI,KAAO,CAAC,CAAC;iBAC5B;aACF;SACF;QACD,2CAA2C;QAC3C,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9B,CAAC;IAEM,8BAAU,GAAjB,UAAkB,MAAuB;QACvC,IAAM,cAAc,GAAa,EAAE,CAAC;QACpC,KAAK,IAAM,WAAW,IAAI,MAAM,EAAE;YAChC,iDAAiD;YACjD,IAAI,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE;gBACtC,IAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC;gBACvD,IAAM,OAAO,GAAG,MAAI,WAAW,WAAM,KAAO,CAAC;gBAC7C,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC9B;SACF;QACD,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IACH,gBAAC;AAAD,CAAC,AA7DD,IA6DC;AA7DY,8BAAS","sourcesContent":["import { Answers } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport { Args } from '../Constants';\n\nexport interface SentryCliProps {\n [s: string]: string;\n}\n\ntype SentryCliConfig = Record<string, SentryCliProps>;\n\nexport class SentryCli {\n // eslint-disable-next-line @typescript-eslint/typedef\n private _resolve = require.resolve;\n\n constructor(protected _argv: Args) {}\n\n public setResolveFunction(resolve: (path: string) => string): void {\n this._resolve = resolve as any;\n }\n\n public convertAnswersToProperties(answers: Answers): SentryCliProps {\n const props: SentryCliProps = {};\n props['defaults/url'] = this._argv.url;\n props['defaults/org'] = _.get(answers, 'config.organization.slug', null);\n props['defaults/project'] = _.get(answers, 'config.project.slug', null);\n props['auth/token'] = _.get(answers, 'config.auth.token', null);\n try {\n const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {\n paths: [process.cwd()],\n });\n props['cli/executable'] = path\n .relative(process.cwd(), cliPath)\n .replace(/\\\\/g, '\\\\\\\\');\n } catch (e) {\n // we do nothing and leave everyting as it is\n }\n return props;\n }\n\n /** Create the contents of a `sentry.properties` file */\n public dumpProperties(props: SentryCliProps): string {\n const rv = [];\n for (let key in props) {\n // eslint-disable-next-line no-prototype-builtins\n if (props.hasOwnProperty(key)) {\n const value = props[key];\n key = key.replace(/\\//g, '.');\n if (value === undefined || value === null) {\n // comment that property out since it has no value\n rv.push(`#${key}=`);\n } else {\n rv.push(`${key}=${value}`);\n }\n }\n }\n // eslint-disable-next-line prefer-template\n return rv.join('\\n') + '\\n';\n }\n\n public dumpConfig(config: SentryCliConfig): string {\n const dumpedSections: string[] = [];\n for (const sectionName in config) {\n // eslint-disable-next-line no-prototype-builtins\n if (config.hasOwnProperty(sectionName)) {\n const props = this.dumpProperties(config[sectionName]);\n const section = `[${sectionName}]\\n${props}`;\n dumpedSections.push(section);\n }\n }\n return dumpedSections.join('\\n');\n }\n}\n"]}
|
|
@@ -147,7 +147,7 @@ var NextJs = /** @class */ (function (_super) {
|
|
|
147
147
|
};
|
|
148
148
|
NextJs.prototype.shouldConfigure = function (_answers) {
|
|
149
149
|
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
-
var userAnswers;
|
|
150
|
+
var userAnswers, hasCompatibleNextjsVersion, hasCompatibleSdkVersion, hasAllPackagesCompatible;
|
|
151
151
|
return __generator(this, function (_a) {
|
|
152
152
|
switch (_a.label) {
|
|
153
153
|
case 0:
|
|
@@ -156,9 +156,10 @@ var NextJs = /** @class */ (function (_super) {
|
|
|
156
156
|
}
|
|
157
157
|
Logging_1.nl();
|
|
158
158
|
userAnswers = { continue: true };
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
hasCompatibleNextjsVersion = this._checkPackageVersion('next', COMPATIBLE_NEXTJS_VERSIONS, true);
|
|
160
|
+
hasCompatibleSdkVersion = this._checkPackageVersion('@sentry/nextjs', COMPATIBLE_SDK_VERSIONS, true);
|
|
161
|
+
hasAllPackagesCompatible = hasCompatibleNextjsVersion && hasCompatibleSdkVersion;
|
|
162
|
+
if (!(!hasAllPackagesCompatible && !this._argv.quiet)) return [3 /*break*/, 2];
|
|
162
163
|
return [4 /*yield*/, inquirer_1.prompt({
|
|
163
164
|
message: 'There were errors during your project checkup, do you still want to continue?',
|
|
164
165
|
name: 'continue',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+BAA0B;AAC1B,uBAAyB;AACzB,qCAA2C;AAC3C,0BAA4B;AAC5B,2BAA6B;AAC7B,iCAA8D;AAG9D,gDAAgE;AAChE,oDAAmE;AACnE,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,IAAM,sBAAsB,GAAG,YAAY,CAAC;AAE5C,+EAA+E;AAC/E,oDAAoD;AACpD,IAAM,qBAAqB,GAAgC;IACzD,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;IACnC,gBAAgB,EAAE,CAAC,GAAG,CAAC;IACvB,yBAAyB,EAAE,CAAC,GAAG,CAAC;IAChC,yBAAyB,EAAE,CAAC,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AC,CAAC,eAAM,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;gBAChD,CAAC,CAAC,kBAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC,CACvD,CAAC;IACJ,CAAC;IAEO,+BAAc,GAAtB,UACE,GAAe,EACf,KAAa,EACb,WAAmB;QACnB,iBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,gCAAiB;;QAEjB,GAAG,CAAC,MAAM,OAAV,GAAG,kBAAQ,KAAK,EAAE,WAAW,GAAK,OAAO,GAAE;QAC3C,OAAO,GAAG,CAAC;IACb,CAAC;IACH,aAAC;AAAD,CAAC,AAxVD,CAA4B,iCAAe,GAwV1C;AAxVY,wBAAM","sourcesContent":["/* eslint-disable max-lines */\nimport Chalk from 'chalk';\nimport * as fs from 'fs';\nimport { Answers, prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { satisfies, subset, valid, validRange } from 'semver';\n\nimport { Args } from '../../Constants';\nimport { debug, green, l, nl, red } from '../../Helper/Logging';\nimport { SentryCli, SentryCliProps } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <13.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};\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 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(\n __dirname,\n '..',\n '..',\n '..',\n 'NextJs',\n );\n const configDirectory = path.join(\n templateDirectory,\n CONFIG_DIR,\n );\n\n if (fs.existsSync(configDirectory)) {\n 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?.((p: { slug: string; }) => p.slug === selectedProjectSlug)?.firstEvent;\n if (!hasFirstEvent) {\n 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 https://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\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 if (\n (!this._checkPackageVersion('next', COMPATIBLE_NEXTJS_VERSIONS, true) ||\n !this._checkPackageVersion(\n '@sentry/nextjs',\n COMPATIBLE_SDK_VERSIONS,\n true,\n )) &&\n !this._argv.quiet\n ) {\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 _createNextConfig(configDirectory: string, dsn: any): void {\n const templates = fs.readdirSync(configDirectory);\n for (const template of templates) {\n 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 _setTemplate(\n configDirectory: string,\n templateFile: string,\n destinationOptions: string[],\n dsn: string,\n ): void {\n const templatePath = path.join(configDirectory, templateFile);\n\n for (const destinationDir of destinationOptions) {\n if (!fs.existsSync(destinationDir)) {\n continue;\n }\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 (!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 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 _checkPackageVersion(\n packageName: string,\n acceptableVersions: string,\n canBeLatest: boolean,\n ): boolean {\n const depsVersion = _.get(appPackage, ['dependencies', packageName]);\n const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);\n\n if (!depsVersion && !devDepsVersion) {\n red(`✗ ${packageName} isn't in your dependencies.`);\n red(' Please install it with yarn/npm.');\n return false;\n } else if (\n !this._fulfillsVersionRange(\n depsVersion,\n acceptableVersions,\n canBeLatest,\n ) &&\n !this._fulfillsVersionRange(\n devDepsVersion,\n acceptableVersions,\n canBeLatest,\n )\n ) {\n red(\n `✗ Your \\`package.json\\` specifies a version of \\`${packageName}\\` outside of the compatible version range ${acceptableVersions}.\\n`,\n );\n return false;\n } else {\n green(\n `✓ A compatible version of \\`${packageName}\\` is specified in \\`package.json\\`.`,\n );\n return true;\n }\n }\n\n private _fulfillsVersionRange(\n version: string,\n acceptableVersions: string,\n canBeLatest: boolean,\n ): boolean {\n if (version === 'latest') {\n return canBeLatest;\n }\n\n let cleanedUserVersion, isRange;\n\n if (valid(version)) {\n cleanedUserVersion = valid(version);\n isRange = false;\n } else if (validRange(version)) {\n cleanedUserVersion = validRange(version);\n isRange = true;\n }\n\n return (\n // If the given version is a bogus format, this will still be undefined and we'll automatically reject it\n !!cleanedUserVersion &&\n (isRange\n ? subset(cleanedUserVersion, acceptableVersions)\n : satisfies(cleanedUserVersion, acceptableVersions))\n );\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"]}
|
|
1
|
+
{"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+BAA0B;AAC1B,uBAAyB;AACzB,qCAA2C;AAC3C,0BAA4B;AAC5B,2BAA6B;AAC7B,iCAA8D;AAG9D,gDAAgE;AAChE,oDAAmE;AACnE,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,IAAM,sBAAsB,GAAG,YAAY,CAAC;AAE5C,+EAA+E;AAC/E,oDAAoD;AACpD,IAAM,qBAAqB,GAAgC;IACzD,WAAW,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC;IACnC,gBAAgB,EAAE,CAAC,GAAG,CAAC;IACvB,yBAAyB,EAAE,CAAC,GAAG,CAAC;IAChC,yBAAyB,EAAE,CAAC,GAAG,CAAC;CACjC,CAAC;AAEF,IAAI,UAAU,GAAQ,EAAE,CAAC;AAEzB,IAAI;IACF,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC;CAChE;AAAC,WAAM;IACN,6BAA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ACvD,CAAC;IACJ,CAAC;IAEO,+BAAc,GAAtB,UACE,GAAe,EACf,KAAa,EACb,WAAmB;QACnB,iBAAiB;aAAjB,UAAiB,EAAjB,qBAAiB,EAAjB,IAAiB;YAAjB,gCAAiB;;QAEjB,GAAG,CAAC,MAAM,OAAV,GAAG,kBAAQ,KAAK,EAAE,WAAW,GAAK,OAAO,GAAE;QAC3C,OAAO,GAAG,CAAC;IACb,CAAC;IACH,aAAC;AAAD,CAAC,AApVD,CAA4B,iCAAe,GAoV1C;AApVY,wBAAM","sourcesContent":["/* eslint-disable max-lines */\nimport Chalk from 'chalk';\nimport * as fs from 'fs';\nimport { Answers, prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { satisfies, subset, valid, validRange } from 'semver';\n\nimport { Args } from '../../Constants';\nimport { debug, green, l, nl, red } from '../../Helper/Logging';\nimport { SentryCli, SentryCliProps } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <13.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};\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 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(\n __dirname,\n '..',\n '..',\n '..',\n 'NextJs',\n );\n const configDirectory = path.join(\n templateDirectory,\n CONFIG_DIR,\n );\n\n if (fs.existsSync(configDirectory)) {\n 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?.((p: { slug: string; }) => p.slug === selectedProjectSlug)?.firstEvent;\n if (!hasFirstEvent) {\n 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 https://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\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 = this._checkPackageVersion('next', COMPATIBLE_NEXTJS_VERSIONS, true);\n const hasCompatibleSdkVersion = this._checkPackageVersion('@sentry/nextjs', COMPATIBLE_SDK_VERSIONS, true);\n const hasAllPackagesCompatible = 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 _createNextConfig(configDirectory: string, dsn: any): void {\n const templates = fs.readdirSync(configDirectory);\n for (const template of templates) {\n 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 _setTemplate(\n configDirectory: string,\n templateFile: string,\n destinationOptions: string[],\n dsn: string,\n ): void {\n const templatePath = path.join(configDirectory, templateFile);\n\n for (const destinationDir of destinationOptions) {\n if (!fs.existsSync(destinationDir)) {\n continue;\n }\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 (!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 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 _checkPackageVersion(\n packageName: string,\n acceptableVersions: string,\n canBeLatest: boolean,\n ): boolean {\n const depsVersion = _.get(appPackage, ['dependencies', packageName]);\n const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);\n\n if (!depsVersion && !devDepsVersion) {\n red(`✗ ${packageName} isn't in your dependencies.`);\n red(' Please install it with yarn/npm.');\n return false;\n } else if (\n !this._fulfillsVersionRange(\n depsVersion,\n acceptableVersions,\n canBeLatest,\n ) &&\n !this._fulfillsVersionRange(\n devDepsVersion,\n acceptableVersions,\n canBeLatest,\n )\n ) {\n red(\n `✗ Your \\`package.json\\` specifies a version of \\`${packageName}\\` outside of the compatible version range ${acceptableVersions}.\\n`,\n );\n return false;\n } else {\n green(\n `✓ A compatible version of \\`${packageName}\\` is specified in \\`package.json\\`.`,\n );\n return true;\n }\n }\n\n private _fulfillsVersionRange(\n version: string,\n acceptableVersions: string,\n canBeLatest: boolean,\n ): boolean {\n if (version === 'latest') {\n return canBeLatest;\n }\n\n let cleanedUserVersion, isRange;\n\n if (valid(version)) {\n cleanedUserVersion = valid(version);\n isRange = false;\n } else if (validRange(version)) {\n cleanedUserVersion = validRange(version);\n isRange = true;\n }\n\n return (\n // If the given version is a bogus format, this will still be undefined and we'll automatically reject it\n !!cleanedUserVersion &&\n (isRange\n ? subset(cleanedUserVersion, acceptableVersions)\n : satisfies(cleanedUserVersion, acceptableVersions))\n );\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"]}
|
|
@@ -295,14 +295,13 @@ var ReactNative = /** @class */ (function (_super) {
|
|
|
295
295
|
ReactNative.prototype._addNewXcodeBuildPhaseForSymbols = function (buildScripts, proj) {
|
|
296
296
|
for (var _i = 0, buildScripts_2 = buildScripts; _i < buildScripts_2.length; _i++) {
|
|
297
297
|
var script = buildScripts_2[_i];
|
|
298
|
-
if (script.shellScript.match(/sentry-cli\s+upload-dsym/)) {
|
|
298
|
+
if (script.shellScript.match(/sentry-cli\s+(upload-dsym|debug-files upload)/)) {
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
|
|
303
303
|
shellPath: '/bin/sh',
|
|
304
|
-
shellScript:
|
|
305
|
-
'../node_modules/@sentry/cli/bin/sentry-cli upload-dsym',
|
|
304
|
+
shellScript: "\nexport SENTRY_PROPERTIES=sentry.properties\n[[ $SENTRY_INCLUDE_NATIVE_SOURCES == \"true\" ]] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\"\n",
|
|
306
305
|
});
|
|
307
306
|
};
|
|
308
307
|
ReactNative.prototype._patchXcodeProj = function (contents, filename) {
|
|
@@ -386,7 +385,7 @@ var ReactNative = /** @class */ (function (_super) {
|
|
|
386
385
|
if (typeof script === 'string' || script === undefined) {
|
|
387
386
|
continue;
|
|
388
387
|
}
|
|
389
|
-
if (script.shellScript.match(/@sentry\/cli\/bin\/sentry-cli\s+upload-dsym\b/)) {
|
|
388
|
+
if (script.shellScript.match(/@sentry\/cli\/bin\/sentry-cli\s+(upload-dsym|debug-files upload)\b/)) {
|
|
390
389
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
391
390
|
delete scripts[key];
|
|
392
391
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
@@ -1 +1 @@
|
|
|
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,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,0BAAI,GAAjB,UAAkB,OAAgB;;;;;;;wBAChC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;4BACxB,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;yBAChC;wBACK,qBAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAA;;wBAApC,IAAI,CAAC,CAAC,SAA8B,CAAC,EAAE;4BACrC,sBAAO,EAAE,EAAC;yBACX;wBAEK,mBAAmB,GAAG,IAAI,CAAC,UAAU,CAAC,0BAA0B,CACpE,OAAO,CACR,CAAC;wBAEF,qDAAqD;wBACrD,sBAAO,IAAI,OAAO,CAAC,UAAO,OAAO,EAAE,MAAM;;;;oCACjC,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,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,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"]}
|
|
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,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,0B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AAK,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,AA1ZD,CAAiC,6BAAa,GA0Z7C;AA1ZY,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|debug-files upload)/)) {\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:`\nexport SENTRY_PROPERTIES=sentry.properties\n[[ $SENTRY_INCLUDE_NATIVE_SOURCES == \"true\" ]] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\"\n`,\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|debug-files upload)\\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"]}
|
package/lib/Helper/SentryCli.ts
CHANGED
|
@@ -27,7 +27,9 @@ export class SentryCli {
|
|
|
27
27
|
props['defaults/project'] = _.get(answers, 'config.project.slug', null);
|
|
28
28
|
props['auth/token'] = _.get(answers, 'config.auth.token', null);
|
|
29
29
|
try {
|
|
30
|
-
const cliPath = this._resolve('@sentry/cli/bin/sentry-cli'
|
|
30
|
+
const cliPath = this._resolve('@sentry/cli/bin/sentry-cli', {
|
|
31
|
+
paths: [process.cwd()],
|
|
32
|
+
});
|
|
31
33
|
props['cli/executable'] = path
|
|
32
34
|
.relative(process.cwd(), cliPath)
|
|
33
35
|
.replace(/\\/g, '\\\\');
|
|
@@ -112,15 +112,11 @@ export class NextJs extends BaseIntegration {
|
|
|
112
112
|
nl();
|
|
113
113
|
|
|
114
114
|
let userAnswers: Answers = { continue: true };
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
true,
|
|
121
|
-
)) &&
|
|
122
|
-
!this._argv.quiet
|
|
123
|
-
) {
|
|
115
|
+
const hasCompatibleNextjsVersion = this._checkPackageVersion('next', COMPATIBLE_NEXTJS_VERSIONS, true);
|
|
116
|
+
const hasCompatibleSdkVersion = this._checkPackageVersion('@sentry/nextjs', COMPATIBLE_SDK_VERSIONS, true);
|
|
117
|
+
const hasAllPackagesCompatible = hasCompatibleNextjsVersion && hasCompatibleSdkVersion;
|
|
118
|
+
|
|
119
|
+
if (!hasAllPackagesCompatible && !this._argv.quiet) {
|
|
124
120
|
userAnswers = await prompt({
|
|
125
121
|
message:
|
|
126
122
|
'There were errors during your project checkup, do you still want to continue?',
|
|
@@ -267,7 +267,7 @@ export class ReactNative extends MobileProject {
|
|
|
267
267
|
|
|
268
268
|
private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {
|
|
269
269
|
for (const script of buildScripts) {
|
|
270
|
-
if (script.shellScript.match(/sentry-cli\s+upload-dsym/)) {
|
|
270
|
+
if (script.shellScript.match(/sentry-cli\s+(upload-dsym|debug-files upload)/)) {
|
|
271
271
|
return;
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -279,9 +279,11 @@ export class ReactNative extends MobileProject {
|
|
|
279
279
|
null,
|
|
280
280
|
{
|
|
281
281
|
shellPath: '/bin/sh',
|
|
282
|
-
shellScript
|
|
283
|
-
|
|
284
|
-
|
|
282
|
+
shellScript:`
|
|
283
|
+
export SENTRY_PROPERTIES=sentry.properties
|
|
284
|
+
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
|
|
285
|
+
../node_modules/@sentry/cli/bin/sentry-cli debug-files upload "$INCLUDE_SOURCES_FLAG"
|
|
286
|
+
`,
|
|
285
287
|
},
|
|
286
288
|
);
|
|
287
289
|
}
|
|
@@ -382,7 +384,7 @@ export class ReactNative extends MobileProject {
|
|
|
382
384
|
|
|
383
385
|
if (
|
|
384
386
|
script.shellScript.match(
|
|
385
|
-
/@sentry\/cli\/bin\/sentry-cli\s+upload-dsym\b/,
|
|
387
|
+
/@sentry\/cli\/bin\/sentry-cli\s+(upload-dsym|debug-files upload)\b/,
|
|
386
388
|
)
|
|
387
389
|
) {
|
|
388
390
|
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
package/package.json
CHANGED