hermex 1.1.1 → 1.1.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/README.md CHANGED
@@ -1,186 +1,162 @@
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
+ -h, --help display help for command
116
101
  ```
117
102
 
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
- ```
103
+ ## Example Output
134
104
 
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
- ```
105
+ Running a basic scan (uses default pattern `**/*.{tsx,jsx,ts,js}`):
157
106
 
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 │
107
+ ```bash
108
+ 📦 Packages
109
+
110
+ No packages found
111
+
112
+ ⚛️ Components
113
+
114
+ No external components found
115
+
116
+ 🔍 Code Patterns
117
+
118
+ ┌──────────────────────┬───────┐
119
+ │ Pattern │ Count │
120
+ ├──────────────────────┼───────┤
121
+ │ Named Imports │ 126 │
122
+ ├──────────────────────┼───────┤
123
+ │ Default Imports │ 49 │
124
+ ├──────────────────────┼───────┤
125
+ │ JSX Usage │ 45 │
126
+ ├──────────────────────┼───────┤
127
+ │ Object Mappings │ 19 │
128
+ ├──────────────────────┼───────┤
129
+ │ Variable Assignments │ 9 │
130
+ ├──────────────────────┼───────┤
131
+ │ Conditional Usage │ 7 │
132
+ ├──────────────────────┼───────┤
133
+ │ Namespace Imports │ 4 │
134
+ ├──────────────────────┼───────┤
135
+ │ Aliased Imports │ 4 │
136
+ ├──────────────────────┼───────┤
137
+ │ Destructuring │ 2 │
138
+ ├──────────────────────┼───────┤
139
+ │ Portal Usage │ 1 │
140
+ └──────────────────────┴───────┘
141
+
142
+ Total: 266 patterns detected
143
+
144
+ 📊 Summary
145
+
146
+ ┌─────────────────────┬───────┐
147
+ │ Metric │ Count │
148
+ ├─────────────────────┼───────┤
149
+ │ Files Analyzed │ 45 │
150
+ ├─────────────────────┼───────┤
151
+ │ External Packages │ 0 │
152
+ ├─────────────────────┼───────┤
153
+ │ External Components │ 0 │
154
+ ├─────────────────────┼───────┤
155
+ │ Total Usages │ 0 │
172
156
  └─────────────────────┴───────┘
173
-
174
- Analysis completed successfully in 0.1s
175
157
  ```
176
158
 
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
159
+ ## Use Cases
184
160
 
185
161
  1. **Dependency Audits** - Understand library usage before migrations
186
162
  2. **Version Tracking** - Know exactly which component versions are in use
@@ -190,12 +166,13 @@ Analysis completed successfully in 0.1s
190
166
  6. **Team Insights** - Understand how your team uses component libraries
191
167
  7. **Documentation** - Generate usage reports for component library documentation
192
168
 
193
- ## 🔍 Pattern Detection
169
+ ## Documentation
170
+
171
+ - **[Examples](./docs/examples.md)** - Comprehensive examples and command usage
172
+ - **[Patterns Guide](./docs/patterns.md)** - All detectable React usage patterns
194
173
 
195
- Hermex detects 10+ React component usage patterns.
196
- See the [Patterns](./docs/PATTERNS.md) for complete details.
174
+ ## Tech Stack
197
175
 
198
- ## 🛠️ Tech Stack
199
176
  - **Runtime**: Node.js 24
200
177
  - **Parser**: [@swc/core](https://swc.rs/)
201
178
  - **CLI**: [Commander.js](https://github.com/tj/commander.js)
@@ -205,16 +182,16 @@ See the [Patterns](./docs/PATTERNS.md) for complete details.
205
182
  - **Linter**: [oxlint](https://oxc-project.github.io/)
206
183
  - **Tests**: [Vitest](https://vitest.dev/)
207
184
 
208
- ## 🤝 Contributing
185
+ ## Contributing
209
186
 
210
187
  Contributions are welcome! Please read our [Contributing Guide](./CONTRIBUTING.md) for details.
211
188
 
212
- ## 📄 License
189
+ ## License
213
190
 
214
191
  MIT License - see [LICENSE.md](./LICENSE.md)
215
192
 
216
- ## 🔗 Links
193
+ ## Links
217
194
 
218
- - [GitHub Repository](https://github.com/Gallevy/hermex)
195
+ - [GitHub Repository](https://github.com/Gallevy/hermex.git)
219
196
  - [npm Package](https://www.npmjs.com/package/hermex)
220
- - [Report Issues](https://github.com/Gallevy/hermex/issues)
197
+ - [Report Issues](https://github.com/Gallevy/hermex.git/issues)