A powerful CLI tool for analyzing JavaScript/TypeScript imports from libraries.
Version 0.1.1 - First stable release! π See CHANGELOG.md for details.
π Complete Documentation β
See Importy in action analyzing a React project! View full demo β
Importy scans your codebase to identify and analyze imports from specific libraries. It helps you:
- Identify which components from a library are being used in your codebase
- Find all occurrences of specific imported components
- Analyze library usage patterns across your project
- Generate detailed reports for dependency management
# Using npm
npm install -g importy
# Using yarn
yarn global add importy
# Using pnpm
pnpm add -g importy
# Verify installation
importy --version # Should output: 0.1.0
importy --dir <directory> --lib <library-name> [options]
-d, --dir <directory>
: Directory to scan (required)-l, --lib <library>
: Library name to match (required)
-o, --output <file>
: Output results to a JSON file instead of stdout-v, --verbose
: Enable verbose logging-i, --include <pattern>
: Only include files matching pattern (glob)-e, --exclude <pattern>
: Exclude files matching pattern (glob)-c, --concurrency <number>
: Number of worker threads (defaults to CPU count - 1)--version
: Show version number--help
: Show help
# Find all React imports in src directory
importy --dir ./src --lib react
# Find all MUI components used in your project
importy --dir ./src --lib @mui/material
# Export results to a JSON file
importy --dir ./src --lib lodash --output imports.json
# Only scan TypeScript files
importy --dir ./src --lib axios --include "**/*.ts"
# Exclude test files
importy --dir ./src --lib react --exclude "**/*.test.{ts,tsx}"
# Limit concurrency
importy --dir ./src --lib react --concurrency 4
The tool outputs JSON in the following format:
{
"summary": {
"library": "react",
"componentsFound": 5,
"totalImports": 12,
"filesScanned": 42
},
"components": {
"useState": [
"src/components/Counter.tsx",
"src/components/Form.tsx"
],
"useEffect": [
"src/components/Dashboard.tsx"
],
"Component": [
"src/components/BaseComponent.tsx"
]
}
}
Importy uses parallel processing with promises, making it efficient even for large codebases. You can adjust the concurrency level to match your system's capabilities using the --concurrency
option.
- Node.js 18+
- npm, yarn, or pnpm
# Clone the repository
git clone https://github.com/yourusername/importy.git
cd importy
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
Importy uses Vitest for testing. There are two types of tests:
- Programmatic tests: Test the core functionality through the JavaScript API
- CLI tests: Test the command-line interface
Run tests with:
# Run all tests
npm test
# Run specific tests
npx vitest run tests/programmatic.test.ts
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
# Setup
git clone https://github.com/tvshevchuk/Importy.git
cd importy
pnpm install
# Development
npm run dev # Development mode
npm run check # Code quality checks
npm test # Run tests
npm run build # Build project
# Release (maintainers only)
npm run release:check # Check if ready for release
npm run release:patch # Create patch release
npm run release:minor # Create minor release
npm run release:major # Create major release
This project uses automated releases via GitHub Actions. When a pull request with a version bump is merged to main, it automatically:
- Runs tests and quality checks
- Updates the changelog
- Creates a GitHub release
- Publishes to npm
See Release Process for detailed information.
- ES Module Compatibility: If you encounter issues with ES modules, ensure your Node.js version is compatible (18+) and you're using the correct import syntax.
- Parsing Errors: Complex TypeScript/JSX syntax may occasionally cause parsing errors. These files are skipped with a warning.
See CHANGELOG.md for a detailed history of changes and releases.
This project is licensed under the MIT License - see the LICENSE file for details.