1.0.1 • Published 5 months ago
check-duplicate-component-selectors v1.0.1
check-duplicate-component-selectors
A command-line tool to detect duplicate component selectors in your frontend projects. While it works with any framework that uses component selectors, it's particularly useful for Angular, Web Components, and similar frameworks.
Features
- ✨ Scans multiple directories for component files
- 🔍 Detects duplicate selectors across your codebase
- 📊 Provides detailed reports with file locations
- 🎨 Colorized output for better readability
- 🛠 Configurable component file suffix
- 📈 Shows summary statistics
Installation
# Using npm
npm install -g check-duplicate-component-selectors
# Using pnpm
pnpm add -g check-duplicate-component-selectors
# Using yarn
yarn global add check-duplicate-component-selectors
Quick Start
# Basic usage
check-duplicate-component-selectors "src/app;libs"
# OR
cdcs "src/app;libs"
# With custom suffix
check-duplicate-component-selectors "src/app" --suffix ".component.js"
# OR
cdcs "src/app" --suffix ".component.js"
Documentation
Basic Example
Add to your package.json:
{
"scripts": {
"check-selectors": "check-duplicate-component-selectors \"src/app;libs\""
}
}
Then run:
npm run check-selectors
# OR
npm run cdcs-check
Command Line Options
-s, --suffix <suffix>
: Specify the component file suffix (default:.component.ts
)-v, --version
: Show version number-h, --help
: Show help
Exit Codes
0
: No duplicates found (success)1
: Duplicates found or error occurred- Use
|| true
in npm scripts to ignore failures - Useful for CI/CD to catch selector conflicts
- Use
Supported File Types
By default, the tool looks for files with the .component.ts
extension, but you can configure this using the --suffix
option to support other file types.
Contributing
Contributions are welcome! Please see our Contributing Guide for details.
License
MIT