$ show e18e/cli
e18e/cli is a command-line tool that analyzes JavaScript and TypeScript projects for packaging issues, dependency health, and opportunities to replace dependencies with lighter or native alternatives. It runs multiple checks: publint for publishing best practices, dependency replacement suggestions from curated manifests (native, preferred, micro-utilities), core-js polyfill analysis against declared engine ranges, duplicate dependency detection, and web feature codemod suggestions. The CLI also includes a `migrate` subcommand that can automatically apply codemods to rewrite imports for selected replacements. The architecture is plugin-based: each analysis is a self-contained `ReportPlugin` that receives an `AnalysisContext` and returns messages and stats, aggregated by a `runPlugins` orchestrator. The tool uses an abstract `FileSystem` interface with a `LocalFileSystem` implementation, making it extensible for custom environments. Output is either an interactive TUI via @clack/prompts or JSON. This is a pre-1.0 project, actively developed with good code quality and comprehensive tests.
The LLM identified 3 files worth highlighting for reuse:
A pure function `analyzePackageModuleType` that determines whether a package is CJS, ESM, dual, faux, or DTS based on its package.json. It examines exports map, main field, type field, and extensions. This logic is ported from a well-known tool and is fully self-contained with no internal imports. It can be extracted and reused in any Node.js project that needs to classify package module types.
A set of pure functions for computing trust levels of npm packages based on provenance attestations. Includes `getProvenance`, `getTrustLevel`, `getMinTrustLevel`, and `computeTrustSummary`. All functions are stateless, well-typed, and have no internal dependencies. This module could be reused in any security tool or audit system to evaluate dependency trustworthiness.
Handles parsing of `--categories` CLI option into either `'all'` or a `Set` of category keys, validates against allowed values, and provides `getManifestForCategories` to merge category-specific replacement manifests into a single `ManifestModule`. The parsing logic is reusable for any CLI that accepts similar scoped filters, and the manifest merging pattern could be generalized for combining multiple data sources.