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
.
Install the tool globally to use it from any directory:
npm install -g angular-v20-bulk-file-refactor
Run the tool directly:
angular-v20-bulk-file-refactor /path/to/your/angular/project
Install the tool locally within a project:
npm install angular-v20-bulk-file-refactor
Run the tool using npx
:
npx angular-v20-bulk-file-refactor /path/to/your/angular/project
Alternatively, add a script to your package.json
:
{
"scripts": {
"refactor": "angular-v20-bulk-file-refactor"
}
}
Then run:
npm run refactor -- /path/to/your/angular/project
Run 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,tests
skips themodels
andtests
directories. -
--replace-file-name-segments <segments>
: Comma-separated list of file name segments to replace with a hyphenated version (e.g.,.service
becomes-service
in theservices
folder).
Default:services,directives
Example:--replace-file-name-segments services,pipes
replaces.service
with-service
in theservices
folder. -
--remove-file-name-segments <segments>
: Comma-separated list of file name segments to remove (e.g.,.model
is removed from file names in themodels
folder).
Default:models
Example:--remove-file-name-segments models,utils
removes.model
from file names in themodels
folder. -
--replace-import-segments <segments>
: Comma-separated list of import segments to replace (e.g.,.service
becomes-service
in import statements).
Default:.service
Example:--replace-import-segments .service
replaces.service
with-service
in 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,.directive
removes 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,utils
This 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
.sha256
file containing a unique fingerprint that verifies the file hasn't been tampered with during download. - GPG Signatures: All binaries include
.asc
signature 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