hermex 1.1.1 → 1.2.0

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/README.md CHANGED
@@ -1,186 +1,164 @@
1
- # Hermex
1
+ # hermex
2
2
 
3
- A powerful SWC-based tool for analyzing React component usage patterns across codebases. Understand how UI library components are used, track dependencies with exact versions, and generate comprehensive reports.
3
+ SWC-based AST parser for analyzing code and React component usage patterns across entire codebases
4
4
 
5
- ## 🚀 Quick Start
5
+ ## Quick Start
6
6
 
7
7
  ```bash
8
- # No installation required - use npx
9
- npx hermex scan "src/**/*.tsx"
8
+ # No installation required - use npx (scans current directory)
9
+ npx hermex scan
10
10
 
11
11
  # Or install globally
12
12
  npm install -g hermex
13
- hermex scan "src/**/*.tsx"
13
+ hermex scan
14
14
 
15
- # Or install locally
16
- npm install hermex
15
+ # Scan specific directory
17
16
  npx hermex scan "src/**/*.tsx"
18
17
  ```
19
18
 
20
- ## 📦 Requirements
19
+ ## Requirements
20
+
21
21
  - Node.js 20+
22
- <!--- Node.js @cli_build_node+ -->
23
22
 
24
- ## 📊 Key Features
23
+ ## Key Features
25
24
 
26
25
  - **Fast SWC-based Parsing**: Lightning-fast static analysis using SWC's Rust-based parser
27
- - **Pattern Detection**: Identifies 10+ React usage patterns including:
28
- - Direct imports and JSX usage
26
+ - **Comprehensive Pattern Detection**: Identifies 10+ React usage patterns including:
27
+ - Direct imports (default, named, namespace, aliased)
28
+ - JSX element usage
29
29
  - Variable assignments and destructuring
30
- - Conditional usage and object mappings
31
- - Namespace imports and aliased imports
32
- - Portal usage
30
+ - Conditional usage (ternary operators)
31
+ - Collection mappings (arrays and objects)
32
+ - Lazy and dynamic imports
33
+ - Advanced patterns (HOC, memo, forwardRef, portals)
33
34
  - **Version Tracking**: Components reported with exact package versions from lockfiles
34
35
  - **Multi-Lockfile Support**: Parses package-lock.json, yarn.lock, and pnpm-lock.yaml
35
36
  - **Flexible Output**: Table and chart visualization formats
36
37
  - **Zero Configuration**: Works out of the box with sensible defaults
37
38
 
38
- ## 📋 Commands
39
-
40
- ### `scan` Command
41
-
42
- Scan and analyze local files for React component usage patterns.
43
-
44
- ```bash
45
- hermex scan [pattern] [options]
46
- ```
47
-
48
- #### Arguments
49
-
50
- | Argument | Description | Default |
51
- |----------|-------------|---------|
52
- | `[pattern]` | Glob pattern for files to analyze | `**/*.{tsx,jsx,ts,js}` |
53
-
54
- #### Options
55
-
56
- | Option | Description | Values | Default |
57
- |--------|-------------|--------|---------|
58
- | `--ignore <pattern>` | Glob pattern for files to ignore | Any glob pattern | `**/node_modules/**`, `**/dist/**`, `**/build/**` |
59
- | `--allow-packages <pattern>` | Glob pattern for packages to scan | Any glob pattern | `ALL` |
60
- | `--ignore-packages <pattern>` | Glob pattern for packages to ignore | Any glob pattern | None |
61
- | `--summary [mode]` | Show summary statistics | `log`, `false` | `log` |
62
- | `--no-summary` | Do not show summary stats | - | - |
63
- | `--details` | Show detailed pattern counts | - | `false` |
64
- | `--components [mode]` | Show components table/chart | `table`, `chart` | `table` |
65
- | `--no-components` | Do not show components | - | - |
66
- | `--packages [mode]` | Show packages table/chart | `table`, `chart` | `table` |
67
- | `--no-packages` | Do not show packages | - | - |
68
- | `--patterns [mode]` | Show patterns table/chart | `table`, `chart` | `table` |
69
- | `--no-patterns` | Do not show patterns | - | - |
70
-
71
- #### Examples
39
+ ## Installation
72
40
 
73
41
  ```bash
74
- # Basic scan with defaults
75
- hermex scan
76
-
77
- # Scan specific directory
78
- hermex scan "src/**/*.tsx"
79
-
80
- # Show only summary and components
81
- hermex scan --no-patterns --no-packages
42
+ # Global installation
43
+ npm install -g hermex
82
44
 
83
- # Chart visualization
84
- hermex scan --components chart --patterns chart
45
+ # Or with pnpm
46
+ pnpm add -g hermex
85
47
 
86
- # Minimal output
87
- hermex scan --no-summary --no-patterns
48
+ # Or with yarn
49
+ yarn global add hermex
88
50
  ```
89
51
 
