kavoru 0.7.0 → 0.7.1
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/package.json +1 -1
- package/src/features.ts +16 -3
package/package.json
CHANGED
package/src/features.ts
CHANGED
|
@@ -276,11 +276,14 @@ async function patchModulesIndex(
|
|
|
276
276
|
await writeText(projectDir, relativePath, content);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
279
|
+
export function buildEntryIndex(selection: FeatureSelection): string {
|
|
280
280
|
const imports = [
|
|
281
281
|
selection.sentry
|
|
282
282
|
? 'import { initSentry, flushSentry } from "./infra/sentry";'
|
|
283
283
|
: null,
|
|
284
|
+
selection.otel
|
|
285
|
+
? 'import {\n bootstrapOpenTelemetry,\n shutdownOpenTelemetry,\n} from "./infra/telemetry";'
|
|
286
|
+
: null,
|
|
284
287
|
selection.kafka
|
|
285
288
|
? 'import { startKafka, stopKafka } from "./infra/kafka";'
|
|
286
289
|
: null,
|
|
@@ -291,8 +294,11 @@ async function patchEntryIndex(projectDir: string, selection: FeatureSelection)
|
|
|
291
294
|
|
|
292
295
|
const body: string[] = [];
|
|
293
296
|
|
|
297
|
+
if (selection.otel) {
|
|
298
|
+
body.push("", "bootstrapOpenTelemetry();");
|
|
299
|
+
}
|
|
294
300
|
if (selection.sentry) {
|
|
295
|
-
body.push("
|
|
301
|
+
body.push("initSentry();");
|
|
296
302
|
}
|
|
297
303
|
|
|
298
304
|
body.push("", "const server = new HttpServer();", "");
|
|
@@ -326,6 +332,9 @@ async function patchEntryIndex(projectDir: string, selection: FeatureSelection)
|
|
|
326
332
|
if (selection.sentry) {
|
|
327
333
|
body.push(" await flushSentry();");
|
|
328
334
|
}
|
|
335
|
+
if (selection.otel) {
|
|
336
|
+
body.push(" await shutdownOpenTelemetry();");
|
|
337
|
+
}
|
|
329
338
|
|
|
330
339
|
body.push(
|
|
331
340
|
" process.exit(0);",
|
|
@@ -337,7 +346,11 @@ async function patchEntryIndex(projectDir: string, selection: FeatureSelection)
|
|
|
337
346
|
"",
|
|
338
347
|
);
|
|
339
348
|
|
|
340
|
-
|
|
349
|
+
return [...imports, ...body].join("\n");
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
async function patchEntryIndex(projectDir: string, selection: FeatureSelection) {
|
|
353
|
+
await writeText(projectDir, "src/index.ts", buildEntryIndex(selection));
|
|
341
354
|
}
|
|
342
355
|
|
|
343
356
|
async function patchServerIndex(projectDir: string, selection: FeatureSelection) {
|