Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apple): Add support for iOS #334

Merged
merged 26 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fedfcc2
iOS Support
brustolin Jul 5, 2023
460207b
Merge branch 'master' into feat/apple-support
brustolin Jul 5, 2023
30244d0
Delete launch.json
brustolin Jul 5, 2023
2510c4f
Update CHANGELOG.md
brustolin Jul 5, 2023
b260076
Update bin.ts
brustolin Jul 5, 2023
09c22cf
Update code-tools.ts
brustolin Jul 5, 2023
67c2e9f
Update ChooseIntegration.ts
brustolin Jul 5, 2023
1a1c17e
Apply suggestions from code review
brustolin Jul 6, 2023
c7acc22
some fixes
brustolin Jul 6, 2023
6aca98c
Merge branch 'feat/apple-support' of https://github.com/getsentry/sen…
brustolin Jul 6, 2023
af68bc3
Update apple-wizard.ts
brustolin Jul 6, 2023
819317a
Merge branch 'master' into feat/apple-support
brustolin Jul 6, 2023
db2c85d
Update Constants.ts
brustolin Jul 6, 2023
8b693e5
Merge branch 'feat/apple-support' of https://github.com/getsentry/sen…
brustolin Jul 6, 2023
f0303d5
Apply suggestions from code review
brustolin Jul 6, 2023
5ed26db
Merge branch 'master' into feat/apple-support
brustolin Jul 7, 2023
24d6664
multiple projects in the same folder
brustolin Jul 7, 2023
12aefe2
Merge branch 'feat/apple-support' of https://github.com/getsentry/sen…
brustolin Jul 7, 2023
1c754f0
Update CHANGELOG.md
brustolin Jul 7, 2023
ae9bac2
Update xcode-manager.ts
brustolin Jul 7, 2023
f03f50a
Update xcode-manager.ts
brustolin Jul 7, 2023
c9ca7c8
telemetry
brustolin Jul 10, 2023
b70a26e
Update Wizard.ts
brustolin Jul 10, 2023
44b8bde
Update Wizard.ts
brustolin Jul 10, 2023
792e6aa
Apply suggestions from code review
brustolin Jul 10, 2023
efbdd1c
Merge branch 'master' into feat/apple-support
brustolin Jul 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/bin.ts",
"args": ["-i", "ios"],
"cwd": "/Users/brustolin/Documents/Projects/iOS/ObjcTest",
"preLaunchTask": "tsc: build - tsconfig.json",
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"console": "integratedTerminal"
}
]
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

