@sentry/wizard 4.0.1 → 4.0.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,8 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.2
4
+
5
+ - ref: Set wizard version at build time ([#827](https://github.com/getsentry/sentry-wizard/pull/827))
6
+ - fix: Skip asking if users have sentry account if `--org` and `--project` flags were passed ([#817](https://github.com/getsentry/sentry-wizard/pull/817))
7
+
3
8
  ## 4.0.1
4
9
 
5
- - fix: Remove bulk from npm ([#825](https://github.com/getsentry/sentry-wizard/pull/825)])
10
+ - fix: Remove bulk from npm ([#825](https://github.com/getsentry/sentry-wizard/pull/825))
6
11
 
7
12
  ## 4.0.0
8
13
 
@@ -28,7 +28,7 @@ const sentryWebpackPluginOptions = {
28
28
 
29
29
  silent: true, // Suppresses all logs
30
30
  // For all available options, see:
31
- // https://github.com/getsentry/sentry-webpack-plugin#options.
31
+ // https://www.npmjs.com/package/@sentry/webpack-plugin#options
32
32
  };
33
33
 
34
34
  // Make sure adding Sentry options is the last code to run before exporting, to
package/dist/bin.js CHANGED
@@ -31,6 +31,7 @@ if (!(0, semver_1.satisfies)(process.version, NODE_VERSION_RANGE)) {
31
31
  }
32
32
  const Constants_1 = require("./lib/Constants");
33
33
  const run_1 = require("./src/run");
34
+ const version_1 = require("./src/version");
34
35
  __exportStar(require("./lib/Setup"), exports);
35
36
  const PRESELECTED_PROJECT_OPTIONS = {
36
37
  'preSelectedProject.authToken': {
@@ -142,7 +143,7 @@ const argv = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv), process.
142
143
  })
143
144
  // This prevents `yargs` from trying to read the local package.json
144
145
  // as it's not available in the Node Single Executable Binary artifacts versions
145
- .version(process.env.npm_package_version).argv;
146
+ .version(version_1.WIZARD_VERSION).argv;
146
147
  // @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties
147
148
  // meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?
148
149
  // Can't upgrade yargs though without dropping support for Node 14.
package/dist/bin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,mCAAmC;AACnC,kDAA2C;AAE3C,kDAA0B;AAC1B,2CAAwC;AAExC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,kCAAkC,kBAAkB,2BAA2B,OAAO,CAAC,OAAO,wCAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,+CAAwD;AACxD,mCAAgC;AAEhC,8CAA4B;AAE5B,MAAM,2BAA2B,GAAG;IAClC,8BAA8B,EAAE;QAC9B,QAAQ,EAAE,gCAAgC;KAC3C;IACD,+BAA+B,EAAE;QAC/B,QAAQ,EAAE,oCAAoC;KAC/C;IACD,wBAAwB,EAAE;QACxB,QAAQ,EAAE,yBAAyB;KACpC;IACD,uBAAuB,EAAE;QACvB,QAAQ,EAAE,wBAAwB;KACnC;IACD,gCAAgC,EAAE;QAChC,QAAQ,EAAE,0BAA0B;KACrC;IACD,gCAAgC,EAAE;QAChC,QAAQ,EAAE,0BAA0B;KACrC;IACD,0BAA0B,EAAE;QAC1B,QAAQ,EAAE,6BAA6B;KACxC;IACD,4BAA4B,EAAE;QAC5B,QAAQ,EAAE,+BAA+B;KAC1C;IACD,4BAA4B,EAAE;QAC5B,QAAQ,EAAE,+BAA+B;KAC1C;CACF,CAAC;AAEF,kJAAkJ;AAClJ,MAAM,IAAI,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE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CAA0C;QACpD,IAAI,EAAE,SAAS;KAChB;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,qCAAqC;QAC/C,IAAI,EAAE,SAAS;KAChB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,iDAAiD;QAC3D,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,mCAAmC;QAC7C,IAAI,EAAE,SAAS;KAChB;IACD,GAAG,2BAA2B;CAC/B,CAAC;IACF,mEAAmE;IACnE,gFAAgF;KAC/E,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,mBAA6B,CAAC,CAAC,IAAI,CAAC;AAE3D,0FAA0F;AAC1F,sFAAsF;AACtF,mEAAmE;AACnE,KAAK,IAAA,SAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=18.20.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\n\nexport * from './lib/Setup';\n\nconst PRESELECTED_PROJECT_OPTIONS = {\n 'preSelectedProject.authToken': {\n describe: 'Preselected project auth token',\n },\n 'preSelectedProject.selfHosted': {\n describe: 'Preselected project is self-hosted',\n },\n 'preSelectedProject.dsn': {\n describe: 'Preselected project DSN',\n },\n 'preSelectedProject.id': {\n describe: 'Preselected project id',\n },\n 'preSelectedProject.projectSlug': {\n describe: 'Preselected project slug',\n },\n 'preSelectedProject.projectName': {\n describe: 'Preselected project name',\n },\n 'preSelectedProject.orgId': {\n describe: 'Preselected organization id',\n },\n 'preSelectedProject.orgName': {\n describe: 'Preselected organization name',\n },\n 'preSelectedProject.orgSlug': {\n describe: 'Preselected organization slug',\n },\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv), process.cwd())\n .options({\n debug: {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n },\n uninstall: {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n },\n 'skip-connect': {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n },\n quiet: {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n },\n i: {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe:\n 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n },\n p: {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n },\n u: {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n },\n project: {\n type: 'string',\n describe: 'The Sentry project slug to use',\n defaultDescription: 'Select project during setup',\n default: undefined,\n },\n org: {\n type: 'string',\n describe: 'The Sentry org slug to use',\n defaultDescription: 'Select org during setup',\n default: undefined,\n },\n saas: {\n default: false,\n describe: 'Skip the self-hosted or SaaS URL selection process',\n defaultDescription: 'Select self-hosted or SaaS during setup',\n type: 'boolean',\n },\n s: {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n },\n 'disable-telemetry': {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n },\n 'promo-code': {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n },\n 'force-install': {\n default: false,\n describe: 'Force install the SDK NPM package',\n type: 'boolean',\n },\n ...PRESELECTED_PROJECT_OPTIONS,\n })\n // This prevents `yargs` from trying to read the local package.json\n // as it's not available in the Node Single Executable Binary artifacts versions\n .version(process.env.npm_package_version as string).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../bin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,mCAAmC;AACnC,kDAA2C;AAE3C,kDAA0B;AAC1B,2CAAwC;AAExC,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAEvC,iFAAiF;AACjF,+BAA+B;AAC/B,IAAI,CAAC,IAAA,kBAAS,EAAC,OAAO,CAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE;IACnD,IAAA,aAAG,EACD,kCAAkC,kBAAkB,2BAA2B,OAAO,CAAC,OAAO,wCAAwC,CACvI,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CACjB;AAED,+CAAwD;AACxD,mCAAgC;AAChC,2CAA+C;AAE/C,8CAA4B;AAE5B,MAAM,2BAA2B,GAAG;IAClC,8BAA8B,EAAE;QAC9B,QAAQ,EAAE,gCAAgC;KAC3C;IACD,+BAA+B,EAAE;QAC/B,QAAQ,EAAE,oCAAoC;KAC/C;IACD,wBAAwB,EAAE;QACxB,QAAQ,EAAE,yBAAyB;KACpC;IACD,uBAAuB,EAAE;QACvB,QAAQ,EAAE,wBAAwB;KACnC;IACD,gCAAgC,EAAE;QAChC,QAAQ,EAAE,0BAA0B;KACrC;IACD,gCAAgC,EAAE;QAChC,QAAQ,EAAE,0BAA0B;KACrC;IACD,0BAA0B,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QAAQ,EAAE,4BAA4B;QACtC,kBAAkB,EAAE,yBAAyB;QAC7C,OAAO,EAAE,SAAS;KACnB;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,oDAAoD;QAC9D,kBAAkB,EAAE,yCAAyC;QAC7D,IAAI,EAAE,SAAS;KAChB;IACD,CAAC,EAAE;QACD,KAAK,EAAE,QAAQ;QACf,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,0CAA0C;QACpD,IAAI,EAAE,SAAS;KAChB;IACD,mBAAmB,EAAE;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,qCAAqC;QAC/C,IAAI,EAAE,SAAS;KAChB;IACD,YAAY,EAAE;QACZ,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,iDAAiD;QAC3D,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,mCAAmC;QAC7C,IAAI,EAAE,SAAS;KAChB;IACD,GAAG,2BAA2B;CAC/B,CAAC;IACF,mEAAmE;IACnE,gFAAgF;KAC/E,OAAO,CAAC,wBAAc,CAAC,CAAC,IAAI,CAAC;AAEhC,0FAA0F;AAC1F,sFAAsF;AACtF,mEAAmE;AACnE,KAAK,IAAA,SAAG,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { satisfies } from 'semver';\nimport { red } from './lib/Helper/Logging';\n\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nconst NODE_VERSION_RANGE = '>=18.20.0';\n\n// Have to run this above the other imports because they are importing clack that\n// has the problematic imports.\nif (!satisfies(process.version, NODE_VERSION_RANGE)) {\n red(\n `Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,\n );\n process.exit(1);\n}\n\nimport { Integration, Platform } from './lib/Constants';\nimport { run } from './src/run';\nimport { WIZARD_VERSION } from './src/version';\n\nexport * from './lib/Setup';\n\nconst PRESELECTED_PROJECT_OPTIONS = {\n 'preSelectedProject.authToken': {\n describe: 'Preselected project auth token',\n },\n 'preSelectedProject.selfHosted': {\n describe: 'Preselected project is self-hosted',\n },\n 'preSelectedProject.dsn': {\n describe: 'Preselected project DSN',\n },\n 'preSelectedProject.id': {\n describe: 'Preselected project id',\n },\n 'preSelectedProject.projectSlug': {\n describe: 'Preselected project slug',\n },\n 'preSelectedProject.projectName': {\n describe: 'Preselected project name',\n },\n 'preSelectedProject.orgId': {\n describe: 'Preselected organization id',\n },\n 'preSelectedProject.orgName': {\n describe: 'Preselected organization name',\n },\n 'preSelectedProject.orgSlug': {\n describe: 'Preselected organization slug',\n },\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\nconst argv = yargs(hideBin(process.argv), process.cwd())\n .options({\n debug: {\n default: false,\n describe: 'Enable verbose logging\\nenv: SENTRY_WIZARD_DEBUG',\n type: 'boolean',\n },\n uninstall: {\n default: false,\n describe: 'Revert project setup process\\nenv: SENTRY_WIZARD_UNINSTALL',\n type: 'boolean',\n },\n 'skip-connect': {\n default: false,\n describe:\n 'Skips the connection to the server\\nenv: SENTRY_WIZARD_SKIP_CONNECT',\n type: 'boolean',\n },\n quiet: {\n default: false,\n describe:\n 'Do not fallback to prompting user asking questions\\nenv: SENTRY_WIZARD_QUIET',\n type: 'boolean',\n },\n i: {\n alias: 'integration',\n choices: Object.keys(Integration),\n describe:\n 'Choose the integration to setup\\nenv: SENTRY_WIZARD_INTEGRATION',\n },\n p: {\n alias: 'platform',\n choices: Object.keys(Platform),\n describe: 'Choose platform(s)\\nenv: SENTRY_WIZARD_PLATFORM',\n type: 'array',\n },\n u: {\n alias: 'url',\n describe: 'The url to your Sentry installation\\nenv: SENTRY_WIZARD_URL',\n },\n project: {\n type: 'string',\n describe: 'The Sentry project slug to use',\n defaultDescription: 'Select project during setup',\n default: undefined,\n },\n org: {\n type: 'string',\n describe: 'The Sentry org slug to use',\n defaultDescription: 'Select org during setup',\n default: undefined,\n },\n saas: {\n default: false,\n describe: 'Skip the self-hosted or SaaS URL selection process',\n defaultDescription: 'Select self-hosted or SaaS during setup',\n type: 'boolean',\n },\n s: {\n alias: 'signup',\n default: false,\n describe: 'Redirect to signup page if not logged in',\n type: 'boolean',\n },\n 'disable-telemetry': {\n default: false,\n describe: \"Don't send telemetry data to Sentry\",\n type: 'boolean',\n },\n 'promo-code': {\n alias: 'promo-code',\n describe: 'A promo code that will be applied during signup',\n type: 'string',\n },\n 'force-install': {\n default: false,\n describe: 'Force install the SDK NPM package',\n type: 'boolean',\n },\n ...PRESELECTED_PROJECT_OPTIONS,\n })\n // This prevents `yargs` from trying to read the local package.json\n // as it's not available in the Node Single Executable Binary artifacts versions\n .version(WIZARD_VERSION).argv;\n\n// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties\n// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?\n// Can't upgrade yargs though without dropping support for Node 14.\nvoid run(argv);\n"]}
@@ -0,0 +1,28 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const getVersionFileContent = (version) => `// DO NOT modify this file manually!
5
+ // This is file is updated at release time.
6
+
7
+ export const WIZARD_VERSION = '${version}';
8
+ `;
9
+
10
+ const newVersion = process.argv[2];
11
+
12
+ if (typeof newVersion !== 'string' || !newVersion.match(/^\d+\.\d+\.\d+.*$/)) {
13
+ console.error(
14
+ `Invalid version provided (${newVersion}). Please provide a valid semver version.`,
15
+ );
16
+ process.exit(1);
17
+ }
18
+
19
+ console.log(`Updating \`version.ts\` to ${newVersion}`);
20
+
21
+ const versionFilePath = path.join(__dirname, '..', 'src', 'version.ts');
22
+
23
+ try {
24
+ fs.writeFileSync(versionFilePath, getVersionFileContent(newVersion));
25
+ } catch (e) {
26
+ console.error('Failed to update `version.ts` file', e);
27
+ process.exit(1);
28
+ }
@@ -8,3 +8,5 @@ NEW_VERSION="${2}"
8
8
  # Do not tag and commit changes made by "npm version"
9
9
  export npm_config_git_tag_version=false
10
10
  npm version "${NEW_VERSION}"
11
+
12
+ node $SCRIPT_DIR/bump-version.js "${NEW_VERSION}"
@@ -1,24 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Initial = void 0;
4
- const node_path_1 = require("node:path");
5
4
  const Logging_1 = require("../Helper/Logging");
6
5
  const BaseStep_1 = require("./BaseStep");
7
- const node_fs_1 = require("node:fs");
8
- let wizardPackage = {};
9
- try {
10
- wizardPackage = process.env.npm_package_version
11
- ? { version: process.env.npm_package_version }
12
- : JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@sentry/wizard')), '..', 'package.json'), 'utf-8'));
13
- }
14
- catch {
15
- // We don't need to have this
16
- }
6
+ const version_1 = require("../../src/version");
17
7
  class Initial extends BaseStep_1.BaseStep {
18
8
  // eslint-disable-next-line @typescript-eslint/require-await
19
9
  async emit(_answers) {
20
10
  (0, Logging_1.dim)('Running Sentry Wizard...');
21
- (0, Logging_1.dim)(`version: ${wizardPackage.version ?? 'DEV'}`);
11
+ (0, Logging_1.dim)(`version: ${version_1.WIZARD_VERSION}`);
22
12
  return {};
23
13
  }
24
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Initial.js","sourceRoot":"","sources":["../../../lib/Steps/Initial.ts"],"names":[],"mappings":";;;AACA,yCAA0C;AAE1C,+CAAwC;AACxC,yCAAsC;AACtC,qCAAuC;AAGvC,IAAI,aAAa,GAAgB,EAAE,CAAC;AAEpC,IAAI;IACF,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC7C,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB,EAAE;QAC9C,CAAC,CAAE,IAAI,CAAC,KAAK,CACT,IAAA,sBAAY,EACV,IAAA,gBAAI,EACF,IAAA,mBAAO,EAAC,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,EAC1C,IAAI,EACJ,cAAc,CACf,EACD,OAAO,CACR,CACc,CAAC;CACvB;AAAC,MAAM;IACN,6BAA6B;CAC9B;AAED,MAAa,OAAQ,SAAQ,mBAAQ;IACnC,4DAA4D;IACrD,KAAK,CAAC,IAAI,CAAC,QAAiB;QACjC,IAAA,aAAG,EAAC,0BAA0B,CAAC,CAAC;QAChC,IAAA,aAAG,EAAC,YAAY,aAAa,CAAC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAPD,0BAOC","sourcesContent":["import type { Answers } from 'inquirer';\nimport { join, dirname } from 'node:path';\n\nimport { dim } from '../Helper/Logging';\nimport { BaseStep } from './BaseStep';\nimport { readFileSync } from 'node:fs';\n\ntype PackageJSON = { version?: string };\nlet wizardPackage: PackageJSON = {};\n\ntry {\n wizardPackage = process.env.npm_package_version\n ? { version: process.env.npm_package_version }\n : (JSON.parse(\n readFileSync(\n join(\n dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n ),\n 'utf-8',\n ),\n ) as PackageJSON);\n} catch {\n // We don't need to have this\n}\n\nexport class Initial extends BaseStep {\n // eslint-disable-next-line @typescript-eslint/require-await\n public async emit(_answers: Answers): Promise<Answers> {\n dim('Running Sentry Wizard...');\n dim(`version: ${wizardPackage.version ?? 'DEV'}`);\n return {};\n }\n}\n"]}
1
+ {"version":3,"file":"Initial.js","sourceRoot":"","sources":["../../../lib/Steps/Initial.ts"],"names":[],"mappings":";;;AAEA,+CAAwC;AACxC,yCAAsC;AACtC,+CAAmD;AAEnD,MAAa,OAAQ,SAAQ,mBAAQ;IACnC,4DAA4D;IACrD,KAAK,CAAC,IAAI,CAAC,QAAiB;QACjC,IAAA,aAAG,EAAC,0BAA0B,CAAC,CAAC;QAChC,IAAA,aAAG,EAAC,YAAY,wBAAc,EAAE,CAAC,CAAC;QAClC,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AAPD,0BAOC","sourcesContent":["import type { Answers } from 'inquirer';\n\nimport { dim } from '../Helper/Logging';\nimport { BaseStep } from './BaseStep';\nimport { WIZARD_VERSION } from '../../src/version';\n\nexport class Initial extends BaseStep {\n // eslint-disable-next-line @typescript-eslint/require-await\n public async emit(_answers: Answers): Promise<Answers> {\n dim('Running Sentry Wizard...');\n dim(`version: ${WIZARD_VERSION}`);\n return {};\n }\n}\n"]}
@@ -9,7 +9,7 @@ const clack_utils_1 = require("../utils/clack-utils");
9
9
  function getWithSentryConfigOptionsTemplate({ orgSlug, projectSlug, selfHosted, tunnelRoute, reactComponentAnnotation, sentryUrl, }) {
10
10
  return `{
11
11
  // For all available options, see:
12
- // https://github.com/getsentry/sentry-webpack-plugin#options
12
+ // https://www.npmjs.com/package/@sentry/webpack-plugin#options
13
13
 
14
14
  org: "${orgSlug}",
15
15
  project: "${projectSlug}",${selfHosted ? `\n sentryUrl: "${sentryUrl}",` : ''}
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sDAAuD;AAWvD,SAAgB,kCAAkC,CAAC,EACjD,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,wBAAwB,EACxB,SAAS,GACe;IACxB,OAAO;;;;YAIG,OAAO;gBACH,WAAW,KACvB,UAAU,CAAC,CAAC,CAAC,qBAAqB,SAAS,IAAI,CAAC,CAAC,CAAC,EACpD;;;;;;;;;kCAUI,wBAAwB;QACtB,CAAC,CAAC;;;;OAIH;QACC,CAAC,CAAC,EACN;;SAGE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,oBAC1B;;;;MAIE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;;;;;;;;;;IAU1B,CAAC;AACL,CAAC;AAnDD,gFAmDC;AAED,SAAgB,0BAA0B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8BAA8B,CAAC,IAAa;IAC1D,IAAI,IAAI,EAAE;QACR,OAAO;;EAET,eAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC;EACxD,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC;EAC9C,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC;;sCAEb,eAAK,CAAC,KAAK,CAC3C,6BAA6B,CAC9B;IACD,eAAK,CAAC,KAAK,CAAC;;eAED,CAAC;;;;;;;;;;CAUf,CAAC;KACC;IACD,OAAO;;EAEP,eAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC;EACxD,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC;EAC9C,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC;;sCAEb,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC;IAC1D,eAAK,CAAC,KAAK,CAAC;;eAED,CAAC;;;;;;;;;;CAUf,CAAC;AACF,CAAC;AA7CD,wEA6CC","sourcesContent":["import chalk from 'chalk';\nimport { makeCodeSnippet } from '../utils/clack-utils';\n\ntype WithSentryConfigOptions = {\n orgSlug: string;\n projectSlug: string;\n selfHosted: boolean;\n sentryUrl: string;\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nexport function getWithSentryConfigOptionsTemplate({\n orgSlug,\n projectSlug,\n selfHosted,\n tunnelRoute,\n reactComponentAnnotation,\n sentryUrl,\n}: WithSentryConfigOptions): string {\n return `{\n // For all available options, see:\n // https://github.com/getsentry/sentry-webpack-plugin#options\n\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${\n selfHosted ? `\\n sentryUrl: \"${sentryUrl}\",` : ''\n }\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\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 reactComponentAnnotation\n ? `\\n\n // Automatically annotate React components to show their full name in breadcrumbs and session replay\n reactComponentAnnotation: {\n enabled: true,\n },`\n : ''\n }\n\n // ${\n tunnelRoute ? 'Route' : 'Uncomment to route'\n } browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n ${tunnelRoute ? '' : '// '}tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\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 withSentryConfigOptionsTemplate: 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 ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigMjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `import { withSentryConfig } from \"@sentry/nextjs\";\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n withSentryConfigOptionsTemplate: 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 ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nfunction getClientIntegrationsSnippet(features: { replay: boolean }) {\n if (features.replay) {\n return `\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],`;\n }\n\n return '';\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'server' | 'client' | 'edge',\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n },\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 const integrationsOptions = getClientIntegrationsSnippet({\n replay: config === 'client' && selectedFeaturesMap.replay,\n });\n\n let replayOptions = '';\n if (config === 'client') {\n if (selectedFeaturesMap.replay) {\n replayOptions += `\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,`;\n }\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\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}\",${integrationsOptions}${performanceOptions}${replayOptions}\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n sentryUrl: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n}): string {\n const issuesPageLink = options.selfHosted\n ? `${options.sentryUrl}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 await 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 getSentryExamplePagesDirApiRoute() {\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${chalk.green(`import Error from \"next/error\";`)}\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 return Error.getInitialProps(contextData);\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 }\nimport Error from \"next/error\";\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 return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getInstrumentationHookContent(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return `import * as Sentry from '@sentry/nextjs';\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n`;\n}\n\nexport function getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return unchanged(`${plus(\"import * as Sentry from '@sentry/nextjs';\")}\n\nexport ${plus('async')} function register() {\n ${plus(`if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }`)}\n}\n\n${plus('export const onRequestError = Sentry.captureRequestError;')}\n`);\n });\n}\n\nexport function getSentryDefaultGlobalErrorPage(isTs: boolean) {\n return isTs\n ? `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }: { error: Error & { digest?: string } }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}`\n : `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError 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 {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\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 }\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"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nextjs/templates.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,sDAAuD;AAWvD,SAAgB,kCAAkC,CAAC,EACjD,OAAO,EACP,WAAW,EACX,UAAU,EACV,WAAW,EACX,wBAAwB,EACxB,SAAS,GACe;IACxB,OAAO;;;;YAIG,OAAO;gBACH,WAAW,KACvB,UAAU,CAAC,CAAC,CAAC,qBAAqB,SAAS,IAAI,CAAC,CAAC,CAAC,EACpD;;;;;;;;;kCAUI,wBAAwB;QACtB,CAAC,CAAC;;;;OAIH;QACC,CAAC,CAAC,EACN;;S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ED,SAAgB,+BAA+B,CAAC,IAAa;IAC3D,OAAO,IAAI;QACT,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;EAsBJ;QACE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;CAuBL,CAAC;AACF,CAAC;AAjDD,0EAiDC;AAED,SAAgB,8BAA8B,CAAC,IAAa;IAC1D,IAAI,IAAI,EAAE;QACR,OAAO;;EAET,eAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC;EACxD,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC;EAC9C,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC;;sCAEb,eAAK,CAAC,KAAK,CAC3C,6BAA6B,CAC9B;IACD,eAAK,CAAC,KAAK,CAAC;;eAED,CAAC;;;;;;;;;;CAUf,CAAC;KACC;IACD,OAAO;;EAEP,eAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC;EACxD,eAAK,CAAC,KAAK,CAAC,iCAAiC,CAAC;EAC9C,eAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC;;sCAEb,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC;IAC1D,eAAK,CAAC,KAAK,CAAC;;eAED,CAAC;;;;;;;;;;CAUf,CAAC;AACF,CAAC;AA7CD,wEA6CC","sourcesContent":["import chalk from 'chalk';\nimport { makeCodeSnippet } from '../utils/clack-utils';\n\ntype WithSentryConfigOptions = {\n orgSlug: string;\n projectSlug: string;\n selfHosted: boolean;\n sentryUrl: string;\n tunnelRoute: boolean;\n reactComponentAnnotation: boolean;\n};\n\nexport function getWithSentryConfigOptionsTemplate({\n orgSlug,\n projectSlug,\n selfHosted,\n tunnelRoute,\n reactComponentAnnotation,\n sentryUrl,\n}: WithSentryConfigOptions): string {\n return `{\n // For all available options, see:\n // https://www.npmjs.com/package/@sentry/webpack-plugin#options\n\n org: \"${orgSlug}\",\n project: \"${projectSlug}\",${\n selfHosted ? `\\n sentryUrl: \"${sentryUrl}\",` : ''\n }\n\n // Only print logs for uploading source maps in CI\n silent: !process.env.CI,\n\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 reactComponentAnnotation\n ? `\\n\n // Automatically annotate React components to show their full name in breadcrumbs and session replay\n reactComponentAnnotation: {\n enabled: true,\n },`\n : ''\n }\n\n // ${\n tunnelRoute ? 'Route' : 'Uncomment to route'\n } browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers.\n // This can increase your server load as well as your hosting bill.\n // Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-\n // side errors will fail.\n ${tunnelRoute ? '' : '// '}tunnelRoute: \"/monitoring\",\n\n // Automatically tree-shake Sentry logger statements to reduce bundle size\n disableLogger: true,\n\n // Enables automatic instrumentation of Vercel Cron Monitors. (Does not yet work with App Router route handlers.)\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 withSentryConfigOptionsTemplate: 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 ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigMjsTemplate(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `import { withSentryConfig } from \"@sentry/nextjs\";\n\n/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default withSentryConfig(\n nextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigCjsAppendix(\n withSentryConfigOptionsTemplate: 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 ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nexport function getNextjsConfigEsmCopyPasteSnippet(\n withSentryConfigOptionsTemplate: string,\n): string {\n return `\n\n// next.config.mjs\nimport { withSentryConfig } from \"@sentry/nextjs\";\n\nexport default withSentryConfig(\n yourNextConfig,\n ${withSentryConfigOptionsTemplate}\n);\n`;\n}\n\nfunction getClientIntegrationsSnippet(features: { replay: boolean }) {\n if (features.replay) {\n return `\n\n // Add optional integrations for additional features\n integrations: [\n Sentry.replayIntegration(),\n ],`;\n }\n\n return '';\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'server' | 'client' | 'edge',\n selectedFeaturesMap: {\n replay: boolean;\n performance: boolean;\n },\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 const integrationsOptions = getClientIntegrationsSnippet({\n replay: config === 'client' && selectedFeaturesMap.replay,\n });\n\n let replayOptions = '';\n if (config === 'client') {\n if (selectedFeaturesMap.replay) {\n replayOptions += `\n\n // Define how likely Replay events are sampled.\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 // Define how likely Replay events are sampled when an error occurs.\n replaysOnErrorSampleRate: 1.0,`;\n }\n }\n\n let performanceOptions = '';\n if (selectedFeaturesMap.performance) {\n performanceOptions += `\n\n // Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.\n tracesSampleRate: 1,`;\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}\",${integrationsOptions}${performanceOptions}${replayOptions}\n\n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n sentryUrl: string;\n orgSlug: string;\n projectId: string;\n useClient: boolean;\n}): string {\n const issuesPageLink = options.selfHosted\n ? `${options.sentryUrl}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 await 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 getSentryExamplePagesDirApiRoute() {\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${chalk.green(`import Error from \"next/error\";`)}\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 return Error.getInitialProps(contextData);\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 }\nimport Error from \"next/error\";\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 return Error.getInitialProps(contextData);\n};\n`;\n}\n\nexport function getInstrumentationHookContent(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return `import * as Sentry from '@sentry/nextjs';\n\nexport async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;\n`;\n}\n\nexport function getInstrumentationHookCopyPasteSnippet(\n instrumentationHookLocation: 'src' | 'root',\n) {\n return makeCodeSnippet(true, (unchanged, plus) => {\n return unchanged(`${plus(\"import * as Sentry from '@sentry/nextjs';\")}\n\nexport ${plus('async')} function register() {\n ${plus(`if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('${\n instrumentationHookLocation === 'root' ? '.' : '..'\n }/sentry.edge.config');\n }`)}\n}\n\n${plus('export const onRequestError = Sentry.captureRequestError;')}\n`);\n });\n}\n\nexport function getSentryDefaultGlobalErrorPage(isTs: boolean) {\n return isTs\n ? `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError from \"next/error\";\nimport { useEffect } from \"react\";\n\nexport default function GlobalError({ error }: { error: Error & { digest?: string } }) {\n useEffect(() => {\n Sentry.captureException(error);\n }, [error]);\n\n return (\n <html>\n <body>\n {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\n </body>\n </html>\n );\n}`\n : `\"use client\";\n\nimport * as Sentry from \"@sentry/nextjs\";\nimport NextError 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 {/* \\`NextError\\` is the default Next.js error page component. Its type\n definition requires a \\`statusCode\\` prop. However, since the App Router\n does not expose status codes for errors, we simply pass 0 to render a\n generic error message. */}\n <NextError statusCode={0} />\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 }\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"]}
package/dist/src/run.js CHANGED
@@ -38,7 +38,7 @@ const remix_wizard_1 = require("./remix/remix-wizard");
38
38
  const sveltekit_wizard_1 = require("./sveltekit/sveltekit-wizard");
39
39
  const sourcemaps_wizard_1 = require("./sourcemaps/sourcemaps-wizard");
40
40
  const Env_1 = require("../lib/Helper/Env");
41
- const node_fs_1 = require("node:fs");
41
+ const version_1 = require("./version");
42
42
  function preSelectedProjectArgsToObject(args) {
43
43
  if (!args.preSelectedProject) {
44
44
  return undefined;
@@ -71,7 +71,7 @@ async function run(argv) {
71
71
  };
72
72
  let integration = finalArgs.integration;
73
73
  if (!integration) {
74
- clack.intro(`Sentry Wizard ${tryGetWizardVersion()}`);
74
+ clack.intro(`Sentry Wizard ${version_1.WIZARD_VERSION}`);
75
75
  integration = await (0, clack_utils_1.abortIfCancelled)(clack.select({
76
76
  message: 'What do you want to set up?',
77
77
  options: [
@@ -148,20 +148,4 @@ async function run(argv) {
148
148
  }
149
149
  }
150
150
  exports.run = run;
151
- /**
152
- * TODO: replace with rollup replace whenever we switch to rollup
153
- */
154
- function tryGetWizardVersion() {
155
- let version = process.env.npm_package_version;
156
- if (!version) {
157
- try {
158
- const wizardPkgJson = JSON.parse((0, node_fs_1.readFileSync)('../package.json', 'utf-8'));
159
- version = wizardPkgJson.version;
160
- }
161
- catch {
162
- // ignore
163
- }
164
- }
165
- return version ?? '';
166
- }
167
151
  //# sourceMappingURL=run.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,sDAAwC;AACxC,qDAAuD;AACvD,4EAA0E;AAE1E,wCAAgD;AAEhD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,0DAAyD;AACzD,oDAAmD;AACnD,uDAAsD;AACtD,mEAAkE;AAClE,sEAAqE;AACrE,2CAAoD;AAGpD,qCAAuC;AA4CvC,SAAS,8BAA8B,CACrC,IAAU;IAEV,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;QAC5C,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU;QA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,QAAQ;YACX,MAAM,IAAA,+BAAe,EAAC,aAAa,CAAC,CAAC;YACrC,MAAM;QAER,KAAK,MAAM;YACT,MAAM,IAAA,2BAAa,EAAC,aAAa,CAAC,CAAC;YACnC,MAAM;QAER,KAAK,OAAO;YACV,MAAM,IAAA,6BAAc,EAAC,aAAa,CAAC,CAAC;YACpC,MAAM;QAER,KAAK,WAAW;YACd,MAAM,IAAA,qCAAkB,EAAC,aAAa,CAAC,CAAC;YACxC,MAAM;QAER,KAAK,YAAY;YACf,MAAM,IAAA,uCAAmB,EAAC,aAAa,CAAC,CAAC;YACzC,MAAM;QAER,KAAK,SAAS;YACZ,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,KAAK,IAAA,WAAS,EAAC,IAAI,CAAC,CAAC;YACrB,MAAM;QAER,KAAK,UAAU;YACb,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,KAAK,IAAA,WAAS,EAAC,IAAI,CAAC,CAAC;YACrB,MAAM;QAER;YACE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;AACH,CAAC;AArGD,kBAqGC;AAED;;GAEG;AACH,SAAS,mBAAmB;IAC1B,IAAI,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAC9C,IAAI,CAAC,OAAO,EAAE;QACZ,IAAI;YACF,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,CAC9B,IAAA,sBAAY,EAAC,iBAAiB,EAAE,OAAO,CAAC,CACvB,CAAC;YACpB,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC;SACjC;QAAC,MAAM;YACN,SAAS;SACV;KACF;IACD,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { abortIfCancelled } from './utils/clack-utils';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\n\nimport { run as legacyRun } from '../lib/Setup';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport type { Platform } from '../lib/Constants';\nimport type { PackageDotJson } from './utils/package-json';\nimport { readFileSync } from 'node:fs';\n\ntype WizardIntegration =\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'sveltekit'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean;\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n disableTelemetry: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${tryGetWizardVersion()}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard({\n ...wizardOptions,\n uninstall: finalArgs.uninstall,\n });\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard(wizardOptions);\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(argv);\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(argv);\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n\n/**\n * TODO: replace with rollup replace whenever we switch to rollup\n */\nfunction tryGetWizardVersion(): string {\n let version = process.env.npm_package_version;\n if (!version) {\n try {\n const wizardPkgJson = JSON.parse(\n readFileSync('../package.json', 'utf-8'),\n ) as PackageDotJson;\n version = wizardPkgJson.version;\n } catch {\n // ignore\n }\n }\n return version ?? '';\n}\n"]}
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,sDAAwC;AACxC,qDAAuD;AACvD,4EAA0E;AAE1E,wCAAgD;AAEhD,6DAA4D;AAC5D,6DAA4D;AAC5D,uDAAsD;AACtD,0DAAyD;AACzD,oDAAmD;AACnD,uDAAsD;AACtD,mEAAkE;AAClE,sEAAqE;AACrE,2CAAoD;AAEpD,uCAA2C;AA4C3C,SAAS,8BAA8B,CACrC,IAAU;IAEV,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;QAC5B,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;QAC5C,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,UAAU;QAC9C,OAAO,EAAE;YACP,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,SAAS;YACrC,IAAI,EAAE;gBACJ;oBACE,GAAG,EAAE;wBACH,MAAM,EAAE,IAAI,CAAC,kBAAkB,CAAC,GAAG;qBACpC;iBACF;aACF;YACD,YAAY,EAAE;gBACZ,EAAE,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;gBACjC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;gBACrC,IAAI,EAAE,IAAI,CAAC,kBAAkB,CAAC,OAAO;aACtC;YACD,IAAI,EAAE,IAAI,CAAC,kBAAkB,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,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,KAAK,IAAA,WAAS,EAAC,IAAI,CAAC,CAAC;YACrB,MAAM;QAER,KAAK,UAAU;YACb,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;YAC9B,KAAK,IAAA,WAAS,EAAC,IAAI,CAAC,CAAC;YACrB,MAAM;QAER;YACE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;KAChD;AACH,CAAC;AArGD,kBAqGC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { abortIfCancelled } from './utils/clack-utils';\nimport { runReactNativeWizard } from './react-native/react-native-wizard';\n\nimport { run as legacyRun } from '../lib/Setup';\nimport type { PreselectedProject, WizardOptions } from './utils/types';\nimport { runFlutterWizard } from './flutter/flutter-wizard';\nimport { runAndroidWizard } from './android/android-wizard';\nimport { runAppleWizard } from './apple/apple-wizard';\nimport { runNextjsWizard } from './nextjs/nextjs-wizard';\nimport { runNuxtWizard } from './nuxt/nuxt-wizard';\nimport { runRemixWizard } from './remix/remix-wizard';\nimport { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';\nimport { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';\nimport { readEnvironment } from '../lib/Helper/Env';\nimport type { Platform } from '../lib/Constants';\nimport { WIZARD_VERSION } from './version';\n\ntype WizardIntegration =\n | 'reactNative'\n | 'flutter'\n | 'ios'\n | 'android'\n | 'cordova'\n | 'electron'\n | 'nextjs'\n | 'nuxt'\n | 'remix'\n | 'sveltekit'\n | 'sourcemaps';\n\ntype Args = {\n integration?: WizardIntegration;\n\n uninstall: boolean;\n signup: boolean;\n skipConnect: boolean;\n debug: boolean;\n quiet: boolean;\n disableTelemetry: boolean;\n promoCode?: string;\n preSelectedProject?: {\n authToken: string;\n selfHosted: boolean;\n dsn: string;\n projectId: string;\n projectSlug: string;\n projectName: string;\n orgId: string;\n orgName: string;\n orgSlug: string;\n };\n url?: string;\n platform?: Platform[];\n org?: string;\n project?: string;\n saas?: boolean;\n forceInstall?: boolean;\n};\n\nfunction preSelectedProjectArgsToObject(\n args: Args,\n): PreselectedProject | undefined {\n if (!args.preSelectedProject) {\n return undefined;\n }\n\n return {\n authToken: args.preSelectedProject.authToken,\n selfHosted: args.preSelectedProject.selfHosted,\n project: {\n id: args.preSelectedProject.projectId,\n keys: [\n {\n dsn: {\n public: args.preSelectedProject.dsn,\n },\n },\n ],\n organization: {\n id: args.preSelectedProject.orgId,\n name: args.preSelectedProject.orgName,\n slug: args.preSelectedProject.orgSlug,\n },\n slug: args.preSelectedProject.projectSlug,\n },\n };\n}\n\nexport async function run(argv: Args) {\n const finalArgs = {\n ...argv,\n ...readEnvironment(),\n };\n\n let integration = finalArgs.integration;\n if (!integration) {\n clack.intro(`Sentry Wizard ${WIZARD_VERSION}`);\n\n integration = await abortIfCancelled(\n clack.select({\n message: 'What do you want to set up?',\n options: [\n { value: 'reactNative', label: 'React Native' },\n { value: 'flutter', label: 'Flutter' },\n { value: 'ios', label: 'iOS' },\n { value: 'android', label: 'Android' },\n { value: 'cordova', label: 'Cordova' },\n { value: 'electron', label: 'Electron' },\n { value: 'nextjs', label: 'Next.js' },\n { value: 'nuxt', label: 'Nuxt' },\n { value: 'remix', label: 'Remix' },\n { value: 'sveltekit', label: 'SvelteKit' },\n { value: 'sourcemaps', label: 'Configure Source Maps Upload' },\n ],\n }),\n );\n\n if (!integration) {\n clack.log.error('No integration selected. Exiting.');\n return;\n }\n\n clack.outro(`Starting ${integration} setup`);\n }\n\n const wizardOptions: WizardOptions = {\n telemetryEnabled: !finalArgs.disableTelemetry,\n promoCode: finalArgs.promoCode,\n url: finalArgs.url,\n orgSlug: finalArgs.org,\n projectSlug: finalArgs.project,\n saas: finalArgs.saas,\n preSelectedProject: preSelectedProjectArgsToObject(finalArgs),\n forceInstall: finalArgs.forceInstall,\n };\n\n switch (integration) {\n case 'reactNative':\n await runReactNativeWizard({\n ...wizardOptions,\n uninstall: finalArgs.uninstall,\n });\n break;\n\n case 'flutter':\n await runFlutterWizard(wizardOptions);\n break;\n\n case 'ios':\n await runAppleWizard(wizardOptions);\n break;\n\n case 'android':\n await runAndroidWizard(wizardOptions);\n break;\n\n case 'nextjs':\n await runNextjsWizard(wizardOptions);\n break;\n\n case 'nuxt':\n await runNuxtWizard(wizardOptions);\n break;\n\n case 'remix':\n await runRemixWizard(wizardOptions);\n break;\n\n case 'sveltekit':\n await runSvelteKitWizard(wizardOptions);\n break;\n\n case 'sourcemaps':\n await runSourcemapsWizard(wizardOptions);\n break;\n\n case 'cordova':\n argv.integration = 'cordova';\n void legacyRun(argv);\n break;\n\n case 'electron':\n argv.integration = 'electron';\n void legacyRun(argv);\n break;\n\n default:\n clack.log.error('No setup wizard selected!');\n }\n}\n"]}
@@ -2,8 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateProgress = exports.traceStep = exports.withTelemetry = void 0;
4
4
  const node_1 = require("@sentry/node");
5
- const node_fs_1 = require("node:fs");
6
- const node_path_1 = require("node:path");
5
+ const version_1 = require("./version");
7
6
  async function withTelemetry(options, callback) {
8
7
  const { sentryHub, sentryClient } = createSentryInstance(options.enabled, options.integration);
9
8
  (0, node_1.makeMain)(sentryHub);
@@ -42,26 +41,13 @@ async function withTelemetry(options, callback) {
42
41
  }
43
42
  exports.withTelemetry = withTelemetry;
44
43
  function createSentryInstance(enabled, integration) {
45
- let version = process.env.npm_package_version;
46
- if (!version) {
47
- try {
48
- const pathToPackageJson = (0, node_path_1.join)((0, node_path_1.dirname)(require.resolve('@sentry/wizard')), '..', 'package.json');
49
- const packageJsonData = (0, node_fs_1.readFileSync)(pathToPackageJson, 'utf-8');
50
- const parsedPackageJson = JSON.parse(packageJsonData);
51
- version = parsedPackageJson.version;
52
- }
53
- catch {
54
- // If we fail to read the package.json file, we don't want to crash the wizard
55
- // so we just don't set the version
56
- }
57
- }
58
44
  const client = new node_1.NodeClient({
59
45
  dsn: 'https://8871d3ff64814ed8960c96d1fcc98a27@o1.ingest.sentry.io/4505425820712960',
60
46
  enabled: enabled,
61
47
  environment: `production-${integration}`,
62
48
  tracesSampleRate: 1,
63
49
  sampleRate: 1,
64
- release: version,
50
+ release: version_1.WIZARD_VERSION,
65
51
  integrations: [new node_1.Integrations.Http()],
66
52
  tracePropagationTargets: [/^https:\/\/sentry.io\//],
67
53
  stackParser: node_1.defaultStackParser,
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;;AAAA,uCAYsB;AACtB,qCAAuC;AACvC,yCAA0C;AAGnC,KAAK,UAAU,aAAa,CACjC,OAIC,EACD,QAA8B;IAE9B,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,oBAAoB,CACtD,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,WAAW,CACpB,CAAC;IAEF,IAAA,eAAQ,EAAC,SAAS,CAAC,CAAC;IAEpB,MAAM,aAAa,GAAG,SAAS,CAAC,YAAY,EAAE,CAAC;IAC/C,SAAS,CAAC,cAAc,EAAE,CAAC;IAE3B,8BAA8B;IAC9B,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACtE,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9D,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAE5D,IAAI;QACF,OAAO,MAAM,IAAA,gBAAS,EACpB;YACE,IAAI,EAAE,yBAAyB;YAC/B,MAAM,EAAE,IAAI;YACZ,EAAE,EAAE,aAAa;SAClB,EACD,KAAK,IAAI,EAAE;YACT,cAAc,CAAC,OAAO,CAAC,CAAC;YACxB,MAAM,GAAG,GAAG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aAAa,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC;AAND,8BAMC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAA,aAAM,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAFD,wCAEC","sourcesContent":["import {\n Hub,\n Integrations,\n NodeClient,\n type Span,\n defaultStackParser,\n flush,\n makeMain,\n makeNodeTransport,\n runWithAsyncContext,\n setTag,\n startSpan,\n} from '@sentry/node';\nimport { readFileSync } from 'node:fs';\nimport { dirname, join } from 'node:path';\nimport type { WizardOptions } from './utils/types';\n\nexport async function withTelemetry<F>(\n options: {\n enabled: boolean;\n integration: string;\n wizardOptions: WizardOptions;\n },\n callback: () => F | Promise<F>,\n): Promise<F> {\n const { sentryHub, sentryClient } = createSentryInstance(\n options.enabled,\n options.integration,\n );\n\n makeMain(sentryHub);\n\n const sentrySession = sentryHub.startSession();\n sentryHub.captureSession();\n\n // Set tag for passed CLI args\n sentryHub.setTag('args.project', !!options.wizardOptions.projectSlug);\n sentryHub.setTag('args.org', !!options.wizardOptions.orgSlug);\n sentryHub.setTag('args.saas', !!options.wizardOptions.saas);\n\n try {\n return await startSpan(\n {\n name: 'sentry-wizard-execution',\n status: 'ok',\n op: 'wizard.flow',\n },\n async () => {\n updateProgress('start');\n const res = await runWithAsyncContext(callback);\n updateProgress('finished');\n\n return res;\n },\n );\n } catch (e) {\n sentryHub.captureException('Error during wizard execution.');\n sentrySession.status = 'crashed';\n throw e;\n } finally {\n sentryHub.endSession();\n await sentryClient.flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n await flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n }\n}\n\nfunction createSentryInstance(enabled: boolean, integration: string) {\n let version: string | undefined = process.env.npm_package_version;\n if (!version) {\n try {\n const pathToPackageJson = join(\n dirname(require.resolve('@sentry/wizard')),\n '..',\n 'package.json',\n );\n const packageJsonData = readFileSync(pathToPackageJson, 'utf-8');\n const parsedPackageJson = JSON.parse(packageJsonData) as {\n version?: string;\n };\n version = parsedPackageJson.version;\n } catch {\n // If we fail to read the package.json file, we don't want to crash the wizard\n // so we just don't set the version\n }\n }\n\n const client = new NodeClient({\n dsn: 'https://8871d3ff64814ed8960c96d1fcc98a27@o1.ingest.sentry.io/4505425820712960',\n enabled: enabled,\n\n environment: `production-${integration}`,\n\n tracesSampleRate: 1,\n sampleRate: 1,\n\n release: version,\n integrations: [new Integrations.Http()],\n tracePropagationTargets: [/^https:\\/\\/sentry.io\\//],\n\n stackParser: defaultStackParser,\n\n beforeSendTransaction: (event) => {\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n transport: makeNodeTransport,\n\n debug: true,\n });\n\n const hub = new Hub(client);\n\n hub.setTag('integration', integration);\n hub.setTag('node', process.version);\n hub.setTag('platform', process.platform);\n\n return { sentryHub: hub, sentryClient: client };\n}\n\nexport function traceStep<T>(\n step: string,\n callback: (span: Span | undefined) => T,\n): T {\n updateProgress(step);\n return startSpan({ name: step, op: 'wizard.step' }, (span) => callback(span));\n}\n\nexport function updateProgress(step: string) {\n setTag('progress', step);\n}\n"]}
1
+ {"version":3,"file":"telemetry.js","sourceRoot":"","sources":["../../src/telemetry.ts"],"names":[],"mappings":";;;AAAA,uCAYsB;AAEtB,uCAA2C;AAEpC,KAAK,UAAU,aAAa,CACjC,OAIC,EACD,QAA8B;IAE9B,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,oBAAoB,CACtD,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,WAAW,CACpB,CAAC;IAEF,IAAA,eAAQ,EAAC,SAAS,CAAC,CAAC;IAEpB,MAAM,aAAa,GAAG,SAAS,CAAC,YAAY,EAAE,CAAC;IAC/C,SAAS,C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AC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC;AAND,8BAMC;AAED,SAAgB,cAAc,CAAC,IAAY;IACzC,IAAA,aAAM,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC;AAFD,wCAEC","sourcesContent":["import {\n Hub,\n Integrations,\n NodeClient,\n type Span,\n defaultStackParser,\n flush,\n makeMain,\n makeNodeTransport,\n runWithAsyncContext,\n setTag,\n startSpan,\n} from '@sentry/node';\nimport type { WizardOptions } from './utils/types';\nimport { WIZARD_VERSION } from './version';\n\nexport async function withTelemetry<F>(\n options: {\n enabled: boolean;\n integration: string;\n wizardOptions: WizardOptions;\n },\n callback: () => F | Promise<F>,\n): Promise<F> {\n const { sentryHub, sentryClient } = createSentryInstance(\n options.enabled,\n options.integration,\n );\n\n makeMain(sentryHub);\n\n const sentrySession = sentryHub.startSession();\n sentryHub.captureSession();\n\n // Set tag for passed CLI args\n sentryHub.setTag('args.project', !!options.wizardOptions.projectSlug);\n sentryHub.setTag('args.org', !!options.wizardOptions.orgSlug);\n sentryHub.setTag('args.saas', !!options.wizardOptions.saas);\n\n try {\n return await startSpan(\n {\n name: 'sentry-wizard-execution',\n status: 'ok',\n op: 'wizard.flow',\n },\n async () => {\n updateProgress('start');\n const res = await runWithAsyncContext(callback);\n updateProgress('finished');\n\n return res;\n },\n );\n } catch (e) {\n sentryHub.captureException('Error during wizard execution.');\n sentrySession.status = 'crashed';\n throw e;\n } finally {\n sentryHub.endSession();\n await sentryClient.flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n await flush(3000).then(null, () => {\n // If telemetry flushing fails we generally don't care\n });\n }\n}\n\nfunction createSentryInstance(enabled: boolean, integration: string) {\n const client = new NodeClient({\n dsn: 'https://8871d3ff64814ed8960c96d1fcc98a27@o1.ingest.sentry.io/4505425820712960',\n enabled: enabled,\n\n environment: `production-${integration}`,\n\n tracesSampleRate: 1,\n sampleRate: 1,\n\n release: WIZARD_VERSION,\n integrations: [new Integrations.Http()],\n tracePropagationTargets: [/^https:\\/\\/sentry.io\\//],\n\n stackParser: defaultStackParser,\n\n beforeSendTransaction: (event) => {\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n beforeSend: (event) => {\n event.exception?.values?.forEach((exception) => {\n delete exception.stacktrace;\n });\n\n delete event.server_name; // Server name might contain PII\n return event;\n },\n\n transport: makeNodeTransport,\n\n debug: true,\n });\n\n const hub = new Hub(client);\n\n hub.setTag('integration', integration);\n hub.setTag('node', process.version);\n hub.setTag('platform', process.platform);\n\n return { sentryHub: hub, sentryClient: client };\n}\n\nexport function traceStep<T>(\n step: string,\n callback: (span: Span | undefined) => T,\n): T {\n updateProgress(step);\n return startSpan({ name: step, op: 'wizard.step' }, (span) => callback(span));\n}\n\nexport function updateProgress(step: string) {\n setTag('progress', step);\n}\n"]}
@@ -4,6 +4,12 @@ import type { Feature, SentryProjectData, WizardOptions } from './types';
4
4
  export declare const SENTRY_DOT_ENV_FILE = ".env.sentry-build-plugin";
5
5
  export declare const SENTRY_CLI_RC_FILE = ".sentryclirc";
6
6
  export declare const SENTRY_PROPERTIES_FILE = "sentry.properties";
7
+ interface WizardProjectData {
8
+ apiKeys?: {
9
+ token?: string;
10
+ };
11
+ projects?: SentryProjectData[];
12
+ }
7
13
  export interface CliSetupConfig {
8
14
  filename: string;
9
15
  name: string;
@@ -100,6 +106,16 @@ export declare function getOrAskForProjectData(options: WizardOptions, platform?
100
106
  selectedProject: SentryProjectData;
101
107
  authToken: string;
102
108
  }>;
109
+ /**
110
+ * Exported for testing
111
+ */
112
+ export declare function askForWizardLogin(options: {
113
+ url: string;
114
+ promoCode?: string;
115
+ platform?: 'javascript-nextjs' | 'javascript-nuxt' | 'javascript-remix' | 'javascript-sveltekit' | 'apple-ios' | 'android' | 'react-native' | 'flutter';
116
+ orgSlug?: string;
117
+ projectSlug?: string;
118
+ }): Promise<WizardProjectData>;
103
119
  /**
104
120
  * Asks users if they have a config file for @param tool (e.g. Vite).
105
121
  * If yes, asks users to specify the path to their config file.