Skip to content

Commit

Permalink
Merge pull request #17 from gokulk16/r-14
Browse files Browse the repository at this point in the history
adding sentry; ignoring config files from test coverage
  • Loading branch information
gokulk16 authored Jun 10, 2024
2 parents 57a926e + fc474db commit 94bcd02
Show file tree
Hide file tree
Showing 7 changed files with 1,864 additions and 179 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
run: npm ci
- name: "Build"
run: npm run build
- name: "Test"
run: npm run coverage-summary
- name: "Run Tests & Coverage"
run: npm run test
- name: "Upload Coverage"
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ node_modules
.parcel-cache/
coverage
.nyc_output

# Sentry Config File
.env.sentry-build-plugin
8 changes: 7 additions & 1 deletion esbuild.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as esbuild from "esbuild";
import copyStaticFiles from "esbuild-copy-static-files";
import * as fsExtra from "fs-extra";
import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin";

fsExtra.emptyDirSync("./dist");

Expand All @@ -9,7 +10,7 @@ esbuild.build({
outdir: "dist/js",
bundle: true,
minify: true,
sourcemap: false,
sourcemap: true, // Source map needed for sentry to work
mainFields: ["module", "main"],
plugins: [
copyStaticFiles({
Expand All @@ -36,5 +37,10 @@ esbuild.build({
preserveTimestamps: false,
recursive: true,
}),
sentryEsbuildPlugin({
authToken: process.env.SENTRY_AUTH_TOKEN,
org: "typetocalculate",
project: "javascript",
}),
],
});
21 changes: 20 additions & 1 deletion js/editor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use strict";
import * as Sentry from "@sentry/browser";

import * as currency from "./currency.js";
import * as regex from "./regex.js";
Expand Down Expand Up @@ -499,7 +500,7 @@ function updateOutputDisplay() {
let len = results.length;
let localizedValue =
typeof value === "number"
? value.toLocaleString("en-US", { maximumFractionDigits: 15 })
? value.toLocaleString("en-US", { maximumFractionDigits: 5 })
: value;

switch (result.type) {
Expand Down Expand Up @@ -740,7 +741,25 @@ async function copyValueToClipboard(value) {
}
}

function initSentry() {
Sentry.init({
dsn: "https://f6181e1f6794abaf08674441d2c08403@o4507406315159552.ingest.de.sentry.io/4507406320992336",
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration(),
],
// Performance Monitoring
tracesSampleRate: 1.0, // Capture 100% of the transactions
// Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
tracePropagationTargets: ["localhost", /^https:\/\/typetocalculate\.in/],
// Session Replay
replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
});
}

export async function init() {
initSentry();
setupDocument();
await loadSettings();
await loadData();
Expand Down
Loading

0 comments on commit 94bcd02

Please sign in to comment.