Expected Behavior
ts-node should be an optional dependency of the project
Current 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 dynamically require / import() that dependency if/when a .ts file is detected, and show a warning if that fails:
Using TypeScript @commitlint configurations requires `@commitlint/ts` to be installed as a peer dependency of your project
Steps to Reproduce (for bugs)
Not really a bug.
$ yarn install @commitlint/cli
Context
I don't use Typescript. So I really don't see why ts-node should be a mandatory dependency of my project:
$ y why ts-node
yarn why v1.22.18
[1/4] 🤔 Why do we have the module "ts-node"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "[email protected]"
info Reasons this module exists
- "_project_#@commitlint#cli#@commitlint#load#cosmiconfig-typescript-loader" depends on it
- Hoisted from "_project_#@commitlint#cli#@commitlint#load#cosmiconfig-typescript-loader#ts-node"
info Disk size without dependencies: "1.5MB"
info Disk size with unique dependencies: "2.97MB"
info Disk size with transitive dependencies: "3.25MB"
info Number of shared dependencies: 16
Your Environment
| Executable |
Version |
commitlint --version |
@commitlint/[email protected] |
git --version |
git version 2.36.1 |
node --version |
v16.15.0 |
Expected Behavior
ts-nodeshould be an optional dependency of the projectCurrent Behavior
currently, installing
@commitlint/cliresults in a lot of downloaded NPM packages.Affected packages
Possible Solution
Instead of statically importing
cosmiconfig-typescript-loader,@commitlint/loadcould depend on on it using an optional peer dependency and dynamicallyrequire/import()that dependency if/when a.tsfile 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-nodeshould be a mandatory dependency of my project:Your Environment
commitlint --versiongit --versionnode --version