CLI
The e18e CLI is a powerful tool for analyzing and optimizing your JavaScript/TypeScript projects. It helps you identify performance issues, find optimization opportunities, and automatically migrate to suggested dependencies.
Quick Start
# Install and run analysis
npx @e18e/cli analyze
# Migrate packages interactively
npx @e18e/cli migrate --interactiveInstallation
You can install the e18e CLI globally or use it with npx:
npm install -g @e18e/cliyarn global add @e18e/clipnpm add -g @e18e/clibun add -g @e18e/cliCommands
analyze
Analyzes your project for various issues and provides recommendations for optimization.
e18e-cli analyze [path] [options]Arguments:
path(optional) - Path to a directory or tarball file to analyze. Defaults to current directory.
Options:
--pack <type>- Package manager to use for packing. Options:auto,npm,yarn,pnpm,bun,none. Default:auto--log-level <level>- Set the log level. Options:debug,info,warn,error. Default:info--manifest <path>- Path(s) to custom manifest file(s) for module replacements analysis
Examples:
# Analyze current project
e18e-cli analyze
# Analyze with debug output
e18e-cli analyze --log-level debug
# Analyze with specific package manager
e18e-cli analyze --pack pnpmmigrate
Migrates your project from packages to more performant alternatives.
e18e-cli migrate [packages...] [options]Arguments:
packages...- Names of packages to migrate (e.g.,chalk,lodash)
Options:
--dry-run- Don't apply any fixes, only show what would change--include <pattern>- Files to migrate. Default:**/*.{ts,js}--interactive- Run in interactive mode
Examples:
# Migrate specific packages
e18e-cli migrate chalk lodash
# Preview changes without applying
e18e-cli migrate chalk --dry-run
# Interactive mode to select packages
e18e-cli migrate --interactiveReplacements System
The CLI uses a set of codemods from the module-replacements-codemods project for migrations, and replacements from the replacements list.
Default Replacements
The CLI comes with pre-configured replacements for common performance optimizations. You can find the list of the current replacements in the replacements docs.
IMPORTANT
The replacement list is still being developed and expanded. The current list represents the initial set of well-tested migrations. More replacements will be added as they are validated and tested across the ecosystem.
Custom Manifests
You can bring your own replacement rules by providing custom manifest files:
{
"replacements": [
{
"moduleName": "custom-module",
"type": "simple",
"replacement": "Use picocolors, kleur, or native console styling"
}
]
}Use custom manifests with the --manifest option:
e18e-cli analyze --manifest ./my-replacements.jsonTroubleshooting
Common Issues
"No package.json found"
- Make sure you're running the command from a project directory
- Check that package.json exists in the current or specified directory
"Path must be a tarball file or a directory"
- Ensure the path you're providing is valid
- For tarballs, make sure the file has a
.tgzextension
Permission errors
- Try running with
npxinstead of global installation - Check file permissions in your project directory
Debug Mode
For detailed debugging information, use the --log-level debug option:
e18e-cli analyze --log-level debugThis will show detailed information about what the CLI is doing and help identify issues.