create-prisma 0.14.0-pr.127.414.1 → 0.14.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/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as ApplicationLayer, i as runCreatePrismaCli } from "./src-Dnqle6oR.mjs";
2
+ import { a as ApplicationLayer, i as runCreatePrismaCli } from "./src-3Er57PqW.mjs";
3
3
  import { Effect } from "effect";
4
4
  import { NodeRuntime } from "@effect/platform-node-shared";
5
5
  //#region src/cli.ts
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import { c as AgentSkillTargetSchema, d as CreateTemplateSchema, f as DatabaseProviderSchema, i as runCreatePrismaCli, l as AuthoringStyleSchema, n as createCreatePrismaCli, o as CREATE_PRISMA_RESULT_SCHEMA_VERSION, p as PackageManagerSchema, r as createPrismaCommand, s as CreateCommandResultSchema, t as create, u as CreateCommandInputSchema } from "./src-Dnqle6oR.mjs";
2
+ import { c as AgentSkillTargetSchema, d as CreateTemplateSchema, f as DatabaseProviderSchema, i as runCreatePrismaCli, l as AuthoringStyleSchema, n as createCreatePrismaCli, o as CREATE_PRISMA_RESULT_SCHEMA_VERSION, p as PackageManagerSchema, r as createPrismaCommand, s as CreateCommandResultSchema, t as create, u as CreateCommandInputSchema } from "./src-3Er57PqW.mjs";
3
3
  export { AgentSkillTargetSchema, AuthoringStyleSchema, CREATE_PRISMA_RESULT_SCHEMA_VERSION, CreateCommandInputSchema, CreateCommandResultSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, createPrismaCommand, runCreatePrismaCli };
@@ -10,6 +10,7 @@ import { createInterface } from "node:readline";
10
10
  import { stripVTControlCharacters, styleText } from "node:util";
11
11
  import { randomUUID } from "node:crypto";
12
12
  import os from "node:os";
13
+ import { PostHog } from "posthog-node";
13
14
  import Handlebars from "handlebars";
14
15
  import { fileURLToPath } from "node:url";
15
16
  import { Writable } from "node:stream";
@@ -464,14 +465,20 @@ function getPackageManagerErrorCode(command, output) {
464
465
  }
465
466
  //#endregion
466
467
  //#region src/telemetry/client.ts
467
- const TELEMETRY_API_KEY = "";
468
+ const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
468
469
  const TELEMETRY_HOST = "https://us.i.posthog.com";
469
470
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
470
471
  const TELEMETRY_TIMEOUT_MS = 2e3;
471
472
  const AnonymousId = Schema.String.check(Schema.isUUID(4));
472
473
  const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
474
+ const isTruthyEnvValue = (value) => [
475
+ "1",
476
+ "true",
477
+ "yes",
478
+ "on"
479
+ ].includes(String(value ?? "").trim().toLowerCase());
473
480
  function shouldDisableTelemetry() {
474
- return true;
481
+ return isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS) || process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
475
482
  }
476
483
  function getTelemetryConfigDir() {
477
484
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -495,35 +502,35 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
495
502
  return anonymousId;
496
503
  });
497
504
  const getCommonProperties = () => ({
498
- "cli-version": "0.14.0-pr.127.414.1",
505
+ "cli-version": "0.14.0",
499
506
  "node-version": process.version,
500
507
  platform: process.platform,
501
508
  arch: process.arch
502
509
  });
503
510
  const sanitizeProperties = (properties) => Object.fromEntries(Object.entries(properties).filter(([, value]) => value !== void 0));
511
+ const shutdownTelemetryClientEffect = (client, timeoutMs = TELEMETRY_TIMEOUT_MS) => Effect.tryPromise({
512
+ try: () => Promise.resolve(client.shutdown(timeoutMs)),
513
+ catch: () => void 0
514
+ }).pipe(Effect.timeout(timeoutMs), Effect.interruptible, Effect.catch(() => Effect.void));
504
515
  const trackCliTelemetryEffect = Effect.fn("Telemetry.track")(function* (event, properties) {
505
516
  if (shouldDisableTelemetry()) return;
506
517
  const distinctId = yield* getAnonymousIdEffect();
507
- yield* Effect.tryPromise(async (signal) => {
508
- await (await fetch(new URL("/i/v0/e/", TELEMETRY_HOST), {
509
- method: "POST",
510
- headers: { "content-type": "application/json" },
511
- redirect: "error",
512
- body: JSON.stringify({
513
- api_key: TELEMETRY_API_KEY,
514
- distinct_id: distinctId,
515
- event,
516
- properties: sanitizeProperties({
517
- ...getCommonProperties(),
518
- ...properties,
519
- $process_person_profile: false,
520
- $geoip_disable: true
521
- }),
522
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
523
- }),
524
- signal
525
- })).body?.cancel();
526
- });
518
+ const client = yield* Effect.acquireRelease(Effect.sync(() => new PostHog(TELEMETRY_API_KEY, {
519
+ host: TELEMETRY_HOST,
520
+ disableGeoip: true,
521
+ flushAt: 1,
522
+ flushInterval: 0
523
+ })), (posthog) => shutdownTelemetryClientEffect(posthog));
524
+ yield* Effect.tryPromise(() => client.captureImmediate({
525
+ distinctId,
526
+ event,
527
+ properties: sanitizeProperties({
528
+ ...getCommonProperties(),
529
+ ...properties,
530
+ $process_person_profile: false
531
+ }),
532
+ disableGeoip: true
533
+ }));
527
534
  });
528
535
  //#endregion
529
536
  //#region src/telemetry/create.ts
@@ -606,7 +613,7 @@ const trackCreateCompletedEffect = Effect.fn("Telemetry.createCompleted")(functi
606
613
  yield* trackCliTelemetryEffect(params.context.operation === "orm_init" ? PRISMA_INIT_COMPLETED_EVENT : CREATE_PRISMA_NEXT_COMPLETED_EVENT, {
607
614
  ...getBaseCreateProperties(params.input, params.context),
608
615
  "duration-ms": params.durationMs
609
- }).pipe(Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
616
+ }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
610
617
  });
611
618
  const trackCreateFailedEffect = Effect.fn("Telemetry.createFailed")(function* (params) {
612
619
  yield* trackCliTelemetryEffect(params.context?.operation === "orm_init" ? PRISMA_INIT_FAILED_EVENT : CREATE_PRISMA_NEXT_FAILED_EVENT, {
@@ -623,14 +630,14 @@ const trackCreateFailedEffect = Effect.fn("Telemetry.createFailed")(function* (p
623
630
  "prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode"),
624
631
  "prisma-cli-cause-code": getPrismaCliCauseCodeProperty(params.error),
625
632
  "package-manager-error-code": params.stage === "install_dependencies" ? getPackageManagerErrorCodeProperty(params.error) : null
626
- }).pipe(Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
633
+ }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
627
634
  });
628
635
  const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(function* (params) {
629
636
  yield* trackCliTelemetryEffect(params.context?.operation === "orm_init" ? PRISMA_INIT_CANCELLED_EVENT : CREATE_PRISMA_NEXT_CANCELLED_EVENT, {
630
637
  ...getBaseCreateProperties(params.input, params.context),
631
638
  "duration-ms": params.durationMs,
632
639
  "cancellation-stage": params.stage
633
- }).pipe(Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
640
+ }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
634
641
  });
635
642
  //#endregion
636
643
  //#region src/constants/dependencies.ts
@@ -2772,7 +2779,7 @@ function isJsonOutputRequested(argv) {
2772
2779
  const writeJsonResult = Effect.fn("JsonOutput.write")((result) => Effect.sync(() => process.stdout.write(`${JSON.stringify(result)}\n`)));
2773
2780
  //#endregion
2774
2781
  //#region src/index.ts
2775
- const CLI_VERSION = "0.14.0-pr.127.414.1";
2782
+ const CLI_VERSION = "0.14.0";
2776
2783
  const optionalArgument = (name, description) => Argument.String(name).pipe(Argument.withDescription(description), Argument.optional, Argument.map(Option.getOrUndefined));
2777
2784
  const optionalBoolean = (name, description) => Flag.Boolean(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
2778
2785
  const optionalString = (name, description) => Flag.String(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.14.0-pr.127.414.1",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -55,7 +55,8 @@
55
55
  "@effect/platform-node-shared": "4.0.1",
56
56
  "effect": "4.0.1",
57
57
  "execa": "^10.0.1",
58
- "handlebars": "^4.7.10"
58
+ "handlebars": "^4.7.10",
59
+ "posthog-node": "^5.55.0"
59
60
  },
60
61
  "devDependencies": {
61
62
  "@prisma/dev": "0.25.2",