drizzle-team / drizzle-team/drizzle-orm

[BUG]: `drizzle-kit` does not have all its dependencies (e.g. `drizzle-orm` or `pg`) listed

Open
#3,990 0 comments 1 reaction 0 assignees View on GitHub
bug drizzle/kit priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.38.3

### What version of `drizzle-kit` are you using?

0.30.1

### Other packages

_No response_

### Describe the Bug

Running `drizzle-kit` commands fails in some cases for pnpm. See #2032, probably [#3578](https://github.com/drizzle-team/drizzle-orm/issues/3578#issuecomment-2553760838)

This happens if drizzle-kit is installed in more restrictive/secure installations (e.g. pnpm without (public) hoisting, where packages cannot just access othe packages freely).

AFAIK, simply adding `drizzle-orm` to the `peerDependencies` should resolve this issue. This also has the nice side effect that package managers can check and warn if `drizzle-kit` is installed, but `drizzle-orm` isn't. [`drizzle-zod` already does this](https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-zod/package.json#L67).

I'm not 100% sure if `peerDependencies` is the correct one or some other property would be a better fit. I've tested it only with `peerDependencies` and `peerDependenciesMeta` (using https://pnpm.io/pnpmfile#usage) and that works well.

.pnpmfile.js

```ts
if (
pkg.name === 'drizzle-kit' &&
(pkg.version === '0.21.4' ||
pkg.version === '0.22.8' ||
pkg.version === '0.30.1')
) {
const drizzleOrmVersion =
pkg.version === '0.22.8'
? '^0.31.0'
: pkg.version === '0.30.1'
? '^0.38.0'
: '^0.30.10';

pkg.peerDependencies = {
...pkg.dependencies,
'drizzle-orm': drizzleOrmVersion,
pg: '^8.11.5',
};
pkg.peerDependenciesMeta = {
...pkg.peerDependenciesMeta,
pg: {
optional: true,
},
};
context.log(
`drizzle-kit@${pkg.version}: adds drizzle-orm@${drizzleOrmVersion} to peerDependencies`,
);
context.log(
`drizzle-kit@${pkg.version}: adds pg@^8.11.5 to peerDependencies`,
);
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.