@slicemachine/init 2.6.4-dev-next-hotfix.3 → 2.6.4-dev-upgrade-legacy.2
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 +30 -29
- package/dist/SliceMachineInitProcess.cjs.map +1 -1
- package/dist/SliceMachineInitProcess.d.ts +1 -3
- package/dist/SliceMachineInitProcess.js +30 -29
- package/dist/SliceMachineInitProcess.js.map +1 -1
- package/dist/constants.cjs +0 -2
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/constants.js +0 -2
- package/dist/constants.js.map +1 -1
- package/dist/packages/init/package.json.cjs +4 -5
- package/dist/packages/init/package.json.cjs.map +1 -1
- package/dist/packages/init/package.json.js +4 -5
- package/dist/packages/init/package.json.js.map +1 -1
- package/package.json +4 -5
- package/src/SliceMachineInitProcess.ts +51 -31
- package/src/constants.ts +0 -3
- package/dist/lib/checkIsSentryEnabled.cjs +0 -5
- package/dist/lib/checkIsSentryEnabled.cjs.map +0 -1
- package/dist/lib/checkIsSentryEnabled.d.ts +0 -9
- package/dist/lib/checkIsSentryEnabled.js +0 -5
- package/dist/lib/checkIsSentryEnabled.js.map +0 -1
- package/dist/lib/sentryErrorHandlers.cjs +0 -31
- package/dist/lib/sentryErrorHandlers.cjs.map +0 -1
- package/dist/lib/sentryErrorHandlers.d.ts +0 -1
- package/dist/lib/sentryErrorHandlers.js +0 -14
- package/dist/lib/sentryErrorHandlers.js.map +0 -1
- package/dist/lib/setupSentry.cjs +0 -37
- package/dist/lib/setupSentry.cjs.map +0 -1
- package/dist/lib/setupSentry.d.ts +0 -1
- package/dist/lib/setupSentry.js +0 -20
- package/dist/lib/setupSentry.js.map +0 -1
- package/dist/lib/updateSentryContext.cjs +0 -45
- package/dist/lib/updateSentryContext.cjs.map +0 -1
- package/dist/lib/updateSentryContext.d.ts +0 -8
- package/dist/lib/updateSentryContext.js +0 -28
- package/dist/lib/updateSentryContext.js.map +0 -1
- package/src/lib/checkIsSentryEnabled.ts +0 -12
- package/src/lib/sentryErrorHandlers.ts +0 -13
- package/src/lib/setupSentry.ts +0 -23
- package/src/lib/updateSentryContext.ts +0 -42
|
@@ -41,9 +41,6 @@ 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";
|
|
46
|
-
import { updateSentryContext } from "./lib/updateSentryContext";
|
|
47
44
|
|
|
48
45
|
export type SliceMachineInitProcessOptions = {
|
|
49
46
|
repository?: string;
|
|
@@ -135,7 +132,6 @@ export class SliceMachineInitProcess {
|
|
|
135
132
|
appName: pkg.name,
|
|
136
133
|
appVersion: pkg.version,
|
|
137
134
|
});
|
|
138
|
-
await setupSentry();
|
|
139
135
|
await this.manager.telemetry.track({
|
|
140
136
|
event: "command:init:start",
|
|
141
137
|
repository: this.options.repository,
|
|
@@ -176,7 +172,7 @@ export class SliceMachineInitProcess {
|
|
|
176
172
|
await this.createNewRepository();
|
|
177
173
|
}
|
|
178
174
|
|
|
179
|
-
await this.
|
|
175
|
+
await this.syncDataWithPrismic();
|
|
180
176
|
await this.initializeProject();
|
|
181
177
|
await this.initializePlugins();
|
|
182
178
|
} catch (error) {
|
|
@@ -303,9 +299,8 @@ export class SliceMachineInitProcess {
|
|
|
303
299
|
}
|
|
304
300
|
}
|
|
305
301
|
}
|
|
306
|
-
} catch
|
|
307
|
-
//
|
|
308
|
-
await this.trackSentryError(error);
|
|
302
|
+
} catch {
|
|
303
|
+
// Noop, it's only the final convenience messsage
|
|
309
304
|
}
|
|
310
305
|
}
|
|
311
306
|
|
|
@@ -320,6 +315,8 @@ export class SliceMachineInitProcess {
|
|
|
320
315
|
this.manager.customTypes.readCustomTypeLibrary(),
|
|
321
316
|
this.readDocuments(),
|
|
322
317
|
]);
|
|
318
|
+
|
|
319
|
+
// If repository exists, and there's anything to push
|
|
323
320
|
if (
|
|
324
321
|
slices.length > 0 ||
|
|
325
322
|
ctLibrary.ids.length > 0 ||
|
|
@@ -327,6 +324,11 @@ export class SliceMachineInitProcess {
|
|
|
327
324
|
) {
|
|
328
325
|
return true;
|
|
329
326
|
}
|
|
327
|
+
|
|
328
|
+
// If repository exists, and there might be things to pull
|
|
329
|
+
if (ctLibrary.ids.length === 0) {
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
330
332
|
} catch (e) {
|
|
331
333
|
return true;
|
|
332
334
|
}
|
|
@@ -334,17 +336,13 @@ export class SliceMachineInitProcess {
|
|
|
334
336
|
return false;
|
|
335
337
|
}
|
|
336
338
|
|
|
337
|
-
protected trackError =
|
|
338
|
-
await this.trackSentryError(error);
|
|
339
|
-
await this.trackTelemetryError(error);
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
protected trackTelemetryError = async (error: unknown): Promise<void> => {
|
|
339
|
+
protected trackError = (error: unknown): Promise<void> => {
|
|
343
340
|
// Transform error to string and prevent hitting Segment 500kb API limit or sending ridiculously long trace
|
|
344
341
|
const safeError = (
|
|
345
342
|
error instanceof Error ? error.message : `${error}`
|
|
346
343
|
).slice(0, 512);
|
|
347
|
-
|
|
344
|
+
|
|
345
|
+
return this.manager.telemetry.track({
|
|
348
346
|
event: "command:init:end",
|
|
349
347
|
framework: this.context.framework?.sliceMachineTelemetryID ?? "unknown",
|
|
350
348
|
repository: this.context.repository?.domain || "",
|
|
@@ -353,15 +351,6 @@ export class SliceMachineInitProcess {
|
|
|
353
351
|
});
|
|
354
352
|
};
|
|
355
353
|
|
|
356
|
-
protected trackSentryError = async (error: unknown): Promise<void> => {
|
|
357
|
-
await updateSentryContext({
|
|
358
|
-
manager: this.manager,
|
|
359
|
-
repositoryName: this.context.repository?.domain || "",
|
|
360
|
-
framework: this.context.framework?.sliceMachineTelemetryID ?? "unknown",
|
|
361
|
-
});
|
|
362
|
-
trackSentryError(error);
|
|
363
|
-
};
|
|
364
|
-
|
|
365
354
|
protected async copyStarter(): Promise<void> {
|
|
366
355
|
const dir = await this.getStarterDirectoryName();
|
|
367
356
|
|
|
@@ -1110,10 +1099,10 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1110
1099
|
return { signature, documents, directoryPath: documentsDirectoryPath };
|
|
1111
1100
|
}
|
|
1112
1101
|
|
|
1113
|
-
protected
|
|
1102
|
+
protected syncDataWithPrismic(): Promise<void> {
|
|
1114
1103
|
return listrRun([
|
|
1115
1104
|
{
|
|
1116
|
-
title: "
|
|
1105
|
+
title: "Syncing data with Prismic...",
|
|
1117
1106
|
task: (_, parentTask) =>
|
|
1118
1107
|
listr([
|
|
1119
1108
|
{
|
|
@@ -1209,7 +1198,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1209
1198
|
task: async (_, task) => {
|
|
1210
1199
|
assertExists(
|
|
1211
1200
|
this.context.repository,
|
|
1212
|
-
"Repository selection must be available through context to run `
|
|
1201
|
+
"Repository selection must be available through context to run `syncDataWithPrismic`",
|
|
1213
1202
|
);
|
|
1214
1203
|
|
|
1215
1204
|
try {
|
|
@@ -1219,7 +1208,6 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1219
1208
|
documentsRead === undefined ||
|
|
1220
1209
|
documentsRead.documents.length === 0
|
|
1221
1210
|
) {
|
|
1222
|
-
parentTask.title = "Pushed data to Prismic";
|
|
1223
1211
|
task.skip("No document to push");
|
|
1224
1212
|
|
|
1225
1213
|
return;
|
|
@@ -1261,9 +1249,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1261
1249
|
});
|
|
1262
1250
|
|
|
1263
1251
|
task.title = "Pushed all documents";
|
|
1264
|
-
parentTask.title = "Pushed data to Prismic";
|
|
1265
1252
|
} catch {
|
|
1266
|
-
parentTask.title = "Pushed data to Prismic";
|
|
1267
1253
|
task.skip("No document to push");
|
|
1268
1254
|
|
|
1269
1255
|
return;
|
|
@@ -1285,7 +1271,41 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
|
|
|
1285
1271
|
}
|
|
1286
1272
|
|
|
1287
1273
|
task.title = "Cleaned up data push artifacts";
|
|
1288
|
-
|
|
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";
|
|
1289
1309
|
},
|
|
1290
1310
|
},
|
|
1291
1311
|
]),
|
package/src/constants.ts
CHANGED
|
@@ -4,6 +4,3 @@ 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";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const checkIsSentryEnabled = () => ({}).VITE_ENABLE_SENTRY === void 0 ? true : {}.VITE_ENABLE_SENTRY === "true";
|
|
4
|
-
exports.checkIsSentryEnabled = checkIsSentryEnabled;
|
|
5
|
-
//# sourceMappingURL=checkIsSentryEnabled.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkIsSentryEnabled.cjs","sources":["../../../src/lib/checkIsSentryEnabled.ts"],"sourcesContent":["/**\n * Checks whether or not Sentry is enabled.\n *\n * Sentry is enabled automatically in production but can be disabled by setting\n * `VITE_ENABLE_SENTRY` to `false`.\n *\n * @returns Whether or not Sentry is enabled.\n */\nexport const checkIsSentryEnabled = (): boolean =>\n\timport.meta.env.VITE_ENABLE_SENTRY === undefined\n\t\t? import.meta.env.PROD\n\t\t: import.meta.env.VITE_ENABLE_SENTRY === \"true\";\n"],"names":[],"mappings":";;AAQa,MAAA,uBAAuB,OACnB,CAAA,GAAA,uBAAuB,SACpC,OACgB,CAAA,EAAA,uBAAuB;;"}
|
|
@@ -1,9 +0,0 @@
|
|
|
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 declare const checkIsSentryEnabled: () => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkIsSentryEnabled.js","sources":["../../../src/lib/checkIsSentryEnabled.ts"],"sourcesContent":["/**\n * Checks whether or not Sentry is enabled.\n *\n * Sentry is enabled automatically in production but can be disabled by setting\n * `VITE_ENABLE_SENTRY` to `false`.\n *\n * @returns Whether or not Sentry is enabled.\n */\nexport const checkIsSentryEnabled = (): boolean =>\n\timport.meta.env.VITE_ENABLE_SENTRY === undefined\n\t\t? import.meta.env.PROD\n\t\t: import.meta.env.VITE_ENABLE_SENTRY === \"true\";\n"],"names":[],"mappings":"AAQa,MAAA,uBAAuB,OACnB,CAAA,GAAA,uBAAuB,SACpC,OACgB,CAAA,EAAA,uBAAuB;"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Sentry = require("@sentry/node");
|
|
4
|
-
const checkIsSentryEnabled = require("./checkIsSentryEnabled.cjs");
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
-
if (e) {
|
|
8
|
-
for (const k in e) {
|
|
9
|
-
if (k !== "default") {
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: () => e[k]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
const Sentry__namespace = /* @__PURE__ */ _interopNamespaceDefault(Sentry);
|
|
22
|
-
function trackSentryError(error) {
|
|
23
|
-
if (!checkIsSentryEnabled.checkIsSentryEnabled()) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
Sentry__namespace.captureException(error, {
|
|
27
|
-
...error instanceof Error ? { extra: { cause: error.cause } } : {}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
exports.trackSentryError = trackSentryError;
|
|
31
|
-
//# sourceMappingURL=sentryErrorHandlers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sentryErrorHandlers.cjs","sources":["../../../src/lib/sentryErrorHandlers.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\n\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\n\nexport function trackSentryError(error: unknown): void {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tSentry.captureException(error, {\n\t\t...(error instanceof Error ? { extra: { cause: error.cause } } : {}),\n\t});\n}\n"],"names":["checkIsSentryEnabled","Sentry"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIM,SAAU,iBAAiB,OAAc;AAC1C,MAAA,CAACA,6CAAwB;AAC5B;AAAA,EACA;AAEDC,oBAAO,iBAAiB,OAAO;AAAA,IAC9B,GAAI,iBAAiB,QAAQ,EAAE,OAAO,EAAE,OAAO,MAAM,YAAY,CAAA;AAAA,EAAA,CACjE;AACF;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function trackSentryError(error: unknown): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled.js";
|
|
3
|
-
function trackSentryError(error) {
|
|
4
|
-
if (!checkIsSentryEnabled()) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
Sentry.captureException(error, {
|
|
8
|
-
...error instanceof Error ? { extra: { cause: error.cause } } : {}
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export {
|
|
12
|
-
trackSentryError
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=sentryErrorHandlers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sentryErrorHandlers.js","sources":["../../../src/lib/sentryErrorHandlers.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\n\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\n\nexport function trackSentryError(error: unknown): void {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tSentry.captureException(error, {\n\t\t...(error instanceof Error ? { extra: { cause: error.cause } } : {}),\n\t});\n}\n"],"names":[],"mappings":";;AAIM,SAAU,iBAAiB,OAAc;AAC1C,MAAA,CAAC,wBAAwB;AAC5B;AAAA,EACA;AAED,SAAO,iBAAiB,OAAO;AAAA,IAC9B,GAAI,iBAAiB,QAAQ,EAAE,OAAO,EAAE,OAAO,MAAM,YAAY,CAAA;AAAA,EAAA,CACjE;AACF;"}
|
package/dist/lib/setupSentry.cjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Sentry = require("@sentry/node");
|
|
4
|
-
const semver = require("semver");
|
|
5
|
-
const constants = require("../constants.cjs");
|
|
6
|
-
const checkIsSentryEnabled = require("./checkIsSentryEnabled.cjs");
|
|
7
|
-
const _package = require("../packages/init/package.json.cjs");
|
|
8
|
-
function _interopNamespaceDefault(e) {
|
|
9
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
10
|
-
if (e) {
|
|
11
|
-
for (const k in e) {
|
|
12
|
-
if (k !== "default") {
|
|
13
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: () => e[k]
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
n.default = e;
|
|
22
|
-
return Object.freeze(n);
|
|
23
|
-
}
|
|
24
|
-
const Sentry__namespace = /* @__PURE__ */ _interopNamespaceDefault(Sentry);
|
|
25
|
-
function setupSentry() {
|
|
26
|
-
if (!checkIsSentryEnabled.checkIsSentryEnabled()) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
const isStableVersion = semver.prerelease(_package.version) === null && semver.lte("0.1.0", _package.version);
|
|
30
|
-
Sentry__namespace.init({
|
|
31
|
-
dsn: constants.SENTRY_EXPRESS_DSN,
|
|
32
|
-
release: _package.version,
|
|
33
|
-
environment: isStableVersion ? "production" : "alpha"
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
exports.setupSentry = setupSentry;
|
|
37
|
-
//# sourceMappingURL=setupSentry.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupSentry.cjs","sources":["../../../src/lib/setupSentry.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\nimport semver from \"semver\";\n\nimport { SENTRY_EXPRESS_DSN } from \"../constants\";\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\nimport { version } from \"../../package.json\";\n\nexport function setupSentry(): void {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tconst isStableVersion =\n\t\tsemver.prerelease(version) === null && semver.lte(\"0.1.0\", version);\n\n\tSentry.init({\n\t\tdsn: SENTRY_EXPRESS_DSN,\n\t\trelease: version,\n\t\tenvironment: isStableVersion\n\t\t\t? import.meta.env.MODE || \"production\"\n\t\t\t: \"alpha\",\n\t});\n}\n"],"names":["checkIsSentryEnabled","version","Sentry","SENTRY_EXPRESS_DSN"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;SAOgB,cAAW;AACtB,MAAA,CAACA,6CAAwB;AAC5B;AAAA,EACA;AAEK,QAAA,kBACL,OAAO,WAAWC,gBAAO,MAAM,QAAQ,OAAO,IAAI,SAASA,SAAAA,OAAO;AAEnEC,oBAAO,KAAK;AAAA,IACX,KAAKC,UAAA;AAAA,IACL,SAASF,SAAA;AAAA,IACT,aAAa,kBACV,eACA;AAAA,EAAA,CACH;AACF;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function setupSentry(): void;
|
package/dist/lib/setupSentry.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
import semver from "semver";
|
|
3
|
-
import { SENTRY_EXPRESS_DSN } from "../constants.js";
|
|
4
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled.js";
|
|
5
|
-
import { version } from "../packages/init/package.json.js";
|
|
6
|
-
function setupSentry() {
|
|
7
|
-
if (!checkIsSentryEnabled()) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
const isStableVersion = semver.prerelease(version) === null && semver.lte("0.1.0", version);
|
|
11
|
-
Sentry.init({
|
|
12
|
-
dsn: SENTRY_EXPRESS_DSN,
|
|
13
|
-
release: version,
|
|
14
|
-
environment: isStableVersion ? "production" : "alpha"
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
setupSentry
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=setupSentry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupSentry.js","sources":["../../../src/lib/setupSentry.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\nimport semver from \"semver\";\n\nimport { SENTRY_EXPRESS_DSN } from \"../constants\";\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\nimport { version } from \"../../package.json\";\n\nexport function setupSentry(): void {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tconst isStableVersion =\n\t\tsemver.prerelease(version) === null && semver.lte(\"0.1.0\", version);\n\n\tSentry.init({\n\t\tdsn: SENTRY_EXPRESS_DSN,\n\t\trelease: version,\n\t\tenvironment: isStableVersion\n\t\t\t? import.meta.env.MODE || \"production\"\n\t\t\t: \"alpha\",\n\t});\n}\n"],"names":[],"mappings":";;;;;SAOgB,cAAW;AACtB,MAAA,CAAC,wBAAwB;AAC5B;AAAA,EACA;AAEK,QAAA,kBACL,OAAO,WAAW,OAAO,MAAM,QAAQ,OAAO,IAAI,SAAS,OAAO;AAEnE,SAAO,KAAK;AAAA,IACX,KAAK;AAAA,IACL,SAAS;AAAA,IACT,aAAa,kBACV,eACA;AAAA,EAAA,CACH;AACF;"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const Sentry = require("@sentry/node");
|
|
4
|
-
const checkIsSentryEnabled = require("./checkIsSentryEnabled.cjs");
|
|
5
|
-
function _interopNamespaceDefault(e) {
|
|
6
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
7
|
-
if (e) {
|
|
8
|
-
for (const k in e) {
|
|
9
|
-
if (k !== "default") {
|
|
10
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
11
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: () => e[k]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
n.default = e;
|
|
19
|
-
return Object.freeze(n);
|
|
20
|
-
}
|
|
21
|
-
const Sentry__namespace = /* @__PURE__ */ _interopNamespaceDefault(Sentry);
|
|
22
|
-
async function updateSentryContext({ manager, repositoryName, framework }) {
|
|
23
|
-
if (!checkIsSentryEnabled.checkIsSentryEnabled()) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
let userProfile;
|
|
27
|
-
try {
|
|
28
|
-
userProfile = await manager.user.getProfile();
|
|
29
|
-
} catch {
|
|
30
|
-
}
|
|
31
|
-
if (userProfile) {
|
|
32
|
-
Sentry__namespace.setUser({ id: userProfile.shortId });
|
|
33
|
-
}
|
|
34
|
-
if (repositoryName) {
|
|
35
|
-
Sentry__namespace.setTag("repository", repositoryName);
|
|
36
|
-
Sentry__namespace.setContext("Repository Data", {
|
|
37
|
-
name: repositoryName
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
if (framework) {
|
|
41
|
-
Sentry__namespace.setTag("framework", framework);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.updateSentryContext = updateSentryContext;
|
|
45
|
-
//# sourceMappingURL=updateSentryContext.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateSentryContext.cjs","sources":["../../../src/lib/updateSentryContext.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\n\nimport { PrismicUserProfile, SliceMachineManager } from \"@slicemachine/manager\";\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\n\ntype UpdateSentryContextArgs = {\n\tmanager: SliceMachineManager;\n\trepositoryName: string;\n\tframework: string;\n};\n\nexport async function updateSentryContext({\n\tmanager,\n\trepositoryName,\n\tframework,\n}: UpdateSentryContextArgs): Promise<void> {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tlet userProfile: PrismicUserProfile | undefined;\n\ttry {\n\t\tuserProfile = await manager.user.getProfile();\n\t} catch {\n\t\t// User is not logged in, it doesn't matter\n\t}\n\n\tif (userProfile) {\n\t\tSentry.setUser({ id: userProfile.shortId });\n\t}\n\n\tif (repositoryName) {\n\t\tSentry.setTag(\"repository\", repositoryName);\n\t\tSentry.setContext(\"Repository Data\", {\n\t\t\tname: repositoryName,\n\t\t});\n\t}\n\n\tif (framework) {\n\t\tSentry.setTag(\"framework\", framework);\n\t}\n}\n"],"names":["checkIsSentryEnabled","Sentry"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAWA,eAAsB,oBAAoB,EACzC,SACA,gBACA,aACyB;AACrB,MAAA,CAACA,6CAAwB;AAC5B;AAAA,EACA;AAEG,MAAA;AACA,MAAA;AACW,kBAAA,MAAM,QAAQ,KAAK;UAChC;AAAA,EAED;AAED,MAAI,aAAa;AAChBC,sBAAO,QAAQ,EAAE,IAAI,YAAY,QAAS,CAAA;AAAA,EAC1C;AAED,MAAI,gBAAgB;AACZA,sBAAA,OAAO,cAAc,cAAc;AAC1CA,sBAAO,WAAW,mBAAmB;AAAA,MACpC,MAAM;AAAA,IAAA,CACN;AAAA,EACD;AAED,MAAI,WAAW;AACPA,sBAAA,OAAO,aAAa,SAAS;AAAA,EACpC;AACF;;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SliceMachineManager } from "@slicemachine/manager";
|
|
2
|
-
type UpdateSentryContextArgs = {
|
|
3
|
-
manager: SliceMachineManager;
|
|
4
|
-
repositoryName: string;
|
|
5
|
-
framework: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function updateSentryContext({ manager, repositoryName, framework, }: UpdateSentryContextArgs): Promise<void>;
|
|
8
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled.js";
|
|
3
|
-
async function updateSentryContext({ manager, repositoryName, framework }) {
|
|
4
|
-
if (!checkIsSentryEnabled()) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
let userProfile;
|
|
8
|
-
try {
|
|
9
|
-
userProfile = await manager.user.getProfile();
|
|
10
|
-
} catch {
|
|
11
|
-
}
|
|
12
|
-
if (userProfile) {
|
|
13
|
-
Sentry.setUser({ id: userProfile.shortId });
|
|
14
|
-
}
|
|
15
|
-
if (repositoryName) {
|
|
16
|
-
Sentry.setTag("repository", repositoryName);
|
|
17
|
-
Sentry.setContext("Repository Data", {
|
|
18
|
-
name: repositoryName
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
if (framework) {
|
|
22
|
-
Sentry.setTag("framework", framework);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export {
|
|
26
|
-
updateSentryContext
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=updateSentryContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updateSentryContext.js","sources":["../../../src/lib/updateSentryContext.ts"],"sourcesContent":["import * as Sentry from \"@sentry/node\";\n\nimport { PrismicUserProfile, SliceMachineManager } from \"@slicemachine/manager\";\nimport { checkIsSentryEnabled } from \"./checkIsSentryEnabled\";\n\ntype UpdateSentryContextArgs = {\n\tmanager: SliceMachineManager;\n\trepositoryName: string;\n\tframework: string;\n};\n\nexport async function updateSentryContext({\n\tmanager,\n\trepositoryName,\n\tframework,\n}: UpdateSentryContextArgs): Promise<void> {\n\tif (!checkIsSentryEnabled()) {\n\t\treturn;\n\t}\n\n\tlet userProfile: PrismicUserProfile | undefined;\n\ttry {\n\t\tuserProfile = await manager.user.getProfile();\n\t} catch {\n\t\t// User is not logged in, it doesn't matter\n\t}\n\n\tif (userProfile) {\n\t\tSentry.setUser({ id: userProfile.shortId });\n\t}\n\n\tif (repositoryName) {\n\t\tSentry.setTag(\"repository\", repositoryName);\n\t\tSentry.setContext(\"Repository Data\", {\n\t\t\tname: repositoryName,\n\t\t});\n\t}\n\n\tif (framework) {\n\t\tSentry.setTag(\"framework\", framework);\n\t}\n}\n"],"names":[],"mappings":";;AAWA,eAAsB,oBAAoB,EACzC,SACA,gBACA,aACyB;AACrB,MAAA,CAAC,wBAAwB;AAC5B;AAAA,EACA;AAEG,MAAA;AACA,MAAA;AACW,kBAAA,MAAM,QAAQ,KAAK;UAChC;AAAA,EAED;AAED,MAAI,aAAa;AAChB,WAAO,QAAQ,EAAE,IAAI,YAAY,QAAS,CAAA;AAAA,EAC1C;AAED,MAAI,gBAAgB;AACZ,WAAA,OAAO,cAAc,cAAc;AAC1C,WAAO,WAAW,mBAAmB;AAAA,MACpC,MAAM;AAAA,IAAA,CACN;AAAA,EACD;AAED,MAAI,WAAW;AACP,WAAA,OAAO,aAAa,SAAS;AAAA,EACpC;AACF;"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
|
|
3
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled";
|
|
4
|
-
|
|
5
|
-
export function trackSentryError(error: unknown): void {
|
|
6
|
-
if (!checkIsSentryEnabled()) {
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
Sentry.captureException(error, {
|
|
11
|
-
...(error instanceof Error ? { extra: { cause: error.cause } } : {}),
|
|
12
|
-
});
|
|
13
|
-
}
|
package/src/lib/setupSentry.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
import semver from "semver";
|
|
3
|
-
|
|
4
|
-
import { SENTRY_EXPRESS_DSN } from "../constants";
|
|
5
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled";
|
|
6
|
-
import { version } from "../../package.json";
|
|
7
|
-
|
|
8
|
-
export function setupSentry(): void {
|
|
9
|
-
if (!checkIsSentryEnabled()) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const isStableVersion =
|
|
14
|
-
semver.prerelease(version) === null && semver.lte("0.1.0", version);
|
|
15
|
-
|
|
16
|
-
Sentry.init({
|
|
17
|
-
dsn: SENTRY_EXPRESS_DSN,
|
|
18
|
-
release: version,
|
|
19
|
-
environment: isStableVersion
|
|
20
|
-
? import.meta.env.MODE || "production"
|
|
21
|
-
: "alpha",
|
|
22
|
-
});
|
|
23
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as Sentry from "@sentry/node";
|
|
2
|
-
|
|
3
|
-
import { PrismicUserProfile, SliceMachineManager } from "@slicemachine/manager";
|
|
4
|
-
import { checkIsSentryEnabled } from "./checkIsSentryEnabled";
|
|
5
|
-
|
|
6
|
-
type UpdateSentryContextArgs = {
|
|
7
|
-
manager: SliceMachineManager;
|
|
8
|
-
repositoryName: string;
|
|
9
|
-
framework: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export async function updateSentryContext({
|
|
13
|
-
manager,
|
|
14
|
-
repositoryName,
|
|
15
|
-
framework,
|
|
16
|
-
}: UpdateSentryContextArgs): Promise<void> {
|
|
17
|
-
if (!checkIsSentryEnabled()) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let userProfile: PrismicUserProfile | undefined;
|
|
22
|
-
try {
|
|
23
|
-
userProfile = await manager.user.getProfile();
|
|
24
|
-
} catch {
|
|
25
|
-
// User is not logged in, it doesn't matter
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (userProfile) {
|
|
29
|
-
Sentry.setUser({ id: userProfile.shortId });
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (repositoryName) {
|
|
33
|
-
Sentry.setTag("repository", repositoryName);
|
|
34
|
-
Sentry.setContext("Repository Data", {
|
|
35
|
-
name: repositoryName,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (framework) {
|
|
40
|
-
Sentry.setTag("framework", framework);
|
|
41
|
-
}
|
|
42
|
-
}
|