@sentry/wizard 3.34.0 → 3.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.34.1
4
+
5
+ - fix(sveltekit): Ensure Sentry example page renders correct Html ([#688](https://github.com/getsentry/sentry-wizard/pull/688))
6
+ - ref: Handle edge cases in formatting step more gracefully ([#687](https://github.com/getsentry/sentry-wizard/pull/686))
7
+
3
8
  ## 3.34.0
4
9
 
5
10
  - feat: Forward slugs to auth page ([#686](https://github.com/getsentry/sentry-wizard/pull/686))
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.34.0",
3
+ "version": "3.34.1",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -22,7 +22,7 @@ function getSentryExampleSveltePage(options) {
22
22
  var issuesPageLink = options.selfHosted
23
23
  ? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
24
24
  : "https://".concat(options.orgSlug, ".sentry.io/issues/?project=").concat(options.projectId);
25
- return "<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n\n function getSentryData() {\n Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test',\n }, async () => {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n });\n }\n</script>\n\n<div>\n <head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your SvelteKit app!\" />\n </head>\n\n <main>\n <h1>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n </h1>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button\n type=\"button\"\n on:click={getSentryData}>\n Throw error!\n </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"".concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">\n Sentry SvelteKit Documentation\n </a>\n </p>\n </main>\n</div>\n\n<style>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n h1 {\n font-size: 4rem;\n margin: 14px 0;\n }\n\n svg {\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n");
25
+ return "<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n</script>\n\n<title>Sentry Onboarding</title>\n\n<div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" on:click={getSentryData}> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"".concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">\n Sentry SvelteKit Documentation\n </a>\n </p>\n </main>\n</div>\n\n<style>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n");
26
26
  }
27
27
  exports.getSentryExampleSveltePage = getSentryExampleSveltePage;
28
28
  function getSentryExampleApiRoute() {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAGC;IAED,OAAO,kKAIC,GAAG,iBAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC,8BAEL;QACG,CAAC,CAAC,EAAE,eAGN,gBAAgB,CAAC,MAAM;QACrB,CAAC,CAAC,4bASiC;QACnC,CAAC,CAAC,EAAE,8IAMP,CAAC;AACF,CAAC;AAtCD,wDAsCC;AAED,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAGC;IAED,OAAO,gNAKC,GAAG,iBAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC,8BAEL;QACG,CAAC,CAAC,EAAE,gaAWP,CAAC;AACF,CAAC;AA9BD,wDA8BC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CAAC,OAK1C;IACC,IAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,UAAG,OAAO,CAAC,GAAG,2BAAiB,OAAO,CAAC,OAAO,8BAAoB,OAAO,CAAC,SAAS,CAAE;QACvF,CAAC,CAAC,kBAAW,OAAO,CAAC,OAAO,wCAA8B,OAAO,CAAC,SAAS,CAAE,CAAC;IAEhF,OAAO,s6EAiDQ,cAAc,w7BAgD9B,CAAC;AACF,CAAC;AA5GD,gEA4GC;AAED,SAAgB,wBAAwB;IACtC,OAAO,wOAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n) {\n return `import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.replay\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}\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n) {\n return `import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});\n\n// If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\n/**\n * +page.svelte with Sentry example\n */\nexport function getSentryExampleSveltePage(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n\n function getSentryData() {\n Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test',\n }, async () => {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n });\n }\n</script>\n\n<div>\n <head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your SvelteKit app!\" />\n </head>\n\n <main>\n <h1>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n </h1>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button\n type=\"button\"\n on:click={getSentryData}>\n Throw error!\n </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">\n Sentry SvelteKit Documentation\n </a>\n </p>\n </main>\n</div>\n\n<style>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n h1 {\n font-size: 4rem;\n margin: 14px 0;\n }\n\n svg {\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file and the entire sentry route.\n\nexport const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n};\n`;\n}\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAGC;IAED,OAAO,kKAIC,GAAG,iBAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC,8BAEL;QACG,CAAC,CAAC,EAAE,eAGN,gBAAgB,CAAC,MAAM;QACrB,CAAC,CAAC,4bASiC;QACnC,CAAC,CAAC,EAAE,8IAMP,CAAC;AACF,CAAC;AAtCD,wDAsCC;AAED,SAAgB,sBAAsB,CACpC,GAAW,EACX,gBAGC;IAED,OAAO,gNAKC,GAAG,iBAEX,gBAAgB,CAAC,WAAW;QAC1B,CAAC,CAAC,8BAEL;QACG,CAAC,CAAC,EAAE,gaAWP,CAAC;AACF,CAAC;AA9BD,wDA8BC;AAED;;GAEG;AACH,SAAgB,0BAA0B,CAAC,OAK1C;IACC,IAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,UAAG,OAAO,CAAC,GAAG,2BAAiB,OAAO,CAAC,OAAO,8BAAoB,OAAO,CAAC,SAAS,CAAE;QACvF,CAAC,CAAC,kBAAW,OAAO,CAAC,OAAO,wCAA8B,OAAO,CAAC,SAAS,CAAE,CAAC;IAEhF,OAAO,myEA2CQ,cAAc,y6BA6C9B,CAAC;AACF,CAAC;AAnGD,gEAmGC;AAED,SAAgB,wBAAwB;IACtC,OAAO,wOAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n) {\n return `import { handleErrorWithSentry, replayIntegration } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n${\n selectedFeatures.replay\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}\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(\n dsn: string,\n selectedFeatures: {\n performance: boolean;\n replay: boolean;\n },\n) {\n return `import { sequence } from \"@sveltejs/kit/hooks\";\nimport { handleErrorWithSentry, sentryHandle } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n${\n selectedFeatures.performance\n ? `\n tracesSampleRate: 1.0,\n`\n : ''\n}\n // uncomment the line below to enable Spotlight (https://spotlightjs.com)\n // spotlight: import.meta.env.DEV,\n});\n\n// If you have custom handlers, make sure to place them after \\`sentryHandle()\\` in the \\`sequence\\` function.\nexport const handle = sequence(sentryHandle());\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\n/**\n * +page.svelte with Sentry example\n */\nexport function getSentryExampleSveltePage(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file and the entire sentry route.\n-->\n\n<script>\n import * as Sentry from '@sentry/sveltekit';\n\n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n );\n }\n</script>\n\n<title>Sentry Onboarding</title>\n\n<div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" on:click={getSentryData}> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/sveltekit/\">\n Sentry SvelteKit Documentation\n </a>\n </p>\n </main>\n</div>\n\n<style>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file and the entire sentry route.\n\nexport const GET = async () => {\n throw new Error(\"Sentry Example API Route Error\");\n};\n`;\n}\n"]}
@@ -32,6 +32,8 @@ export declare function printWelcome(options: {
32
32
  telemetryEnabled?: boolean;
33
33
  }): void;
34
34
  export declare function confirmContinueIfNoOrDirtyGitRepo(): Promise<void>;
35
+ export declare function isInGitRepo(): boolean;
36
+ export declare function getUncommittedOrUntrackedFiles(): string[];
35
37
  export declare function askToInstallSentryCLI(): Promise<boolean>;
36
38
  export declare function askForItemSelection(items: string[], message: string): Promise<{
37
39
  value: string;
@@ -62,7 +62,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
62
62
  return (mod && mod.__esModule) ? mod : { "default": mod };
63
63
  };
64
64
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.featureSelectionPrompt = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
65
+ exports.featureSelectionPrompt = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
66
66
  // @ts-ignore - clack is ESM and TS complains about that. It works though
67
67
  var clack = __importStar(require("@clack/prompts"));
68
68
  var axios_1 = __importDefault(require("axios"));
@@ -262,6 +262,7 @@ function isInGitRepo() {
262
262
  return false;
263
263
  }
264
264
  }
265
+ exports.isInGitRepo = isInGitRepo;
265
266
  function getUncommittedOrUntrackedFiles() {
266
267
  try {
267
268
  var gitStatus = childProcess
@@ -278,6 +279,7 @@ function getUncommittedOrUntrackedFiles() {
278
279
  return [];
279
280
  }
280
281
  }
282
+ exports.getUncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles;
281
283
  function askToInstallSentryCLI() {
282
284
  return __awaiter(this, void 0, void 0, function () {
283
285
  return __generator(this, function (_a) {
@@ -600,14 +602,32 @@ function runPrettierIfInstalled() {
600
602
  var _this = this;
601
603
  return __generator(this, function (_a) {
602
604
  return [2 /*return*/, (0, telemetry_1.traceStep)('run-prettier', function () { return __awaiter(_this, void 0, void 0, function () {
603
- var packageJson, prettierInstalled, shouldRunPrettier, changedOrUntrackedFiles, prettierSpinner, e_2;
605
+ var changedOrUntrackedFiles, packageJson, prettierInstalled, shouldRunPrettier, prettierSpinner, e_2;
604
606
  return __generator(this, function (_a) {
605
607
  switch (_a.label) {
606
- case 0: return [4 /*yield*/, getPackageDotJson()];
608
+ case 0:
609
+ if (!isInGitRepo()) {
610
+ // We only run formatting on changed files. If we're not in a git repo, we can't find
611
+ // changed files. So let's early-return without showing any formatting-related messages.
612
+ return [2 /*return*/];
613
+ }
614
+ changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()
615
+ .map(function (filename) {
616
+ return filename.startsWith('- ') ? filename.slice(2) : filename;
617
+ })
618
+ .join(' ');
619
+ if (!changedOrUntrackedFiles.length) {
620
+ // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
621
+ return [2 /*return*/];
622
+ }
623
+ return [4 /*yield*/, getPackageDotJson()];
607
624
  case 1:
608
625
  packageJson = _a.sent();
609
626
  prettierInstalled = (0, package_json_1.hasPackageInstalled)('prettier', packageJson);
610
- if (!prettierInstalled) return [3 /*break*/, 3];
627
+ Sentry.setTag('prettier-installed', prettierInstalled);
628
+ if (!prettierInstalled) {
629
+ return [2 /*return*/];
630
+ }
611
631
  return [4 /*yield*/, abortIfCancelled(clack.confirm({
612
632
  message: 'Looks like you have Prettier in your project. Do you want to run it on your files?',
613
633
  }))];
@@ -616,19 +636,11 @@ function runPrettierIfInstalled() {
616
636
  if (!shouldRunPrettier) {
617
637
  return [2 /*return*/];
618
638
  }
619
- return [3 /*break*/, 4];
620
- case 3: return [2 /*return*/];
621
- case 4:
622
- changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()
623
- .map(function (filename) {
624
- return filename.startsWith('- ') ? filename.slice(2) : filename;
625
- })
626
- .join(' ');
627
639
  prettierSpinner = clack.spinner();
628
640
  prettierSpinner.start('Running Prettier on your files.');
629
- _a.label = 5;
630
- case 5:
631
- _a.trys.push([5, 7, , 8]);
641
+ _a.label = 3;
642
+ case 3:
643
+ _a.trys.push([3, 5, , 6]);
632
644
  return [4 /*yield*/, new Promise(function (resolve, reject) {
633
645
  childProcess.exec("npx prettier --ignore-unknown --write ".concat(changedOrUntrackedFiles), function (err) {
634
646
  if (err) {
@@ -639,15 +651,15 @@ function runPrettierIfInstalled() {
639
651
  }
640
652
  });
641
653
  })];
642
- case 6:
654
+ case 4:
643
655
  _a.sent();
644
- return [3 /*break*/, 8];
645
- case 7:
656
+ return [3 /*break*/, 6];
657
+ case 5:
646
658
  e_2 = _a.sent();
647
659
  prettierSpinner.stop('Prettier failed to run.');
648
- clack.log.error('Prettier failed to run. There may be formatting issues in your updated files.');
660
+ clack.log.warn('Prettier failed to run. There may be formatting issues in your updated files.');
649
661
  return [2 /*return*/];
650
- case 8:
662
+ case 6:
651
663
  prettierSpinner.stop('Prettier has formatted your files.');
652
664
  return [2 /*return*/];
653
665
  }
@@ -1 +1 @@
1
- {"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,0DAA8C;AAC9C,qCAAyB;AACzB,yCAA6B;AAC7B,qCAAyB;AACzB,iCAAqC;AACrC,2BAA0B;AAC1B,mDAAuC;AACvC,+CAAqE;AAErE,0CAAyC;AACzC,qDAI2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAKc,CAAC;AAE3B,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AACjD,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,IAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,IAAM,gBAAgB,GAAG,0BAA0B,CAAC;AA+BvC,QAAA,gBAAgB,GAAmB;IAC9C,QAAQ,EAAE,0BAAkB;IAC5B,IAAI,EAAE,aAAa;IACnB,SAAS,EAAE,IAAI;IACf,yBAAyB,EAAE,UAAU,QAAgB;QACnD,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,YAAY,EAAE,UAAU,SAAiB;QACvC,OAAO,wBAAiB,SAAS,CAAE,CAAC;IACtC,CAAC;IACD,6BAA6B,EAAE,UAAU,QAAgB;QACvD,OAAO,CAAC,CAAC,CACP,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC/B,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC;YACxB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,EAAE,CAAC;sCAEvB,EAAR,qBAAQ;;;qCAAR,CAAA,sBAAQ,CAAA;gCAAnB,OAAO;gCACC,qBAAM,gBAAgB,CACrC,KAAK,CAAC,MAAM,CAAC;wCACX,OAAO,EAAE,OAAO,CAAC,MAAM;wCACvB,YAAY,EAAE,IAAI;wCAClB,OAAO,EAAE;4CACP;gDACE,KAAK,EAAE,IAAI;gDACX,KAAK,EAAE,KAAK;gDACZ,IAAI,EAAE,OAAO,CAAC,WAAW;6CAC1B;4CACD;gDACE,KAAK,EAAE,KAAK;gDACZ,KAAK,EAAE,IAAI;gDACX,IAAI,EAAE,OAAO,CAAC,YAAY;6CAC3B;yCACF;qCACF,CAAC,CACH,EAAA;;gCAjBK,QAAQ,GAAG,SAiBhB;gCAED,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;;;gCApBpB,IAAQ,CAAA;;oCAuB9B,sBAAO,gBAAyD,EAAC;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nfunction isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nfunction getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n}: {\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n}): Promise<void> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return;\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\\nhttps://github.com/getsentry/sentry-wizard/issues\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n if (prettierInstalled) {\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n } else {\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.error(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
1
+ {"version":3,"file":"clack-utils.js","sourceRoot":"","sources":["../../../src/utils/clack-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,gDAA0B;AAC1B,0DAA8C;AAC9C,qCAAyB;AACzB,yCAA6B;AAC7B,qCAAyB;AACzB,iCAAqC;AACrC,2BAA0B;AAC1B,mDAAuC;AACvC,+CAAqE;AAErE,0CAAyC;AACzC,qDAI2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAKc,CAAC;AAE3B,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AACjD,QAAA,kBAAkB,GAAG,cAAc,CAAC;AACpC,QAAA,sBAAsB,GAAG,mBAAmB,CAAC;AAE1D,IAAM,QAAQ,GAAG,oBAAoB,CAAC;AAEtC,IAAM,gBAAgB,GAAG,0BAA0B,CAAC;AA+BvC,QAAA,gBAAgB,GAAmB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BhB;gCAED,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;;;gCApBpB,IAAQ,CAAA;;oCAuB9B,sBAAO,gBAAyD,EAAC;;;qBAClE,CAAC,EAAC;;;CACJ;AA/BD,wDA+BC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport axios from 'axios';\nimport chalk from 'chalk';\nimport * as childProcess from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as os from 'os';\nimport { setInterval } from 'timers';\nimport { URL } from 'url';\nimport * as Sentry from '@sentry/node';\nimport { hasPackageInstalled, PackageDotJson } from './package-json';\nimport { Feature, SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\n options?: {\n wait?: boolean;\n },\n) => Promise<childProcess.ChildProcess>;\n\nexport const SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';\nexport const SENTRY_CLI_RC_FILE = '.sentryclirc';\nexport const SENTRY_PROPERTIES_FILE = 'sentry.properties';\n\nconst SAAS_URL = 'https://sentry.io/';\n\nconst DUMMY_AUTH_TOKEN = '_YOUR_SENTRY_AUTH_TOKEN_';\n\ninterface WizardProjectData {\n apiKeys?: {\n token?: string;\n };\n projects?: SentryProjectData[];\n}\n\nexport interface CliSetupConfig {\n filename: string;\n name: string;\n gitignore: boolean;\n\n likelyAlreadyHasAuthToken(contents: string): boolean;\n tokenContent(authToken: string): string;\n\n likelyAlreadyHasOrgAndProject(contents: string): boolean;\n orgAndProjContent(org: string, project: string): string;\n\n likelyAlreadyHasUrl?(contents: string): boolean;\n urlContent?(url: string): string;\n}\n\nexport interface CliSetupConfigContent {\n authToken: string;\n org?: string;\n project?: string;\n url?: string;\n}\n\nexport const rcCliSetupConfig: CliSetupConfig = {\n filename: SENTRY_CLI_RC_FILE,\n name: 'source maps',\n gitignore: true,\n likelyAlreadyHasAuthToken: function (contents: string): boolean {\n return !!(contents.includes('[auth]') && contents.match(/token=./g));\n },\n tokenContent: function (authToken: string): string {\n return `[auth]\\ntoken=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject: function (contents: string): boolean {\n return !!(\n contents.includes('[defaults]') &&\n contents.match(/org=./g) &&\n contents.match(/project=./g)\n );\n },\n orgAndProjContent: function (org: string, project: string): string {\n return `[defaults]\\norg=${org}\\nproject=${project}`;\n },\n};\n\nexport const propertiesCliSetupConfig: Required<CliSetupConfig> = {\n filename: SENTRY_PROPERTIES_FILE,\n gitignore: true,\n name: 'debug files',\n likelyAlreadyHasAuthToken(contents: string): boolean {\n return !!contents.match(/auth\\.token=./g);\n },\n tokenContent(authToken: string): string {\n return `auth.token=${authToken}`;\n },\n likelyAlreadyHasOrgAndProject(contents: string): boolean {\n return !!(\n contents.match(/defaults\\.org=./g) &&\n contents.match(/defaults\\.project=./g)\n );\n },\n orgAndProjContent(org: string, project: string): string {\n return `defaults.org=${org}\\ndefaults.project=${project}`;\n },\n likelyAlreadyHasUrl(contents: string): boolean {\n return !!contents.match(/defaults\\.url=./g);\n },\n urlContent(url: string): string {\n return `defaults.url=${url}`;\n },\n};\n\nexport async function abort(message?: string, status?: number): Promise<never> {\n clack.outro(message ?? 'Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('aborted');\n sentryTransaction?.finish();\n const sentrySession = sentryHub.getScope().getSession();\n if (sentrySession) {\n sentrySession.status = status === 0 ? 'abnormal' : 'crashed';\n sentryHub.captureSession(true);\n }\n await Sentry.flush(3000);\n return process.exit(status ?? 1);\n}\n\nexport async function abortIfCancelled<T>(\n input: T | Promise<T>,\n): Promise<Exclude<T, symbol>> {\n if (clack.isCancel(await input)) {\n clack.cancel('Wizard setup cancelled.');\n const sentryHub = Sentry.getCurrentHub();\n const sentryTransaction = sentryHub.getScope().getTransaction();\n sentryTransaction?.setStatus('cancelled');\n sentryTransaction?.finish();\n sentryHub.captureSession(true);\n await Sentry.flush(3000);\n process.exit(0);\n } else {\n return input as Exclude<T, symbol>;\n }\n}\n\nexport function printWelcome(options: {\n wizardName: string;\n promoCode?: string;\n message?: string;\n telemetryEnabled?: boolean;\n}): void {\n let wizardPackage: { version?: string } = {};\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n wizardPackage = require(path.join(\n path.dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ));\n } catch {\n // We don't need to have this\n }\n\n // eslint-disable-next-line no-console\n console.log('');\n clack.intro(chalk.inverse(` ${options.wizardName} `));\n\n let welcomeText =\n options.message ||\n `The ${options.wizardName} will help you set up Sentry for your application.\\nThank you for using Sentry :)`;\n\n if (options.promoCode) {\n welcomeText = `${welcomeText}\\n\\nUsing promo-code: ${options.promoCode}`;\n }\n\n if (wizardPackage.version) {\n welcomeText = `${welcomeText}\\n\\nVersion: ${wizardPackage.version}`;\n }\n\n if (options.telemetryEnabled) {\n welcomeText = `${welcomeText}\n\nThis wizard sends telemetry data and crash reports to Sentry. This helps us improve the Wizard.\nYou can turn this off at any time by running ${chalk.cyanBright(\n 'sentry-wizard --disable-telemetry',\n )}.`;\n }\n\n clack.note(welcomeText);\n}\n\nexport async function confirmContinueIfNoOrDirtyGitRepo(): Promise<void> {\n return traceStep('check-git-status', async () => {\n if (!isInGitRepo()) {\n const continueWithoutGit = await abortIfCancelled(\n clack.confirm({\n message:\n 'You are not inside a git repository. The wizard will create and update files. Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-without-git', continueWithoutGit);\n\n if (!continueWithoutGit) {\n await abort(undefined, 0);\n }\n }\n\n const uncommittedOrUntrackedFiles = getUncommittedOrUntrackedFiles();\n if (uncommittedOrUntrackedFiles.length) {\n clack.log.warn(\n `You have uncommitted or untracked files in your repo:\n\n${uncommittedOrUntrackedFiles.join('\\n')}\n\nThe wizard will create and update files.`,\n );\n const continueWithDirtyRepo = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n\n Sentry.setTag('continue-with-dirty-repo', continueWithDirtyRepo);\n\n if (!continueWithDirtyRepo) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport function isInGitRepo() {\n try {\n childProcess.execSync('git rev-parse --is-inside-work-tree', {\n stdio: 'ignore',\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport function getUncommittedOrUntrackedFiles(): string[] {\n try {\n const gitStatus = childProcess\n .execSync('git status --porcelain=v1')\n .toString();\n\n const files = gitStatus\n .split(os.EOL)\n .map((line) => line.trim())\n .filter(Boolean)\n .map((f) => `- ${f.split(/\\s+/)[1]}`);\n\n return files;\n } catch {\n return [];\n }\n}\n\nexport async function askToInstallSentryCLI(): Promise<boolean> {\n return await abortIfCancelled(\n clack.confirm({\n message:\n \"You don't have Sentry CLI installed. Do you want to install it?\",\n }),\n );\n}\n\nexport async function askForItemSelection(\n items: string[],\n message: string,\n): Promise<{ value: string; index: number }> {\n const selection: { value: string; index: number } | symbol =\n await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: message,\n options: items.map((item, index) => {\n return {\n value: { value: item, index: index },\n label: item,\n };\n }),\n }),\n );\n\n return selection;\n}\n\nexport async function confirmContinueIfPackageVersionNotSupported({\n packageId,\n packageName,\n packageVersion,\n acceptableVersions,\n note,\n}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: string;\n note?: string;\n}): Promise<void> {\n return traceStep(`check-package-version`, async () => {\n Sentry.setTag(`${packageName.toLowerCase()}-version`, packageVersion);\n const isSupportedVersion = fulfillsVersionRange({\n acceptableVersions,\n version: packageVersion,\n canBeLatest: true,\n });\n\n if (isSupportedVersion) {\n Sentry.setTag(`${packageName.toLowerCase()}-supported`, true);\n return;\n }\n\n clack.log.warn(\n `You have an unsupported version of ${packageName} installed:\n\n ${packageId}@${packageVersion}`,\n );\n\n clack.note(\n note ??\n `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.`,\n );\n const continueWithUnsupportedVersion = await abortIfCancelled(\n clack.confirm({\n message: 'Do you want to continue anyway?',\n }),\n );\n Sentry.setTag(\n `${packageName.toLowerCase()}-continue-with-unsupported-version`,\n continueWithUnsupportedVersion,\n );\n\n if (!continueWithUnsupportedVersion) {\n await abort(undefined, 0);\n }\n });\n}\n\n/**\n * Installs or updates a package with the user's package manager.\n *\n * IMPORTANT: This function modifies the `package.json`! Be sure to re-read\n * it if you make additional modifications to it after calling this function!\n */\nexport async function installPackage({\n packageName,\n alreadyInstalled,\n askBeforeUpdating = true,\n}: {\n packageName: string;\n alreadyInstalled: boolean;\n askBeforeUpdating?: boolean;\n}): Promise<void> {\n return traceStep('install-package', async () => {\n if (alreadyInstalled && askBeforeUpdating) {\n const shouldUpdatePackage = await abortIfCancelled(\n clack.confirm({\n message: `The ${chalk.bold.cyan(\n packageName,\n )} package is already installed. Do you want to update it to the latest version?`,\n }),\n );\n\n if (!shouldUpdatePackage) {\n return;\n }\n }\n\n const sdkInstallSpinner = clack.spinner();\n\n const packageManager = await getPackageManager();\n\n sdkInstallSpinner.start(\n `${alreadyInstalled ? 'Updating' : 'Installing'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `${packageManager.installCommand} ${packageName} ${packageManager.flags}`,\n (err, stdout, stderr) => {\n if (err) {\n // Write a log file so we can better troubleshoot issues\n fs.writeFileSync(\n path.join(\n process.cwd(),\n `sentry-wizard-installation-error-${Date.now()}.log`,\n ),\n JSON.stringify({\n stdout,\n stderr,\n }),\n { encoding: 'utf8' },\n );\n\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n sdkInstallSpinner.stop('Installation failed.');\n clack.log.error(\n `${chalk.red(\n 'Encountered the following error during installation:',\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n )}\\n\\n${e}\\n\\n${chalk.dim(\n \"The wizard has created a `sentry-wizard-installation-error-*.log` file. If you think this issue is caused by the Sentry wizard, create an issue on GitHub and include the log file's content:\\nhttps://github.com/getsentry/sentry-wizard/issues\",\n )}`,\n );\n await abort();\n }\n\n sdkInstallSpinner.stop(\n `${alreadyInstalled ? 'Updated' : 'Installed'} ${chalk.bold.cyan(\n packageName,\n )} with ${chalk.bold(packageManager.label)}.`,\n );\n });\n}\n\nexport async function addSentryCliConfig(\n { authToken, org, project, url }: CliSetupConfigContent,\n setupConfig: CliSetupConfig = rcCliSetupConfig,\n): Promise<void> {\n return traceStep('add-sentry-cli-config', async () => {\n const configPath = path.join(process.cwd(), setupConfig.filename);\n const configExists = fs.existsSync(configPath);\n\n let configContents =\n (configExists && fs.readFileSync(configPath, 'utf8')) || '';\n configContents = addAuthTokenToSentryConfig(\n configContents,\n authToken,\n setupConfig,\n );\n configContents = addOrgAndProjectToSentryConfig(\n configContents,\n org,\n project,\n setupConfig,\n );\n configContents = addUrlToSentryConfig(configContents, url, setupConfig);\n\n try {\n await fs.promises.writeFile(configPath, configContents, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `${configExists ? 'Saved' : 'Created'} ${chalk.cyan(\n setupConfig.filename,\n )}.`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.cyan(\n setupConfig.filename,\n )}. Uploading ${\n setupConfig.name\n } during build will likely not work locally.`,\n );\n }\n\n if (setupConfig.gitignore) {\n await addCliConfigFileToGitIgnore(setupConfig.filename);\n } else {\n clack.log.warn(\n chalk.yellow('DO NOT commit auth token to your repository!'),\n );\n }\n });\n}\n\nfunction addAuthTokenToSentryConfig(\n configContents: string,\n authToken: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!authToken) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasAuthToken(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has auth token. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.tokenContent(\n authToken,\n )}\\n`;\n clack.log.success(\n `Added auth token to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addOrgAndProjectToSentryConfig(\n configContents: string,\n org: string | undefined,\n project: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!org || !project) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasOrgAndProject(configContents)) {\n clack.log.warn(\n `${chalk.cyan(\n setupConfig.filename,\n )} already has org and project. Will not add them.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.orgAndProjContent(\n org,\n project,\n )}\\n`;\n clack.log.success(\n `Added default org and project to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nfunction addUrlToSentryConfig(\n configContents: string,\n url: string | undefined,\n setupConfig: CliSetupConfig,\n): string {\n if (!url || !setupConfig.urlContent || !setupConfig.likelyAlreadyHasUrl) {\n return configContents;\n }\n\n if (setupConfig.likelyAlreadyHasUrl(configContents)) {\n clack.log.warn(\n `${chalk.cyan(setupConfig.filename)} already has url. Will not add one.`,\n );\n return configContents;\n }\n\n const newContents = `${configContents}\\n${setupConfig.urlContent(url)}\\n`;\n clack.log.success(\n `Added default url to ${chalk.cyan(\n setupConfig.filename,\n )} for you to test uploading ${setupConfig.name} locally.`,\n );\n return newContents;\n}\n\nexport async function addDotEnvSentryBuildPluginFile(\n authToken: string,\n): Promise<void> {\n const envVarContent = `# DO NOT commit this file to your repository!\n# The SENTRY_AUTH_TOKEN variable is picked up by the Sentry Build Plugin.\n# It's used for authentication when uploading source maps.\n# You can also set this env variable in your own \\`.env\\` files and remove this file.\nSENTRY_AUTH_TOKEN=${authToken}\n`;\n\n const dotEnvFilePath = path.join(process.cwd(), SENTRY_DOT_ENV_FILE);\n const dotEnvFileExists = fs.existsSync(dotEnvFilePath);\n\n if (dotEnvFileExists) {\n const dotEnvFileContent = fs.readFileSync(dotEnvFilePath, 'utf8');\n\n const hasAuthToken = !!dotEnvFileContent.match(\n /^\\s*SENTRY_AUTH_TOKEN\\s*=/g,\n );\n\n if (hasAuthToken) {\n clack.log.warn(\n `${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} already has auth token. Will not add one.`,\n );\n } else {\n try {\n await fs.promises.writeFile(\n dotEnvFilePath,\n `${dotEnvFileContent}\\n${envVarContent}`,\n {\n encoding: 'utf8',\n flag: 'w',\n },\n );\n clack.log.success(\n `Added auth token to ${chalk.bold(SENTRY_DOT_ENV_FILE)}`,\n );\n } catch {\n clack.log.warning(\n `Failed to add auth token to ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )}. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n } else {\n try {\n await fs.promises.writeFile(dotEnvFilePath, envVarContent, {\n encoding: 'utf8',\n flag: 'w',\n });\n clack.log.success(\n `Created ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token for you to test source map uploading locally.`,\n );\n } catch {\n clack.log.warning(\n `Failed to create ${chalk.bold(\n SENTRY_DOT_ENV_FILE,\n )} with auth token. Uploading source maps during build will likely not work locally.`,\n );\n }\n }\n\n await addCliConfigFileToGitIgnore(SENTRY_DOT_ENV_FILE);\n}\n\nasync function addCliConfigFileToGitIgnore(filename: string): Promise<void> {\n const gitignorePath = path.join(process.cwd(), '.gitignore');\n\n try {\n const gitignoreContent = await fs.promises.readFile(gitignorePath, 'utf8');\n if (gitignoreContent.split(/\\r?\\n/).includes(filename)) {\n clack.log.info(\n `${chalk.bold('.gitignore')} already has ${chalk.bold(\n filename,\n )}. Will not add it again.`,\n );\n return;\n }\n\n await fs.promises.appendFile(\n gitignorePath,\n `\\n# Sentry Config File\\n${filename}\\n`,\n { encoding: 'utf8' },\n );\n clack.log.success(\n `Added ${chalk.cyan(filename)} to ${chalk.cyan('.gitignore')}.`,\n );\n } catch {\n clack.log.error(\n `Failed adding ${chalk.cyan(filename)} to ${chalk.cyan(\n '.gitignore',\n )}. Please add it manually!`,\n );\n }\n}\n\nexport async function runPrettierIfInstalled(): Promise<void> {\n return traceStep('run-prettier', async () => {\n if (!isInGitRepo()) {\n // We only run formatting on changed files. If we're not in a git repo, we can't find\n // changed files. So let's early-return without showing any formatting-related messages.\n return;\n }\n\n const changedOrUntrackedFiles = getUncommittedOrUntrackedFiles()\n .map((filename) => {\n return filename.startsWith('- ') ? filename.slice(2) : filename;\n })\n .join(' ');\n\n if (!changedOrUntrackedFiles.length) {\n // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.\n return;\n }\n\n const packageJson = await getPackageDotJson();\n const prettierInstalled = hasPackageInstalled('prettier', packageJson);\n\n Sentry.setTag('prettier-installed', prettierInstalled);\n\n if (!prettierInstalled) {\n return;\n }\n\n // prompt the user if they want to run prettier\n const shouldRunPrettier = await abortIfCancelled(\n clack.confirm({\n message:\n 'Looks like you have Prettier in your project. Do you want to run it on your files?',\n }),\n );\n\n if (!shouldRunPrettier) {\n return;\n }\n\n const prettierSpinner = clack.spinner();\n prettierSpinner.start('Running Prettier on your files.');\n\n try {\n await new Promise<void>((resolve, reject) => {\n childProcess.exec(\n `npx prettier --ignore-unknown --write ${changedOrUntrackedFiles}`,\n (err) => {\n if (err) {\n reject(err);\n } else {\n resolve();\n }\n },\n );\n });\n } catch (e) {\n prettierSpinner.stop('Prettier failed to run.');\n clack.log.warn(\n 'Prettier failed to run. There may be formatting issues in your updated files.',\n );\n return;\n }\n\n prettierSpinner.stop('Prettier has formatted your files.');\n });\n}\n\n/**\n * Checks if @param packageId is listed as a dependency in @param packageJson.\n * If not, it will ask users if they want to continue without the package.\n *\n * Use this function to check if e.g. a the framework of the SDK is installed\n *\n * @param packageJson the package.json object\n * @param packageId the npm name of the package\n * @param packageName a human readable name of the package\n */\nexport async function ensurePackageIsInstalled(\n packageJson: PackageDotJson,\n packageId: string,\n packageName: string,\n): Promise<void> {\n return traceStep('ensure-package-installed', async () => {\n const installed = hasPackageInstalled(packageId, packageJson);\n\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, installed);\n\n if (!installed) {\n Sentry.setTag(`${packageName.toLowerCase()}-installed`, false);\n const continueWithoutPackage = await abortIfCancelled(\n clack.confirm({\n message: `${packageName} does not seem to be installed. Do you still want to continue?`,\n initialValue: false,\n }),\n );\n\n if (!continueWithoutPackage) {\n await abort(undefined, 0);\n }\n }\n });\n}\n\nexport async function getPackageDotJson(): Promise<PackageDotJson> {\n const packageJsonFileContents = await fs.promises\n .readFile(path.join(process.cwd(), 'package.json'), 'utf8')\n .catch(() => {\n clack.log.error(\n 'Could not find package.json. Make sure to run the wizard in the root of your app!',\n );\n return abort();\n });\n\n let packageJson: PackageDotJson | undefined = undefined;\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n packageJson = JSON.parse(packageJsonFileContents);\n } catch {\n clack.log.error(\n `Unable to parse your ${chalk.cyan(\n 'package.json',\n )}. Make sure it has a valid format!`,\n );\n\n await abort();\n }\n\n return packageJson || {};\n}\n\nexport async function getPackageManager(): Promise<PackageManager> {\n const detectedPackageManager = detectPackageManger();\n\n if (detectedPackageManager) {\n return detectedPackageManager;\n }\n\n const selectedPackageManager: PackageManager | symbol =\n await abortIfCancelled(\n clack.select({\n message: 'Please select your package manager.',\n options: packageManagers.map((packageManager) => ({\n value: packageManager,\n label: packageManager.label,\n })),\n }),\n );\n\n Sentry.setTag('package-manager', selectedPackageManager.name);\n\n return selectedPackageManager;\n}\n\nexport function isUsingTypeScript() {\n try {\n return fs.existsSync(path.join(process.cwd(), 'tsconfig.json'));\n } catch {\n return false;\n }\n}\n\n/**\n * Checks if we already got project data from a previous wizard invocation.\n * If yes, this data is returned.\n * Otherwise, we start the login flow and ask the user to select a project.\n *\n * Use this function to get project data for the wizard.\n *\n * @param options wizard options\n * @param platform the platform of the wizard\n * @returns project data (org, project, token, url)\n */\nexport async function getOrAskForProjectData(\n options: WizardOptions,\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native',\n): Promise<{\n sentryUrl: string;\n selfHosted: boolean;\n selectedProject: SentryProjectData;\n authToken: string;\n}> {\n if (options.preSelectedProject) {\n return {\n selfHosted: options.preSelectedProject.selfHosted,\n sentryUrl: options.url ?? SAAS_URL,\n authToken: options.preSelectedProject.authToken,\n selectedProject: options.preSelectedProject.project,\n };\n }\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url, options.saas),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\n orgSlug: options.orgSlug,\n projectSlug: options.projectSlug,\n }),\n );\n\n if (!projects || !projects.length) {\n clack.log.error(\n 'No projects found. Please create a project in Sentry and try again.',\n );\n Sentry.setTag('no-projects-found', true);\n await abort();\n // This rejection won't return due to the abort call but TS doesn't know that\n return Promise.reject();\n }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects, options.orgSlug, options.projectSlug),\n );\n\n const { token } = apiKeys ?? {};\n\n if (!token) {\n clack.log.error(`Didn't receive an auth token. This shouldn't happen :(\n\nPlease let us know if you think this is a bug in the wizard:\n${chalk.cyan('https://github.com/getsentry/sentry-wizard/issues')}`);\n\n clack.log.info(`In the meantime, we'll add a dummy auth token (${chalk.cyan(\n `\"${DUMMY_AUTH_TOKEN}\"`,\n )}) for you to replace later.\nCreate your auth token here:\n${chalk.cyan(\n selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/settings/auth-tokens`\n : `https://${selectedProject.organization.slug}.sentry.io/settings/auth-tokens`,\n)}`);\n }\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys?.token || DUMMY_AUTH_TOKEN,\n selectedProject,\n };\n}\n\n/**\n * Asks users if they are using SaaS or self-hosted Sentry and returns the validated URL.\n *\n * If users started the wizard with a --url arg, that URL is used as the default and we skip\n * the self-hosted question. However, the passed url is still validated and in case it's\n * invalid, users are asked to enter a new one until it is valid.\n *\n * @param urlFromArgs the url passed via the --url arg\n */\nasync function askForSelfHosted(\n urlFromArgs?: string,\n saas?: boolean,\n): Promise<{\n url: string;\n selfHosted: boolean;\n}> {\n if (saas) {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n\n if (!urlFromArgs) {\n const choice: 'saas' | 'self-hosted' | symbol = await abortIfCancelled(\n clack.select({\n message: 'Are you using Sentry SaaS or self-hosted Sentry?',\n options: [\n { value: 'saas', label: 'Sentry SaaS (sentry.io)' },\n {\n value: 'self-hosted',\n label: 'Self-hosted/on-premise/single-tenant',\n },\n ],\n }),\n );\n\n if (choice === 'saas') {\n Sentry.setTag('url', SAAS_URL);\n Sentry.setTag('self-hosted', false);\n return { url: SAAS_URL, selfHosted: false };\n }\n }\n\n let validUrl: string | undefined;\n let tmpUrlFromArgs = urlFromArgs;\n\n while (validUrl === undefined) {\n const url =\n tmpUrlFromArgs ||\n (await abortIfCancelled(\n clack.text({\n message: `Please enter the URL of your ${\n urlFromArgs ? '' : 'self-hosted '\n }Sentry instance.`,\n placeholder: 'https://sentry.io/',\n }),\n ));\n tmpUrlFromArgs = undefined;\n\n try {\n validUrl = new URL(url).toString();\n\n // We assume everywhere else that the URL ends in a slash\n if (!validUrl.endsWith('/')) {\n validUrl += '/';\n }\n } catch {\n clack.log.error(\n `Please enter a valid URL. (It should look something like \"https://sentry.mydomain.com/\", got ${url})`,\n );\n }\n }\n\n const isSelfHostedUrl = new URL(validUrl).host !== new URL(SAAS_URL).host;\n\n Sentry.setTag('url', validUrl);\n Sentry.setTag('self-hosted', isSelfHostedUrl);\n\n return { url: validUrl, selfHosted: true };\n}\n\nasync function askForWizardLogin(options: {\n url: string;\n promoCode?: string;\n platform?:\n | 'javascript-nextjs'\n | 'javascript-remix'\n | 'javascript-sveltekit'\n | 'apple-ios'\n | 'android'\n | 'react-native';\n orgSlug?: string;\n projectSlug?: string;\n}): Promise<WizardProjectData> {\n Sentry.setTag('has-promo-code', !!options.promoCode);\n\n let hasSentryAccount = await clack.confirm({\n message: 'Do you already have a Sentry account?',\n });\n\n hasSentryAccount = await abortIfCancelled(hasSentryAccount);\n\n Sentry.setTag('already-has-sentry-account', hasSentryAccount);\n\n let wizardHash: string;\n try {\n wizardHash = (\n await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)\n ).data.hash;\n } catch (e: unknown) {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please check your configuration and try again.\\n\\n Let us know if you think this is an issue with the wizard or Sentry: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n } else {\n clack.log.error('Loading Wizard failed.');\n clack.log.info(JSON.stringify(e, null, 2));\n await abort(\n chalk.red(\n 'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',\n ),\n );\n }\n }\n\n const loginUrl = new URL(\n `${options.url}account/settings/wizard/${wizardHash!}/`,\n );\n\n if (options.orgSlug) {\n loginUrl.searchParams.set('org_slug', options.orgSlug);\n }\n\n if (options.projectSlug) {\n loginUrl.searchParams.set('project_slug', options.projectSlug);\n }\n\n if (!hasSentryAccount) {\n loginUrl.searchParams.set('signup', '1');\n if (options.platform) {\n loginUrl.searchParams.set('project_platform', options.platform);\n }\n }\n\n if (options.promoCode) {\n loginUrl.searchParams.set('code', options.promoCode);\n }\n\n const urlToOpen = loginUrl.toString();\n clack.log.info(\n `${chalk.bold(\n `If the browser window didn't open automatically, please open the following link to ${\n hasSentryAccount ? 'log' : 'sign'\n } into Sentry:`,\n )}\\n\\n${chalk.cyan(urlToOpen)}`,\n );\n\n opn(urlToOpen, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n\n const loginSpinner = clack.spinner();\n\n loginSpinner.start('Waiting for you to log in using the link above');\n\n const data = await new Promise<WizardProjectData>((resolve) => {\n const pollingInterval = setInterval(() => {\n axios\n .get<WizardProjectData>(`${options.url}api/0/wizard/${wizardHash}/`, {\n headers: {\n 'Accept-Encoding': 'deflate',\n },\n })\n .then((result) => {\n resolve(result.data);\n clearTimeout(timeout);\n clearInterval(pollingInterval);\n void axios.delete(`${options.url}api/0/wizard/${wizardHash}/`);\n })\n .catch(() => {\n // noop - just try again\n });\n }, 500);\n\n const timeout = setTimeout(() => {\n clearInterval(pollingInterval);\n loginSpinner.stop(\n 'Login timed out. No worries - it happens to the best of us.',\n );\n\n Sentry.setTag('opened-wizard-link', false);\n void abort('Please restart the Wizard and log in to complete the setup.');\n }, 180_000);\n });\n\n loginSpinner.stop('Login complete.');\n Sentry.setTag('opened-wizard-link', true);\n\n return data;\n}\n\nasync function askForProjectSelection(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n\n const filteredProjects = filterProjectsBySlugs(\n projects,\n orgSlug,\n projectSlug,\n );\n\n if (filteredProjects.length === 1) {\n const selection = filteredProjects[0];\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n clack.log.step(`Selected project ${label(selection)}`);\n\n return selection;\n }\n\n if (filteredProjects.length === 0) {\n clack.log.warn('Could not find a project with the provided slugs.');\n }\n\n const sortedProjects = filteredProjects.length ? filteredProjects : projects;\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\n });\n\n const selection: SentryProjectData | symbol = await abortIfCancelled(\n clack.select({\n maxItems: 12,\n message: 'Select your Sentry project.',\n options: sortedProjects.map((project) => {\n return {\n value: project,\n label: label(project),\n };\n }),\n }),\n );\n\n Sentry.setTag('project', selection.slug);\n Sentry.setUser({ id: selection.organization.slug });\n\n return selection;\n}\n\nfunction filterProjectsBySlugs(\n projects: SentryProjectData[],\n orgSlug?: string,\n projectSlug?: string,\n): SentryProjectData[] {\n if (!orgSlug && !projectSlug) {\n return projects;\n }\n if (orgSlug && !projectSlug) {\n return projects.filter((p) => p.organization.slug === orgSlug);\n }\n if (!orgSlug && projectSlug) {\n return projects.filter((p) => p.slug === projectSlug);\n }\n\n return projects.filter(\n (p) => p.organization.slug === orgSlug && p.slug === projectSlug,\n );\n}\n\n/**\n * Asks users if they have a config file for @param tool (e.g. Vite).\n * If yes, asks users to specify the path to their config file.\n *\n * Use this helper function as a fallback mechanism if the lookup for\n * a config file with its most usual location/name fails.\n *\n * @param toolName Name of the tool for which we're looking for the config file\n * @param configFileName Name of the most common config file name (e.g. vite.config.js)\n *\n * @returns a user path to the config file or undefined if the user doesn't have a config file\n */\nexport async function askForToolConfigPath(\n toolName: string,\n configFileName: string,\n): Promise<string | undefined> {\n const hasConfig = await abortIfCancelled(\n clack.confirm({\n message: `Do you have a ${toolName} config file (e.g. ${chalk.cyan(\n configFileName,\n )})?`,\n initialValue: true,\n }),\n );\n\n if (!hasConfig) {\n return undefined;\n }\n\n return await abortIfCancelled(\n clack.text({\n message: `Please enter the path to your ${toolName} config file:`,\n placeholder: path.join('.', configFileName),\n validate: (value) => {\n if (!value) {\n return 'Please enter a path.';\n }\n\n try {\n fs.accessSync(value);\n } catch {\n return 'Could not access the file at this path.';\n }\n },\n }),\n );\n}\n\n/**\n * Prints copy/paste-able instructions to the console.\n * Afterwards asks the user if they added the code snippet to their file.\n *\n * While there's no point in providing a \"no\" answer here, it gives users time to fulfill the\n * task before the wizard continues with additional steps.\n *\n * Use this function if you want to show users instructions on how to add/modify\n * code in their file. This is helpful if automatic insertion failed or is not possible/feasible.\n *\n * @param filename the name of the file to which the code snippet should be applied.\n * If a path is provided, only the filename will be used.\n *\n * @param codeSnippet the snippet to be printed. Use {@link makeCodeSnippet} to create the\n * diff-like format for visually highlighting unchanged or modified lines of code.\n *\n * @param hint (optional) a hint to be printed after the main instruction to add\n * the code from @param codeSnippet to their @param filename.\n *\n * More guidelines on copy/paste instructions:\n * @see {@link https://develop.sentry.dev/sdk/setup-wizards/#copy--paste-snippets}\n *\n * TODO: refactor copy paste instructions across different wizards to use this function.\n * this might require adding a custom message parameter to the function\n */\nexport async function showCopyPasteInstructions(\n filename: string,\n codeSnippet: string,\n hint?: string,\n): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.cyan(\n path.basename(filename),\n )} file:${hint ? chalk.dim(` (${chalk.dim(hint)})`) : ''}`,\n );\n\n // Padding the code snippet to be printed with a \\n at the beginning and end\n // This makes it easier to distinguish the snippet from the rest of the output\n // Intentionally logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(`\\n${codeSnippet}\\n`);\n\n await abortIfCancelled(\n clack.select({\n message: 'Did you apply the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\n/**\n * Callback that exposes formatting helpers for a code snippet.\n * @param unchanged - Formats text as old code.\n * @param plus - Formats text as new code.\n * @param minus - Formats text as removed code.\n */\ntype CodeSnippetFormatter = (\n unchanged: (txt: string) => string,\n plus: (txt: string) => string,\n minus: (txt: string) => string,\n) => string;\n\n/**\n * Crafts a code snippet that can be used to e.g.\n * - print copy/paste instructions to the console\n * - create a new config file.\n *\n * @param colors set this to true if you want the final snippet to be colored.\n * This is useful for printing the snippet to the console as part of copy/paste instructions.\n *\n * @param callback the callback that returns the formatted code snippet.\n * It exposes takes the helper functions for marking code as unchanged, new or removed.\n * These functions no-op if no special formatting should be applied\n * and otherwise apply the appropriate formatting/coloring.\n * (@see {@link CodeSnippetFormatter})\n *\n * @see {@link showCopyPasteInstructions} for the helper with which to display the snippet in the console.\n *\n * @returns a string containing the final, formatted code snippet.\n */\nexport function makeCodeSnippet(\n colors: boolean,\n callback: CodeSnippetFormatter,\n): string {\n const unchanged = (txt: string) => (colors ? chalk.grey(txt) : txt);\n const plus = (txt: string) => (colors ? chalk.greenBright(txt) : txt);\n const minus = (txt: string) => (colors ? chalk.redBright(txt) : txt);\n\n return callback(unchanged, plus, minus);\n}\n\n/**\n * Creates a new config file with the given @param filepath and @param codeSnippet.\n *\n * Use this function to create a new config file for users. This is useful\n * when users answered that they don't yet have a config file for a tool.\n *\n * (This doesn't mean that they don't yet have some other way of configuring\n * their tool but we can leave it up to them to figure out how to merge configs\n * here.)\n *\n * @param filepath absolute path to the new config file\n * @param codeSnippet the snippet to be inserted into the file\n * @param moreInformation (optional) the message to be printed after the file was created\n * For example, this can be a link to more information about configuring the tool.\n *\n * @returns true on success, false otherwise\n */\nexport async function createNewConfigFile(\n filepath: string,\n codeSnippet: string,\n moreInformation?: string,\n): Promise<boolean> {\n if (!path.isAbsolute(filepath)) {\n debug(`createNewConfigFile: filepath is not absolute: ${filepath}`);\n return false;\n }\n\n const prettyFilename = chalk.cyan(path.relative(process.cwd(), filepath));\n\n try {\n await fs.promises.writeFile(filepath, codeSnippet);\n\n clack.log.success(`Added new ${prettyFilename} file.`);\n\n if (moreInformation) {\n clack.log.info(chalk.gray(moreInformation));\n }\n\n return true;\n } catch (e) {\n debug(e);\n clack.log.warn(\n `Could not create a new ${prettyFilename} file. Please create one manually and follow the instructions below.`,\n );\n }\n\n return false;\n}\n\nexport async function askShouldCreateExamplePage(\n customRoute?: string,\n): Promise<boolean> {\n const route = chalk.cyan(customRoute ?? '/sentry-example-page');\n return traceStep('ask-create-example-page', () =>\n abortIfCancelled(\n clack.select({\n message: `Do you want to create an example page (\"${route}\") to test your Sentry setup?`,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: 'Recommended - Check your git status before committing!',\n },\n { value: false, label: 'No' },\n ],\n }),\n ),\n );\n}\n\nexport async function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(\n features: F,\n): Promise<{ [key in F[number]['id']]: boolean }> {\n return traceStep('feature-selection', async () => {\n const selectedFeatures: Record<string, boolean> = {};\n\n for (const feature of features) {\n const selected = await abortIfCancelled(\n clack.select({\n message: feature.prompt,\n initialValue: true,\n options: [\n {\n value: true,\n label: 'Yes',\n hint: feature.enabledHint,\n },\n {\n value: false,\n label: 'No',\n hint: feature.disabledHint,\n },\n ],\n }),\n );\n\n selectedFeatures[feature.id] = selected;\n }\n\n return selectedFeatures as { [key in F[number]['id']]: boolean };\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.34.0",
3
+ "version": "3.34.1",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -92,43 +92,37 @@ Feel free to delete this file and the entire sentry route.
92
92
  import * as Sentry from '@sentry/sveltekit';
93
93
 
94
94
  function getSentryData() {
95
- Sentry.startSpan({
96
- name: 'Example Frontend Span',
97
- op: 'test',
98
- }, async () => {
99
- const res = await fetch('/sentry-example');
100
- if (!res.ok) {
101
- throw new Error('Sentry Example Frontend Error');
95
+ Sentry.startSpan(
96
+ {
97
+ name: 'Example Frontend Span',
98
+ op: 'test'
99
+ },
100
+ async () => {
101
+ const res = await fetch('/sentry-example');
102
+ if (!res.ok) {
103
+ throw new Error('Sentry Example Frontend Error');
104
+ }
102
105
  }
103
- });
106
+ );
104
107
  }
105
108
  </script>
106
109
 
107
- <div>
108
- <head>
109
- <title>Sentry Onboarding</title>
110
- <meta name="description" content="Test Sentry for your SvelteKit app!" />
111
- </head>
110
+ <title>Sentry Onboarding</title>
112
111
 
112
+ <div>
113
113
  <main>
114
- <h1>
115
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 44">
116
- <path
117
- fill="currentColor"
118
- d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"
119
- />
120
- </svg>
121
- </h1>
114
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 44">
115
+ <path
116
+ fill="currentColor"
117
+ d="M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z"
118
+ />
119
+ </svg>
122
120
  <p>
123
121
  Get Started with this <strong>simple Example:</strong>
124
122
  </p>
125
123
 
126
124
  <p>1. Send us a sample error:</p>
127
- <button
128
- type="button"
129
- on:click={getSentryData}>
130
- Throw error!
131
- </button>
125
+ <button type="button" on:click={getSentryData}> Throw error! </button>
132
126
 
133
127
  <p>
134
128
  2. Look for the error on the
@@ -151,12 +145,9 @@ Feel free to delete this file and the entire sentry route.
151
145
  align-items: center;
152
146
  }
153
147
 
154
- h1 {
148
+ svg {
155
149
  font-size: 4rem;
156
150
  margin: 14px 0;
157
- }
158
-
159
- svg {
160
151
  height: 1em;
161
152
  }
162
153
 
@@ -233,7 +233,7 @@ The wizard will create and update files.`,
233
233
  });
234
234
  }
235
235
 
236
- function isInGitRepo() {
236
+ export function isInGitRepo() {
237
237
  try {
238
238
  childProcess.execSync('git rev-parse --is-inside-work-tree', {
239
239
  stdio: 'ignore',
@@ -244,7 +244,7 @@ function isInGitRepo() {
244
244
  }
245
245
  }
246
246
 
247
- function getUncommittedOrUntrackedFiles(): string[] {
247
+ export function getUncommittedOrUntrackedFiles(): string[] {
248
248
  try {
249
249
  const gitStatus = childProcess
250
250
  .execSync('git status --porcelain=v1')
@@ -672,22 +672,9 @@ async function addCliConfigFileToGitIgnore(filename: string): Promise<void> {
672
672
 
673
673
  export async function runPrettierIfInstalled(): Promise<void> {
674
674
  return traceStep('run-prettier', async () => {
675
- const packageJson = await getPackageDotJson();
676
- const prettierInstalled = hasPackageInstalled('prettier', packageJson);
677
-
678
- if (prettierInstalled) {
679
- // prompt the user if they want to run prettier
680
- const shouldRunPrettier = await abortIfCancelled(
681
- clack.confirm({
682
- message:
683
- 'Looks like you have Prettier in your project. Do you want to run it on your files?',
684
- }),
685
- );
686
-
687
- if (!shouldRunPrettier) {
688
- return;
689
- }
690
- } else {
675
+ if (!isInGitRepo()) {
676
+ // We only run formatting on changed files. If we're not in a git repo, we can't find
677
+ // changed files. So let's early-return without showing any formatting-related messages.
691
678
  return;
692
679
  }
693
680
 
@@ -697,6 +684,32 @@ export async function runPrettierIfInstalled(): Promise<void> {
697
684
  })
698
685
  .join(' ');
699
686
 
687
+ if (!changedOrUntrackedFiles.length) {
688
+ // Likewise, if we can't find changed or untracked files, there's no point in running Prettier.
689
+ return;
690
+ }
691
+
692
+ const packageJson = await getPackageDotJson();
693
+ const prettierInstalled = hasPackageInstalled('prettier', packageJson);
694
+
695
+ Sentry.setTag('prettier-installed', prettierInstalled);
696
+
697
+ if (!prettierInstalled) {
698
+ return;
699
+ }
700
+
701
+ // prompt the user if they want to run prettier
702
+ const shouldRunPrettier = await abortIfCancelled(
703
+ clack.confirm({
704
+ message:
705
+ 'Looks like you have Prettier in your project. Do you want to run it on your files?',
706
+ }),
707
+ );
708
+
709
+ if (!shouldRunPrettier) {
710
+ return;
711
+ }
712
+
700
713
  const prettierSpinner = clack.spinner();
701
714
  prettierSpinner.start('Running Prettier on your files.');
702
715
 
@@ -715,7 +728,7 @@ export async function runPrettierIfInstalled(): Promise<void> {
715
728
  });
716
729
  } catch (e) {
717
730
  prettierSpinner.stop('Prettier failed to run.');
718
- clack.log.error(
731
+ clack.log.warn(
719
732
  'Prettier failed to run. There may be formatting issues in your updated files.',
720
733
  );
721
734
  return;