UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

85 lines (84 loc) 4.27 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.configureRemixSourceMapsUpload = void 0; // @ts-expect-error - clack is ESM and TS complains about that. It works though const clack = __importStar(require("@clack/prompts")); const chalk_1 = __importDefault(require("chalk")); const remix_wizard_1 = require("../../remix/remix-wizard"); const telemetry_1 = require("../../telemetry"); const clack_1 = require("../../utils/clack"); const Sentry = __importStar(require("@sentry/node")); const configureRemixSourceMapsUpload = async (options, wizardOptions) => { clack.log .info(`Source Maps upload for Remix is configured automatically by default if you run the Sentry Wizard for Remix. But don't worry, we can redirect you to the wizard now! In case you already tried the wizard, we can also show you how to configure your ${chalk_1.default.cyan('remix.config.js')} file manually instead.`); const shouldRedirect = await (0, clack_1.abortIfCancelled)(clack.select({ message: 'Do you want to run the Sentry Wizard for Remix now?', options: [ { label: 'Yes, run the wizard!', value: true, hint: 'The wizard can also configure your SDK setup', }, { label: 'No, show me how to configure it manually', value: false, }, ], })); Sentry.setTag('redirect-remix-wizard', shouldRedirect); if (shouldRedirect) { await (0, telemetry_1.traceStep)('run-remix-wizard', () => (0, remix_wizard_1.runRemixWizard)(wizardOptions)); clack.intro('Sentry Source Maps Upload Configuration Wizard'); clack.log.info("Welcome back to the Source Maps wizard - we're almost done ;)"); } else { clack.log.step(`Build your app with ${chalk_1.default.cyan('remix build --sourcemap')}, then upload your source maps using ${chalk_1.default.cyan('sentry-upload-sourcemaps')} cli tool.`); clack.log.step(`You can add ${chalk_1.default.cyan('sentry-upload-sourcemaps')} to your build script in ${chalk_1.default.cyan('package.json')} like this:`); // Intentially logging directly to console here so that the code can be copied/pasted directly // eslint-disable-next-line no-console console.log(codeSnippet); clack.log.step(`or run it manually after building your app. To see all available options for ${chalk_1.default.cyan('sentry-upload-sourcemaps')}, run ${chalk_1.default.cyan('sentry-upload-sourcemaps --help')} `); await (0, clack_1.abortIfCancelled)(clack.select({ message: 'Did you finish configuring your build and prod scripts?', options: [{ label: 'Yes, continue!', value: true }], initialValue: true, })); } }; exports.configureRemixSourceMapsUpload = configureRemixSourceMapsUpload; const codeSnippet = chalk_1.default.gray(` "scripts": { ${chalk_1.default.greenBright('"build": "remix build --sourcemap && sentry-upload-sourcemaps"')}; } `); //# sourceMappingURL=remix.js.map