@sentry/wizard
Version:
Sentry wizard helping you to configure your project
92 lines (84 loc) • 3.75 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.sourceContextKts = exports.sourceContext = exports.testErrorSnippetKt = exports.testErrorSnippet = exports.sentryImportKt = exports.sentryImport = exports.manifest = exports.pluginKts = exports.plugin = exports.pluginsBlockKts = exports.pluginsBlock = void 0;
const pluginsBlock = (version = '3.12.0') => `
plugins {
id 'io.sentry.android.gradle' version '${version}'
}
`;
exports.pluginsBlock = pluginsBlock;
const pluginsBlockKts = (version = '3.12.0') => `
plugins {
id("io.sentry.android.gradle") version "${version}"
}
`;
exports.pluginsBlockKts = pluginsBlockKts;
const plugin = (version = '3.12.0') => `
id 'io.sentry.android.gradle' version '${version}'
`;
exports.plugin = plugin;
const pluginKts = (version = '3.12.0') => `
id("io.sentry.android.gradle") version "${version}"
`;
exports.pluginKts = pluginKts;
const manifest = (dsn, enableLogs) => `
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${dsn}" />
<!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
<meta-data android:name="io.sentry.send-default-pii" android:value="true" />
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data android:name="io.sentry.traces.user-interaction.enable" android:value="true" />
<!-- enable screenshot for crashes (could contain sensitive/PII data) -->
<meta-data android:name="io.sentry.attach-screenshot" android:value="true" />
<!-- enable view hierarchy for crashes -->
<meta-data android:name="io.sentry.attach-view-hierarchy" android:value="true" />
<!-- enable the performance API by setting a sample-rate, adjust in production env -->
<meta-data android:name="io.sentry.traces.sample-rate" android:value="1.0" />
${enableLogs
? ' <!-- enable Sentry Logs -->\n <meta-data android:name="io.sentry.logs.enabled" android:value="true" />'
: ''}
`;
exports.manifest = manifest;
exports.sentryImport = `import io.sentry.Sentry;\n`;
exports.sentryImportKt = `import io.sentry.Sentry\n`;
exports.testErrorSnippet = `
// waiting for view to draw to better represent a captured error with a screenshot
findViewById(android.R.id.content).getViewTreeObserver().addOnGlobalLayoutListener(() -> {
try {
throw new Exception("This app uses Sentry! :)");
} catch (Exception e) {
Sentry.captureException(e);
}
});
`;
exports.testErrorSnippetKt = `
// waiting for view to draw to better represent a captured error with a screenshot
findViewById<android.view.View>(android.R.id.content).viewTreeObserver.addOnGlobalLayoutListener {
try {
throw Exception("This app uses Sentry! :)")
} catch (e: Exception) {
Sentry.captureException(e)
}
}
`;
const sourceContext = (orgSlug, projectSlug) => `
sentry {
org = "${orgSlug}"
projectName = "${projectSlug}"
// this will upload your source code to Sentry to show it as part of the stack traces
// disable if you don't want to expose your sources
includeSourceContext = true
}
`;
exports.sourceContext = sourceContext;
const sourceContextKts = (orgSlug, projectSlug) => `
sentry {
org.set("${orgSlug}")
projectName.set("${projectSlug}")
// this will upload your source code to Sentry to show it as part of the stack traces
// disable if you don't want to expose your sources
includeSourceContext.set(true)
}
`;
exports.sourceContextKts = sourceContextKts;
//# sourceMappingURL=templates.js.map