@slicemachine/init 2.6.4-dev-upgrade-legacy.0 → 2.6.4-dev-next-hotfix.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SliceMachineInitProcess.cjs +28 -38
- package/dist/SliceMachineInitProcess.cjs.map +1 -1
- package/dist/SliceMachineInitProcess.d.ts +1 -1
- package/dist/SliceMachineInitProcess.js +28 -38
- package/dist/SliceMachineInitProcess.js.map +1 -1
- package/dist/constants.cjs +2 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/lib/checkIsSentryEnabled.cjs +5 -0
- package/dist/lib/checkIsSentryEnabled.cjs.map +1 -0
- package/dist/lib/checkIsSentryEnabled.d.ts +9 -0
- package/dist/lib/checkIsSentryEnabled.js +5 -0
- package/dist/lib/checkIsSentryEnabled.js.map +1 -0
- package/dist/lib/sentryErrorHandlers.cjs +38 -0
- package/dist/lib/sentryErrorHandlers.cjs.map +1 -0
- package/dist/lib/sentryErrorHandlers.d.ts +1 -0
- package/dist/lib/sentryErrorHandlers.js +21 -0
- package/dist/lib/sentryErrorHandlers.js.map +1 -0
- package/dist/lib/setupSentry.cjs +50 -0
- package/dist/lib/setupSentry.cjs.map +1 -0
- package/dist/lib/setupSentry.d.ts +8 -0
- package/dist/lib/setupSentry.js +33 -0
- package/dist/lib/setupSentry.js.map +1 -0
- package/dist/packages/init/package.json.cjs +6 -5
- package/dist/packages/init/package.json.cjs.map +1 -1
- package/dist/packages/init/package.json.js +6 -5
- package/dist/packages/init/package.json.js.map +1 -1
- package/package.json +6 -5
- package/src/SliceMachineInitProcess.ts +32 -60
- package/src/constants.ts +3 -0
- package/src/lib/checkIsSentryEnabled.ts +12 -0
- package/src/lib/sentryErrorHandlers.ts +27 -0
- package/src/lib/setupSentry.ts +49 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const name = "@slicemachine/init";
|
|
4
|
-
const version = "2.6.4-dev-
|
|
4
|
+
const version = "2.6.4-dev-next-hotfix.0";
|
|
5
5
|
const description = "Init Prismic Slice Machine in your project";
|
|
6
6
|
const keywords = [
|
|
7
7
|
"typescript",
|
|
@@ -42,7 +42,7 @@ const scripts = {
|
|
|
42
42
|
dev: "vite build --watch",
|
|
43
43
|
format: "prettier --write .",
|
|
44
44
|
lint: "eslint --max-warnings 0 --ext .js,.ts .",
|
|
45
|
-
prepack: "
|
|
45
|
+
prepack: "npm run build",
|
|
46
46
|
size: "size-limit",
|
|
47
47
|
test: "yarn lint && yarn types && yarn unit && yarn build && yarn size",
|
|
48
48
|
types: "tsc --noEmit",
|
|
@@ -54,7 +54,8 @@ const scripts = {
|
|
|
54
54
|
const dependencies = {
|
|
55
55
|
"@antfu/ni": "^0.20.0",
|
|
56
56
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
57
|
-
"@
|
|
57
|
+
"@sentry/node": "^7.70.0",
|
|
58
|
+
"@slicemachine/manager": "^0.11.3-dev-next-hotfix.0",
|
|
58
59
|
chalk: "^4.1.2",
|
|
59
60
|
giget: "^1.1.2",
|
|
60
61
|
globby: "^13.1.3",
|
|
@@ -67,7 +68,7 @@ const dependencies = {
|
|
|
67
68
|
};
|
|
68
69
|
const devDependencies = {
|
|
69
70
|
"@size-limit/preset-small-lib": "8.2.4",
|
|
70
|
-
"@slicemachine/plugin-kit": "0.4.17-dev-
|
|
71
|
+
"@slicemachine/plugin-kit": "0.4.17-dev-next-hotfix.0",
|
|
71
72
|
"@types/listr": "0.14.4",
|
|
72
73
|
"@types/prompts": "2.4.3",
|
|
73
74
|
"@types/semver": "7.3.13",
|
|
@@ -93,7 +94,7 @@ const devDependencies = {
|
|
|
93
94
|
"vite-plugin-sdk": "0.1.1",
|
|
94
95
|
vitest: "0.32.0"
|
|
95
96
|
};
|
|
96
|
-
const gitHead = "
|
|
97
|
+
const gitHead = "01f71118f1d7c2b422f527dad5949368f7c816ce";
|
|
97
98
|
const pkg = {
|
|
98
99
|
name,
|
|
99
100
|
version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const name = "@slicemachine/init";
|
|
2
|
-
const version = "2.6.4-dev-
|
|
2
|
+
const version = "2.6.4-dev-next-hotfix.0";
|
|
3
3
|
const description = "Init Prismic Slice Machine in your project";
|
|
4
4
|
const keywords = [
|
|
5
5
|
"typescript",
|
|
@@ -40,7 +40,7 @@ const scripts = {
|
|
|
40
40
|
dev: "vite build --watch",
|
|
41
41
|
format: "prettier --write .",
|
|
42
42
|
lint: "eslint --max-warnings 0 --ext .js,.ts .",
|
|
43
|
-
prepack: "
|
|
43
|
+
prepack: "npm run build",
|
|
44
44
|
size: "size-limit",
|
|
45
45
|
test: "yarn lint && yarn types && yarn unit && yarn build && yarn size",
|
|
46
46
|
types: "tsc --noEmit",
|
|
@@ -52,7 +52,8 @@ const scripts = {
|
|
|
52
52
|
const dependencies = {
|
|
53
53
|
"@antfu/ni": "^0.20.0",
|
|
54
54
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
55
|
-
"@
|
|
55
|
+
"@sentry/node": "^7.70.0",
|
|
56
|
+
"@slicemachine/manager": "^0.11.3-dev-next-hotfix.0",
|
|
56
57
|
chalk: "^4.1.2",
|
|
57
58
|
giget: "^1.1.2",
|
|
58
59
|
globby: "^13.1.3",
|
|
@@ -65,7 +66,7 @@ const dependencies = {
|
|
|
65
66
|
};
|
|
66
67
|
const devDependencies = {
|
|
67
68
|
"@size-limit/preset-small-lib": "8.2.4",
|
|
68
|
-
"@slicemachine/plugin-kit": "0.4.17-dev-
|
|
69
|
+
"@slicemachine/plugin-kit": "0.4.17-dev-next-hotfix.0",
|
|
69
70
|
"@types/listr": "0.14.4",
|
|
70
71
|
"@types/prompts": "2.4.3",
|
|
71
72
|
"@types/semver": "7.3.13",
|
|
@@ -91,7 +92,7 @@ const devDependencies = {
|
|
|
91
92
|
"vite-plugin-sdk": "0.1.1",
|
|
92
93
|
vitest: "0.32.0"
|
|
93
94
|
};
|
|
94
|
-
const gitHead = "
|
|
95
|
+
const gitHead = "01f71118f1d7c2b422f527dad5949368f7c816ce";
|
|
95
96
|
const pkg = {
|
|
96
97
|
name,
|
|
97
98
|
version,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/init",
|
|
3
|
-
"version": "2.6.4-dev-
|
|
3
|
+
"version": "2.6.4-dev-next-hotfix.0",
|
|
4
4
|
"description": "Init Prismic Slice Machine in your project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dev": "vite build --watch",
|
|
42
42
|
"format": "prettier --write .",
|
|
43
43
|
"lint": "eslint --max-warnings 0 --ext .js,.ts .",
|
|
44
|
-
"prepack": "
|
|
44
|
+
"prepack": "npm run build",
|
|
45
45
|
"size": "size-limit",
|
|
46
46
|
"test": "yarn lint && yarn types && yarn unit && yarn build && yarn size",
|
|
47
47
|
"types": "tsc --noEmit",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@antfu/ni": "^0.20.0",
|
|
55
55
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
56
|
-
"@
|
|
56
|
+
"@sentry/node": "^7.70.0",
|
|
57
|
+
"@slicemachine/manager": "^0.11.3-dev-next-hotfix.0",
|
|
57
58
|
"chalk": "^4.1.2",
|
|
58
59
|
"giget": "^1.1.2",
|
|
59
60
|
"globby": "^13.1.3",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
69
|
"@size-limit/preset-small-lib": "8.2.4",
|
|
69
|
-
"@slicemachine/plugin-kit": "0.4.17-dev-
|
|
70
|
+
"@slicemachine/plugin-kit": "0.4.17-dev-next-hotfix.0",
|
|
70
71
|
"@types/listr": "0.14.4",
|
|
71
72
|
"@types/prompts": "2.4.3",
|
|
72
73
|
"@types/semver": "7.3.13",
|
|
@@ -92,5 +93,5 @@
|
|
|
92
93
|
"vite-plugin-sdk": "0.1.1",
|
|
93
94
|
"vitest": "0.32.0"
|
|
94
95
|
},
|
|
95
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "01f71118f1d7c2b422f527dad5949368f7c816ce"
|
|
96
97
|
}
|
|
@@ -41,6 +41,8 @@ import {
|
|
|
41
41
|
START_SCRIPT_VALUE,
|
|
42
42
|
} from "./constants";
|
|
43
43
|
import { detectStarterId } from "./lib/starters";
|
|
44
|
+
import { setupSentry } from "./lib/setupSentry";
|
|
45
|
+
import { trackSentryError } from "./lib/sentryErrorHandlers";
|
|
44
46
|
|
|
45
47
|
export type SliceMachineInitProcessOptions = {
|
|
46
48
|
repository?: string;
|
|
@@ -172,7 +174,7 @@ export class SliceMachineInitProcess {
|
|
|
172
174
|
await this.createNewRepository();
|
|
173
175
|
}
|
|
174
176
|
|
|
175
|
-
await this.
|
|
177
|
+
await this.pushDataToPrismic();
|
|
176
178
|
await this.initializeProject();
|
|
177
179
|
await this.initializePlugins();
|
|
178
180
|
} catch (error) {
|
|
@@ -299,8 +301,8 @@ export class SliceMachineInitProcess {
|
|
|
299
301
|
}
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
|
-
} catch {
|
|
303
|
-
|
|
304
|
+
} catch (error) {
|
|
305
|
+
await this.trackError(error);
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
308
|
|
|
@@ -315,8 +317,6 @@ export class SliceMachineInitProcess {
|
|
|
315
317
|
this.manager.customTypes.readCustomTypeLibrary(),
|
|
316
318
|
this.readDocuments(),
|
|
317
319
|
]);
|
|
318
|
-
|
|
319
|
-
// If repository exists, and there's anything to push
|
|
320
320
|
if (
|
|
321
321
|
slices.length > 0 ||
|
|
322
322
|
ctLibrary.ids.length > 0 ||
|
|
@@ -324,11 +324,6 @@ export class SliceMachineInitProcess {
|
|
|
324
324
|
) {
|
|
325
325
|
return true;
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
// If repository exists, and there might be things to pull
|
|
329
|
-
if (ctLibrary.ids.length === 0) {
|
|
330
|
-
return true;
|
|
331
|
-
}
|
|
332
327
|
} catch (e) {
|
|
333
328
|
return true;
|
|
334
329
|
}
|
|
@@ -336,19 +331,27 @@ export class SliceMachineInitProcess {
|
|
|
336
331
|
return false;
|
|
337
332
|
}
|
|
338
333
|
|
|
339
|
-
protected trackError = (error: unknown): Promise<void> => {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
334
|
+
protected trackError = async (error: unknown): Promise<void> => {
|
|
335
|
+
if (await this.manager.telemetry.checkIsTelemetryEnabled()) {
|
|
336
|
+
const repositoryName = this.context.repository?.domain || "";
|
|
337
|
+
const framework =
|
|
338
|
+
this.context.framework?.sliceMachineTelemetryID ?? "unknown";
|
|
344
339
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
340
|
+
await setupSentry({ manager: this.manager, repositoryName, framework });
|
|
341
|
+
trackSentryError(error);
|
|
342
|
+
|
|
343
|
+
// Transform error to string and prevent hitting Segment 500kb API limit or sending ridiculously long trace
|
|
344
|
+
const safeError = (
|
|
345
|
+
error instanceof Error ? error.message : `${error}`
|
|
346
|
+
).slice(0, 512);
|
|
347
|
+
await this.manager.telemetry.track({
|
|
348
|
+
event: "command:init:end",
|
|
349
|
+
framework: this.context.framework?.sliceMachineTelemetryID ?? "unknown",
|
|
350
|
+
repository: repositoryName,
|
|
351
|
+
success: false,
|
|
352
|
+
error: safeError,
|
|
353
|
+
});
|
|
354
|
+
}
|
|
352
355
|
};
|
|
353
356
|
|
|
354
357
|
protected async copyStarter(): Promise<void> {
|
|
@@ -1099,10 +1102,10 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1099
1102
|
return { signature, documents, directoryPath: documentsDirectoryPath };
|
|
1100
1103
|
}
|
|
1101
1104
|
|
|
1102
|
-
protected
|
|
1105
|
+
protected pushDataToPrismic(): Promise<void> {
|
|
1103
1106
|
return listrRun([
|
|
1104
1107
|
{
|
|
1105
|
-
title: "
|
|
1108
|
+
title: "Pushing data to Prismic...",
|
|
1106
1109
|
task: (_, parentTask) =>
|
|
1107
1110
|
listr([
|
|
1108
1111
|
{
|
|
@@ -1198,7 +1201,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1198
1201
|
task: async (_, task) => {
|
|
1199
1202
|
assertExists(
|
|
1200
1203
|
this.context.repository,
|
|
1201
|
-
"Repository selection must be available through context to run `
|
|
1204
|
+
"Repository selection must be available through context to run `pushDataToPrismic`",
|
|
1202
1205
|
);
|
|
1203
1206
|
|
|
1204
1207
|
try {
|
|
@@ -1208,6 +1211,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1208
1211
|
documentsRead === undefined ||
|
|
1209
1212
|
documentsRead.documents.length === 0
|
|
1210
1213
|
) {
|
|
1214
|
+
parentTask.title = "Pushed data to Prismic";
|
|
1211
1215
|
task.skip("No document to push");
|
|
1212
1216
|
|
|
1213
1217
|
return;
|
|
@@ -1249,7 +1253,9 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1249
1253
|
});
|
|
1250
1254
|
|
|
1251
1255
|
task.title = "Pushed all documents";
|
|
1256
|
+
parentTask.title = "Pushed data to Prismic";
|
|
1252
1257
|
} catch {
|
|
1258
|
+
parentTask.title = "Pushed data to Prismic";
|
|
1253
1259
|
task.skip("No document to push");
|
|
1254
1260
|
|
|
1255
1261
|
return;
|
|
@@ -1271,41 +1277,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1271
1277
|
}
|
|
1272
1278
|
|
|
1273
1279
|
task.title = "Cleaned up data push artifacts";
|
|
1274
|
-
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
title: "Pulling existing types...",
|
|
1278
|
-
task: async (_, task) => {
|
|
1279
|
-
const { ids, errors } =
|
|
1280
|
-
await this.manager.customTypes.readCustomTypeLibrary();
|
|
1281
|
-
|
|
1282
|
-
if (errors.length > 0) {
|
|
1283
|
-
// TODO: Provide better error message.
|
|
1284
|
-
throw new Error(
|
|
1285
|
-
`Failed to read custom type libraries: ${errors.join(
|
|
1286
|
-
", ",
|
|
1287
|
-
)}`,
|
|
1288
|
-
);
|
|
1289
|
-
}
|
|
1290
|
-
|
|
1291
|
-
if (ids && ids.length > 0) {
|
|
1292
|
-
task.skip("Types already exists");
|
|
1293
|
-
parentTask.title = "Synced data with Prismic";
|
|
1294
|
-
|
|
1295
|
-
return;
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
const remoteTypes =
|
|
1299
|
-
await this.manager.customTypes.fetchRemoteCustomTypes();
|
|
1300
|
-
|
|
1301
|
-
await Promise.all(
|
|
1302
|
-
remoteTypes.map(async (model) => {
|
|
1303
|
-
await this.manager.customTypes.createCustomType({ model });
|
|
1304
|
-
}),
|
|
1305
|
-
);
|
|
1306
|
-
|
|
1307
|
-
task.title = "Pulled existing types";
|
|
1308
|
-
parentTask.title = "Synced data with Prismic";
|
|
1280
|
+
parentTask.title = "Pushed data to Prismic";
|
|
1309
1281
|
},
|
|
1310
1282
|
},
|
|
1311
1283
|
]),
|
package/src/constants.ts
CHANGED
|
@@ -4,3 +4,6 @@ export const START_SCRIPT_VALUE = "start-slicemachine";
|
|
|
4
4
|
export const GIGET_PROVIDER = "github";
|
|
5
5
|
export const GIGET_ORGANIZATION = "prismicio-community";
|
|
6
6
|
export const SLICE_MACHINE_INIT_USER_AGENT = "slice-machine-init";
|
|
7
|
+
export const SENTRY_EXPRESS_DSN =
|
|
8
|
+
import.meta.env.VITE_SENTRY_EXPRESS_DSN ||
|
|
9
|
+
"https://d3e69d5189266d8d7f60f71ccc9353fc@o146123.ingest.sentry.io/4505917981982720";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether or not Sentry is enabled.
|
|
3
|
+
*
|
|
4
|
+
* Sentry is enabled automatically in production but can be disabled by setting
|
|
5
|
+
* `VITE_ENABLE_SENTRY` to `false`.
|
|
6
|
+
*
|
|
7
|
+
* @returns Whether or not Sentry is enabled.
|
|
8
|
+
*/
|
|
9
|
+
export const checkIsSentryEnabled = (): boolean =>
|
|
10
|
+
import.meta.env.VITE_ENABLE_SENTRY === undefined
|
|
11
|
+
? import.meta.env.PROD
|
|
12
|
+
: import.meta.env.VITE_ENABLE_SENTRY === "true";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/node";
|
|
2
|
+
|
|
3
|
+
import { checkIsSentryEnabled } from "./checkIsSentryEnabled";
|
|
4
|
+
|
|
5
|
+
type ErrorWithCause = Error & {
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
function hasCause(error: unknown): error is ErrorWithCause {
|
|
10
|
+
return error instanceof Error && "cause" in error;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function trackSentryError(error: unknown): void {
|
|
14
|
+
if (checkIsSentryEnabled()) {
|
|
15
|
+
Sentry.withScope(function (scope) {
|
|
16
|
+
scope.setTransactionName("init");
|
|
17
|
+
Sentry.captureException(error, {
|
|
18
|
+
extra: {
|
|
19
|
+
cause:
|
|
20
|
+
hasCause(error) && error.cause !== undefined
|
|
21
|
+
? (error.cause as string)
|
|
22
|
+
: "",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as Sentry from "@sentry/node";
|
|
2
|
+
import semver from "semver";
|
|
3
|
+
|
|
4
|
+
import { PrismicUserProfile, SliceMachineManager } from "@slicemachine/manager";
|
|
5
|
+
import { SENTRY_EXPRESS_DSN } from "../constants";
|
|
6
|
+
import { checkIsSentryEnabled } from "./checkIsSentryEnabled";
|
|
7
|
+
import { version } from "../../package.json";
|
|
8
|
+
|
|
9
|
+
type SetupSentryArgs = {
|
|
10
|
+
manager: SliceMachineManager;
|
|
11
|
+
repositoryName: string;
|
|
12
|
+
framework: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const setupSentry = async ({
|
|
16
|
+
manager,
|
|
17
|
+
repositoryName,
|
|
18
|
+
framework,
|
|
19
|
+
}: SetupSentryArgs): Promise<void> => {
|
|
20
|
+
if (!checkIsSentryEnabled()) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let userProfile: PrismicUserProfile | undefined;
|
|
25
|
+
try {
|
|
26
|
+
userProfile = await manager.user.getProfile();
|
|
27
|
+
} catch {
|
|
28
|
+
// User is not logged in, it doesn't matter
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const isStableVersion =
|
|
32
|
+
semver.prerelease(version) === null && semver.lte("0.1.0", version);
|
|
33
|
+
|
|
34
|
+
Sentry.init({
|
|
35
|
+
dsn: SENTRY_EXPRESS_DSN,
|
|
36
|
+
release: version,
|
|
37
|
+
environment: isStableVersion
|
|
38
|
+
? import.meta.env.MODE || "production"
|
|
39
|
+
: "alpha",
|
|
40
|
+
});
|
|
41
|
+
if (userProfile) {
|
|
42
|
+
Sentry.setUser({ id: userProfile.shortId });
|
|
43
|
+
}
|
|
44
|
+
Sentry.setTag("repository", repositoryName);
|
|
45
|
+
Sentry.setContext("Repository Data", {
|
|
46
|
+
name: repositoryName,
|
|
47
|
+
});
|
|
48
|
+
Sentry.setTag("framework", framework);
|
|
49
|
+
};
|