90
- ## 🎯 Example Output
52
+ ## CLI Usage
91
53
 
92
- ### Lockfile Detection
93
- ```
94
- ✔ 📦 Found pnpm lockfile (supports: v5, v6, v9) - 156 packages
95
- ```
54
+ ### Main CLI
96
55
 
97
- ### File Analysis
98
- ```
99
- ✔ Found 42 files
100
- Analysis complete! Analyzed 42 files
56
+ ```bash
57
+ Usage: hermex [options] [command]
58
+
59
+ Analyze React component usage patterns in your codebase
60
+
61
+ Options:
62
+ -V, --version output the version number
63
+ -h, --help display help for command
64
+
65
+ Commands:
66
+ scan [options] [pattern] Scan and analyze local files
67
+ help [command] display help for command
101
68
  ```
102
69
 
103
- ### Packages Table
104
- ```
105
- 📦 Packages
70
+ ### Scan Command
106
71
 
107
- ┌───────────────────────────┬─────────┬────────────┬───────┬────────────┐
108
- │ Package │ Version │ Components │ Usage │ Percentage │
109
- ├───────────────────────────┼─────────┼────────────┼───────┼────────────┤
110
- │ @design-system/foundation │ 2.5.3 │ 9 │ 23 │ 88.5% │
111
- ├───────────────────────────┼─────────┼────────────┼───────┼────────────┤
112
- │ react │ 18.3.1 │ 1 │ 3 │ 11.5% │
113
- └───────────────────────────┴─────────┴────────────┴───────┴────────────┘
72
+ The `scan` command analyzes local files for React component usage patterns.
114
73
 
115
- Total: 2 packages | 10 unique components | 26 total usages
74
+ ```bash
75
+ Usage: hermex scan [options] [pattern]
76
+
77
+ Scan and analyze local files
78
+
79
+ Arguments:
80
+ pattern Glob pattern for files to analyze (defaults to
81
+ current directory recursively) (default:
82
+ "**/*.{tsx,jsx,ts,js}")
83
+
84
+ Options:
85
+ --ignore <pattern> Glob pattern for files to ignore (default:
86
+ ["**/node_modules/**","**/dist/**","**/build/**"])
87
+ --allow-packages <pattern> Pattern for what packages to scan (default:
88
+ ["**"])
89
+ --ignore-packages <pattern> Pattern for what packages to ignore (default: [])
90
+ --no-summary Hide summary
91
+ --components [mode] Show components table/chart (table, chart)
92
+ (default: "table")
93
+ --no-components Do not show components
94
+ --packages [mode] Show packages table/chart (table, chart)
95
+ (default: "table")
96
+ --no-packages Do not show packages
97
+ --patterns [mode] Show patterns table/chart (table, chart)
98
+ (default: "table")
99
+ --no-patterns Do not show patterns
100
+ --ignore-errors Continue scanning even if some files fail to
101
+ parse
102
+ -h, --help display help for command
116
103
  ```
117
104
 
118
- ### Components Table
119
- ```
120
- ⚛️ Components
121
-
122
- ┌────────────┬───────────────────────────┬───────┐
123
- │ Component │ Package │ Count │
124
- ├────────────┼───────────────────────────┼───────┤
125
- │ Button │ @design-system/foundation │ 5 │
126
- ├────────────┼───────────────────────────┼───────┤
127
- │ Card │ @design-system/foundation │ 5 │
128
- ├────────────┼───────────────────────────┼───────┤
129
- │ Input │ @design-system/foundation │ 4 │
130
- ├────────────┼───────────────────────────┼───────┤
131
- │ Typography │ @design-system/foundation │ 4 │
132
- └────────────┴───────────────────────────┴───────┘
133
- ```
105
+ ## Example Output
134
106
 
135
- ### Code Patterns
136
- ```
137
- 🔍 Code Patterns
138
-
139
- ┌──────────────────────┬───────┐
140
- │ Pattern │ Count │
141
- ├──────────────────────┼───────┤
142
- │ JSX Usage │ 145 │
143
- ├──────────────────────┼───────┤
144
- │ Named Imports │ 89 │
145
- ├──────────────────────┼───────┤
146
- │ Default Imports │ 67 │
147
- ├──────────────────────┼───────┤
148
- │ Variable Assignments │ 23 │
149
- ├──────────────────────┼───────┤
150
- │ Object Mappings │ 15 │
151
- ├──────────────────────┼───────┤
152
- │ Conditional Usage │ 12 │
153
- └──────────────────────┴───────┘
154
-
155
- Total: 146 patterns detected
156
- ```
107
+ Running a basic scan (uses default pattern `**/*.{tsx,jsx,ts,js}`):
157
108
 
