Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin committed Sep 4, 2023
1 parent de6a384 commit e237b28
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 24 deletions.
4 changes: 3 additions & 1 deletion src/apple/apple-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ async function runAppleWizardWithTelementry(
const { project, apiKey } = await getSentryProjectAndApiKey(options);

SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });
clack.log.info('We created a ".sentryclirc" file in your project directory in order to provide an auth token for Sentry CLI.\nIt was also added to your ".gitignore" file.\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.');
clack.log.info(
'We created a ".sentryclirc" file in your project directory in order to provide an auth token for Sentry CLI.\nIt was also added to your ".gitignore" file.\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',
);

const hasCocoa = cocoapod.usesCocoaPod(projectDir);

Expand Down
11 changes: 3 additions & 8 deletions src/apple/fastlane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function addSentryToLane(
content: string,
lane: { index: number; length: number; name: string },
org: string,
project: string
project: string,
): string {
const laneContent = content.slice(lane.index, lane.index + lane.length);
const sentryCLIMatch = /sentry_cli\s*\([^)]+\)/gim.exec(laneContent);
Expand Down Expand Up @@ -129,12 +129,7 @@ export async function addSentryToFastlane(

let newFileContent: string | undefined;
if (lanes.length === 1) {
newFileContent = addSentryToLane(
fileContent,
lanes[0],
org,
project
);
newFileContent = addSentryToLane(fileContent, lanes[0], org, project);
} else {
const laneNames = lanes.map((l) => l.name);
const selectedLane = await askForItemSelection(
Expand All @@ -148,7 +143,7 @@ export async function addSentryToFastlane(
fileContent,
lanes[selectedLane.index],
org,
project
project,
);
}

Expand Down
9 changes: 4 additions & 5 deletions src/apple/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export function getRunScriptTemplate(
uploadSource = true,
): string {
// eslint-disable-next-line no-useless-escape
return `# This script is responsable to upload debug symbols and source context for Sentry.\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${uploadSource ? '--include-sources ' : ''}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho "warning: sentry-cli - $ERROR"\\nfi\\nelse\\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\\nfi\\n`;
return `# This script is responsable to upload debug symbols and source context for Sentry.\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=${orgSlug}\\nexport SENTRY_PROJECT=${projectSlug}\\nERROR=$(sentry-cli debug-files upload ${
uploadSource ? '--include-sources ' : ''
}"$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho "warning: sentry-cli - $ERROR"\\nfi\\nelse\\necho "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"\\nfi\\n`;
}

export const scriptInputPath =
Expand Down Expand Up @@ -38,10 +40,7 @@ export function getObjcSnippet(dsn: string): string {
[SentrySDK captureMessage:@"This app uses Sentry!"];\n`;
}

export function getFastlaneSnippet(
org: string,
project: string
): string {
export function getFastlaneSnippet(org: string, project: string): string {
return ` sentry_cli(
org_slug: '${org}',
project_slug: '${project}',
Expand Down
23 changes: 13 additions & 10 deletions src/utils/sentrycli-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ import * as fs from 'fs';
import * as path from 'path';

export interface SentryCLIConfiguration {
auth_token: string
auth_token: string;
}

export function createSentryCLIRC(directory: string, params: SentryCLIConfiguration) {
const rcPath = path.join(directory, '.sentryclirc');
fs.writeFileSync(rcPath, "[auth]\ntoken=" + params.auth_token);
export function createSentryCLIRC(
directory: string,
params: SentryCLIConfiguration,
) {
const rcPath = path.join(directory, '.sentryclirc');
fs.writeFileSync(rcPath, '[auth]\ntoken=' + params.auth_token);

if (fs.existsSync(".gitignore")) {
const gitIgnore = fs.readFileSync(".gitignore").toString();
if (!gitIgnore.includes(".sentryclirc")) {
fs.appendFileSync(".gitignore", "\n.sentryclirc");
}
if (fs.existsSync('.gitignore')) {
const gitIgnore = fs.readFileSync('.gitignore').toString();
if (!gitIgnore.includes('.sentryclirc')) {
fs.appendFileSync('.gitignore', '\n.sentryclirc');
}
}
}
}

0 comments on commit e237b28

Please sign in to comment.