A CLI tool to automate file renaming and content refactoring for Angular 20 projects. This tool updates file names and TypeScript file contents to align with Angular 20 conventions, handling patterns like .component, .service, .directive, and .model.
The project path you provide must include
/src/appIf you omit
/src/app, the tool will not work and will throw an error.Example:
✅npx angular-v20-bulk-file-refactor /path/to/angular/project/src/app
❌npx angular-v20-bulk-file-refactor /path/to/angular/project
Install the tool globally to use it from any directory:
npm install -g angular-v20-bulk-file-refactorRun the tool directly:
angular-v20-bulk-file-refactor /path/to/your/angular/project/src/appInstall the tool locally within a project:
npm install angular-v20-bulk-file-refactorRun the tool using npx:
npx angular-v20-bulk-file-refactor /path/to/your/angular/project/src/appAlternatively, add a script to your package.json:
{
"scripts": {
"refactor": "angular-v20-bulk-file-refactor"
}
}Then run:
npm run refactor -- /path/to/your/angular/project/src/appRun the tool on your Angular project by specifying the project folder path. Use the global command or npx depending on your installation method.
-
--skip-dirs <dirs>: Comma-separated list of directories to skip during processing.
Default:models,partials
Example:--skip-dirs models,testsskips themodelsandtestsdirectories. -
--replace-file-name-segments <segments>: Comma-separated list of file name segments to replace with a hyphenated version (e.g.,.servicebecomes-servicein theservicesfolder).
Default:services,directives
Example:--replace-file-name-segments services,pipesreplaces.servicewith-servicein theservicesfolder. -
--remove-file-name-segments <segments>: Comma-separated list of file name segments to remove (e.g.,.modelis removed from file names in themodelsfolder).
Default:models
Example:--remove-file-name-segments models,utilsremoves.modelfrom file names in themodelsfolder. -
--replace-import-segments <segments>: Comma-separated list of import segments to replace (e.g.,.servicebecomes-servicein import statements).
Default:.service
Example:--replace-import-segments .servicereplaces.servicewith-servicein imports. -
--remove-import-segments <segments>: Comma-separated list of import segments to remove from import statements.
Default:.component,.directive,.model
Example:--remove-import-segments .component,.directiveremoves these segments from imports.
Run the tool on a specific Angular project folder with custom options:
# Global installation
angular-v20-bulk-file-refactor D:\\Estee\\Programming\\My-Projects\\angular-app\\src\\app --skip-dirs models,tests --replace-file-name-segments services,pipes --remove-file-name-segments models,utils
# Local installation with default options
npx angular-v20-bulk-file-refactor D:\\Estee\\Programming\\My-Projects\\angular-app\\src\\app --skip-dirs models,partials --replace-file-name-segments services,directives --remove-file-name-segments models --replace-import-segments .service --remove-import-segments .component,.directive,.model
# Local installation with custom options
npx angular-v20-bulk-file-refactor D:\\Estee\\Programming\\My-Projects\\angular-app\\src\\app --skip-dirs models,tests --replace-file-name-segments services,pipes --remove-file-name-segments models,utils
# Using package.json script
npm run refactor -- D:\\Estee\\Programming\\My-Projects\\angular-app\\src\\app --skip-dirs models,tests --replace-file-name-segments services,pipes --remove-file-name-segments models,utilsThis tool has been tested on Windows and works reliably. A Linux binary is included but hasn’t been fully tested yet. I’d love to hear how it performs on Linux or macOS! Please share your experience or report issues at github.com/esteecodes/angular-v20-bulk-file-refactor/issues.
MIT License. See LICENSE for details.
Esther White esteecodes
github.com/esteecodes/angular-v20-bulk-file-refactor
Report bugs or suggest improvements at github.com/esteecodes/angular-v20-bulk-file-refactor/issues.
This package includes several security features to protect users:
- SHA-256 Verification: Each binary comes with a
.sha256file containing a unique fingerprint that verifies the file hasn't been tampered with during download. - GPG Signatures: All binaries include
.ascsignature files that prove the software was created by the package author and not modified by third parties. - Automated Builds: All binaries are built using GitHub Actions automated workflows, ensuring consistent and reproducible builds without manual intervention.
Read more at keys/README.md