check-duplicate-component-selectors
v1.0.1
Published
A tool to check for duplicate Angular component selectors across your project
Maintainers
Readme
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-selectorsQuick 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-checkCommand 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
|| truein 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
