angular-v20-bulk-file-refactor 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Esther White
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # Angular v20 File Refactor
2
+
3
+ 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`.
4
+
5
+ ## Installation
6
+
7
+ ### Global Installation
8
+ Install the tool globally to use it from any directory:
9
+
10
+ ```bash
11
+ npm install -g angular-v20-bulk-file-refactor
12
+ ```
13
+
14
+ Run the tool directly:
15
+
16
+ ```bash
17
+ angular-v20-bulk-file-refactor /path/to/your/angular/project
18
+ ```
19
+
20
+ ### Local Installation
21
+ Install the tool locally within a project:
22
+
23
+ ```bash
24
+ npm install angular-v20-bulk-file-refactor
25
+ ```
26
+
27
+ Run the tool using `npx`:
28
+
29
+ ```bash
30
+ npx angular-v20-bulk-file-refactor /path/to/your/angular/project
31
+ ```
32
+
33
+ Alternatively, add a script to your `package.json`:
34
+
35
+ ```json
36
+ {
37
+ "scripts": {
38
+ "refactor": "angular-v20-bulk-file-refactor"
39
+ }
40
+ }
41
+ ```
42
+
43
+ Then run:
44
+
45
+ ```bash
46
+ npm run refactor -- /path/to/your/angular/project
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ Run the tool on your Angular project by specifying the project folder path. Use the global command or `npx` depending on your installation method.
52
+
53
+ ### Options
54
+
55
+ - `--skip-dirs <dirs>`: Comma-separated list of directories to skip during processing.
56
+ **Default**: `models,partials`
57
+ **Example**: `--skip-dirs models,tests` skips the `models` and `tests` directories.
58
+
59
+ - `--replace-file-name-segments <segments>`: Comma-separated list of file name segments to replace with a hyphenated version (e.g., `.service` becomes `-service` in the `services` folder).
60
+ **Default**: `services,directives`
61
+ **Example**: `--replace-file-name-segments services,pipes` replaces `.service` with `-service` in the `services` folder.
62
+
63
+ - `--remove-file-name-segments <segments>`: Comma-separated list of file name segments to remove (e.g., `.model` is removed from file names in the `models` folder).
64
+ **Default**: `models`
65
+ **Example**: `--remove-file-name-segments models,utils` removes `.model` from file names in the `models` folder.
66
+
67
+ - `--replace-import-segments <segments>`: Comma-separated list of import segments to replace (e.g., `.service` becomes `-service` in import statements).
68
+ **Default**: `.service`
69
+ **Example**: `--replace-import-segments .service` replaces `.service` with `-service` in imports.
70
+
71
+ - `--remove-import-segments <segments>`: Comma-separated list of import segments to remove from import statements.
72
+ **Default**: `.component,.directive,.model`
73
+ **Example**: `--remove-import-segments .component,.directive` removes these segments from imports.
74
+
75
+ ### Example
76
+
77
+ Run the tool on a specific Angular project folder with custom options:
78
+
79
+ ```bash
80
+ # Global installation
81
+ 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
82
+
83
+ # Local installation with default options
84
+ 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
85
+
86
+ # Local installation with custom options
87
+ 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
88
+
89
+ # Using package.json script
90
+ 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
91
+ ```
92
+
93
+ ## Compatibility
94
+
95
+ 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](github.com/esteecodes/angular-v20-bulk-file-refactor/issues).
96
+
97
+ ## License
98
+
99
+ MIT License. See [LICENSE](./LICENSE) for details.
100
+
101
+ ## Author
102
+
103
+ Esther White [esteecodes](https://github.com/esteecodes)
104
+
105
+ ## Repository
106
+
107
+ [github.com/esteecodes/angular-v20-bulk-file-refactor](https://github.com/esteecodes/angular-v20-bulk-file-refactor)
108
+
109
+ ## Issues
110
+
111
+ Report bugs or suggest improvements at [github.com/esteecodes/angular-v20-bulk-file-refactor/issues](https://github.com/esteecodes/angular-v20-bulk-file-refactor/issues).
112
+
113
+ ## Security Measures
114
+
115
+ This package includes several security features to protect users:
116
+ - **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.
117
+ - **GPG Signatures**: All binaries include `.asc` signature files that prove the software was created by the package author and not modified by third parties.
118
+ - **Automated Builds**: All binaries are built using GitHub Actions automated workflows, ensuring consistent and reproducible builds without manual intervention.
119
+
120
+ Read more at [keys/README.md](keys/README.md)
121
+
package/bin/cli.js ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+ const { program } = require('commander');
3
+ const { execFile } = require('child_process');
4
+ const path = require('path');
5
+
6
+ program
7
+ .version('1.0.01')
8
+ .description('CLI tool to refactor Angular 20 project files by renaming and updating contents')
9
+ .argument('<projectPath>', 'Path to the Angular project folder')
10
+ .option('-s, --skip-dirs <dirs>', 'Comma-separated list of directories to skip', 'models,partials')
11
+ .option('--replace-file-name-segments <segments>', 'Comma-separated list of file segments to replace (e.g., services,directives)', 'services,directives')
12
+ .option('--remove-file-name-segments <segments>', 'Comma-separated list of file segments to remove (e.g., models)', 'models')
13
+ .option('--replace-import-segments <segments>', 'Comma-separated list of import segments to replace (e.g., .service)', '.service')
14
+ .option('--remove-import-segments <segments>', 'Comma-separated list of import segments to remove (e.g., .component,.directive,.model)', '.component,.directive,.model')
15
+ .action((projectPath, options) => {
16
+ let binaryName;
17
+ switch (process.platform) {
18
+ case 'win32':
19
+ binaryName = 'angular-v20-bulk-file-refactor'; // Resolves to .exe on Windows
20
+ break;
21
+ case 'darwin':
22
+ binaryName = 'angular-v20-bulk-file-refactor-darwin';
23
+ break;
24
+ case 'linux':
25
+ binaryName = 'angular-v20-bulk-file-refactor-linux';
26
+ break;
27
+ default:
28
+ console.error(`Unsupported platform: ${process.platform}`);
29
+ process.exit(1);
30
+ }
31
+
32
+ const binaryPath = path.join(__dirname, binaryName);
33
+ const args = [
34
+ projectPath,
35
+ '--skip-dirs', options.skipDirs,
36
+ '--replace-file-name-segments', options.replaceFileNameSegments,
37
+ '--remove-file-name-segments', options.removeFileNameSegments,
38
+ '--replace-import-segments', options.replaceImportSegments,
39
+ '--remove-import-segments', options.removeImportSegments
40
+ ];
41
+
42
+ execFile(binaryPath, args, (error, stdout, stderr) => {
43
+ if (error) {
44
+ console.error('Error executing refactor binary:', stderr);
45
+ process.exit(1);
46
+ }
47
+ console.log(stdout);
48
+ });
49
+ });
50
+
51
+ program.parse(process.argv);
package/package.json ADDED
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "angular-v20-bulk-file-refactor",
3
+ "version": "1.0.01",
4
+ "description": "A CLI tool to automate file renaming and TypeScript refactoring for Angular 20 projects, aligning with conventions for components, services, directives, models, and standalone components.",
5
+ "keywords": [
6
+ "angular",
7
+ "angular20",
8
+ "angular-20",
9
+ "angular-v20",
10
+ "automation",
11
+ "automated-tool",
12
+ "refactor",
13
+ "typescript",
14
+ "cli",
15
+ "update",
16
+ "migration-tool",
17
+ "file-rename",
18
+ "file-refactor",
19
+ "bulk-file-refactor",
20
+ "bulk-file-rename",
21
+ "typescript-refactor",
22
+ "angular-cli",
23
+ "angular-refactoring",
24
+ "standalone"
25
+ ],
26
+ "license": "MIT",
27
+ "author": "Esther White <esteecodes@gmail.com>[](https://github.com/esteecodes)",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/esteecodes/angular-v20-bulk-file-refactor.git"
31
+ },
32
+ "homepage": "https://angular-v20-bulk-file-refactor.esteecodes.com",
33
+ "bin": {
34
+ "angular-v20-bulk-file-refactor": "./bin/cli.js"
35
+ },
36
+ "files": [
37
+ "bin/cli.js",
38
+ "bin/angular-v20-bulk-file-refactor.exe",
39
+ "bin/angular-v20-bulk-file-refactor-linux"
40
+ ],
41
+ "dependencies": {
42
+ "commander": "^12.1.0"
43
+ }
44
+ }