Allow importing package without webpack
This commit is contained in:
parent
2d3ecc8f98
commit
260d32795a
3 changed files with 11 additions and 8 deletions
|
|
@ -1,15 +1,13 @@
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
import { packageVersion } from "./package-version";
|
||||||
|
|
||||||
export function createClientId(): string {
|
export function createClientId(): string {
|
||||||
// @ts-expect-error, injected by webpack
|
|
||||||
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
|
|
||||||
|
|
||||||
const platform =
|
const platform =
|
||||||
typeof navigator !== "undefined"
|
typeof navigator !== "undefined"
|
||||||
? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated
|
? navigator.platform // eslint-disable-line @typescript-eslint/no-deprecated
|
||||||
: typeof process !== "undefined"
|
: typeof process !== "undefined"
|
||||||
? process.platform
|
? process.platform
|
||||||
: "unknown";
|
: "unknown";
|
||||||
|
|
||||||
return `vault-link/${packageVersion} (${uuidv4()}; ${platform})`;
|
return `vault-link/${packageVersion} (${uuidv4()}; ${platform})`;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
7
frontend/sync-client/src/utils/package-version.ts
Normal file
7
frontend/sync-client/src/utils/package-version.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
declare const __CURRENT_VERSION__: string;
|
||||||
|
|
||||||
|
/** Webpack replaces this identifier in bundles; source imports use a stable fallback. */
|
||||||
|
export const packageVersion =
|
||||||
|
typeof __CURRENT_VERSION__ === "undefined"
|
||||||
|
? "development"
|
||||||
|
: __CURRENT_VERSION__;
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import * as Sentry from "@sentry/browser";
|
import * as Sentry from "@sentry/browser";
|
||||||
|
import { packageVersion } from "./package-version";
|
||||||
// @ts-expect-error, injected by webpack
|
|
||||||
const packageVersion = __CURRENT_VERSION__; // eslint-disable-line
|
|
||||||
|
|
||||||
export const setUpTelemetry = (): (() => void) => {
|
export const setUpTelemetry = (): (() => void) => {
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue