Skip to content

Commit b2a3251

Browse files
committed
Show build tools in CLI
1 parent 2c67f2d commit b2a3251

File tree

9 files changed

+49
-6
lines changed

9 files changed

+49
-6
lines changed

.changeset/moody-dancers-nail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@arethetypeswrong/cli": minor
3+
---
4+
5+
Report relevant build tools detected in package.json `devDependencies`

packages/cli/src/render/typed.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,23 @@ export async function typed(analysis: core.Analysis, opts: Opts) {
2121
headerIds: false,
2222
});
2323

24+
console.log(`${analysis.packageName} v${analysis.packageVersion}`);
25+
if (analysis.types.kind === "@types") {
26+
console.log(`${analysis.types.packageName} v${analysis.types.packageVersion}`);
27+
}
28+
console.log();
29+
if (Object.keys(analysis.buildTools).length) {
30+
console.log("Build tools:");
31+
console.log(
32+
Object.entries(analysis.buildTools)
33+
.map(([tool, version]) => {
34+
return `- ${tool}@${version}`;
35+
})
36+
.join("\n")
37+
);
38+
console.log();
39+
}
40+
2441
if (opts.ignoreRules && opts.ignoreRules.length) {
2542
console.log(
2643
chalk.gray(
@@ -31,12 +48,6 @@ export async function typed(analysis: core.Analysis, opts: Opts) {
3148
);
3249
}
3350

34-
console.log(`${analysis.packageName} v${analysis.packageVersion}`);
35-
if (analysis.types.kind === "@types") {
36-
console.log(`${analysis.types.packageName} v${analysis.types.packageVersion}`);
37-
}
38-
console.log();
39-
4051
if (opts.summary) {
4152
const defaultSummary = marked(!opts.emoji ? " No problems found" : " No problems found 🌟");
4253
const summaryTexts = Object.keys(grouped).map((kind) => {

packages/cli/test/snapshots/@apollo__client-3.7.16.tgz.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ $ attw @apollo__client-3.7.16.tgz -f table-flipped
66
77
@apollo/client v3.7.16
88
9+
Build tools:
10+
11+
12+
913
👺 Import resolved to an ESM type declaration file, but a CommonJS JavaScript file. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseESM.md
1014
1115
⚠️ A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md

packages/cli/test/snapshots/@[email protected]

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ $ attw @[email protected] -f table-flipped
66
77
@ice/app v3.2.6
88
9+
Build tools:
10+
- webpack@^5.86.0
11+
- esbuild@^0.17.16
12+
913
⚠️ A require call resolved to an ESM JavaScript file, which is an error in Node and some bundlers. CommonJS consumers will need to use a dynamic import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSResolvesToESM.md
1014
1115
💀 Import failed to resolve to type declarations or JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md

packages/cli/test/snapshots/@[email protected]

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ $ attw @[email protected] -f table-flipped
66
77
@reduxjs/toolkit v2.0.0-beta.0
88
9+
Build tools:
10+
- typescript@~4.9
11+
- @microsoft/api-extractor@^7.13.2
12+
913
🎭 Import resolved to a CommonJS type declaration file, but an ESM JavaScript file. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md
1014
1115
🥴 Import found in a type declaration file failed to resolve. Either this indicates that runtime resolution errors will occur, or (more likely) the types misrepresent the contents of the JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/InternalResolutionError.md

packages/cli/test/snapshots/[email protected]

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ $ attw [email protected] -f table-flipped
66
77
ajv v8.12.0
88
9+
Build tools:
10+
- typescript@^4.8.0
11+
- rollup@^2.44.0
12+
- @rollup/plugin-typescript@^10.0.1
13+
914
No problems found 🌟
1015
1116

packages/cli/test/snapshots/[email protected]

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ $ attw [email protected] -f table-flipped
66
77
axios v1.4.0
88
9+
Build tools:
10+
- typescript@^4.8.4
11+
- rollup@^2.67.0
12+
913
❓ Wildcard subpaths cannot yet be analyzed by this tool. https://github.com/arethetypeswrong/arethetypeswrong.github.io/issues/40
1014
1115
💀 Import failed to resolve to type declarations or JavaScript files. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/NoResolution.md

packages/cli/test/snapshots/[email protected] -f table.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ $ attw [email protected] -f table
66
77
commander v10.0.1
88
9+
Build tools:
10+
- typescript@^4.9.4
11+
912
🎭 Import resolved to a CommonJS type declaration file, but an ESM JavaScript file. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md
1013
1114
❌ Import resolved to JavaScript files, but no type declarations were found. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/UntypedResolution.md

packages/cli/test/snapshots/[email protected]

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ $ attw [email protected] -f table-flipped
66
77
node-html-parser v6.1.5
88
9+
Build tools:
10+
- typescript@latest
11+
912
🤨 CommonJS module simulates a default export with exports.default and exports.__esModule, but does not also set module.exports for compatibility with Node. Node, and some bundlers under certain conditions (https://andrewbranch.github.io/interop-test/#synthesizing-default-exports-for-cjs-modules), do not respect the __esModule marker, so accessing the intended default export will require a .default property access on the default import. https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/CJSOnlyExportsDefault.md
1013
1114

0 commit comments

Comments
 (0)