Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Sep 29, 2023
1 parent c3c0934 commit 7ee44aa
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
25 changes: 17 additions & 8 deletions src/react-native/react-native-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ export async function runReactNativeWizard(
await patchAndroidFiles({ authToken });
}

const confirmedFirstException = await confirmFirstSentryException(selectedProject);
const confirmedFirstException = await confirmFirstSentryException(
selectedProject,
);

if (confirmedFirstException) {
clack.outro(
Expand Down Expand Up @@ -148,7 +150,9 @@ Sentry.init({
`,
);
clack.log.success(`Added ${chalk.bold('Sentry.init')} to ${chalk.bold(jsRelativePath)}.`);
clack.log.success(
`Added ${chalk.bold('Sentry.init')} to ${chalk.bold(jsRelativePath)}.`,
);

fs.writeFileSync(jsPath, newContent, 'utf-8');
clack.log.success(`${chalk.bold(jsRelativePath)} changes saved.`);
Expand Down Expand Up @@ -201,7 +205,8 @@ async function patchXcodeFiles({ authToken }: { authToken: string }) {
const bundlePhase = findBundlePhase(buildPhasesMap);
patchBundlePhase(bundlePhase);

const debugFilesUploadPhaseExists = !!findDebugFilesUploadPhase(buildPhasesMap);
const debugFilesUploadPhaseExists =
!!findDebugFilesUploadPhase(buildPhasesMap);
addDebugFilesUploadPhase(xcodeProject, { debugFilesUploadPhaseExists });

writeXcodeProject(xcodeProjectPath, xcodeProject);
Expand All @@ -217,23 +222,27 @@ async function patchAndroidFiles({ authToken }: { authToken: string }) {
const appBuildGradlePath = getFirstMatchedPath(APP_BUILD_GRADLE);
if (!appBuildGradlePath) {
clack.log.warn(
`Could not find Android ${chalk.bold('app/build.gradle')} file using ${chalk.bold(
APP_BUILD_GRADLE,
)}.`,
`Could not find Android ${chalk.bold(
'app/build.gradle',
)} file using ${chalk.bold(APP_BUILD_GRADLE)}.`,
);
return;
}

const appBuildGradle = fs.readFileSync(appBuildGradlePath, 'utf-8');
const includesSentry = doesAppBuildGradleIncludeSentry(appBuildGradle);
if (includesSentry) {
clack.log.warn(`Android ${chalk.bold('app/build.gradle')} file already includes Sentry.`);
clack.log.warn(
`Android ${chalk.bold('app/build.gradle')} file already includes Sentry.`,
);
return;
}

const patchedAppBuildGradle = patchAppBuildGradle(appBuildGradle);
if (doesAppBuildGradleIncludeSentry(patchedAppBuildGradle)) {
clack.log.success(`Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`);
clack.log.success(
`Added Sentry RN Gradle Plugin to ${chalk.bold('app/build.gradle')}.`,
);
}

writeAppBuildGradle(appBuildGradlePath, patchedAppBuildGradle);
Expand Down
8 changes: 5 additions & 3 deletions src/react-native/xcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ export function unPatchBundlePhase(bundlePhase: BuildPhase | undefined) {
}

export function findBundlePhase(buildPhases: BuildPhaseMap) {
return Object.values(buildPhases).find(
(buildPhase) => buildPhase.shellScript.match(/\/scripts\/react-native-xcode\.sh/i),
return Object.values(buildPhases).find((buildPhase) =>
buildPhase.shellScript.match(/\/scripts\/react-native-xcode\.sh/i),
);
}

Expand Down Expand Up @@ -202,7 +202,9 @@ export function findDebugFilesUploadPhase(
return Object.entries(buildPhasesMap).find(
([_, buildPhase]) =>
typeof buildPhase !== 'string' &&
!!buildPhase.shellScript.match(/@sentry\/cli\/bin\/sentry-cli\s+(upload-dsym|debug-files upload)\b/),
!!buildPhase.shellScript.match(
/@sentry\/cli\/bin\/sentry-cli\s+(upload-dsym|debug-files upload)\b/,
),
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/utils/clack-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ ${packageId}@${packageVersion}`,

clack.note(
`Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.
Or setup using ${chalk.cyan('https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/')}`,
Or setup using ${chalk.cyan(
'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/',
)}`,
);
const continueWithUnsupportedVersion = await abortIfCancelled(
clack.confirm({
Expand Down

0 comments on commit 7ee44aa

Please sign in to comment.