UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

76 lines (73 loc) 2.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initSnippetColored = exports.pubspecSnippetColored = exports.initSnippet = exports.sentryProperties = exports.pubspecOptions = exports.sentryImport = void 0; const clack_utils_1 = require("../utils/clack-utils"); exports.sentryImport = `import 'package:sentry_flutter/sentry_flutter.dart';\n`; function pubspecOptions(project, org) { return `sentry: upload_debug_symbols: true upload_source_maps: true project: ${project} org: ${org} `; } exports.pubspecOptions = pubspecOptions; function sentryProperties(authToken) { return `auth_token=${authToken}`; } exports.sentryProperties = sentryProperties; function initSnippet(dsn, selectedFeaturesMap, runApp) { let snippet = `await SentryFlutter.init( (options) { options.dsn = '${dsn}';`; if (selectedFeaturesMap.tracing) { snippet += ` // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0;`; } if (selectedFeaturesMap.profiling && selectedFeaturesMap.tracing) { snippet += ` // The sampling rate for profiling is relative to tracesSampleRate // Setting to 1.0 will profile 100% of sampled transactions: options.profilesSampleRate = 1.0;`; } snippet += ` }, appRunner: () => runApp(SentryWidget(child: ${runApp})), ); // TODO: Remove this line after sending the first sample event to sentry. await Sentry.captureException(Exception('This is a sample exception.'));`; return snippet; } exports.initSnippet = initSnippet; function pubspecSnippetColored(sentryVersion, pluginVersion, project, org) { const snippet = `dependencies: sentry_flutter: ${sentryVersion} dev_dependencies: sentry_dart_plugin: ${pluginVersion} ${pubspecOptions(project, org)}`; return (0, clack_utils_1.makeCodeSnippet)(true, (_unchanged, plus, _minus) => { return plus(snippet); }); } exports.pubspecSnippetColored = pubspecSnippetColored; function initSnippetColored(dsn) { const snippet = `import 'package:sentry_flutter/sentry_flutter.dart'; Future<void>main() async { await SentryFlutter.init( (options) { options.dsn = '${dsn}'; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; }, appRunner: () => runApp(SentryWidget(child: YourApp())), ) }`; return (0, clack_utils_1.makeCodeSnippet)(true, (_unchanged, plus, _minus) => { return plus(snippet); }); } exports.initSnippetColored = initSnippetColored; //# sourceMappingURL=templates.js.map