hermex 1.2.0 → 1.3.0-beta.2
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.md +21 -21
- package/README.md +114 -114
- package/dist/cli.mjs +1874 -0
- package/dist/cli.mjs.map +1 -0
- package/package.json +45 -42
- package/dist/cli.js +0 -1520
- package/dist/cli.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Gal Levy
|
|
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.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gal Levy
|
|
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
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
# hermex
|
|
2
|
-
|
|
3
|
-
SWC-based AST parser for analyzing code and React component usage patterns across entire codebases
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
# No installation required - use npx (scans current directory)
|
|
9
|
-
npx hermex scan
|
|
10
|
-
|
|
11
|
-
# Or install globally
|
|
12
|
-
npm install -g hermex
|
|
13
|
-
hermex scan
|
|
14
|
-
|
|
15
|
-
# Scan specific directory
|
|
16
|
-
npx hermex scan "src/**/*.tsx"
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Requirements
|
|
20
|
-
|
|
21
|
-
- Node.js 20+
|
|
22
|
-
|
|
23
|
-
## Key Features
|
|
24
|
-
|
|
25
|
-
- **Fast SWC-based Parsing**: Lightning-fast static analysis using SWC's Rust-based parser
|
|
26
|
-
- **Comprehensive Pattern Detection**: Identifies 10+ React usage patterns including:
|
|
27
|
-
- Direct imports (default, named, namespace, aliased)
|
|
28
|
-
- JSX element usage
|
|
29
|
-
- Variable assignments and destructuring
|
|
30
|
-
- Conditional usage (ternary operators)
|
|
31
|
-
- Collection mappings (arrays and objects)
|
|
32
|
-
- Lazy and dynamic imports
|
|
33
|
-
- Advanced patterns (HOC, memo, forwardRef, portals)
|
|
34
|
-
- **Version Tracking**: Components reported with exact package versions from lockfiles
|
|
35
|
-
- **Multi-Lockfile Support**: Parses package-lock.json, yarn.lock, and pnpm-lock.yaml
|
|
36
|
-
- **Flexible Output**: Table and chart visualization formats
|
|
37
|
-
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
38
|
-
|
|
39
|
-
## Installation
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Global installation
|
|
43
|
-
npm install -g hermex
|
|
44
|
-
|
|
45
|
-
# Or with pnpm
|
|
46
|
-
pnpm add -g hermex
|
|
47
|
-
|
|
48
|
-
# Or with yarn
|
|
49
|
-
yarn global add hermex
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
## CLI Usage
|
|
53
|
-
|
|
54
|
-
### Main CLI
|
|
55
|
-
|
|
56
|
-
```bash
|
|
1
|
+
# hermex
|
|
2
|
+
|
|
3
|
+
SWC-based AST parser for analyzing code and React component usage patterns across entire codebases
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# No installation required - use npx (scans current directory)
|
|
9
|
+
npx hermex scan
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g hermex
|
|
13
|
+
hermex scan
|
|
14
|
+
|
|
15
|
+
# Scan specific directory
|
|
16
|
+
npx hermex scan "src/**/*.tsx"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
|
|
21
|
+
- Node.js 20+
|
|
22
|
+
|
|
23
|
+
## Key Features
|
|
24
|
+
|
|
25
|
+
- **Fast SWC-based Parsing**: Lightning-fast static analysis using SWC's Rust-based parser
|
|
26
|
+
- **Comprehensive Pattern Detection**: Identifies 10+ React usage patterns including:
|
|
27
|
+
- Direct imports (default, named, namespace, aliased)
|
|
28
|
+
- JSX element usage
|
|
29
|
+
- Variable assignments and destructuring
|
|
30
|
+
- Conditional usage (ternary operators)
|
|
31
|
+
- Collection mappings (arrays and objects)
|
|
32
|
+
- Lazy and dynamic imports
|
|
33
|
+
- Advanced patterns (HOC, memo, forwardRef, portals)
|
|
34
|
+
- **Version Tracking**: Components reported with exact package versions from lockfiles
|
|
35
|
+
- **Multi-Lockfile Support**: Parses package-lock.json, yarn.lock, and pnpm-lock.yaml
|
|
36
|
+
- **Flexible Output**: Table and chart visualization formats
|
|
37
|
+
- **Zero Configuration**: Works out of the box with sensible defaults
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Global installation
|
|
43
|
+
npm install -g hermex
|
|
44
|
+
|
|
45
|
+
# Or with pnpm
|
|
46
|
+
pnpm add -g hermex
|
|
47
|
+
|
|
48
|
+
# Or with yarn
|
|
49
|
+
yarn global add hermex
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## CLI Usage
|
|
53
|
+
|
|
54
|
+
### Main CLI
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
57
|
Usage: hermex [options] [command]
|
|
58
58
|
|
|
59
59
|
Analyze React component usage patterns in your codebase
|
|
@@ -64,14 +64,14 @@ Options:
|
|
|
64
64
|
|
|
65
65
|
Commands:
|
|
66
66
|
scan [options] [pattern] Scan and analyze local files
|
|
67
|
-
help [command] display help for command
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### Scan Command
|
|
71
|
-
|
|
72
|
-
The `scan` command analyzes local files for React component usage patterns.
|
|
73
|
-
|
|
74
|
-
```bash
|
|
67
|
+
help [command] display help for command
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Scan Command
|
|
71
|
+
|
|
72
|
+
The `scan` command analyzes local files for React component usage patterns.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
75
|
Usage: hermex scan [options] [pattern]
|
|
76
76
|
|
|
77
77
|
Scan and analyze local files
|
|
@@ -99,14 +99,14 @@ Options:
|
|
|
99
99
|
--no-patterns Do not show patterns
|
|
100
100
|
--ignore-errors Continue scanning even if some files fail to
|
|
101
101
|
parse
|
|
102
|
-
-h, --help display help for command
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Example Output
|
|
106
|
-
|
|
107
|
-
Running a basic scan (uses default pattern `**/*.{tsx,jsx,ts,js}`):
|
|
108
|
-
|
|
109
|
-
```bash
|
|
102
|
+
-h, --help display help for command
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Example Output
|
|
106
|
+
|
|
107
|
+
Running a basic scan (uses default pattern `**/*.{tsx,jsx,ts,js}`):
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
110
|
📦 Packages
|
|
111
111
|
|
|
112
112
|
No packages found
|
|
@@ -155,45 +155,45 @@ Total: 272 patterns detected
|
|
|
155
155
|
│ External Components │ 0 │
|
|
156
156
|
├─────────────────────┼───────┤
|
|
157
157
|
│ Total Usages │ 0 │
|
|
158
|
-
└─────────────────────┴───────┘
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
## Use Cases
|
|
162
|
-
|
|
163
|
-
1. **Dependency Audits** - Understand library usage before migrations
|
|
164
|
-
2. **Version Tracking** - Know exactly which component versions are in use
|
|
165
|
-
3. **Migration Planning** - Identify components that need updating when migrating UI libraries
|
|
166
|
-
4. **Component Analytics** - Track most-used components and usage patterns
|
|
167
|
-
5. **Code Quality** - Identify complex usage patterns that may need refactoring
|
|
168
|
-
6. **Team Insights** - Understand how your team uses component libraries
|
|
169
|
-
7. **Documentation** - Generate usage reports for component library documentation
|
|
170
|
-
|
|
171
|
-
## Documentation
|
|
172
|
-
|
|
173
|
-
- **[Examples](./docs/examples.md)** - Comprehensive examples and command usage
|
|
174
|
-
- **[Patterns Guide](./docs/patterns.md)** - All detectable React usage patterns
|
|
175
|
-
|
|
176
|
-
## Tech Stack
|
|
177
|
-
|
|
178
|
-
- **Runtime**: Node.js 24
|
|
179
|
-
- **Parser**: [@swc/core](https://swc.rs/)
|
|
180
|
-
- **CLI**: [Commander.js](https://github.com/tj/commander.js)
|
|
181
|
-
- **Build**: [tsup](https://tsup.egoist.dev/)
|
|
182
|
-
- **Language**: [TypeScript](https://www.typescriptlang.org/)
|
|
183
|
-
- **Formatter**: [Biome](https://biomejs.dev/)
|
|
184
|
-
- **Linter**: [oxlint](https://oxc-project.github.io/)
|
|
185
|
-
- **Tests**: [Vitest](https://vitest.dev/)
|
|
186
|
-
|
|
187
|
-
## Contributing
|
|
188
|
-
|
|
189
|
-
Contributions are welcome! Please read our [Contributing Guide](./CONTRIBUTING.md) for details.
|
|
190
|
-
|
|
191
|
-
## License
|
|
192
|
-
|
|
193
|
-
MIT License - see [LICENSE.md](./LICENSE.md)
|
|
194
|
-
|
|
195
|
-
## Links
|
|
196
|
-
|
|
197
|
-
- [GitHub Repository](https://github.com/Gallevy/hermex.git)
|
|
198
|
-
- [npm Package](https://www.npmjs.com/package/hermex)
|
|
199
|
-
- [Report Issues](https://github.com/Gallevy/hermex.git/issues)
|
|
158
|
+
└─────────────────────┴───────┘
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Use Cases
|
|
162
|
+
|
|
163
|
+
1. **Dependency Audits** - Understand library usage before migrations
|
|
164
|
+
2. **Version Tracking** - Know exactly which component versions are in use
|
|
165
|
+
3. **Migration Planning** - Identify components that need updating when migrating UI libraries
|
|
166
|
+
4. **Component Analytics** - Track most-used components and usage patterns
|
|
167
|
+
5. **Code Quality** - Identify complex usage patterns that may need refactoring
|
|
168
|
+
6. **Team Insights** - Understand how your team uses component libraries
|
|
169
|
+
7. **Documentation** - Generate usage reports for component library documentation
|
|
170
|
+
|
|
171
|
+
## Documentation
|
|
172
|
+
|
|
173
|
+
- **[Examples](./docs/examples.md)** - Comprehensive examples and command usage
|
|
174
|
+
- **[Patterns Guide](./docs/patterns.md)** - All detectable React usage patterns
|
|
175
|
+
|
|
176
|
+
## Tech Stack
|
|
177
|
+
|
|
178
|
+
- **Runtime**: Node.js 24
|
|
179
|
+
- **Parser**: [@swc/core](https://swc.rs/)
|
|
180
|
+
- **CLI**: [Commander.js](https://github.com/tj/commander.js)
|
|
181
|
+
- **Build**: [tsup](https://tsup.egoist.dev/)
|
|
182
|
+
- **Language**: [TypeScript](https://www.typescriptlang.org/)
|
|
183
|
+
- **Formatter**: [Biome](https://biomejs.dev/)
|
|
184
|
+
- **Linter**: [oxlint](https://oxc-project.github.io/)
|
|
185
|
+
- **Tests**: [Vitest](https://vitest.dev/)
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions are welcome! Please read our [Contributing Guide](./CONTRIBUTING.md) for details.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
MIT License - see [LICENSE.md](./LICENSE.md)
|
|
194
|
+
|
|
195
|
+
## Links
|
|
196
|
+
|
|
197
|
+
- [GitHub Repository](https://github.com/Gallevy/hermex.git)
|
|
198
|
+
- [npm Package](https://www.npmjs.com/package/hermex)
|
|
199
|
+
- [Report Issues](https://github.com/Gallevy/hermex.git/issues)
|