arethetypeswrong / arethetypeswrong.github.io

Tool for analyzing TypeScript types of npm packages
https://arethetypeswrong.github.io
MIT License
1.18k stars 41 forks source link

[New] add `--entrypoints-legacy` CLI command #156

Closed ljharb closed 7 months ago

ljharb commented 7 months ago

Note that the snapshots here are incorrect - despite these changes working as expected on the actual project/version in question, it's not working when i run the tests locally.

Closes #153.

changeset-bot[bot] commented 7 months ago

🦋 Changeset detected

Latest commit: ab6cd95931b4b3abd1356bcf2adc2d108d4bd417

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages | Name | Type | | ------------------------- | ----- | | @arethetypeswrong/cli | Minor | | @arethetypeswrong/core | Minor | | @arethetypeswrong/history | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

ljharb commented 7 months ago

ah, hmm, i suppose that's true - i was assuming it runs in-situ, but i guess the pack option takes care of that?

I'll refactor to just look at the files, and that should remove the need for path as well as the added deps.

ljharb commented 7 months ago

thanks, that's much simpler. the snapshot still isn't matching the actual behavior of the built cli, tho.

andrewbranch commented 7 months ago

I checked this out locally, ran tests, and got a new snapshot:

❯ git diff --staged
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
added: packages/cli/test/snapshots/eslint-module-utils@2.8.1.tgz --entrypoints-legacy --ignore-rules=cjs-only-exports-default.md
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ packages/cli/test/snapshots/eslint-module-utils@2.8.1.tgz --entrypoints-legacy --ignore-rules=cjs-only-exports-default.md:4 @
# eslint-module-utils@2.8.1.tgz --entrypoints-legacy --ignore-rules=cjs-only-exports-default

$ attw eslint-module-utils@2.8.1.tgz --entrypoints-legacy --ignore-rules=cjs-only-exports-default

eslint-module-utils v2.8.1

Build tools:

┌─────────────────────────────────────────┬────────┬───────────────────┬───────────────────┬─────────┐ │ │ node10 │ node16 (from CJS) │ node16 (from ESM) │ bundler │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/declaredScope.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/hash.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/ignore.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/module-require.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/ModuleCache.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/moduleVisitor.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/parse.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/pkgDir.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/pkgUp.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/readPkgUp.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/resolve.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/unambiguous.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ ├─────────────────────────────────────────┼────────┼───────────────────┼───────────────────┼─────────┤ │ "eslint-module-utils/visit.js" │ 🟢 │ 🟢 (CJS) │ 🟢 (CJS) │ 🟢 │ └─────────────────────────────────────────┴────────┴───────────────────┴───────────────────┴─────────┘


Exit code: 0
\ No newline at end of file

I think this looks right? What are you getting?

ljharb commented 7 months ago

That's totally right! what i get is what's in this PR :-/

ljharb commented 7 months ago

I was able to effectively start from scratch and get the md to update, but the json snapshot data still doesn't look right.

andrewbranch commented 7 months ago

the json snapshot data still doesn't look right

The JSON snapshot is running the core library with default options; only the CLI test is getting the entrypointsLegacy option.

ljharb commented 7 months ago

Updated except for https://github.com/arethetypeswrong/arethetypeswrong.github.io/pull/156#discussion_r1504670172

I'm happy to expand the functionality, in this PR, so that --exclude-entrypoints can be used in concert with --entrypoints-legacy - but it should probably be an error to use --entrypoints or --include-entrypoints with it, since there's nothing that can possibly be included that's not already in the file list?

andrewbranch commented 7 months ago

Thanks @ljharb!