-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cli): expands the info displayed in --info (#959)
## Description - enriches the --info output with info relevant for troubleshooting environment issues: - versions of transpilers _found_ - current version of dependency-cruiser - supported node versions, found node version - found os ## Motivation and Context Makes it easier to debug issues in the setup. E.g. seeing that dependency-cruiser finds typescript@4 is used instead of an expected typescript@5 already gives clues to ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> - [x] green ci ## Screenshots ### After ``` [email protected] node version supported : ^18.17||>=20 node version found : v22.8.0 os version found : x64 [email protected] If you need a supported, but not enabled transpiler ('x' below), just install it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript' will enable livescript support if it's installed in your project folder. ✔ transpiler versions supported version found - ---------------------- ------------------- ------------------------ ✔ javascript * [email protected] ✔ babel >=7.0.0 <8.0.0 @babel/[email protected] ✔ coffee-script >=1.0.0 <2.0.0 [email protected] ✔ coffeescript >=1.0.0 <3.0.0 [email protected] x livescript >=1.0.0 <2.0.0 - ✔ svelte >=3.0.0 <5.0.0 svelte/[email protected] ✔ swc >=1.0.0 <2.0.0 @swc/[email protected] ✔ typescript >=2.0.0 <6.0.0 [email protected] ✔ vue-template-compiler >=2.0.0 <3.0.0 vue-template-compiler ✔ @vue/compiler-sfc >=3.0.0 <4.0.0 vue-template-compiler ✔ extension - --------- ✔ .js ✔ .cjs ✔ .mjs ✔ .jsx ✔ .ts ✔ .tsx ✔ .d.ts ✔ .cts ✔ .d.cts ✔ .mts ✔ .d.mts ✔ .vue ✔ .svelte x .ls ✔ .coffee ✔ .litcoffee ✔ .coffee.md ✔ .csx ✔ .cjsx ``` ### Before ``` Supported: If you need a supported, but not enabled transpiler ('x' below), just install it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript' will enable livescript support if it's installed in your project folder. Transpilers: ✔ javascript (>es1) ✔ babel (>=7.0.0 <8.0.0) ✔ coffee-script (>=1.0.0 <2.0.0) ✔ coffeescript (>=1.0.0 <3.0.0) x livescript (>=1.0.0 <2.0.0) ✔ svelte (>=3.0.0 <5.0.0) ✔ swc (>=1.0.0 <2.0.0) ✔ typescript (>=2.0.0 <6.0.0) ✔ vue-template-compiler (>=2.0.0 <3.0.0) ✔ @vue/compiler-sfc (>=3.0.0 <4.0.0) Extensions: ✔ .js ✔ .cjs ✔ .mjs ✔ .jsx ✔ .ts ✔ .tsx ✔ .d.ts ✔ .cts ✔ .d.cts ✔ .mts ✔ .d.mts ✔ .vue ✔ .svelte x .ls ✔ .coffee ✔ .litcoffee ✔ .coffee.md ✔ .csx ✔ .cjsx ``` ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Documentation only change - [ ] Refactor (non-breaking change which fixes an issue without changing functionality) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change)
- Loading branch information
Showing
12 changed files
with
174 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ available in dependency-cruiser configurations. | |
1. [`--init`](#--init) | ||
1. [`--metrics`: calculate stability metrics](#--metrics) | ||
1. [`--no-metrics`: do not calculate stability metrics](#--no-metrics) | ||
1. [`--info`: show what alt-js are supported](#--info-showing-what-alt-js-are-supported) | ||
1. [`--info`: show what alt-js are supported](#--info-show-what-alt-js-are-supported) | ||
1. [`--ignore-known`: ignore known violations](#--ignore-known-ignore-known-violations) | ||
1. [`--no-ignore-known`: don't ignore known violations](#--no-ignore-known) | ||
1. [`--help`/ no parameters: get help](#--help--no-parameters) | ||
|
@@ -749,7 +749,7 @@ Do not calculate metrics. You can use this to override an earlier set `--metrics | |
command line option or `metrics` option in a .dependency-cruiser.js configuration | ||
file. | ||
|
||
### `--info` showing what alt-js are supported | ||
### `--info` show what alt-js are supported | ||
|
||
Which alt-js languages dependency-cruiser supports depends on the availability | ||
it has to them. To see how dependency-cruiser perceives its environment use | ||
|
@@ -759,35 +759,50 @@ it has to them. To see how dependency-cruiser perceives its environment use | |
<summary>Typical output</summary> | ||
|
||
``` | ||
Supported: | ||
If you need a supported, but not enabled transpiler ('✖' below), install | ||
it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript' | ||
will enable livescript support if it's installed in your project folder. | ||
Transpilers: | ||
✔ javascript (>es1) | ||
✔ coffee-script (>=1.0.0 <2.0.0) | ||
✔ coffeescript (>=1.0.0 <3.0.0) | ||
✖ livescript (>=1.0.0 <2.0.0) | ||
✔ typescript (>=2.0.0 <4.0.0) | ||
Extensions: | ||
✔ .js | ||
✔ .mjs | ||
✔ .jsx | ||
✔ .vue | ||
✔ .ts | ||
✔ .tsx | ||
✔ .d.ts | ||
✖ .ls | ||
✔ .coffee | ||
✔ .litcoffee | ||
✔ .coffee.md | ||
✔ .csx | ||
✔ .cjsx | ||
[email protected] | ||
node version supported : ^18.17||>=20 | ||
node version found : v22.8.0 | ||
os version found : x64 [email protected] | ||
If you need a supported, but not enabled transpiler ('x' below), just install | ||
it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript' | ||
will enable livescript support if it's installed in your project folder. | ||
✔ transpiler versions supported version found | ||
- ---------------------- ------------------- ------------------------ | ||
✔ javascript * [email protected] | ||
✔ babel >=7.0.0 <8.0.0 @babel/[email protected] | ||
✔ coffee-script >=1.0.0 <2.0.0 [email protected] | ||
✔ coffeescript >=1.0.0 <3.0.0 [email protected] | ||
x livescript >=1.0.0 <2.0.0 - | ||
✔ svelte >=3.0.0 <5.0.0 svelte/[email protected] | ||
✔ swc >=1.0.0 <2.0.0 @swc/[email protected] | ||
✔ typescript >=2.0.0 <6.0.0 [email protected] | ||
✔ vue-template-compiler >=2.0.0 <3.0.0 vue-template-compiler | ||
✔ @vue/compiler-sfc >=3.0.0 <4.0.0 vue-template-compiler | ||
✔ extension | ||
- --------- | ||
✔ .js | ||
✔ .cjs | ||
✔ .mjs | ||
✔ .jsx | ||
✔ .ts | ||
✔ .tsx | ||
✔ .d.ts | ||
✔ .cts | ||
✔ .d.cts | ||
✔ .mts | ||
✔ .d.mts | ||
✔ .vue | ||
✔ .svelte | ||
x .ls | ||
✔ .coffee | ||
✔ .litcoffee | ||
✔ .coffee.md | ||
✔ .csx | ||
✔ .cjsx | ||
``` | ||
|
||
</details> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
import { createRequire } from "node:module"; | ||
|
||
export default { | ||
isAvailable: () => true, | ||
|
||
version: () => { | ||
const require = createRequire(import.meta.url); | ||
return `acorn@${require("acorn").version}`; | ||
}, | ||
|
||
transpile: (pSource) => pSource, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.