158
- ### Summary Statistics
159
- ```
160
- 📊 Summary
161
-
162
- ┌─────────────────────┬───────┐
163
- Metric │ Count │
164
- ├─────────────────────┼───────┤
165
- Files Analyzed │ 8 │
166
- ├─────────────────────┼───────┤
167
- External Packages │ 2 │
168
- ├─────────────────────┼───────┤
169
- │ External Components │ 10 │
170
- ├─────────────────────┼───────┤
171
- │ Total Usages │ 26 │
109
+ ```bash
110
+ 📦 Packages
111
+
112
+ No packages found
113
+
114
+ ⚛️ Components
115
+
116
+ No external components found
117
+
118
+ 🔍 Code Patterns
119
+
120
+ ┌──────────────────────┬───────┐
121
+ │ Pattern │ Count │
122
+ ├──────────────────────┼───────┤
123
+ │ Named Imports │ 130 │
124
+ ├──────────────────────┼───────┤
125
+ │ Default Imports │ 51 │
126
+ ├──────────────────────┼───────┤
127
+ │ JSX Usage │ 45 │
128
+ ├──────────────────────┼───────┤
129
+ │ Object Mappings │ 19 │
130
+ ├──────────────────────┼───────┤
131
+ │ Variable Assignments │ 9 │
132
+ ├──────────────────────┼───────┤
133
+ │ Conditional Usage │ 7 │
134
+ ├──────────────────────┼───────┤
135
+ │ Namespace Imports │ 4 │
136
+ ├──────────────────────┼───────┤
137
+ │ Aliased Imports │ 4 │
138
+ ├──────────────────────┼───────┤
139
+ │ Destructuring │ 2 │
140
+ ├──────────────────────┼───────┤
141
+ │ Portal Usage │ 1 │
142
+ └──────────────────────┴───────┘
143
+
144
+ Total: 272 patterns detected
145
+
146
+ 📊 Summary
147
+
148
+ ┌─────────────────────┬───────┐
149
+ │ Metric │ Count │
150
+ ├─────────────────────┼───────┤
151
+ │ Files Analyzed │ 46 │
152
+ ├─────────────────────┼───────┤
153
+ │ External Packages │ 0 │
154
+ ├─────────────────────┼───────┤
155
+ │ External Components │ 0 │
156
+ ├─────────────────────┼───────┤
157
+ │ Total Usages │ 0 │
172
158
  └─────────────────────┴───────┘
173
-
174
- Analysis completed successfully in 0.1s
175
159
  ```
176
160
 
177
- ## 📚 Documentation
178
-
179
- - **[Examples](./docs/EXAMPLES.md)** - Comprehensive examples and command usage
180
- - **[Patterns Guide](./docs/PATTERNS.md)** - All detectable React usage patterns
181
- - **[Project Milestones](./docs/MILESTONES.md)** - Roadmap and future features
182
-
183
- ## 🎯 Use Cases
161
+ ## Use Cases
184
162
 
185
163
  1. **Dependency Audits** - Understand library usage before migrations
186
164
  2. **Version Tracking** - Know exactly which component versions are in use
@@ -190,12 +168,13 @@ Analysis completed successfully in 0.1s
190
168
  6. **Team Insights** - Understand how your team uses component libraries
191
169
  7. **Documentation** - Generate usage reports for component library documentation
192
170
 
193
- ## 🔍 Pattern Detection
171
+ ## Documentation
172
+
173
+ - **[Examples](./docs/examples.md)** - Comprehensive examples and command usage
174
+ - **[Patterns Guide](./docs/patterns.md)** - All detectable React usage patterns
194
175
 
195
- Hermex detects 10+ React component usage patterns.
196
- See the [Patterns](./docs/PATTERNS.md) for complete details.
176
+ ## Tech Stack
197
177
 
198
- ## 🛠️ Tech Stack
199
178
  - **Runtime**: Node.js 24
200
179
  - **Parser**: [@swc/core](https://swc.rs/)
201
180
  - **CLI**: [Commander.js](https://github.com/tj/commander.js)
@@ -205,16 +184,16 @@ See the [Patterns](./docs/PATTERNS.md) for complete details.
205
184
  - **Linter**: [oxlint](https://oxc-project.github.io/)
206
185
  - **Tests**: [Vitest](https://vitest.dev/)
207
186
 
208
- ## 🤝 Contributing
187
+ ## Contributing
209
188
 
210
189
  Contributions are welcome! Please read our [Contributing Guide](./CONTRIBUTING.md) for details.
211
190
 
212
- ## 📄 License
191
+ ## License
213
192
 
214
193
  MIT License - see [LICENSE.md](./LICENSE.md)
215
194
 
216
- ## 🔗 Links
195
+ ## Links
217
196
 
218
- - [GitHub Repository](https://github.com/Gallevy/hermex)
197
+ - [GitHub Repository](https://github.com/Gallevy/hermex.git)
219
198
  - [npm Package](https://www.npmjs.com/package/hermex)
220
- - [Report Issues](https://github.com/Gallevy/hermex/issues)
199
+ - [Report Issues](https://github.com/Gallevy/hermex.git/issues)