- feat(apple): Add support for iOS (#334)
- feat(sourcemaps): Detect SvelteKit and NextJS projects and redirect to dedicated wizards (#341)
- ref(sourcemaps): Improve Outro message (#344)

Expand Down
11 changes: 11 additions & 0 deletions bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { runNextjsWizard } from './src/nextjs/nextjs-wizard';
import { runSourcemapsWizard } from './src/sourcemaps/sourcemaps-wizard';
import { runSvelteKitWizard } from './src/sveltekit/sveltekit-wizard';
import { runAppleWizard } from './src/apple/apple-wizard';
import { withTelemetry } from './src/telemetry';
import { WizardOptions } from './src/utils/types';
export * from './lib/Setup';
Expand Down Expand Up @@ -66,11 +67,11 @@
// Collect argv options that are relevant for the new wizard
// flows based on `clack`
const wizardOptions: WizardOptions = {
url: argv.url as string | undefined,

Check warning on line 70 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access .url on an `any` value
promoCode: argv['promo-code'] as string | undefined,

Check warning on line 71 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access ['promo-code'] on an `any` value
};

switch (argv.i) {

Check warning on line 74 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access .i on an `any` value
case 'nextjs':
// eslint-disable-next-line no-console
runNextjsWizard(wizardOptions).catch(console.error);
Expand All @@ -82,13 +83,23 @@
case 'sourcemaps':
withTelemetry(
{
enabled: !argv['disable-telemetry'],

Check warning on line 86 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access ['disable-telemetry'] on an `any` value
integration: 'sourcemaps',
},
() => runSourcemapsWizard(wizardOptions),
// eslint-disable-next-line no-console
).catch(console.error);
break;
case 'ios':
withTelemetry(
{
enabled: !argv['disable-telemetry'],

Check warning on line 96 in bin.ts

View workflow job for this annotation

GitHub Actions / Lint

Unsafe member access ['disable-telemetry'] on an `any` value
integration: 'ios'
},
() => runAppleWizard(wizardOptions),
// eslint-disable-next-line no-console
).catch(console.error);
break
default:
void run(argv);
}
6 changes: 6 additions & 0 deletions lib/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** Key value should be the same here */
export enum Integration {
reactNative = 'reactNative',
ios = 'ios',
cordova = 'cordova',
electron = 'electron',
nextjs = 'nextjs',
Expand All @@ -14,7 +15,7 @@
android = 'android',
}

export function getPlatformChoices(): any[] {

Check warning on line 18 in lib/Constants.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
return Object.keys(Platform).map((platform: string) => ({
checked: true,
name: getPlatformDescription(platform),
Expand Down Expand Up @@ -45,6 +46,8 @@
return 'SvelteKit';
case Integration.sourcemaps:
return 'Configure Source Maps Upload';
case Integration.ios:
return 'iOS';
default:
return 'React Native';
}
Expand All @@ -64,6 +67,8 @@
return 'javascript-sveltekit';
case Integration.sourcemaps:
return undefined;
case Integration.ios:
return 'iOS';
default:
throw new Error(`Unknown integration ${type}`);
}
Expand Down Expand Up @@ -91,6 +96,7 @@
quiet: boolean;
signup: boolean;
promoCode?: string;
disableTelemetry?: boolean;
}

export const DEFAULT_URL = 'https://sentry.io/';
3 changes: 3 additions & 0 deletions lib/Helper/Wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ function sanitizeAndValidateArgs(argv: Args): void {
}
// @ts-ignore skip-connect does not exist on args
argv.promoCode = argv['promo-code'];

// @ts-ignore skip-connect does not exist on args
argv.disableTelemetry = argv['disable-telemetry'] != undefined;
}

export function getCurrentIntegration(answers: Answers): BaseIntegration {
Expand Down
3 changes: 2 additions & 1 deletion lib/Helper/__tests__/SentryCli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="jest" />
import type { Answers } from 'inquirer';

import type { Args} from '../../Constants';
import type { Args } from '../../Constants';
import { Integration, Platform } from '../../Constants';
import { SentryCli } from '../SentryCli';

Expand All @@ -14,6 +14,7 @@ const args: Args = {
uninstall: false,
url: 'https://localhost:1234',
signup: false,
disableTelemetry: false
};

const demoAnswers: Answers = {
Expand Down
4 changes: 4 additions & 0 deletions lib/Steps/ChooseIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Electron } from './Integrations/Electron';
import { NextJsShim } from './Integrations/NextJsShim';
import { ReactNative } from './Integrations/ReactNative';
import { SourceMapsShim } from './Integrations/SourceMapsShim';
import { Apple } from './Integrations/Apple';
import { SvelteKitShim } from './Integrations/SvelteKitShim';

let projectPackage: any = {};
Expand Down Expand Up @@ -51,6 +52,9 @@ export class ChooseIntegration extends BaseStep {
case Integration.sourcemaps:
integration = new SourceMapsShim(this._argv);
break;
case Integration.ios:
integration = new Apple(this._argv);
break;
case Integration.reactNative:
default:
integration = new ReactNative(sanitizeUrl(this._argv));
Expand Down
32 changes: 32 additions & 0 deletions lib/Steps/Integrations/Apple.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Answers } from 'inquirer';
import type { Args } from '../../Constants';
import { BaseIntegration } from './BaseIntegration';
import { runAppleWizard } from '../../../src/apple/apple-wizard';
import { withTelemetry } from '../../../src/telemetry';

export class Apple extends BaseIntegration {
argv: Args;
public constructor(protected _argv: Args) {
super(_argv);
this.argv = _argv;
}

public async emit(_answers: Answers): Promise<Answers> {
await withTelemetry(
{
enabled: !this.argv.disableTelemetry,
integration: 'ios'
},
async () =>
await runAppleWizard({ promoCode: this._argv.promoCode, url: this._argv.url, })
,
// eslint-disable-next-line no-console
).catch(console.error);

return {};
}

public async shouldConfigure(_answers: Answers): Promise<Answers> {
return this._shouldConfigure;
}
}
Loading
Loading