Open-Source Wikis

/

Prisma

/

How to contribute

/

Tooling

prisma/prisma

Tooling

Build pipelines, runners, and quality gates used inside prisma/prisma.

Workspace layout

  • pnpm-workspace.yaml — defines the workspace globs (packages/*).
  • turbo.json — Turborepo task graph for build and dev. Dependent builds run in topological order; outputs are cached.
  • Engine constraintspackage.json engines field requires Node ^20.19 || ^22.12 || >=24.0 and pnpm >=10.15 <11.

The preinstall script (scripts/only-allow-pnpm.js) hard-fails any attempt to run npm or yarn against the repo.

Build pipeline (esbuild)

The shared build code lives in helpers/compile/:

  • helpers/compile/build.ts — the build orchestrator. Each package's helpers/build.ts calls into this with package-specific config.
  • helpers/compile/configs.ts — reusable config presets (bundledConfig, etc.).
  • helpers/compile/plugins/ — esbuild plugins. The most notable is tsc/ (the in-process tsc step that emits .d.ts) and fill-plugin/ (which polyfills missing Node modules in browser builds).

Most packages opt in to bundledConfig, which produces:

  • A CommonJS bundle (dist/index.js)
  • An ESM bundle (dist/index.mjs)
  • Type declarations (dist/index.d.ts and dist/index.d.mts)

Test files (*.test.ts) are explicitly excluded from build output by esbuild config; place tests anywhere in src/.

Turborepo

pnpm build      # turbo build
pnpm dev        # turbo dev (no tsc)
pnpm watch      # one-shot dev + parallel watch

Turbo's task definitions in turbo.json:

  • build depends on upstream build. Inputs include helpers/**/*.ts so editing the shared builder invalidates every cache.
  • dev mirrors build but skips the type-emit step.
  • @prisma/type-benchmark-tests#dev has its own outputs (**/generated).

ESLint

eslint.config.cjs is the flat-config root. Plugins in use:

  • @typescript-eslint/* — TypeScript-aware rules
  • eslint-plugin-import-x — import resolution and ordering
  • eslint-plugin-simple-import-sort — deterministic import sort
  • eslint-plugin-prettier — wraps Prettier as a lint rule
  • eslint-plugin-jest — Jest-specific lints
  • eslint-plugin-local-rules — loads eslint-local-rules/ for project-specific rules
  • @eslint-community/eslint-plugin-eslint-comments — guards eslint-disable usage

Run lint with:

pnpm lint            # check
pnpm lint-fix        # autofix

Prettier

Prettier 3 is the formatter (prettier@3.6.2); the legacy prettier2 is also installed for tools that need v2 output.

pnpm format          # write
pnpm prettier-check  # check, no writes

.prettierrc.yml and .prettierignore at the root configure it. Some packages have their own .prettierrc.yml overrides.

Husky + lint-staged

.husky/ registers Git hooks. precommit runs lint-staged, which:

  • Runs Prettier on every staged file (prettier --ignore-unknown --write)
  • Runs ESLint with --fix on staged .js/.ts files

The hook is installed automatically via the prepare script (is-ci || husky) on pnpm install.

CI workflows

.github/workflows/:

Workflow Purpose
test.yml Top-level CI orchestrator
test-template.yml Reusable matrix template for per-package tests
benchmark.yml CodSpeed benchmarks
bundle-size.yml Tracks packages/cli/build/index.js size
build-engine-branch.yml Builds engines from a custom branch when /engine-branch is set
release.yml, release-ci.yml Production releases and integration tag pre-releases
update-engines-version.yml Bumps engine versions automatically
update-studio-version.yml Bumps the bundled Studio
manage-dist-tag.yml npm dist-tag management
codeql-analysis.yml Security scanning
lint-workflow-files.yml Lint the workflow YAMLs themselves

test-template.yml partitions the workspace into jobs by purpose:

  • others (Linux, no Docker) — utility packages: debug, generator-helper, get-platform, fetch-engine, engines, instrumentation, instrumentation-contract, schema-files-loader, config, dmmf, generator, credentials-store, sqlcommenter-*
  • client-packagesclient-common, client-engine-runtime, ts-builders, client-generator-js, client-generator-ts, client-generator-registry
  • driver-adapter-unit-testsadapter-libsql, adapter-mariadb, adapter-d1, adapter-pg, adapter-planetscale, adapter-mssql, adapter-neon
  • no-docker (Windows/macOS) — mirrors others and client-packages

When you add a new package with tests, edit test-template.yml to include it in the right job.

Bundle-size enforcement

The root package.json declares size-limit paths covering the CLI bundle, the Client browser bundle, the Client tarball, the CLI tarball, and several driver-adapter worker outputs. CI (bundle-size.yml) posts a comment on every PR. The CLI bundle ceiling is ~6MB; the Client tarball ceiling is also tracked.

Engine downloads

packages/engines has a postinstall hook that downloads Schema Engine binaries from S3 for the host platform. This is what gives pnpm install its long install times.

The download wrapper is in packages/fetch-engine. To override, see Custom engines.

Ad-hoc scripts

scripts/ and helpers/:

  • scripts/ci/publish.ts — backbone of pnpm build/test/status/pull/publish-all
  • scripts/bench.ts — benchmark runner
  • scripts/bump-engines.ts — engine version bumper
  • scripts/check-engines-override.ts — fail-safe to prevent shipping a custom engines override
  • scripts/run-studio.ts — convenience for spinning up Studio locally
  • scripts/graph-dependencies.ts — regenerates the dependency graph PNGs in graphs/ (needs GraphViz installed)

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Tooling – Prisma wiki | Factory