Skip to content

refactor: extract 'prisma-client-js' string literal into a shared constant #29316

Closed

Description

@coderabbitai

Summary

The string literal 'prisma-client-js' is repeated across multiple TypeScript source files as a comparison/identification value. Extracting it into a shared named constant would reduce the risk of typos and make future updates easier.

Relevant occurrences in source files

File Line(s) Usage
packages/client-generator-js/src/generator.ts 23 readonly name = 'prisma-client-js' (canonical definition)
packages/client-generator-js/src/utils/types/dmmfToTypes.ts 27, 29 Assigned as name / provider.value
packages/cli/src/Generate.ts 99, 201, 255 Provider identity comparisons
packages/internals/src/cli/getGeneratorSuccessMessage.ts 23 Provider identity comparison
packages/internals/src/utils/extractPreviewFeatures.ts 6 Provider identity comparison
packages/client/src/utils/getTestClient.ts 37 Provider identity comparison (alongside prisma-client-ts, prisma-client)
packages/cli/src/utils/checkpoint.ts 137 Used in an array of client generator providers

Suggested approach

Define a shared constant in an appropriate location (e.g., packages/internals/src/constants.ts):

export const PRISMA_CLIENT_JS_PROVIDER = 'prisma-client-js'

Then replace all comparison sites with this constant.

Note: Prisma schema language files (e.g., prisma/_schema.ts test fixtures) use provider = "prisma-client-js" as schema strings — those are out of scope for this refactor.

Context

Identified during code review in PR #29315 (comment: #29315 (comment)).

Activity

  1. added
    kind/tech
    on Mar 9, 2026
  2. added a commit that references this issue on Mar 17, 2026
    309b4bc
  3. khalidsaidi commented on Mar 25, 2026

    @khalidsaidi

    A2ABench has an accepted answer for this imported thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/tech

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions