@sentry/wizard 6.12.0 → 6.13.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 +15 -0
- package/dist/bin.js +16 -1
- package/dist/bin.js.map +1 -1
- package/dist/e2e-tests/tests/angular-17.test.js +3 -4
- package/dist/e2e-tests/tests/angular-17.test.js.map +1 -1
- package/dist/e2e-tests/tests/angular-19.test.js +3 -4
- package/dist/e2e-tests/tests/angular-19.test.js.map +1 -1
- package/dist/e2e-tests/tests/flutter.test.js +60 -0
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/help-message.test.js +8 -3
- package/dist/e2e-tests/tests/help-message.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-3.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +12 -6
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/e2e-tests/tests/pnpm-workspace.test.js +6 -3
- package/dist/e2e-tests/tests/pnpm-workspace.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js +4 -4
- package/dist/e2e-tests/tests/react-router-instrumentation-api.test.js.map +1 -1
- package/dist/e2e-tests/tests/react-router.test.js +3 -6
- package/dist/e2e-tests/tests/react-router.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +2 -4
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js +24 -8
- package/dist/e2e-tests/tests/sveltekit-hooks.test.js.map +1 -1
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js +6 -3
- package/dist/e2e-tests/tests/sveltekit-tracing.test.js.map +1 -1
- package/dist/lib/Constants.d.ts +1 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +2 -2
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/android/android-wizard.js +3 -0
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/angular/codemods/main.d.ts +1 -1
- package/dist/src/angular/codemods/main.js +0 -1
- package/dist/src/angular/codemods/main.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +2 -3
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/check-installed-cli.d.ts +1 -1
- package/dist/src/apple/check-installed-cli.js +13 -7
- package/dist/src/apple/check-installed-cli.js.map +1 -1
- package/dist/src/apple/configure-xcode-project.js +8 -1
- package/dist/src/apple/configure-xcode-project.js.map +1 -1
- package/dist/src/apple/lookup-xcode-project.d.ts +8 -5
- package/dist/src/apple/lookup-xcode-project.js +22 -17
- package/dist/src/apple/lookup-xcode-project.js.map +1 -1
- package/dist/src/apple/options.d.ts +5 -0
- package/dist/src/apple/options.js.map +1 -1
- package/dist/src/apple/sentry-swift-package.d.ts +4 -0
- package/dist/src/apple/sentry-swift-package.js +17 -0
- package/dist/src/apple/sentry-swift-package.js.map +1 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.d.ts +2 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js +251 -0
- package/dist/src/apple/snapshots/apple-snapshots-wizard.js.map +1 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.d.ts +13 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js +48 -0
- package/dist/src/apple/snapshots/configure-snapshotpreviews-xcode-project.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-test-file.d.ts +18 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js +122 -0
- package/dist/src/apple/snapshots/snapshot-test-file.js.map +1 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.d.ts +6 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js +147 -0
- package/dist/src/apple/snapshots/snapshot-verification-scheme.js.map +1 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.d.ts +4 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js +8 -0
- package/dist/src/apple/snapshots/snapshotpreviews-package.js.map +1 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.d.ts +23 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js +136 -0
- package/dist/src/apple/snapshots/snapshots-cli-preflight.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +59 -1
- package/dist/src/apple/xcode-manager.js +507 -106
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -0
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/templates.js +12 -6
- package/dist/src/nextjs/templates.js.map +1 -1
- package/dist/src/nuxt/templates.js +12 -6
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/react-router/codemods/client.entry.d.ts +1 -1
- package/dist/src/react-router/codemods/client.entry.js +93 -52
- package/dist/src/react-router/codemods/client.entry.js.map +1 -1
- package/dist/src/react-router/codemods/server-entry.js +8 -7
- package/dist/src/react-router/codemods/server-entry.js.map +1 -1
- package/dist/src/react-router/react-router-wizard.js +13 -19
- package/dist/src/react-router/react-router-wizard.js.map +1 -1
- package/dist/src/react-router/sdk-setup.d.ts +2 -2
- package/dist/src/react-router/sdk-setup.js +16 -15
- package/dist/src/react-router/sdk-setup.js.map +1 -1
- package/dist/src/react-router/templates.d.ts +1 -3
- package/dist/src/react-router/templates.js +24 -92
- package/dist/src/react-router/templates.js.map +1 -1
- package/dist/src/remix/sdk-setup.js +1 -2
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/run.d.ts +4 -1
- package/dist/src/run.js +13 -0
- package/dist/src/run.js.map +1 -1
- package/dist/src/sourcemaps/tools/remix.js +4 -4
- package/dist/src/sourcemaps/tools/remix.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup/setup.js +17 -4
- package/dist/src/sveltekit/sdk-setup/setup.js.map +1 -1
- package/dist/src/sveltekit/templates.js +12 -6
- package/dist/src/sveltekit/templates.js.map +1 -1
- package/dist/src/utils/clack/index.d.ts +2 -1
- package/dist/src/utils/clack/index.js +17 -6
- package/dist/src/utils/clack/index.js.map +1 -1
- package/dist/src/utils/files.d.ts +2 -0
- package/dist/src/utils/files.js +58 -0
- package/dist/src/utils/files.js.map +1 -0
- package/dist/src/utils/git.d.ts +3 -1
- package/dist/src/utils/git.js +2 -1
- package/dist/src/utils/git.js.map +1 -1
- package/dist/src/utils/line-endings.d.ts +1 -0
- package/dist/src/utils/line-endings.js +76 -0
- package/dist/src/utils/line-endings.js.map +1 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/test/angular/angular-wizard.test.js +0 -5
- package/dist/test/angular/angular-wizard.test.js.map +1 -1
- package/dist/test/apple/lookup-xcode-project.test.js +167 -0
- package/dist/test/apple/lookup-xcode-project.test.js.map +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.d.ts +1 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js +487 -0
- package/dist/test/apple/snapshots/apple-snapshots-wizard.test.js.map +1 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.d.ts +24 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js +191 -0
- package/dist/test/apple/snapshots/hosted-test-target-fixture.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js +110 -0
- package/dist/test/apple/snapshots/snapshot-test-file.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js +146 -0
- package/dist/test/apple/snapshots/snapshot-verification-scheme.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js +186 -0
- package/dist/test/apple/snapshots/snapshotpreviews-xcode-smoke.test.js.map +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.d.ts +1 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js +192 -0
- package/dist/test/apple/snapshots/snapshots-cli-preflight.test.js.map +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.d.ts +1 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js +77 -0
- package/dist/test/apple/snapshots/source-file-insertion.test.js.map +1 -0
- package/dist/test/apple/xcode-manager.test.js +452 -43
- package/dist/test/apple/xcode-manager.test.js.map +1 -1
- package/dist/test/constants.test.d.ts +1 -0
- package/dist/test/constants.test.js +12 -0
- package/dist/test/constants.test.js.map +1 -0
- package/dist/test/nextjs/templates.test.js +66 -33
- package/dist/test/nextjs/templates.test.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +66 -36
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/dist/test/react-router/codemods/client-entry.test.js +15 -11
- package/dist/test/react-router/codemods/client-entry.test.js.map +1 -1
- package/dist/test/react-router/codemods/server-entry.test.js +21 -8
- package/dist/test/react-router/codemods/server-entry.test.js.map +1 -1
- package/dist/test/react-router/sdk-setup.test.js +46 -10
- package/dist/test/react-router/sdk-setup.test.js.map +1 -1
- package/dist/test/react-router/templates.test.js +26 -64
- package/dist/test/react-router/templates.test.js.map +1 -1
- package/dist/test/remix/build-script.test.d.ts +1 -0
- package/dist/test/remix/build-script.test.js +124 -0
- package/dist/test/remix/build-script.test.js.map +1 -0
- package/dist/test/remix/client-entry.test.js +4 -10
- package/dist/test/remix/client-entry.test.js.map +1 -1
- package/dist/test/run.test.d.ts +1 -0
- package/dist/test/run.test.js +137 -0
- package/dist/test/run.test.js.map +1 -0
- package/dist/test/sveltekit/templates.test.js +78 -27
- package/dist/test/sveltekit/templates.test.js.map +1 -1
- package/dist/test/utils/clack/index.test.js +101 -0
- package/dist/test/utils/clack/index.test.js.map +1 -1
- package/dist/test/utils/git.test.js +10 -0
- package/dist/test/utils/git.test.js.map +1 -1
- package/dist/test/utils/line-endings.test.d.ts +1 -0
- package/dist/test/utils/line-endings.test.js +103 -0
- package/dist/test/utils/line-endings.test.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/react-router/codemods/root.d.ts +0 -1
- package/dist/src/react-router/codemods/root.js +0 -170
- package/dist/src/react-router/codemods/root.js.map +0 -1
- package/dist/test/react-router/codemods/root.test.js +0 -182
- package/dist/test/react-router/codemods/root.test.js.map +0 -1
- /package/dist/test/{react-router/codemods/root.test.d.ts → apple/lookup-xcode-project.test.d.ts} +0 -0
|
@@ -120,9 +120,12 @@ const clifty_1 = require("clifty");
|
|
|
120
120
|
// If you don't want to use Session Replay, just remove the line below:
|
|
121
121
|
integrations: [replayIntegration()],
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
dataCollection: {
|
|
124
|
+
// To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:
|
|
125
|
+
// https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection
|
|
126
|
+
// userInfo: false,
|
|
127
|
+
// httpBodies: [],
|
|
128
|
+
},
|
|
126
129
|
});
|
|
127
130
|
|
|
128
131
|
// If you have a custom error handler, pass it to \`handleErrorWithSentry\`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit-tracing.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit-tracing.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAWkB;AAClB,mCAAmE;AAEnE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAW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AC,qBAAqB,EAAE,KAAK,IAAI,EAAE;YACnC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;YAC1C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC3C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Sveltekit with instrumentation and tracing', () => {\n describe('without existing files', () => {\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'sveltekit-tracing-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, '@sentry/sveltekit');\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n checkFileContents(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n // svelte 5 specific syntax\n ['let hasSentError = $state(false);', 'onclick={getSentryData}'],\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\n \"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n\n expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"\n `);\n });\n\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"sveltekit-tracing.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/sveltekit-tracing.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,4CAA8B;AAC9B,mDAAkD;AAClD,oCAWkB;AAClB,mCAAmE;AAEnE,uCAAuC;AACvC,mCAAuC;AAEvC,IAAA,iBAAQ,EAAC,4CAA4C,EAAE,GAAG,EAAE;IAC1D,IAAA,iBAAQ,EAAC,wBAAwB,EAAE,GAAG,EAAE;QACtC,MAAM,WAAW,GAAG,uBAAW,CAAC,SAAS,CAAC;QAC1C,IAAI,cAAsB,CAAC;QAE3B,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,IAAA,6BAAqB,EACnD,4BAA4B,CAC7B,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,c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,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QAEH,IAAA,WAAE,EAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC3C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport * as fs from 'node:fs';\nimport { Integration } from '../../lib/Constants';\nimport {\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n createIsolatedTestEnv,\n getWizardCommand,\n TEST_ARGS,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, it } from 'vitest';\n\n//@ts-expect-error - clifty is ESM only\nimport { KEYS, withEnv } from 'clifty';\n\ndescribe('Sveltekit with instrumentation and tracing', () => {\n describe('without existing files', () => {\n const integration = Integration.sveltekit;\n let wizardExitCode: number;\n\n const { projectDir, cleanup } = createIsolatedTestEnv(\n 'sveltekit-tracing-test-app',\n );\n\n beforeAll(async () => {\n wizardExitCode = await withEnv({\n cwd: projectDir,\n })\n .defineInteraction()\n .expectOutput(\n 'The Sentry SvelteKit Wizard will help you set up Sentry for your application',\n )\n .step('package installation', ({ expectOutput, whenAsked }) => {\n whenAsked('Please select your package manager.').respondWith(\n KEYS.DOWN,\n KEYS.ENTER,\n );\n expectOutput('Installing @sentry/sveltekit');\n })\n .step('SDK setup', ({ whenAsked }) => {\n whenAsked('Do you want to enable Tracing', {\n timeout: 90_000, // package installation can take a while in CI\n }).respondWith(KEYS.ENTER);\n whenAsked('Do you want to enable Session Replay').respondWith(\n KEYS.ENTER,\n );\n whenAsked('Do you want to enable Logs').respondWith(KEYS.ENTER);\n })\n .whenAsked('Do you want to create an example page')\n .respondWith(KEYS.ENTER)\n .whenAsked(\n 'Optionally add a project-scoped MCP server configuration for the Sentry MCP?',\n )\n .respondWith(KEYS.DOWN, KEYS.ENTER)\n .expectOutput('Successfully installed the Sentry SvelteKit SDK!')\n .run(getWizardCommand(integration));\n });\n\n afterAll(() => {\n cleanup();\n });\n\n it('exits with exit code 0', () => {\n expect(wizardExitCode).toBe(0);\n });\n\n it('adds the SDK dependency to package.json', () => {\n checkPackageJson(projectDir, '@sentry/sveltekit');\n });\n\n it('adds the .env.sentry-build-plugin', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n it('adds the example page', () => {\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n );\n checkFileExists(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+server.js'),\n );\n checkFileContents(\n path.resolve(projectDir, 'src/routes/sentry-example-page/+page.svelte'),\n // svelte 5 specific syntax\n ['let hasSentError = $state(false);', 'onclick={getSentryData}'],\n );\n });\n\n it('adds the sentry plugin to vite.config.ts', () => {\n const viteConfig = fs.readFileSync(\n path.resolve(projectDir, 'vite.config.ts'),\n );\n expect(viteConfig.toString()).toMatchInlineSnapshot(`\n \"import { sentrySvelteKit } from \"@sentry/sveltekit\";\n import { sveltekit } from '@sveltejs/kit/vite';\n import { defineConfig } from 'vite';\n\n export default defineConfig({\n \tplugins: [sentrySvelteKit({\n org: \"${TEST_ARGS.ORG_SLUG}\",\n project: \"${TEST_ARGS.PROJECT_SLUG}\"\n }), sveltekit()]\n });\n \"\n `);\n });\n\n it('creates the hook files', () => {\n const clientHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.client.ts'),\n );\n const serverHooks = fs.readFileSync(\n path.resolve(projectDir, 'src/hooks.server.ts'),\n );\n\n expect(clientHooks.toString()).toMatchInlineSnapshot(`\n \"import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\n import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n\n // If you don't want to use Session Replay, just remove the line below:\n integrations: [replayIntegration()],\n\n dataCollection: {\n // To disable sending user data and HTTP bodies, uncomment the lines below. For more info visit:\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#dataCollection\n // userInfo: false,\n // httpBodies: [],\n },\n });\n\n // If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\n export const handleError = handleErrorWithSentry();\n \"\n `);\n\n expect(serverHooks.toString()).toMatchInlineSnapshot(`\n \"import {sequence} from \"@sveltejs/kit/hooks\";\n import * as Sentry from \"@sentry/sveltekit\";\n export const handle = sequence(Sentry.sentryHandle(), async ({ event, resolve }) => {\n const response = await resolve(event);\n return response;\n });\n export const handleError = Sentry.handleErrorWithSentry();\"\n `);\n });\n\n it('creates the insturmentation.server file', () => {\n const instrumentationServer = fs.readFileSync(\n path.resolve(projectDir, 'src/instrumentation.server.ts'),\n );\n\n expect(instrumentationServer.toString()).toMatchInlineSnapshot(`\n \"import * as Sentry from '@sentry/sveltekit';\n\n Sentry.init({\n dsn: '${TEST_ARGS.PROJECT_DSN}',\n\n tracesSampleRate: 1.0,\n\n // Enable logs to be sent to Sentry\n enableLogs: true,\n\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n });\"\n `);\n });\n\n it('enables tracing and instrumentation in svelte.config.js', () => {\n const svelteConfig = fs.readFileSync(\n path.resolve(projectDir, 'svelte.config.js'),\n );\n expect(svelteConfig.toString()).toMatchInlineSnapshot(`\n \"import adapter from '@sveltejs/adapter-node';\n import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';\n\n /** @type {import('@sveltejs/kit').Config} */\n const config = {\n // Consult https://svelte.dev/docs/kit/integrations#preprocessors\n // for more information about preprocessors\n preprocess: vitePreprocess(),\n\n kit: {\n // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.\n // If your environment is not supported, or you settled on a specific environment, switch out the adapter.\n // See https://svelte.dev/docs/kit/adapters for more information about adapters.\n adapter: adapter(),\n experimental: {\n remoteFunctions: true,\n\n tracing: {\n server: true,\n },\n\n instrumentation: {\n server: true,\n },\n },\n },\n };\n\n export default config;\"\n `);\n });\n\n // checkSvelteKitProject(projectDir, integration);\n it('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n it('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'ready in');\n });\n\n it('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'to expose', 'preview');\n });\n });\n});\n"]}
|
package/dist/lib/Constants.d.ts
CHANGED
package/dist/lib/Constants.js
CHANGED
|
@@ -7,6 +7,7 @@ var Integration;
|
|
|
7
7
|
Integration["reactNative"] = "reactNative";
|
|
8
8
|
Integration["flutter"] = "flutter";
|
|
9
9
|
Integration["ios"] = "ios";
|
|
10
|
+
Integration["appleSnapshots"] = "appleSnapshots";
|
|
10
11
|
Integration["android"] = "android";
|
|
11
12
|
Integration["cordova"] = "cordova";
|
|
12
13
|
Integration["angular"] = "angular";
|
|
@@ -66,6 +67,8 @@ function getIntegrationDescription(type) {
|
|
|
66
67
|
return 'Configure Source Maps Upload';
|
|
67
68
|
case Integration.ios:
|
|
68
69
|
return 'iOS';
|
|
70
|
+
case Integration.appleSnapshots:
|
|
71
|
+
return 'Apple Snapshots';
|
|
69
72
|
case Integration.cloudflare:
|
|
70
73
|
return 'Cloudflare';
|
|
71
74
|
default:
|
|
@@ -101,6 +104,8 @@ function mapIntegrationToPlatform(type) {
|
|
|
101
104
|
return 'node-cloudflare-workers';
|
|
102
105
|
case Integration.ios:
|
|
103
106
|
return 'iOS';
|
|
107
|
+
case Integration.appleSnapshots:
|
|
108
|
+
return 'iOS';
|
|
104
109
|
default:
|
|
105
110
|
throw new Error(`Unknown integration ${type}`);
|
|
106
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,
|
|
1
|
+
{"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAgBX;AAhBD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,gDAAiC,CAAA;IACjC,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,0CAA2B,CAAA;IAC3B,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;AAC3B,CAAC,EAhBW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAgBtB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,SAAgB,kBAAkB;IAKhC,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,sBAAsB,CAAC,QAAQ,CAAC;QACtC,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC,CAAC;AACN,CAAC;AAVD,gDAUC;AAED,SAAgB,sBAAsB,CAAC,IAAY;IACjD,QAAQ,IAAI,EAAE;QACZ,KAAK,QAAQ,CAAC,GAAG;YACf,OAAO,KAAK,CAAC;Q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AAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,yBAAyB,CAAC;QACnC,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,yBAAyB,CAAC;QACnC,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf,KAAK,WAAW,CAAC,cAAc;YAC7B,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;KAClD;AACH,CAAC;AAjCD,4DAiCC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAkBY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n appleSnapshots = 'appleSnapshots',\n android = 'android',\n cordova = 'cordova',\n angular = 'angular',\n cloudflare = 'cloudflare',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n reactRouter = 'reactRouter',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): Array<{\n checked: boolean;\n name: string;\n value: string;\n}> {\n return Object.keys(Platform).map((platform) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.reactRouter:\n return 'React Router (framework)';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n case Integration.appleSnapshots:\n return 'Apple Snapshots';\n case Integration.cloudflare:\n return 'Cloudflare';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.angular:\n return 'javascript-angular';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.reactRouter:\n return 'javascript-react-router';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.cloudflare:\n return 'node-cloudflare-workers';\n case Integration.ios:\n return 'iOS';\n case Integration.appleSnapshots:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n comingFrom?: string;\n ignoreGitChanges?: boolean;\n xcodeProjectDir?: string;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
|
|
@@ -40,8 +40,8 @@ const Sentry = require('@sentry/electron/main');
|
|
|
40
40
|
Sentry.init({
|
|
41
41
|
dsn: '___DSN___',
|
|
42
42
|
|
|
43
|
-
//
|
|
44
|
-
// https://docs.sentry.io/platforms/javascript/guides/
|
|
43
|
+
// Adds more context data to events (IP address, cookies, user, etc.)
|
|
44
|
+
// For more information, visit: https://docs.sentry.io/platforms/javascript/guides/electron/configuration/options/#sendDefaultPii
|
|
45
45
|
sendDefaultPii: true,
|
|
46
46
|
});`;
|
|
47
47
|
const CODE_EXAMPLE_RENDERER = `// ESM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Electron.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Electron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAE9B,uCAAkC;AAClC,gDAAkC;AAGlC,kDAA8D;AAC9D,sDAAmD;AACnD,uDAAoD;AAGpD,MAAM,2BAA2B,GAAG,QAAQ,CAAC;AAC7C,MAAM,oBAAoB,GAAG,QAAQ,CACnC,2BAA2B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAC/C,EAAE,CACH,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;IAWtB,CAAC;AAEL,MAAM,qBAAqB,GAAG;;;;;iBAKb,CAAC;AAMlB,IAAI,UAAU,GAAgB,EAAE,CAAC;AAEjC,SAAS,YAAY,CAAC,OAAe,EAAE,KAAK,GAAG,EAAE;IAC/C,IAAI,KAAK,EAAE;QACT,IAAA,WAAC,EAAC,KAAK,CAAC,CAAC;KACV;IAED,IAAA,YAAE,GAAE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,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EACtE,EAAE,CACH,CAAC;QAEF,IACE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC;YACvC,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,EAC1C;YACA,IAAA,aAAG,EAAC,KAAK,WAAW,6BAA6B,CAAC,CAAC;YACnD,IAAA,aAAG,EAAC,mCAAmC,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC;SACd;QACD,IACE,UAAU;YACV,UAAU,GAAG,oBAAoB;YACjC,aAAa,GAAG,oBAAoB,EACpC;YACA,IAAA,aAAG,EACD,+BAA+B,WAAW,gBAAgB,2BAA2B,SAAS,CAC/F,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QACD,IAAI,UAAU,EAAE;YACd,IAAA,eAAK,EAAC,KAAK,WAAW,MAAM,UAAU,eAAe,CAAC,CAAC;SACxD;aAAM;YACL,IAAA,eAAK,EAAC,KAAK,WAAW,eAAe,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3GD,4BA2GC","sourcesContent":["import * as fs from 'node:fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as path from 'node: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';\nimport { Config } from '../../Types';\n\nconst MIN_ELECTRON_VERSION_STRING = '23.0.0';\nconst MIN_ELECTRON_VERSION = parseInt(\n MIN_ELECTRON_VERSION_STRING.replace(/\\D+/g, ''),\n 10,\n);\n\nconst CODE_EXAMPLE_MAIN = `// ESM\nimport * as Sentry from '@sentry/electron/main';\n// CommonJs\nconst Sentry = require('@sentry/electron/main');\n\nSentry.init({\n dsn: '___DSN___',\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YACd,IAAA,eAAK,EAAC,KAAK,WAAW,MAAM,UAAU,eAAe,CAAC,CAAC;SACxD;aAAM;YACL,IAAA,eAAK,EAAC,KAAK,WAAW,eAAe,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3GD,4BA2GC","sourcesContent":["import * as fs from 'node:fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as path from 'node: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';\nimport { Config } from '../../Types';\n\nconst MIN_ELECTRON_VERSION_STRING = '23.0.0';\nconst MIN_ELECTRON_VERSION = parseInt(\n MIN_ELECTRON_VERSION_STRING.replace(/\\D+/g, ''),\n 10,\n);\n\nconst CODE_EXAMPLE_MAIN = `// ESM\nimport * as Sentry from '@sentry/electron/main';\n// CommonJs\nconst Sentry = require('@sentry/electron/main');\n\nSentry.init({\n dsn: '___DSN___',\n\n // Adds more context data to events (IP address, cookies, user, etc.)\n // For more information, visit: https://docs.sentry.io/platforms/javascript/guides/electron/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n});`;\n\nconst CODE_EXAMPLE_RENDERER = `// ESM\nimport * as Sentry from '@sentry/electron/renderer';\n// CommonJs\nconst Sentry = require('@sentry/electron/renderer');\n\nSentry.init({});`;\n\ntype PackageJSON = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n};\nlet appPackage: PackageJSON = {};\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 = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'),\n ) as PackageJSON;\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 & { config?: Config }): Promise<Answers> {\n const dsn = answers.config?.dsn?.public ?? 'DSN NOT FOUND';\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_MAIN.replace('___DSN___', dsn),\n 'Add these lines in to your main process code to setup Sentry:',\n );\n\n printExample(\n CODE_EXAMPLE_RENDERER,\n 'Add these lines in to your renderer processes code 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 (!continued?.continue) {\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 (appPackage.dependencies?.[packageName] || '0').replace(/\\D+/g, ''),\n 10,\n );\n const devDepVersion = parseInt(\n (appPackage.devDependencies?.[packageName] || '0').replace(/\\D+/g, ''),\n 10,\n );\n\n if (\n !appPackage.dependencies?.[packageName] &&\n !appPackage.devDependencies?.[packageName]\n ) {\n red(`✗ ${packageName} isn't in your dependencies`);\n red(' please install it with yarn/npm');\n return false;\n }\n 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 }\n if (minVersion) {\n green(`✓ ${packageName} > ${minVersion} is installed`);\n } else {\n green(`✓ ${packageName} is installed`);\n }\n return true;\n }\n}\n"]}
|
|
@@ -41,6 +41,7 @@ const codetools = __importStar(require("./code-tools"));
|
|
|
41
41
|
const gradle = __importStar(require("./gradle"));
|
|
42
42
|
const manifest = __importStar(require("./manifest"));
|
|
43
43
|
const abort_if_sportlight_not_supported_1 = require("../utils/abort-if-sportlight-not-supported");
|
|
44
|
+
const line_endings_1 = require("../utils/line-endings");
|
|
44
45
|
const proguardMappingCliSetupConfig = {
|
|
45
46
|
...clack_1.propertiesCliSetupConfig,
|
|
46
47
|
name: 'proguard mappings',
|
|
@@ -132,6 +133,8 @@ async function runAndroidWizardWithTelemetry(options) {
|
|
|
132
133
|
await (0, clack_1.addSentryCliConfig)({ authToken }, proguardMappingCliSetupConfig);
|
|
133
134
|
// Offer optional project-scoped MCP config for Sentry with org and project scope
|
|
134
135
|
await (0, mcp_config_1.offerProjectScopedMcpConfig)(selectedProject.organization.slug, selectedProject.slug);
|
|
136
|
+
// Fix mixed line endings caused by inserting LF content into CRLF files (Windows)
|
|
137
|
+
(0, line_endings_1.fixLineEndings)();
|
|
135
138
|
// ======== OUTRO ========
|
|
136
139
|
const issuesPageLink = selfHosted
|
|
137
140
|
? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"android-wizard.js","sourceRoot":"","sources":["../../../src/android/android-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA4D;AAC5D,uCAAyB;AACzB,+EAA+E;AAC/E,sDAAwC;AAC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AAI,CACV;EACA,cAAc,EAAE,CACjB;;;;GAIE,CAAC,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC,SAAS,uBAAuB,CAC9B,GAAW,EACX,UAAoB,EACpB,sBAAgC,EAAE;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;KACF;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n CliSetupConfig,\n abort,\n abortIfCancelled,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack';\nimport { WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport * as codetools from './code-tools';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport { abortIfSpotlightNotSupported } from '../utils/abort-if-sportlight-not-supported';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n ...propertiesCliSetupConfig,\n name: 'proguard mappings',\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n wizardOptions: options,\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const projectData = await getOrAskForProjectData(options, 'android');\n\n if (projectData.spotlight) {\n return abortIfSpotlightNotSupported('Android');\n }\n\n const { selectedProject, selfHosted, sentryUrl, authToken } = projectData;\n\n // Ask if user wants to enable Sentry Logs\n const enableLogs = await abortIfCancelled(\n clack.confirm({\n message:\n 'Do you want to enable Logs? (See https://docs.sentry.io/platforms/android/logs/)',\n }),\n );\n Sentry.setTag('enable-logs', enableLogs);\n\n if (enableLogs) {\n clack.log.info(\n 'Logs will be enabled with default settings. You can send logs using the Sentry.logger() APIs or use one of the integrations: https://docs.sentry.io/platforms/android/logs/#integrations.',\n );\n }\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n enableLogs,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n\n await addSentryCliConfig({ authToken }, proguardMappingCliSetupConfig);\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n // ======== OUTRO ========\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n${issuesPageLink}`,\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"android-wizard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Ae,CAAC,EAAE,EAAE;QACxG,CAAC,CAAC,WAAW,eAAe,CAAC,YAAY,CAAC,IAAI,8BAA8B,eAAe,CAAC,EAAE,EAAE,CAAC;IAEnG,KAAK,CAAC,KAAK,CAAC;EACZ,eAAK,CAAC,WAAW,CAAC,gDAAgD,CAAC;;EAEnE,eAAK,CAAC,IAAI,CACV;EACA,cAAc,EAAE,CACjB;;;;GAIE,CAAC,CAAC;AACL,CAAC;AAED,qCAAqC;AACrC,SAAS,uBAAuB,CAC9B,GAAW,EACX,UAAoB,EACpB,sBAAgC,EAAE;IAElC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,IAAI,CAAC,WAAW,EAAE,EAAE;YACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YAC3C,uBAAuB,CAAC,QAAQ,EAAE,UAAU,EAAE,mBAAmB,CAAC,CAAC;SACpE;aAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE;YAC5D,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACzE;KACF;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\nimport * as fs from 'fs';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport * as path from 'path';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n CliSetupConfig,\n abort,\n abortIfCancelled,\n addSentryCliConfig,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n propertiesCliSetupConfig,\n} from '../utils/clack';\nimport { WizardOptions } from '../utils/types';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport * as codetools from './code-tools';\nimport * as gradle from './gradle';\nimport * as manifest from './manifest';\nimport { abortIfSpotlightNotSupported } from '../utils/abort-if-sportlight-not-supported';\nimport { fixLineEndings } from '../utils/line-endings';\n\nconst proguardMappingCliSetupConfig: CliSetupConfig = {\n ...propertiesCliSetupConfig,\n name: 'proguard mappings',\n};\n\nexport async function runAndroidWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'android',\n wizardOptions: options,\n },\n () => runAndroidWizardWithTelemetry(options),\n );\n}\n\nasync function runAndroidWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Android Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const projectDir = process.cwd();\n const buildGradleFiles = findFilesWithExtensions(projectDir, [\n '.gradle',\n 'gradle.kts',\n ]);\n\n if (!buildGradleFiles || buildGradleFiles.length === 0) {\n clack.log.error(\n 'No Gradle project found. Please run this command from the root of your project.',\n );\n Sentry.captureException('No Gradle project found');\n await abort();\n return;\n }\n\n const appFile = await traceStep('Select App File', () =>\n gradle.selectAppFile(buildGradleFiles),\n );\n\n const projectData = await getOrAskForProjectData(options, 'android');\n\n if (projectData.spotlight) {\n return abortIfSpotlightNotSupported('Android');\n }\n\n const { selectedProject, selfHosted, sentryUrl, authToken } = projectData;\n\n // Ask if user wants to enable Sentry Logs\n const enableLogs = await abortIfCancelled(\n clack.confirm({\n message:\n 'Do you want to enable Logs? (See https://docs.sentry.io/platforms/android/logs/)',\n }),\n );\n Sentry.setTag('enable-logs', enableLogs);\n\n if (enableLogs) {\n clack.log.info(\n 'Logs will be enabled with default settings. You can send logs using the Sentry.logger() APIs or use one of the integrations: https://docs.sentry.io/platforms/android/logs/#integrations.',\n );\n }\n\n // ======== STEP 1. Add Sentry Gradle Plugin to build.gradle(.kts) ============\n clack.log.step(\n `Adding ${chalk.bold('Sentry Gradle plugin')} to your app's ${chalk.cyan(\n 'build.gradle',\n )} file.`,\n );\n const pluginAdded = await traceStep('Add Gradle Plugin', () =>\n gradle.addGradlePlugin(\n appFile,\n selectedProject.organization.slug,\n selectedProject.slug,\n ),\n );\n if (!pluginAdded) {\n clack.log.warn(\n \"Could not add Sentry Gradle plugin to your app's build.gradle file. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#install\",\n );\n }\n Sentry.setTag('gradle-plugin-added', pluginAdded);\n\n // ======== STEP 2. Configure Sentry SDK via AndroidManifest ============\n clack.log.step(\n `Configuring Sentry SDK via ${chalk.cyan('AndroidManifest.xml')}`,\n );\n const appDir = path.dirname(appFile);\n const manifestFile = path.join(appDir, 'src', 'main', 'AndroidManifest.xml');\n\n const manifestUpdated = traceStep('Update Android Manifest', () =>\n manifest.addManifestSnippet(\n manifestFile,\n selectedProject.keys[0].dsn.public,\n enableLogs,\n ),\n );\n if (!manifestUpdated) {\n clack.log.warn(\n \"Could not configure the Sentry SDK. You'll have to do it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#configure\",\n );\n }\n Sentry.setTag('android-manifest-updated', manifestUpdated);\n\n // ======== STEP 3. Patch Main Activity with a test error snippet ============\n clack.log.step(\n `Patching ${chalk.bold('Main Activity')} with a test error snippet.`,\n );\n const mainActivity = traceStep('Find Main Activity', () =>\n manifest.getMainActivity(manifestFile),\n );\n let packageName = mainActivity.packageName;\n if (!packageName) {\n // if no package name in AndroidManifest, look into gradle script\n packageName = gradle.getNamespace(appFile);\n }\n const activityName = mainActivity.activityName;\n Sentry.setTag('has-activity-name', !!activityName);\n Sentry.setTag('has-package-name', !!packageName);\n if (!activityName || !packageName) {\n clack.log.warn(\n \"Could not find Activity with intent action MAIN. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n Sentry.captureException('Could not find Main Activity');\n } else {\n const packageNameStable = packageName;\n const activityFile = traceStep('Find Main Activity Source File', () =>\n codetools.findActivitySourceFile(appDir, packageNameStable, activityName),\n );\n\n const activityPatched = traceStep('Patch Main Activity', () =>\n codetools.patchMainActivity(activityFile),\n );\n if (!activityPatched) {\n clack.log.warn(\n \"Could not patch main activity. You'll have to manually verify the setup.\\nPlease follow the instructions at https://docs.sentry.io/platforms/android/#verify\",\n );\n }\n Sentry.setTag('main-activity-patched', activityPatched);\n }\n\n // ======== STEP 4. Add sentry-cli config file ============\n clack.log.step(\n `Configuring ${chalk.bold('proguard mappings upload')} via the ${chalk.cyan(\n 'sentry.properties',\n )} file.`,\n );\n\n await addSentryCliConfig({ authToken }, proguardMappingCliSetupConfig);\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n // Fix mixed line endings caused by inserting LF content into CRLF files (Windows)\n fixLineEndings();\n\n // ======== OUTRO ========\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n${chalk.greenBright('Successfully installed the Sentry Android SDK!')}\n\n${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n${issuesPageLink}`,\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/android/\n `);\n}\n\n//find files with the given extension\nfunction findFilesWithExtensions(\n dir: string,\n extensions: string[],\n filesWithExtensions: string[] = [],\n): string[] {\n const cwd = process.cwd();\n const files = fs.readdirSync(dir, { withFileTypes: true });\n for (const file of files) {\n if (file.isDirectory()) {\n const childDir = path.join(dir, file.name);\n findFilesWithExtensions(childDir, extensions, filesWithExtensions);\n } else if (extensions.some((ext) => file.name.endsWith(ext))) {\n filesWithExtensions.push(path.relative(cwd, path.join(dir, file.name)));\n }\n }\n return filesWithExtensions;\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export declare function insertInitCall(originalAppModuleMod: ProxifiedModule<any
|
|
|
10
10
|
replay: boolean;
|
|
11
11
|
logs: boolean;
|
|
12
12
|
}): void;
|
|
13
|
-
type InitCallArgs = Record<string, string | number | boolean | Array<Proxified>>;
|
|
13
|
+
type InitCallArgs = Record<string, string | number | boolean | Array<Proxified> | Record<string, boolean>>;
|
|
14
14
|
export declare function getInitCallArgs(dsn: string, selectedFeatures: {
|
|
15
15
|
performance: boolean;
|
|
16
16
|
replay: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../src/angular/codemods/main.ts"],"names":[],"mappings":";;;AAEA,uCAMkB;AAElB,SAAgB,iBAAiB;AAC/B,8DAA8D;AAC9D,oBAA0C,EAC1C,GAAW,EACX,gBAIC;IAGD,oBAAoB,CAAC,OAAO,CAAC,IAAI,CAAC;QAChC,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,GAAG;QACb,KAAK,EAAE,QAAQ;KAChB,CAAC,CAAC;IAEH,cAAc,CAAC,oBAAoB,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAE5D,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AApBD,8CAoBC;AAED,SAAgB,cAAc;AAC5B,8DAA8D;AAC9D,oBAA0C,EAC1C,GAAW,EACX,gBAIC;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;IAC5D,sHAAsH;IACtH,MAAM,QAAQ,GAA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M,EAAE;YAC3B,YAAY,CAAC,YAAY,CAAC,IAAI,CAC5B,mBAAQ,CAAC,YAAY,CAAC,0BAA0B,CAAC,CAClD,CAAC;YAEF,YAAY,CAAC,wBAAwB,GAAG,GAAG,CAAC;YAC5C,YAAY,CAAC,wBAAwB,GAAG,GAAG,CAAC;SAC7C;KACF;IAED,IAAI,gBAAgB,CAAC,IAAI,EAAE;QACzB,YAAY,CAAC,UAAU,GAAG,IAAI,CAAC;KAChC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AArCD,0CAqCC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAC3C,yBAAkC;IAElC,KAAK,IAAI,CAAC,GAAG,yBAAyB,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE;YAClE,OAAO,CAAC,GAAG,CAAC,CAAC;SACd;KACF;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAVD,sEAUC","sourcesContent":["import type { Program } from '@babel/types';\n\nimport {\n builders,\n generateCode,\n Proxified,\n type ProxifiedModule,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\n\nexport function updateAppEntryMod(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): ProxifiedModule<any> {\n originalAppModuleMod.imports.$add({\n from: '@sentry/angular',\n imported: '*',\n local: 'Sentry',\n });\n\n insertInitCall(originalAppModuleMod, dsn, selectedFeatures);\n\n return originalAppModuleMod;\n}\n\nexport function insertInitCall(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n originalAppModuleMod: ProxifiedModule<any>,\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): void {\n const initCallArgs = getInitCallArgs(dsn, selectedFeatures);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- builders return Proxified which defaults to any\n const initCall = builders.functionCall('Sentry.init', initCallArgs);\n const originalAppModuleModAst = originalAppModuleMod.$ast as Program;\n\n const initCallInsertionIndex = getAfterImportsInsertionIndex(\n originalAppModuleModAst,\n );\n\n originalAppModuleModAst.body.splice(\n initCallInsertionIndex,\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- builders return Proxified which defaults to any.\n generateCode(initCall).code,\n );\n}\n\ntype InitCallArgs = Record<\n string,\n string | number | boolean | Array<Proxified> | Record<string, boolean>\n>;\n\nexport function getInitCallArgs(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n logs: boolean;\n },\n): InitCallArgs {\n const initCallArgs: InitCallArgs = {\n dsn,\n };\n\n if (selectedFeatures.replay || selectedFeatures.performance) {\n initCallArgs.integrations = [];\n\n if (selectedFeatures.performance) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.browserTracingIntegration'),\n );\n initCallArgs.tracesSampleRate = 1.0;\n }\n\n if (selectedFeatures.replay) {\n initCallArgs.integrations.push(\n builders.functionCall('Sentry.replayIntegration'),\n );\n\n initCallArgs.replaysSessionSampleRate = 0.1;\n initCallArgs.replaysOnErrorSampleRate = 1.0;\n }\n }\n\n if (selectedFeatures.logs) {\n initCallArgs.enableLogs = true;\n }\n\n return initCallArgs;\n}\n\n/**\n * We want to insert the handleError function just after all imports\n */\nexport function getAfterImportsInsertionIndex(\n originalEntryServerModAST: Program,\n): number {\n for (let x = originalEntryServerModAST.body.length - 1; x >= 0; x--) {\n if (originalEntryServerModAST.body[x].type === 'ImportDeclaration') {\n return x + 1;\n }\n }\n\n return 0;\n}\n"]}
|
|
@@ -44,9 +44,8 @@ async function runAppleWizardWithTelementry(options) {
|
|
|
44
44
|
// Step - Xcode Project Lookup
|
|
45
45
|
// This step should be run before the Sentry Project and API Key step
|
|
46
46
|
// because it can abort the wizard if no Xcode project is found.
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
});
|
|
47
|
+
const xcProject = await (0, lookup_xcode_project_1.lookupXcodeProject)({ projectDir });
|
|
48
|
+
const target = await (0, lookup_xcode_project_1.selectXcodeTarget)(xcProject);
|
|
50
49
|
// Step - Sentry Project and API Key
|
|
51
50
|
const projectData = await (0, clack_1.getOrAskForProjectData)(options, 'apple-ios');
|
|
52
51
|
if (projectData.spotlight) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,4CAA6C;AAC7C,0CAKwB;AACxB,0DAAwE;AACxE,+DAA0D;AAC1D,6DAAyD;AACzD,2EAAsE;AACtE,iEAA4D;AAC5D,uEAAkE;AAClE,+DAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,4CAA6C;AAC7C,0CAKwB;AACxB,0DAAwE;AACxE,+DAA0D;AAC1D,6DAAyD;AACzD,2EAAsE;AACtE,iEAA4D;AAC5D,uEAAkE;AAClE,+DAA0D;AAC1D,iEAA+E;AAE/E,kGAA0F;AAEnF,KAAK,UAAU,cAAc,CAClC,OAA2B;IAE3B,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAC5C,CAAC;AACJ,CAAC;AAXD,wCAWC;A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AgB,GAAG,MAAM,IAAA,8BAAsB,EAAC;QACpD;YACE,EAAE,EAAE,MAAM;YACV,MAAM,EAAE,yBAAyB,eAAK,CAAC,IAAI,CACzC,MAAM,CACP,2CAA2C;YAC5C,WAAW,EAAE,UAAU;SACxB;KACF,CAAC,CAAC;IAEH,0BAA0B;IAC1B,IAAA,uCAAiB,EAAC;QAChB,OAAO,EAAE,SAAS;QAClB,MAAM;QACN,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM;QACvC,UAAU,EAAE,gBAAgB,CAAC,IAAI,IAAI,KAAK;KAC3C,CAAC,CAAC;IAEH,gCAAgC;IAChC,MAAM,IAAA,sCAAiB,EAAC;QACtB,UAAU;QACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;QAC1C,WAAW,EAAE,eAAe,CAAC,IAAI;KAClC,CAAC,CAAC;IAEH,iFAAiF;IACjF,MAAM,IAAA,wCAA2B,EAC/B,eAAe,CAAC,YAAY,CAAC,IAAI,EACjC,eAAe,CAAC,IAAI,CACrB,CAAC;IAEF,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gKAAgK,CACjK,CAAC;AACJ,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport { withTelemetry } from '../telemetry';\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n featureSelectionPrompt,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack';\nimport { offerProjectScopedMcpConfig } from '../utils/clack/mcp-config';\nimport { checkInstalledCLI } from './check-installed-cli';\nimport { configureFastlane } from './configure-fastlane';\nimport { configurePackageManager } from './configure-package-manager';\nimport { configureSentryCLI } from './configure-sentry-cli';\nimport { configureXcodeProject } from './configure-xcode-project';\nimport { injectCodeSnippet } from './inject-code-snippet';\nimport { lookupXcodeProject, selectXcodeTarget } from './lookup-xcode-project';\nimport { AppleWizardOptions } from './options';\nimport { abortIfSpotlightNotSupported } from '../utils/abort-if-sportlight-not-supported';\n\nexport async function runAppleWizard(\n options: AppleWizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n wizardOptions: options,\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: AppleWizardOptions,\n): Promise<void> {\n // Define options with defaults\n const projectDir = options.projectDir ?? process.cwd();\n\n // Step - Welcome Message\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n // Step - Git Status Check\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: projectDir,\n });\n\n // Step - Sentry CLI Check\n await checkInstalledCLI();\n\n // Step - Xcode Project Lookup\n // This step should be run before the Sentry Project and API Key step\n // because it can abort the wizard if no Xcode project is found.\n const xcProject = await lookupXcodeProject({ projectDir });\n const target = await selectXcodeTarget(xcProject);\n\n // Step - Sentry Project and API Key\n const projectData = await getOrAskForProjectData(options, 'apple-ios');\n\n if (projectData.spotlight) {\n return abortIfSpotlightNotSupported('Apple/iOS');\n }\n\n const { selectedProject, authToken } = projectData;\n\n // Step - Sentry CLI Configuration Setup\n configureSentryCLI({\n projectDir,\n authToken: authToken,\n });\n\n // Step - Set up Package Manager\n const { shouldUseSPM } = await configurePackageManager({\n projectDir,\n });\n\n // Step - Configure Xcode Project\n configureXcodeProject({\n xcProject,\n project: selectedProject,\n target,\n shouldUseSPM,\n });\n\n // Step - Feature Selection\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'optional',\n },\n ]);\n\n // Step - Add Code Snippet\n injectCodeSnippet({\n project: xcProject,\n target,\n dsn: selectedProject.keys[0].dsn.public,\n enableLogs: selectedFeatures.logs ?? false,\n });\n\n // Step - Fastlane Configuration\n await configureFastlane({\n projectDir,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n });\n\n // Offer optional project-scoped MCP config for Sentry with org and project scope\n await offerProjectScopedMcpConfig(\n selectedProject.organization.slug,\n selectedProject.slug,\n );\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function checkInstalledCLI(): Promise<
|
|
1
|
+
export declare function checkInstalledCLI(declineWarning?: string, nonInteractive?: boolean): Promise<boolean>;
|
|
@@ -34,14 +34,20 @@ const telemetry_1 = require("../telemetry");
|
|
|
34
34
|
const bash = __importStar(require("../utils/bash"));
|
|
35
35
|
const clack_1 = require("../utils/clack");
|
|
36
36
|
const debug_1 = require("../utils/debug");
|
|
37
|
-
async function checkInstalledCLI() {
|
|
37
|
+
async function checkInstalledCLI(declineWarning = "Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/", nonInteractive = false) {
|
|
38
38
|
(0, debug_1.debug)(`Checking if sentry-cli is installed`);
|
|
39
39
|
const hasCli = bash.hasSentryCLI();
|
|
40
40
|
Sentry.setTag('has-cli', hasCli);
|
|
41
41
|
if (hasCli) {
|
|
42
42
|
// If the CLI is installed, we don't need to ask the user to install it and can exit early.
|
|
43
43
|
(0, debug_1.debug)(`sentry-cli is installed`);
|
|
44
|
-
return;
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (nonInteractive) {
|
|
47
|
+
(0, debug_1.debug)(`sentry-cli is not installed; skipping install prompt`);
|
|
48
|
+
prompts_1.default.log.warn(declineWarning);
|
|
49
|
+
Sentry.setTag('CLI-Installed', false);
|
|
50
|
+
return false;
|
|
45
51
|
}
|
|
46
52
|
(0, debug_1.debug)(`sentry-cli is not installed, asking user to install it`);
|
|
47
53
|
const shouldInstallCLI = await (0, telemetry_1.traceStep)('Ask for SentryCLI', () => (0, clack_1.askToInstallSentryCLI)());
|
|
@@ -49,12 +55,12 @@ async function checkInstalledCLI() {
|
|
|
49
55
|
(0, debug_1.debug)(`User agreed to install sentry-cli`);
|
|
50
56
|
await bash.installSentryCLI();
|
|
51
57
|
Sentry.setTag('CLI-Installed', true);
|
|
58
|
+
return true;
|
|
52
59
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
60
|
+
(0, debug_1.debug)(`User declined to install sentry-cli`);
|
|
61
|
+
prompts_1.default.log.warn(declineWarning);
|
|
62
|
+
Sentry.setTag('CLI-Installed', false);
|
|
63
|
+
return false;
|
|
58
64
|
}
|
|
59
65
|
exports.checkInstalledCLI = checkInstalledCLI;
|
|
60
66
|
//# sourceMappingURL=check-installed-cli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-installed-cli.js","sourceRoot":"","sources":["../../../src/apple/check-installed-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,qDAAuC;AACvC,4CAAyC;AACzC,oDAAsC;AACtC,0CAAuD;AACvD,0CAAuC;AAEhC,KAAK,UAAU,iBAAiB;
|
|
1
|
+
{"version":3,"file":"check-installed-cli.js","sourceRoot":"","sources":["../../../src/apple/check-installed-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,qDAAuC;AACvC,4CAAyC;AACzC,oDAAsC;AACtC,0CAAuD;AACvD,0CAAuC;AAEhC,KAAK,UAAU,iBAAiB,CACrC,cAAc,GAAG,gKAAgK,EACjL,cAAc,GAAG,KAAK;IAEtB,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,MAAM,EAAE;QACV,2FAA2F;QAC3F,IAAA,aAAK,EAAC,yBAAyB,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;KACb;IAED,IAAI,cAAc,EAAE;QAClB,IAAA,aAAK,EAAC,sDAAsD,CAAC,CAAC;QAC9D,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC/B,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC;KACd;IAED,IAAA,aAAK,EAAC,wDAAwD,CAAC,CAAC;IAChE,MAAM,gBAAgB,GAAG,MAAM,IAAA,qBAAS,EAAC,mBAAmB,EAAE,GAAG,EAAE,CACjE,IAAA,6BAAqB,GAAE,CACxB,CAAC;IACF,IAAI,gBAAgB,EAAE;QACpB,IAAA,aAAK,EAAC,mCAAmC,CAAC,CAAC;QAC3C,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC;KACb;IAED,IAAA,aAAK,EAAC,qCAAqC,CAAC,CAAC;IAC7C,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC/B,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,KAAK,CAAC;AACf,CAAC;AAnCD,8CAmCC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport { traceStep } from '../telemetry';\nimport * as bash from '../utils/bash';\nimport { askToInstallSentryCLI } from '../utils/clack';\nimport { debug } from '../utils/debug';\n\nexport async function checkInstalledCLI(\n declineWarning = \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n nonInteractive = false,\n): Promise<boolean> {\n debug(`Checking if sentry-cli is installed`);\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (hasCli) {\n // If the CLI is installed, we don't need to ask the user to install it and can exit early.\n debug(`sentry-cli is installed`);\n return true;\n }\n\n if (nonInteractive) {\n debug(`sentry-cli is not installed; skipping install prompt`);\n clack.log.warn(declineWarning);\n Sentry.setTag('CLI-Installed', false);\n return false;\n }\n\n debug(`sentry-cli is not installed, asking user to install it`);\n const shouldInstallCLI = await traceStep('Ask for SentryCLI', () =>\n askToInstallSentryCLI(),\n );\n if (shouldInstallCLI) {\n debug(`User agreed to install sentry-cli`);\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n return true;\n }\n\n debug(`User declined to install sentry-cli`);\n clack.log.warn(declineWarning);\n Sentry.setTag('CLI-Installed', false);\n return false;\n}\n"]}
|
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configureXcodeProject = void 0;
|
|
4
4
|
const telemetry_1 = require("../telemetry");
|
|
5
|
+
const sentry_swift_package_1 = require("./sentry-swift-package");
|
|
5
6
|
function configureXcodeProject({ xcProject, project, target, shouldUseSPM, }) {
|
|
6
7
|
(0, telemetry_1.traceStep)('Update Xcode project', () => {
|
|
7
|
-
xcProject.updateXcodeProject(project, target, shouldUseSPM
|
|
8
|
+
xcProject.updateXcodeProject(project, target, shouldUseSPM
|
|
9
|
+
? {
|
|
10
|
+
product: sentry_swift_package_1.sentrySwiftPackageProductSpec,
|
|
11
|
+
existingFrameworkComment: sentry_swift_package_1.SENTRY_SPM_ALREADY_LINKED_FRAMEWORK_COMMENT,
|
|
12
|
+
successMessage: 'Added Sentry SPM dependency to your project',
|
|
13
|
+
}
|
|
14
|
+
: undefined, true);
|
|
8
15
|
});
|
|
9
16
|
}
|
|
10
17
|
exports.configureXcodeProject = configureXcodeProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure-xcode-project.js","sourceRoot":"","sources":["../../../src/apple/configure-xcode-project.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;
|
|
1
|
+
{"version":3,"file":"configure-xcode-project.js","sourceRoot":"","sources":["../../../src/apple/configure-xcode-project.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AAEzC,iEAGgC;AAGhC,SAAgB,qBAAqB,CAAC,EACpC,SAAS,EACT,OAAO,EACP,MAAM,EACN,YAAY,GAMb;IACC,IAAA,qBAAS,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACrC,SAAS,CAAC,kBAAkB,CAC1B,OAAO,EACP,MAAM,EACN,YAAY;YACV,CAAC,CAAC;gBACE,OAAO,EAAE,oDAA6B;gBACtC,wBAAwB,EACtB,kEAA2C;gBAC7C,cAAc,EAAE,6CAA6C;aAC9D;YACH,CAAC,CAAC,SAAS,EACb,IAAI,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,sDA0BC","sourcesContent":["import { traceStep } from '../telemetry';\nimport { SentryProjectData } from '../utils/types';\nimport {\n SENTRY_SPM_ALREADY_LINKED_FRAMEWORK_COMMENT,\n sentrySwiftPackageProductSpec,\n} from './sentry-swift-package';\nimport { XcodeProject } from './xcode-manager';\n\nexport function configureXcodeProject({\n xcProject,\n project,\n target,\n shouldUseSPM,\n}: {\n xcProject: XcodeProject;\n project: SentryProjectData;\n target: string;\n shouldUseSPM: boolean;\n}) {\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(\n project,\n target,\n shouldUseSPM\n ? {\n product: sentrySwiftPackageProductSpec,\n existingFrameworkComment:\n SENTRY_SPM_ALREADY_LINKED_FRAMEWORK_COMMENT,\n successMessage: 'Added Sentry SPM dependency to your project',\n }\n : undefined,\n true,\n );\n });\n}\n"]}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { XcodeProject } from './xcode-manager';
|
|
2
|
-
export declare function lookupXcodeProject({ projectDir, }: {
|
|
2
|
+
export declare function lookupXcodeProject({ projectDir, nonInteractive, }: {
|
|
3
3
|
projectDir: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
nonInteractive?: boolean;
|
|
5
|
+
}): Promise<XcodeProject>;
|
|
6
|
+
export declare function selectXcodeTarget(xcProject: XcodeProject, { targetNames, noTargetMessage, promptMessage, }?: {
|
|
7
|
+
targetNames?: string[];
|
|
8
|
+
noTargetMessage?: string;
|
|
9
|
+
promptMessage?: string;
|
|
10
|
+
}): Promise<string>;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.lookupXcodeProject = void 0;
|
|
29
|
+
exports.selectXcodeTarget = exports.lookupXcodeProject = void 0;
|
|
30
30
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
31
31
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
32
32
|
const Sentry = __importStar(require("@sentry/node"));
|
|
@@ -38,7 +38,7 @@ const clack_1 = require("../utils/clack");
|
|
|
38
38
|
const debug_1 = require("../utils/debug");
|
|
39
39
|
const search_xcode_project_at_path_1 = require("./search-xcode-project-at-path");
|
|
40
40
|
const xcode_manager_1 = require("./xcode-manager");
|
|
41
|
-
async function lookupXcodeProject({ projectDir, }) {
|
|
41
|
+
async function lookupXcodeProject({ projectDir, nonInteractive = false, }) {
|
|
42
42
|
(0, debug_1.debug)(`Looking for Xcode project in directory: ${chalk_1.default.cyan(projectDir)}`);
|
|
43
43
|
const xcodeProjFiles = (0, search_xcode_project_at_path_1.searchXcodeProjectAtPath)(projectDir);
|
|
44
44
|
if (xcodeProjFiles.length === 0) {
|
|
@@ -58,9 +58,16 @@ async function lookupXcodeProject({ projectDir, }) {
|
|
|
58
58
|
else {
|
|
59
59
|
(0, debug_1.debug)(`Found multiple Xcode projects, asking user to choose one`);
|
|
60
60
|
Sentry.setTag('multiple-projects', true);
|
|
61
|
+
if (nonInteractive) {
|
|
62
|
+
prompts_1.default.log.error([
|
|
63
|
+
'Multiple Xcode projects found in non-interactive mode.',
|
|
64
|
+
`Available projects: ${xcodeProjFiles.join(', ')}.`,
|
|
65
|
+
'Run from a directory with a single .xcodeproj or pass --xcode-project-dir with a narrower project directory.',
|
|
66
|
+
].join(' '));
|
|
67
|
+
return await (0, clack_1.abort)();
|
|
68
|
+
}
|
|
61
69
|
xcodeProjFile = (await (0, telemetry_1.traceStep)('Choose Xcode project', () => (0, clack_1.askForItemSelection)(xcodeProjFiles, 'Which project do you want to add Sentry to?'))).value;
|
|
62
70
|
}
|
|
63
|
-
// Load the pbxproj file
|
|
64
71
|
const pathToPbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');
|
|
65
72
|
(0, debug_1.debug)(`Loading Xcode project pbxproj at path: ${chalk_1.default.cyan(pathToPbxproj)}`);
|
|
66
73
|
if (!fs.existsSync(pathToPbxproj)) {
|
|
@@ -68,31 +75,29 @@ async function lookupXcodeProject({ projectDir, }) {
|
|
|
68
75
|
Sentry.setTag('pbxproj-not-found', true);
|
|
69
76
|
return await (0, clack_1.abort)();
|
|
70
77
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
return new xcode_manager_1.XcodeProject(pathToPbxproj);
|
|
79
|
+
}
|
|
80
|
+
exports.lookupXcodeProject = lookupXcodeProject;
|
|
81
|
+
async function selectXcodeTarget(xcProject, { targetNames = xcProject.getAllTargets(), noTargetMessage = `No suitable Xcode target found in ${path.basename(xcProject.xcodeprojPath)}`, promptMessage = 'Which target do you want to add Sentry to?', } = {}) {
|
|
82
|
+
if (targetNames.length === 0) {
|
|
83
|
+
prompts_1.default.log.error(noTargetMessage);
|
|
75
84
|
Sentry.setTag('No-Target', true);
|
|
76
85
|
return await (0, clack_1.abort)();
|
|
77
86
|
}
|
|
78
|
-
(0, debug_1.debug)(`Found ${chalk_1.default.cyan(
|
|
79
|
-
// Step - Lookup Xcode Target
|
|
87
|
+
(0, debug_1.debug)(`Found ${chalk_1.default.cyan(targetNames.length.toString())} targets in Xcode project`);
|
|
80
88
|
let target;
|
|
81
|
-
if (
|
|
89
|
+
if (targetNames.length === 1) {
|
|
82
90
|
(0, debug_1.debug)(`Found exactly one target, using it`);
|
|
83
91
|
Sentry.setTag('multiple-targets', false);
|
|
84
|
-
target =
|
|
92
|
+
target = targetNames[0];
|
|
85
93
|
}
|
|
86
94
|
else {
|
|
87
95
|
(0, debug_1.debug)(`Found multiple targets, asking user to choose one`);
|
|
88
96
|
Sentry.setTag('multiple-targets', true);
|
|
89
|
-
target = (await (0, telemetry_1.traceStep)('Choose target', () => (0, clack_1.askForItemSelection)(
|
|
97
|
+
target = (await (0, telemetry_1.traceStep)('Choose target', () => (0, clack_1.askForItemSelection)(targetNames, promptMessage))).value;
|
|
90
98
|
}
|
|
91
99
|
(0, debug_1.debug)(`Selected target: ${chalk_1.default.cyan(target)}`);
|
|
92
|
-
return
|
|
93
|
-
xcProject,
|
|
94
|
-
target,
|
|
95
|
-
};
|
|
100
|
+
return target;
|
|
96
101
|
}
|
|
97
|
-
exports.
|
|
102
|
+
exports.selectXcodeTarget = selectXcodeTarget;
|
|
98
103
|
//# sourceMappingURL=lookup-xcode-project.js.map
|