@bemedev/codebase 0.0.2 → 0.0.3
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/CHANGE_LOG.md +1 -1
- package/README.md +175 -42
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,77 +1,210 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bemedev/codebase
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
pour manipuler les constantes, helpers, types, et schemas, ainsi qu'une CLI
|
|
7
|
-
extensible.
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
A powerful CLI to generate and analyze your TypeScript/JavaScript codebase.
|
|
8
|
+
This tool allows partial importing of libraries and generates comprehensive
|
|
9
|
+
analyses of your source code.
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- Génération automatique de schémas et types
|
|
13
|
-
- Helpers pour l'import/export de modules
|
|
14
|
-
- CLI pour automatiser les tâches courantes
|
|
15
|
-
- Structure modulaire et extensible
|
|
11
|
+
## 🚀 Main Features
|
|
16
12
|
|
|
17
|
-
|
|
13
|
+
- **📊 Codebase analysis**: Full analysis of imports, exports and
|
|
14
|
+
dependencies
|
|
15
|
+
- **🔧 Automatic generation**: Creates detailed JSON analysis files
|
|
16
|
+
- **⚡ Intuitive CLI**: Simple and effective command-line interface
|
|
17
|
+
- **📦 Partial import**: Selective import of library parts
|
|
18
|
+
- **🎯 Flexible exclusion**: Ability to exclude specific files
|
|
19
|
+
- **📈 Statistics**: Detailed reports about your codebase
|
|
20
|
+
|
|
21
|
+
## 📋 Prerequisites
|
|
22
|
+
|
|
23
|
+
- **Node.js** ≥ 22.0.0
|
|
24
|
+
- **pnpm** (recommended) or npm/yarn
|
|
25
|
+
|
|
26
|
+
## 🛠️ Installation
|
|
27
|
+
|
|
28
|
+
### Global installation (recommended)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add -g @bemedev/codebase
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Local installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pnpm add @bemedev/codebase
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Development installation
|
|
18
41
|
|
|
19
42
|
```bash
|
|
20
|
-
pnpm
|
|
43
|
+
pnpm add -D @bemedev/codebase
|
|
21
44
|
```
|
|
22
45
|
|
|
23
|
-
##
|
|
46
|
+
## 🎯 Usage
|
|
24
47
|
|
|
25
|
-
|
|
48
|
+
### CLI
|
|
26
49
|
|
|
27
|
-
|
|
28
|
-
import { analyse, generate, helpers } from 'bemedev';
|
|
50
|
+
#### Generate a codebase analysis
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
|
|
52
|
+
```bash
|
|
53
|
+
# Basic analysis - generates a codebase.json file
|
|
54
|
+
@bemedev/codebase
|
|
55
|
+
|
|
56
|
+
# Specify a custom output file
|
|
57
|
+
@bemedev/codebase --output my-analysis.json
|
|
58
|
+
|
|
59
|
+
# Exclude specific files
|
|
60
|
+
@bemedev/codebase --exclude node_modules dist lib build
|
|
61
|
+
|
|
62
|
+
# Use short options
|
|
63
|
+
@bemedev/codebase -o output.json node_modules dist
|
|
32
64
|
```
|
|
33
65
|
|
|
34
|
-
|
|
66
|
+
#### Available options
|
|
67
|
+
|
|
68
|
+
- `-o, --output <file>` : Output file (default: `codebase.json`)
|
|
69
|
+
- `[excludes...]` : List of files/folders to exclude
|
|
70
|
+
|
|
71
|
+
### Programmatic API
|
|
35
72
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- `pnpm build` : génère les fichiers de production
|
|
73
|
+
```typescript
|
|
74
|
+
import { generate, analyze } from '@bemedev/codebase';
|
|
39
75
|
|
|
40
|
-
|
|
76
|
+
// Analyze the codebase
|
|
77
|
+
const analysis = analyze('src');
|
|
41
78
|
|
|
42
|
-
|
|
43
|
-
|
|
79
|
+
// Generate an analysis file
|
|
80
|
+
await generate({
|
|
81
|
+
output: 'my-codebase.json',
|
|
82
|
+
excludes: ['node_modules', 'dist'],
|
|
83
|
+
});
|
|
84
|
+
```
|
|
44
85
|
|
|
45
|
-
##
|
|
86
|
+
## 📊 Output format
|
|
87
|
+
|
|
88
|
+
The generated JSON file contains:
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"STATS": {
|
|
93
|
+
"files": 42,
|
|
94
|
+
"imports": 156,
|
|
95
|
+
"exports": 89
|
|
96
|
+
},
|
|
97
|
+
"CODEBASE_ANALYSIS": {
|
|
98
|
+
"src/index.ts": {
|
|
99
|
+
"imports": ["./functions", "./types"],
|
|
100
|
+
"relativePath": "src/index.ts",
|
|
101
|
+
"text": "export * from './functions';"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
46
106
|
|
|
47
|
-
|
|
107
|
+
## 🏗️ Project structure
|
|
48
108
|
|
|
49
|
-
|
|
109
|
+
```
|
|
110
|
+
src/
|
|
111
|
+
├── cli/ # CLI interface
|
|
112
|
+
├── functions/ # Core functions
|
|
113
|
+
│ ├── add.ts # Add dependencies
|
|
114
|
+
│ ├── generate.ts # Generate analysis
|
|
115
|
+
│ ├── init.ts # Initialization
|
|
116
|
+
│ └── remove.ts # Removal
|
|
117
|
+
├── analyze.ts # Analysis engine
|
|
118
|
+
├── types.ts # TypeScript definitions
|
|
119
|
+
└── constants.ts # Global constants
|
|
120
|
+
```
|
|
50
121
|
|
|
51
|
-
|
|
122
|
+
## 🧪 Development scripts
|
|
52
123
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
124
|
+
```bash
|
|
125
|
+
# Run tests
|
|
126
|
+
pnpm test
|
|
56
127
|
|
|
57
|
-
|
|
128
|
+
# Linting
|
|
129
|
+
pnpm lint
|
|
58
130
|
|
|
59
|
-
|
|
131
|
+
# Build
|
|
132
|
+
pnpm build
|
|
60
133
|
|
|
61
|
-
|
|
134
|
+
# Development mode with watch
|
|
135
|
+
pnpm dev
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 🎨 Examples
|
|
139
|
+
|
|
140
|
+
### Analyze a React project
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
@bemedev/codebase -o react-analysis.json node_modules public build
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Analyze a Node.js project
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
@bemedev/codebase -o backend-analysis.json node_modules dist coverage
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Integrate into an NPM script
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"scripts": {
|
|
157
|
+
"analyze": "@bemedev/codebase -o analysis/codebase.json",
|
|
158
|
+
"analyze:clean": "@bemedev/codebase -o analysis/clean.json node_modules dist lib build"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 🤝 Contribution
|
|
164
|
+
|
|
165
|
+
Contributions are welcome! How to contribute:
|
|
166
|
+
|
|
167
|
+
1. Fork the project
|
|
168
|
+
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
|
|
169
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
170
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
171
|
+
5. Open a Pull Request
|
|
172
|
+
|
|
173
|
+
### Contribution guidelines
|
|
174
|
+
|
|
175
|
+
- Follow commit conventions
|
|
176
|
+
([Conventional Commits](https://www.conventionalcommits.org/))
|
|
177
|
+
- Add tests for new features
|
|
178
|
+
- Update documentation when necessary
|
|
179
|
+
- Respect existing code style
|
|
180
|
+
|
|
181
|
+
## 🐛 Report a bug
|
|
182
|
+
|
|
183
|
+
If you find a bug, please
|
|
184
|
+
[open an issue](https://github.com/chlbri/codebase/issues) with:
|
|
185
|
+
|
|
186
|
+
- A clear description of the problem
|
|
187
|
+
- Steps to reproduce the bug
|
|
188
|
+
- Your environment (OS, Node.js version, etc.)
|
|
189
|
+
- Error logs if available
|
|
190
|
+
|
|
191
|
+
## License ([_MIT_](LICENSE))
|
|
62
192
|
|
|
63
193
|
<br/>
|
|
64
194
|
|
|
65
|
-
##
|
|
195
|
+
## [CHANGE_LOG](CHANGE_LOG.md)
|
|
196
|
+
|
|
197
|
+
<br/>
|
|
66
198
|
|
|
67
|
-
|
|
199
|
+
## Author
|
|
68
200
|
|
|
69
|
-
[
|
|
201
|
+
[chlbri](bri_lvi@icloud.com), my
|
|
202
|
+
[github](https://github.com/chlbri?tab=repositories)
|
|
70
203
|
|
|
71
204
|
[<svg width="98" height="96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>](https://github.com/chlbri?tab=repositories)
|
|
72
205
|
|
|
73
206
|
<br/>
|
|
74
207
|
|
|
75
|
-
##
|
|
208
|
+
## Links
|
|
76
209
|
|
|
77
|
-
- [Documentation](https://github.com/chlbri/
|
|
210
|
+
- [Documentation](https://github.com/chlbri/codebase)
|