Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
michaelschufi opened this issue Jan 23, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@michaelschufi
Copy link

Report hasn't been filed before.

  • 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

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.

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
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`,
    );
  }
@michaelschufi michaelschufi added the bug Something isn't working label Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant