-
Notifications
You must be signed in to change notification settings - Fork 914
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
Optional dependency on ts-node #3221
Comments
Relates to #3218 I guess. Had a look where this was introduced: #3007 (comment) So looks like we wanted to avoid a breaking change. |
This absolutely makes sense to me. I think it might be a little tricky to implement, though, because isn't the point of Cosmic Config to delegate configuration discovery (which files etc.)? I guess, even as someone who uses TypeScript almost exclusively, I'd also question the value of supporting TypeScript-based configuration files. I think the easiest move here might be to drop support for those, but I don't know how popular that feature is. |
Hrm, maybe we could wrap the loader in a function that ensures the optional dependency: import { cosmiconfig } from "cosmiconfig";
import TypeScriptLoader from "cosmiconfig-typescript-loader";
const moduleName = "module";
const explorer = cosmiconfig("test", {
searchPlaces: [
// ...
],
loaders: {
".ts": TypeScriptLoader(), // ← wrap this in a function that loads `cosmiconfig-typescript-loader` dynamically
},
});
const cfg = explorer.load("./"); |
Thanks for your feedback @jrolfs ! Not sure how many people use a TS config. But also not sure how many people care about the size of commitlint really (Relates to #3040, #1791). |
I just wanted to advocate for the people who care about the size since we're heavy users of your libs (btw thx for it 🙏). The hard-dep makes our docker image nearly ~100MB bigger, which may seem not much nowadays, but equates to more bandwidth usage which is costly, and cumulative time wasted by developers waiting image pulls in CI/locally. This is just a matter of DevX to me :) |
Reopening because of #3641 |
|
This is even more necessary given the rise of bun. |
Solved by #3722 |
Expected Behavior
ts-node
should be an optional dependency of the projectCurrent Behavior
currently, installing
@commitlint/cli
results in a lot of downloaded NPM packages.Affected packages
Possible Solution
Instead of statically importing
cosmiconfig-typescript-loader
,@commitlint/load
could depend on on it using an optional peer dependency and dynamicallyrequire
/import()
that dependency if/when a.ts
file is detected, and show a warning if that fails:Steps to Reproduce (for bugs)
Not really a bug.
Context
I don't use Typescript. So I really don't see why
ts-node
should be a mandatory dependency of my project:Your Environment
commitlint --version
git --version
node --version
The text was updated successfully, but these errors were encountered: