kysely-org / kysely-ctl

Command-line tool for Kysely
MIT License
50 stars 2 forks source link

Why suggesting peer dependencies #4

Closed pi0 closed 2 months ago

pi0 commented 2 months ago

Hi, I'm so glad that you are adopting unjs projects ❤️

I noticed something a little strange about usage though since you are advising to install needed depes as peer dependencies. May I ask the reasons behind it?


PS: Note sure if you also know about jiti project. Aside from top-level await support I like to know what were main limitations if you ever considered it (this dependency at least comes out of the box by c12 so at least will make install smaller)

igalklebanov commented 2 months ago

Hey 👋

unjs is 🔥 . For real. Serious time-savers and quality boosters. 🥇

I noticed something a little strange about usage though since you are advising to install needed depes as peer dependencies. May I ask the reasons behind it?

Was not the intention. These are listed as peer dependencies of kysely-ctl. The readme tries to ensure they're installed. e.g. a setup with pre v7 npm, or some flags turning off auto-peer dep installation.

PS: Note sure if you also know about jiti project. Aside from top-level await support I like to know what were main limitations if you ever considered it (this dependency at least comes out of the box by c12 so at least will make install smaller)

It was considered in a pool of libraries that can help transpile TS files - didn't dig deeper. Eventually abandoned with the rest when I found tsImport by tsx. I'll try it out! Shorter install times is definitely a plus.

acro5piano commented 2 months ago

I've been curious about it, too. As far as I know, dependencies is normally used over peerDependencies if these dependencies are mandatory, right?

igalklebanov commented 2 months ago

What are the pros/cons of either way? if both are installed automatically (when not peerDependenciesMeta.optional: true) by modern package managers.

The aim is to reduce install time and node_modules size by promoting the reuse of externals.

I might be missing something, and there might be more than just semantics here..

pi0 commented 2 months ago

peerDependencies being installed is actually a compatibiliy and implicit behavior of package managers. It was not intended behavior of peerDependencies. They started to do this for dependencies that don't install their peers in their hierarchy but were assuming it would be installed often via hoisted dependencies in the tree.


Package managers will try to deduplicate standard dependencies when shared and pnpm does not actually copy the files either, so it won't affect install size.

igalklebanov commented 2 months ago

@pi0 thank you! 🙏

Released changes @ https://github.com/kysely-org/kysely-ctl/releases/tag/v0.6.0.