@sentry/wizard 3.20.0 → 3.20.2

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,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.20.2
4
+
5
+ - ref(wizard): Print error object if wizard endpoint API request failed (#524)
6
+
7
+ ## 3.20.1
8
+
9
+ - fix(nextjs): Replace deprecated Sentry API calls in example page templates (#520)
10
+ - fix(sveltekit): Replace deprecated Sentry API calls in example page templates (#520)
11
+
3
12
  ## 3.20.0
4
13
 
5
14
  - feat(nextjs): Ask for confirmation before creating example page (#515)
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.20.0",
3
+ "version": "3.20.2",
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",
@@ -48,7 +48,7 @@ function getSentryExamplePageContents(options) {
48
48
  var issuesPageLink = options.selfHosted
49
49
  ? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
50
50
  : "https://".concat(options.orgSlug, ".sentry.io/issues/?project=").concat(options.projectId);
51
- return "".concat(options.useClient ? '"use client";\n\n' : '', "import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport default function Page() {\n return (\n <div>\n <Head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 ></path>\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={async () => {\n const transaction = Sentry.startTransaction({\n name: \"Example Frontend Transaction\",\n });\n\n Sentry.configureScope((scope) => {\n scope.setSpan(transaction);\n });\n\n try {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n throw new Error(\"Sentry Example Frontend Error\");\n }\n } finally {\n transaction.finish();\n }\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"").concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">\n https://docs.sentry.io/platforms/javascript/guides/nextjs/\n </a>\n </p>\n </main>\n </div>\n );\n}\n");
51
+ return "".concat(options.useClient ? '"use client";\n\n' : '', "import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport default function Page() {\n return (\n <div>\n <Head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 ></path>\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test'\n }, async () => {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n throw new Error(\"Sentry Example Frontend Error\");\n }\n });\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"").concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">\n https://docs.sentry.io/platforms/javascript/guides/nextjs/\n </a>\n </p>\n </main>\n </div>\n );\n}\n");
52
52
  }
53
53
  exports.getSentryExamplePageContents = getSentryExamplePageContents;
54
54
  function getSentryExampleApiRoute() {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,SAAgB,qCAAqC,CACnD,OAAe,EACf,WAAmB,EACnB,UAAmB,EACnB,GAAW;IAEX,OAAO,kNAMG,OAAO,iCACH,WAAW,gBAAK,UAAU,CAAC,CAAC,CAAC,uBAAe,GAAG,OAAG,CAAC,CAAC,CAAC,EAAE,UACnE,CAAC;AACL,CAAC;AAfD,sFAeC;AAED,SAAgB,mCAAmC;IACjD,OAAO,w7BAwBL,CAAC;AACL,CAAC;AA1BD,kFA0BC;AAED,SAAgB,0BAA0B,CACxC,kCAA0C,EAC1C,0BAAkC;IAElC,OAAO,gMAOL,kCAAkC,kBAClC,0BAA0B,WAE7B,CAAC;AACF,CAAC;AAfD,gEAeC;AAED,SAAgB,0BAA0B,CACxC,kCAA0C,EAC1C,0BAAkC;IAElC,OAAO,mLAQL,kCAAkC,kBAClC,0BAA0B,WAE7B,CAAC;AACF,CAAC;AAhBD,gEAgBC;AAED,SAAgB,kCAAkC,CAChD,kCAA0C,EAC1C,0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chalk';\n\nexport function getNextjsWebpackPluginOptionsTemplate(\n orgSlug: string,\n projectSlug: string,\n selfHosted: boolean,\n url: string,\n): string {\n return `{\n // For all available options, see:\n // https://github.com/getsentry/sentry-webpack-plugin#options\n\n // Suppresses source map uploading logs during build\n silent: true,\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${selfHosted ? `\\n url: \"${url}\"` : ''}\n }`;\n}\n\nexport function getNextjsSentryBuildOptionsTemplate(): string {\n return `{\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Transpiles SDK to be compatible with IE11 (increases bundle size)\n transpileClientSDK: true,\n\n // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)\n tunnelRoute: \"/monitoring\",\n\n // Hides source maps from generated client bundles\n hideSourceMaps: true,\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors.\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }`;\n}\n\nexport function getNextjsConfigCjsTemplate(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `const { withSentryConfig } = require(\"@sentry/nextjs\");\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nmodule.exports = withSentryConfig(\n nextConfig,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `\n\n// Injected content via Sentry wizard below\n\nconst { withSentryConfig } = require(\"@sentry/nextjs\");\n\nmodule.exports = withSentryConfig(\n module.exports,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'server' | 'client' | 'edge',\n): string {\n let primer;\n if (config === 'server') {\n primer = `// This file configures the initialization of Sentry on the server.\n// The config you add here will be used whenever the server handles a request.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'client') {\n primer = `// This file configures the initialization of Sentry on the client.\n// The config you add here will be used whenever a users loads a page in their browser.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'edge') {\n primer = `// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n// The config you add here will be used whenever one of the edge features is loaded.\n// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n }\n\n let additionalOptions = '';\n if (config === 'client') {\n additionalOptions = `\n\n replaysOnErrorSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // You can remove this option if you're not planning to use the Sentry Session Replay feature:\n integrations: [\n new Sentry.Replay({\n // Additional Replay configuration goes in here, for example:\n maskAllText: true,\n blockAllMedia: true,\n }),\n ],`;\n }\n\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${primer}\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",\n\n // Adjust this value in production, or use tracesSampler for greater control\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,${additionalOptions}\n});\n`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n}): string {\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 `${\n options.useClient ? '\"use client\";\\n\\n' : ''\n }import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport default function Page() {\n return (\n <div>\n <Head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 ></path>\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={async () => {\n const transaction = Sentry.startTransaction({\n name: \"Example Frontend Transaction\",\n });\n\n Sentry.configureScope((scope) => {\n scope.setSpan(transaction);\n });\n\n try {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n throw new Error(\"Sentry Example Frontend Error\");\n }\n } finally {\n transaction.finish();\n }\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">\n https://docs.sentry.io/platforms/javascript/guides/nextjs/\n </a>\n </p>\n </main>\n </div>\n );\n}\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// A faulty API route to test Sentry's error monitoring\nexport default function handler(_req, res) {\n throw new Error(\"Sentry Example API Route Error\");\n res.status(200).json({ name: \"John Doe\" });\n}\n`;\n}\n\nexport function getSentryExampleAppDirApiRoute() {\n return `import { NextResponse } from \"next/server\";\n\nexport const dynamic = \"force-dynamic\";\n\n// A faulty API route to test Sentry's error monitoring\nexport function GET() {\n throw new Error(\"Sentry Example API Route Error\");\n return NextResponse.json({ data: \"Testing Sentry Error...\" });\n}\n`;\n}\n\nexport function getSentryDefaultUnderscoreErrorPage() {\n return `import * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\n\nconst CustomErrorComponent = (props) => {\n return <Error statusCode={props.statusCode} />;\n};\n\nCustomErrorComponent.getInitialProps = async (contextData) => {\n // In case this is running in a serverless function, await this in order to give Sentry\n // time to send the error before the lambda exits\n await Sentry.captureUnderscoreErrorException(contextData);\n\n // This will contain the status code of the response\n return Error.getInitialProps(contextData);\n};\n\nexport default CustomErrorComponent;\n`;\n}\n\nexport function getSimpleUnderscoreErrorCopyPasteSnippet() {\n return `\n${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (${chalk.green(\n `contextData`,\n )}) => {\n ${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}\n\n ${chalk.dim('// ...other getInitialProps code')}\n};\n`;\n}\n\nexport function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {\n return `\nimport * as Sentry from '@sentry/nextjs';${\n isTs ? '\\nimport type { NextPageContext } from \"next\";' : ''\n }\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (contextData${\n isTs ? ': NextPageContext' : ''\n }) => {\n await Sentry.captureUnderscoreErrorException(contextData);\n};\n`;\n}\n\nexport function getSentryDefaultGlobalErrorPage() {\n return `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n <Error />\n </body>\n </html>\n );\n}\n`;\n}\n\nexport function getGlobalErrorCopyPasteSnippet(isTs: boolean) {\n if (isTs) {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green(\n '{ error }: { error: Error }',\n )}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n } else {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green('{ error }')}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n }\n}\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA0B;AAE1B,SAAgB,qCAAqC,CACnD,OAAe,EACf,WAAmB,EACnB,UAAmB,EACnB,GAAW;IAEX,OAAO,kNAMG,OAAO,iCACH,WAAW,gBAAK,UAAU,CAAC,CAAC,CAAC,uBAAe,GAAG,OAAG,CAAC,CAAC,CAAC,EAAE,UACnE,CAAC;AACL,CAAC;AAfD,sFAeC;AAED,SAAgB,mCAAmC;IACjD,OAAO,w7BAwBL,CAAC;AACL,CAAC;AA1BD,kFA0BC;AAED,SAAgB,0BAA0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AAO,6BAET,eAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC,eACxD,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC,eAC9C,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC,qDAEb,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,oBAC1D,eAAK,CAAC,KAAK,CAAC,wEAED,CAAC,kIAUf,CAAC;KACC;AACH,CAAC;AA9CD,wEA8CC","sourcesContent":["import chalk from 'chalk';\n\nexport function getNextjsWebpackPluginOptionsTemplate(\n orgSlug: string,\n projectSlug: string,\n selfHosted: boolean,\n url: string,\n): string {\n return `{\n // For all available options, see:\n // https://github.com/getsentry/sentry-webpack-plugin#options\n\n // Suppresses source map uploading logs during build\n silent: true,\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${selfHosted ? `\\n url: \"${url}\"` : ''}\n }`;\n}\n\nexport function getNextjsSentryBuildOptionsTemplate(): string {\n return `{\n // For all available options, see:\n // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/\n\n // Upload a larger set of source maps for prettier stack traces (increases build time)\n widenClientFileUpload: true,\n\n // Transpiles SDK to be compatible with IE11 (increases bundle size)\n transpileClientSDK: true,\n\n // Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers (increases server load)\n tunnelRoute: \"/monitoring\",\n\n // Hides source maps from generated client bundles\n hideSourceMaps: true,\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors.\n // See the following for more information:\n // https://docs.sentry.io/product/crons/\n // https://vercel.com/docs/cron-jobs\n automaticVercelMonitors: true,\n }`;\n}\n\nexport function getNextjsConfigCjsTemplate(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `const { withSentryConfig } = require(\"@sentry/nextjs\");\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nmodule.exports = withSentryConfig(\n nextConfig,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `\n\n// Injected content via Sentry wizard below\n\nconst { withSentryConfig } = require(\"@sentry/nextjs\");\n\nmodule.exports = withSentryConfig(\n module.exports,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n sentryWebpackPluginOptionsTemplate: string,\n sentryBuildOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${sentryWebpackPluginOptionsTemplate},\n ${sentryBuildOptionsTemplate}\n);\n`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'server' | 'client' | 'edge',\n): string {\n let primer;\n if (config === 'server') {\n primer = `// This file configures the initialization of Sentry on the server.\n// The config you add here will be used whenever the server handles a request.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'client') {\n primer = `// This file configures the initialization of Sentry on the client.\n// The config you add here will be used whenever a users loads a page in their browser.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n } else if (config === 'edge') {\n primer = `// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).\n// The config you add here will be used whenever one of the edge features is loaded.\n// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.\n// https://docs.sentry.io/platforms/javascript/guides/nextjs/`;\n }\n\n let additionalOptions = '';\n if (config === 'client') {\n additionalOptions = `\n\n replaysOnErrorSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // You can remove this option if you're not planning to use the Sentry Session Replay feature:\n integrations: [\n new Sentry.Replay({\n // Additional Replay configuration goes in here, for example:\n maskAllText: true,\n blockAllMedia: true,\n }),\n ],`;\n }\n\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `${primer}\n\nimport * as Sentry from \"@sentry/nextjs\";\n\nSentry.init({\n dsn: \"${dsn}\",\n\n // Adjust this value in production, or use tracesSampler for greater control\n tracesSampleRate: 1,\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,${additionalOptions}\n});\n`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n url: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n}): string {\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 `${\n options.useClient ? '\"use client\";\\n\\n' : ''\n }import Head from \"next/head\";\nimport * as Sentry from \"@sentry/nextjs\";\n\nexport default function Page() {\n return (\n <div>\n <Head>\n <title>Sentry Onboarding</title>\n <meta name=\"description\" content=\"Test Sentry for your Next.js app!\" />\n </Head>\n\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\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 ></path>\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n Sentry.startSpan({\n name: 'Example Frontend Span',\n op: 'test'\n }, async () => {\n const res = await fetch(\"/api/sentry-example-api\");\n if (!res.ok) {\n throw new Error(\"Sentry Example Frontend Error\");\n }\n });\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nextjs/\">\n https://docs.sentry.io/platforms/javascript/guides/nextjs/\n </a>\n </p>\n </main>\n </div>\n );\n}\n`;\n}\n\nexport function getSentryExampleApiRoute() {\n return `// A faulty API route to test Sentry's error monitoring\nexport default function handler(_req, res) {\n throw new Error(\"Sentry Example API Route Error\");\n res.status(200).json({ name: \"John Doe\" });\n}\n`;\n}\n\nexport function getSentryExampleAppDirApiRoute() {\n return `import { NextResponse } from \"next/server\";\n\nexport const dynamic = \"force-dynamic\";\n\n// A faulty API route to test Sentry's error monitoring\nexport function GET() {\n throw new Error(\"Sentry Example API Route Error\");\n return NextResponse.json({ data: \"Testing Sentry Error...\" });\n}\n`;\n}\n\nexport function getSentryDefaultUnderscoreErrorPage() {\n return `import * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\n\nconst CustomErrorComponent = (props) => {\n return <Error statusCode={props.statusCode} />;\n};\n\nCustomErrorComponent.getInitialProps = async (contextData) => {\n // In case this is running in a serverless function, await this in order to give Sentry\n // time to send the error before the lambda exits\n await Sentry.captureUnderscoreErrorException(contextData);\n\n // This will contain the status code of the response\n return Error.getInitialProps(contextData);\n};\n\nexport default CustomErrorComponent;\n`;\n}\n\nexport function getSimpleUnderscoreErrorCopyPasteSnippet() {\n return `\n${chalk.green(`import * as Sentry from '@sentry/nextjs';`)}\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (${chalk.green(\n `contextData`,\n )}) => {\n ${chalk.green('await Sentry.captureUnderscoreErrorException(contextData);')}\n\n ${chalk.dim('// ...other getInitialProps code')}\n};\n`;\n}\n\nexport function getFullUnderscoreErrorCopyPasteSnippet(isTs: boolean) {\n return `\nimport * as Sentry from '@sentry/nextjs';${\n isTs ? '\\nimport type { NextPageContext } from \"next\";' : ''\n }\n\n${chalk.dim(\n '// Replace \"YourCustomErrorComponent\" with your custom error component!',\n)}\nYourCustomErrorComponent.getInitialProps = async (contextData${\n isTs ? ': NextPageContext' : ''\n }) => {\n await Sentry.captureUnderscoreErrorException(contextData);\n};\n`;\n}\n\nexport function getSentryDefaultGlobalErrorPage() {\n return `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport Error from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n <Error />\n </body>\n </html>\n );\n}\n`;\n}\n\nexport function getGlobalErrorCopyPasteSnippet(isTs: boolean) {\n if (isTs) {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green(\n '{ error }: { error: Error }',\n )}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n } else {\n return `\"use client\";\n\n${chalk.green('import * as Sentry from \"@sentry/nextjs\";')}\n${chalk.green('import Error from \"next/error\";')}\n${chalk.green('import { useEffect } from \"react\";')}\n\nexport default function GlobalError(${chalk.green('{ error }')}) {\n ${chalk.green(`useEffect(() => {\n Sentry.captureException(error);\n }, [error]);`)}\n\n return (\n <html>\n <body>\n {/* Your Error component here... */}\n </body>\n </html>\n );\n}\n`;\n }\n}\n"]}
@@ -175,7 +175,7 @@ function runSvelteKitWizardWithTelemetry(options) {
175
175
  case 14:
176
176
  _b.sent();
177
177
  return [2 /*return*/];
178
- case 15: return [4 /*yield*/, (0, clack_utils_1.askShouldCreateExamplePage)('sentry-example')];
178
+ case 15: return [4 /*yield*/, (0, clack_utils_1.askShouldCreateExamplePage)('/sentry-example')];
179
179
  case 16:
180
180
  shouldCreateExamplePage = _b.sent();
181
181
  if (!shouldCreateExamplePage) return [3 /*break*/, 21];
@@ -1 +1 @@
1
- {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAE1B,mDAAuC;AAEvC,oDAW8B;AAC9B,sDAA+E;AAE/E,6CAAkD;AAClD,yCAA4E;AAC5E,0CAAwD;AACxD,iCAAsE;AACtE,4DAAoE;AAEpE,SAAsB,kBAAkB,CACtC,OAAsB;;;YAEtB,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,WAAW;iBACzB,EACD,cAAM,OAAA,+BAA+B,CAAC,OAAO,CAAC,EAAxC,CAAwC,CAC/C,EAAC;;;CACH;AAVD,gDAUC;AAED,SAAsB,+BAA+B,CACnD,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,yBAAyB;wBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEtB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAE7C,qBAAM,IAAA,sCAAwB,EAAC,WAAW,EAAE,eAAe,EAAE,WAAW,CAAC,EAAA;;oBAAzE,SAAyE,CAAC;oBAEpE,UAAU,GAAG,IAAA,gCAAiB,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;oBAC7D,gBAAgB,GAAG,IAAA,2B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7D,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getKitVersionBucket, getSvelteVersionBucket } from './utils';\nimport { NPM, detectPackageManger } from '../utils/package-manager';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sveltekit',\n },\n () => runSvelteKitWizardWithTelemetry(options),\n );\n}\n\nexport async function runSvelteKitWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const kitVersion = getPackageVersion('@sveltejs/kit', packageJson);\n const kitVersionBucket = getKitVersionBucket(kitVersion);\n Sentry.setTag('sveltekit-version', kitVersionBucket);\n\n if (kitVersionBucket === '0.x') {\n clack.log.warn(\n \"It seems you're using a SvelteKit version <1.0.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest 1.x version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n Sentry.setTag(\n 'svelte-version',\n getSvelteVersionBucket(getPackageVersion('svelte', packageJson)),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'javascript-sveltekit');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/sveltekit',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/sveltekit',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\n await addSentryCliConfig({ authToken });\n\n const svelteConfig = await traceStep('load-svelte-config', loadSvelteConfig);\n\n try {\n await traceStep('configure-sdk', () =>\n createOrMergeSvelteKitFiles(\n {\n dsn: selectedProject.keys[0].dsn.public,\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n },\n svelteConfig,\n ),\n );\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException('Error while setting up the SvelteKit SDK');\n await abort('Exiting Wizard');\n return;\n }\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage(\n 'sentry-example',\n );\n\n if (shouldCreateExamplePage) {\n try {\n await traceStep('create-example-page', () =>\n createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while creating an example Svelte page to test Sentry',\n );\n await abort('Exiting Wizard');\n return;\n }\n }\n\n clack.outro(buildOutroMessage(shouldCreateExamplePage));\n}\n\nfunction buildOutroMessage(shouldCreateExamplePage: boolean): string {\n const packageManager = detectPackageManger() || NPM;\n\n let msg = chalk.green('\\nSuccessfully installed the Sentry SvelteKit SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n `\\`${packageManager.runScriptCommand} dev\\``,\n )}) and visiting ${chalk.cyan('\"/sentry-example\"')}.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/`;\n\n return msg;\n}\n"]}
1
+ {"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAE1B,mDAAuC;AAEvC,oDAW8B;AAC9B,sDAA+E;AAE/E,6CAAkD;AAClD,yCAA4E;AAC5E,0CAAwD;AACxD,iCAAsE;AACtE,4DAAoE;AAEpE,SAAsB,kBAAkB,CACtC,OAAsB;;;YAEtB,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,WAAW;iBACzB,EACD,cAAM,OAAA,+BAA+B,CAAC,OAAO,CAAC,EAAxC,CAAwC,CAC/C,EAAC;;;CACH;AAVD,gDAUC;AAED,SAAsB,+BAA+B,CACnD,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,yBAAyB;wBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAE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AAG,IAAA,qCAAmB,GAAE,IAAI,qBAAG,CAAC;IAEpD,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,oDAAoD,CAAC,CAAC;IAE5E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,4EAAqE,eAAK,CAAC,IAAI,CACpF,WAAK,cAAc,CAAC,gBAAgB,UAAQ,CAC7C,4BAAkB,eAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAG,CAAC;KACvD;IAED,GAAG,IAAI,+HACqD,CAAC;IAE7D,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport * as Sentry from '@sentry/node';\n\nimport {\n abort,\n abortIfCancelled,\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { getKitVersionBucket, getSvelteVersionBucket } from './utils';\nimport { NPM, detectPackageManger } from '../utils/package-manager';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sveltekit',\n },\n () => runSvelteKitWizardWithTelemetry(options),\n );\n}\n\nexport async function runSvelteKitWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\n\n const kitVersion = getPackageVersion('@sveltejs/kit', packageJson);\n const kitVersionBucket = getKitVersionBucket(kitVersion);\n Sentry.setTag('sveltekit-version', kitVersionBucket);\n\n if (kitVersionBucket === '0.x') {\n clack.log.warn(\n \"It seems you're using a SvelteKit version <1.0.0 which is not supported by Sentry.\\nWe recommend upgrading to the latest 1.x version before you continue.\",\n );\n const shouldContinue = await abortIfCancelled(\n clack.select({\n message: 'Do you want to continue anyway?',\n options: [\n {\n label: 'Yes, continue',\n hint: 'The SDK might not work correctly',\n value: true,\n },\n { label: \"No, I'll upgrade first\", value: false },\n ],\n }),\n );\n if (!shouldContinue) {\n await abort('Exiting Wizard', 0);\n return;\n }\n }\n\n Sentry.setTag(\n 'svelte-version',\n getSvelteVersionBucket(getPackageVersion('svelte', packageJson)),\n );\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'javascript-sveltekit');\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/sveltekit',\n packageJson,\n );\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/sveltekit',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\n await addSentryCliConfig({ authToken });\n\n const svelteConfig = await traceStep('load-svelte-config', loadSvelteConfig);\n\n try {\n await traceStep('configure-sdk', () =>\n createOrMergeSvelteKitFiles(\n {\n dsn: selectedProject.keys[0].dsn.public,\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n },\n svelteConfig,\n ),\n );\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException('Error while setting up the SvelteKit SDK');\n await abort('Exiting Wizard');\n return;\n }\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage(\n '/sentry-example',\n );\n\n if (shouldCreateExamplePage) {\n try {\n await traceStep('create-example-page', () =>\n createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while creating an example Svelte page to test Sentry',\n );\n await abort('Exiting Wizard');\n return;\n }\n }\n\n clack.outro(buildOutroMessage(shouldCreateExamplePage));\n}\n\nfunction buildOutroMessage(shouldCreateExamplePage: boolean): string {\n const packageManager = detectPackageManger() || NPM;\n\n let msg = chalk.green('\\nSuccessfully installed the Sentry SvelteKit SDK!');\n\n if (shouldCreateExamplePage) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n `\\`${packageManager.runScriptCommand} dev\\``,\n )}) and visiting ${chalk.cyan('\"/sentry-example\"')}.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/`;\n\n return msg;\n}\n"]}
@@ -16,7 +16,7 @@ function getSentryExampleSveltePage(options) {
16
16
  var issuesPageLink = options.selfHosted
17
17
  ? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
18
18
  : "https://".concat(options.orgSlug, ".sentry.io/issues/?project=").concat(options.projectId);
19
- 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 async function getSentryData() {\n const transaction = Sentry.startTransaction({\n name: 'Example Frontend Transaction'\n });\n\n Sentry.configureScope((scope) => {\n scope.setSpan(transaction);\n });\n\n try {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n } finally {\n transaction.finish();\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");
19
+ 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");
20
20
  }
21
21
  exports.getSentryExampleSveltePage = getSentryExampleSveltePage;
22
22
  function getSentryExampleApiRoute() {
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/sveltekit/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,uJAIC,GAAG,mmBAiBZ,CAAC;AACF,CAAC;AAvBD,wDAuBC;AAED,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,gNAKC,GAAG,yUASZ,CAAC;AACF,CAAC;AAhBD,wDAgBC;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,+jFAwDQ,cAAc,w7BAgD9B,CAAC;AACF,CAAC;AAnHD,gEAmHC;AAED,SAAgB,wBAAwB;IACtC,OAAO,wOAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(dsn: string) {\n return `import { handleErrorWithSentry, Replay } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [new Replay()],\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(dsn: string) {\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 tracesSampleRate: 1.0,\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 async function getSentryData() {\n const transaction = Sentry.startTransaction({\n name: 'Example Frontend Transaction'\n });\n\n Sentry.configureScope((scope) => {\n scope.setSpan(transaction);\n });\n\n try {\n const res = await fetch('/sentry-example');\n if (!res.ok) {\n throw new Error('Sentry Example Frontend Error');\n }\n } finally {\n transaction.finish();\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,CAAC,GAAW;IAChD,OAAO,uJAIC,GAAG,mmBAiBZ,CAAC;AACF,CAAC;AAvBD,wDAuBC;AAED,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,gNAKC,GAAG,yUASZ,CAAC;AACF,CAAC;AAhBD,wDAgBC;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,y6EAiDQ,cAAc,w7BAgD9B,CAAC;AACF,CAAC;AA5GD,gEA4GC;AAED,SAAgB,wBAAwB;IACtC,OAAO,wOAMR,CAAC;AACF,CAAC;AARD,4DAQC","sourcesContent":["export function getClientHooksTemplate(dsn: string) {\n return `import { handleErrorWithSentry, Replay } from \"@sentry/sveltekit\";\nimport * as Sentry from '@sentry/sveltekit';\n\nSentry.init({\n dsn: '${dsn}',\n tracesSampleRate: 1.0,\n\n // This sets the sample rate to be 10%. You may want this to be 100% while\n // in development and sample at a lower rate in production\n replaysSessionSampleRate: 0.1,\n\n // If the entire session is not sampled, use the below sample rate to sample\n // sessions when an error occurs.\n replaysOnErrorSampleRate: 1.0,\n \n // If you don't want to use Session Replay, just remove the line below:\n integrations: [new Replay()],\n});\n\n// If you have a custom error handler, pass it to \\`handleErrorWithSentry\\`\nexport const handleError = handleErrorWithSentry();\n`;\n}\n\nexport function getServerHooksTemplate(dsn: string) {\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 tracesSampleRate: 1.0,\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"]}
@@ -822,41 +822,43 @@ function askForSelfHosted(urlFromArgs) {
822
822
  }
823
823
  function askForWizardLogin(options) {
824
824
  return __awaiter(this, void 0, void 0, function () {
825
- var hasSentryAccount, wizardHash, _a, loginUrl, urlToOpen, loginSpinner, data;
826
- return __generator(this, function (_b) {
827
- switch (_b.label) {
825
+ var hasSentryAccount, wizardHash, e_2, loginUrl, urlToOpen, loginSpinner, data;
826
+ return __generator(this, function (_a) {
827
+ switch (_a.label) {
828
828
  case 0:
829
829
  Sentry.setTag('has-promo-code', !!options.promoCode);
830
830
  return [4 /*yield*/, clack.confirm({
831
831
  message: 'Do you already have a Sentry account?',
832
832
  })];
833
833
  case 1:
834
- hasSentryAccount = _b.sent();
834
+ hasSentryAccount = _a.sent();
835
835
  return [4 /*yield*/, abortIfCancelled(hasSentryAccount)];
836
836
  case 2:
837
- hasSentryAccount = _b.sent();
837
+ hasSentryAccount = _a.sent();
838
838
  Sentry.setTag('already-has-sentry-account', hasSentryAccount);
839
- _b.label = 3;
839
+ _a.label = 3;
840
840
  case 3:
841
- _b.trys.push([3, 5, , 10]);
841
+ _a.trys.push([3, 5, , 10]);
842
842
  return [4 /*yield*/, axios_1.default.get("".concat(options.url, "api/0/wizard/"))];
843
843
  case 4:
844
- wizardHash = (_b.sent()).data.hash;
844
+ wizardHash = (_a.sent()).data.hash;
845
845
  return [3 /*break*/, 10];
846
846
  case 5:
847
- _a = _b.sent();
847
+ e_2 = _a.sent();
848
848
  if (!(options.url !== SAAS_URL)) return [3 /*break*/, 7];
849
849
  clack.log.error('Loading Wizard failed. Did you provide the right URL?');
850
+ clack.log.info(JSON.stringify(e_2, null, 2));
850
851
  return [4 /*yield*/, abort(chalk_1.default.red('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'))];
851
852
  case 6:
852
- _b.sent();
853
+ _a.sent();
853
854
  return [3 /*break*/, 9];
854
855
  case 7:
855
856
  clack.log.error('Loading Wizard failed.');
857
+ clack.log.info(JSON.stringify(e_2, null, 2));
856
858
  return [4 /*yield*/, abort(chalk_1.default.red('Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues'))];
857
859
  case 8:
858
- _b.sent();
859
- _b.label = 9;
860
+ _a.sent();
861
+ _a.label = 9;
860
862
  case 9: return [3 /*break*/, 10];
861
863
  case 10:
862
864
  loginUrl = new url_1.URL("".concat(options.url, "account/settings/wizard/").concat(wizardHash, "/"));
@@ -902,7 +904,7 @@ function askForWizardLogin(options) {
902
904
  }, 180000);
903
905
  })];
904
906
  case 11:
905
- data = _b.sent();
907
+ data = _a.sent();
906
908
  loginSpinner.stop('Login complete.');
907
909
  Sentry.setTag('opened-wizard-link', true);
908
910
  return [2 /*return*/, data];
@@ -1082,7 +1084,7 @@ exports.makeCodeSnippet = makeCodeSnippet;
1082
1084
  */
1083
1085
  function createNewConfigFile(filepath, codeSnippet, moreInformation) {
1084
1086
  return __awaiter(this, void 0, void 0, function () {
1085
- var prettyFilename, e_2;
1087
+ var prettyFilename, e_3;
1086
1088
  return __generator(this, function (_a) {
1087
1089
  switch (_a.label) {
1088
1090
  case 0:
@@ -1103,8 +1105,8 @@ function createNewConfigFile(filepath, codeSnippet, moreInformation) {
1103
1105
  }
1104
1106
  return [2 /*return*/, true];
1105
1107
  case 3:
1106
- e_2 = _a.sent();
1107
- (0, debug_1.debug)(e_2);
1108
+ e_3 = _a.sent();
1109
+ (0, debug_1.debug)(e_3);
1108
1110
  clack.log.warn("Could not create a new ".concat(prettyFilename, " file. Please create one manually and follow the instructions below."));
1109
1111
  return [3 /*break*/, 4];
1110
1112
  case 4: return [2 /*return*/, false];
@@ -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,qDAK2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAEc,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;AA+BzB,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,Q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,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;;;;oBAGxE,qBAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAA;;oBAAlD,SAAkD,CAAC;oBAEnD,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,oBAAa,cAAc,WAAQ,CAAC,CAAC;oBAEvD,IAAI,eAAe,EAAE;wBACnB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;qBAC7C;oBAED,sBAAO,IAAI,EAAC;;;oBAEZ,IAAA,aAAK,EAAC,GAAC,CAAC,CAAC;oBACT,KAAK,CAAC,GAAG,CAAC,IAAI,CACZ,iCAA0B,cAAc,yEAAsE,CAC/G,CAAC;;wBAGJ,sBAAO,KAAK,EAAC;;;;CACd;AA9BD,kDA8BC;AAED,SAAsB,0BAA0B,CAC9C,WAAoB;;;;YAEd,KAAK,GAAG,eAAK,CAAC,IAAI,CAAC,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,sBAAsB,CAAC,CAAC;YAChE,sBAAO,IAAA,qBAAS,EAAC,yBAAyB,EAAE;oBAC1C,OAAA,gBAAgB,CACd,KAAK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,mDAA2C,KAAK,mCAA+B;wBACxF,OAAO,EAAE;4BACP;gCACE,KAAK,EAAE,IAAI;gCACX,KAAK,EAAE,KAAK;gCACZ,IAAI,EAAE,wDAAwD;6BAC/D;4BACD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;yBAC9B;qBACF,CAAC,CACH;gBAZD,CAYC,CACF,EAAC;;;CACH;AAnBD,gEAmBC","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 { SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n installPackageWithPackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\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\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}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: 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 `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.\nOr setup using ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/',\n )}`,\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 installPackageWithPackageManager(packageManager, packageName);\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 'If you think this issue is caused by the Sentry wizard, let us know here:\\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 //TODO: Add a check to see if the file is already ignored in .gitignore\n try {\n await fs.promises.appendFile(\n path.join(process.cwd(), '.gitignore'),\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\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\nasync 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),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\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 }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects),\n );\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys.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(urlFromArgs?: string): Promise<{\n url: string;\n selfHosted: boolean;\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/\")',\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}): 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 {\n if (options.url !== SAAS_URL) {\n clack.log.error('Loading Wizard failed. Did you provide the right URL?');\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 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 (!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).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): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n const sortedProjects = [...projects];\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\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\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"]}
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,qDAK2B;AAC3B,iCAAgC;AAChC,mCAAgD;AAEhD,IAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAEc,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;AA+BzB,QAAA,gBAAgB,GAAmB;IAC9C,QAAQ,EAAE,0BAAkB;IAC5B,IAAI,EA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OAAO,EAAE;4BACP;gCACE,KAAK,EAAE,IAAI;gCACX,KAAK,EAAE,KAAK;gCACZ,IAAI,EAAE,wDAAwD;6BAC/D;4BACD,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;yBAC9B;qBACF,CAAC,CACH;gBAZD,CAYC,CACF,EAAC;;;CACH;AAnBD,gEAmBC","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 { SentryProjectData, WizardOptions } from './types';\nimport { traceStep } from '../telemetry';\nimport {\n detectPackageManger,\n PackageManager,\n installPackageWithPackageManager,\n packageManagers,\n} from './package-manager';\nimport { debug } from './debug';\nimport { fulfillsVersionRange } from './semver';\n\nconst opn = require('opn') as (\n url: string,\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\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}: {\n packageId: string;\n packageName: string;\n packageVersion: string;\n acceptableVersions: 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 `Please upgrade to ${acceptableVersions} if you wish to use the Sentry Wizard.\nOr setup using ${chalk.cyan(\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/',\n )}`,\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 installPackageWithPackageManager(packageManager, packageName);\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 'If you think this issue is caused by the Sentry wizard, let us know here:\\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 //TODO: Add a check to see if the file is already ignored in .gitignore\n try {\n await fs.promises.appendFile(\n path.join(process.cwd(), '.gitignore'),\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\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\nasync 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),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n platform: platform,\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 }\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects),\n );\n\n return {\n sentryUrl,\n selfHosted,\n authToken: apiKeys.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(urlFromArgs?: string): Promise<{\n url: string;\n selfHosted: boolean;\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/\")',\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}): 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 (!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).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): Promise<SentryProjectData> {\n const label = (project: SentryProjectData): string => {\n return `${project.organization.slug}/${project.slug}`;\n };\n const sortedProjects = [...projects];\n sortedProjects.sort((a: SentryProjectData, b: SentryProjectData) => {\n return label(a).localeCompare(label(b));\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\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.20.0",
3
+ "version": "3.20.2",
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",
@@ -215,23 +215,16 @@ export default function Page() {
215
215
  fontSize: "14px",
216
216
  margin: "18px",
217
217
  }}
218
- onClick={async () => {
219
- const transaction = Sentry.startTransaction({
220
- name: "Example Frontend Transaction",
221
- });
222
-
223
- Sentry.configureScope((scope) => {
224
- scope.setSpan(transaction);
225
- });
226
-
227
- try {
218
+ onClick={() => {
219
+ Sentry.startSpan({
220
+ name: 'Example Frontend Span',
221
+ op: 'test'
222
+ }, async () => {
228
223
  const res = await fetch("/api/sentry-example-api");
229
224
  if (!res.ok) {
230
225
  throw new Error("Sentry Example Frontend Error");
231
226
  }
232
- } finally {
233
- transaction.finish();
234
- }
227
+ });
235
228
  }}
236
229
  >
237
230
  Throw error!
@@ -131,7 +131,7 @@ export async function runSvelteKitWizardWithTelemetry(
131
131
  }
132
132
 
133
133
  const shouldCreateExamplePage = await askShouldCreateExamplePage(
134
- 'sentry-example',
134
+ '/sentry-example',
135
135
  );
136
136
 
137
137
  if (shouldCreateExamplePage) {
@@ -62,23 +62,16 @@ Feel free to delete this file and the entire sentry route.
62
62
  <script>
63
63
  import * as Sentry from '@sentry/sveltekit';
64
64
 
65
- async function getSentryData() {
66
- const transaction = Sentry.startTransaction({
67
- name: 'Example Frontend Transaction'
68
- });
69
-
70
- Sentry.configureScope((scope) => {
71
- scope.setSpan(transaction);
72
- });
73
-
74
- try {
65
+ function getSentryData() {
66
+ Sentry.startSpan({
67
+ name: 'Example Frontend Span',
68
+ op: 'test',
69
+ }, async () => {
75
70
  const res = await fetch('/sentry-example');
76
71
  if (!res.ok) {
77
72
  throw new Error('Sentry Example Frontend Error');
78
73
  }
79
- } finally {
80
- transaction.finish();
81
- }
74
+ });
82
75
  }
83
76
  </script>
84
77
 
@@ -891,9 +891,10 @@ async function askForWizardLogin(options: {
891
891
  wizardHash = (
892
892
  await axios.get<{ hash: string }>(`${options.url}api/0/wizard/`)
893
893
  ).data.hash;
894
- } catch {
894
+ } catch (e: unknown) {
895
895
  if (options.url !== SAAS_URL) {
896
896
  clack.log.error('Loading Wizard failed. Did you provide the right URL?');
897
+ clack.log.info(JSON.stringify(e, null, 2));
897
898
  await abort(
898
899
  chalk.red(
899
900
  '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',
@@ -901,6 +902,7 @@ async function askForWizardLogin(options: {
901
902
  );
902
903
  } else {
903
904
  clack.log.error('Loading Wizard failed.');
905
+ clack.log.info(JSON.stringify(e, null, 2));
904
906
  await abort(
905
907
  chalk.red(
906
908
  'Please try again in a few minutes and let us know if this issue persists: https://github.com/getsentry/sentry-wizard/issues',