@bemedev/codebase 0.0.1 → 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 ADDED
@@ -0,0 +1,47 @@
1
+ ## CHANGELOG
2
+
3
+ <br/>
4
+ <br/>
5
+
6
+ <details>
7
+
8
+ <summary>
9
+
10
+ ### Version [0.0.3] --> _2025/09/04 11:30_
11
+
12
+ </summary>
13
+
14
+ - 📦 Add documentation
15
+
16
+ </details>
17
+
18
+ <br/>
19
+
20
+ <details>
21
+
22
+ <summary>
23
+
24
+ ### Version [0.0.1] --> _2025/09/04 11:30_
25
+
26
+ </summary>
27
+
28
+ - ✨ First version
29
+ - 📦 Initial release
30
+
31
+ </details>
32
+
33
+ <br/>
34
+
35
+ ## Auteur
36
+
37
+ chlbri (bri_lvi@icloud.com)
38
+
39
+ [My github](https://github.com/chlbri?tab=repositories)
40
+
41
+ [<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)
42
+
43
+ <br/>
44
+
45
+ ## Liens
46
+
47
+ - [Documentation](https://github.com/chlbri/new-package)
package/README.md CHANGED
@@ -1,39 +1,210 @@
1
- # Beatifull lib
1
+ # @bemedev/codebase
2
2
 
3
- A beautifull description
3
+ ![License](https://img.shields.io/badge/license-MIT-blue.svg)
4
+ ![Node.js](https://img.shields.io/badge/node-%3E%3D22-green.svg)
5
+ ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?logo=typescript&logoColor=white)
4
6
 
5
- <br/>
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
+
11
+ ## 🚀 Main Features
12
+
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
41
+
42
+ ```bash
43
+ pnpm add -D @bemedev/codebase
44
+ ```
45
+
46
+ ## 🎯 Usage
47
+
48
+ ### CLI
49
+
50
+ #### Generate a codebase analysis
51
+
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
64
+ ```
65
+
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
6
72
 
7
- ## Licence
73
+ ```typescript
74
+ import { generate, analyze } from '@bemedev/codebase';
8
75
 
9
- MIT
76
+ // Analyze the codebase
77
+ const analysis = analyze('src');
10
78
 
11
- ## CHANGE_LOG
79
+ // Generate an analysis file
80
+ await generate({
81
+ output: 'my-codebase.json',
82
+ excludes: ['node_modules', 'dist'],
83
+ });
84
+ ```
12
85
 
13
- <details>
86
+ ## 📊 Output format
14
87
 
15
- <summary>
16
- ...
17
- </summary>
88
+ The generated JSON file contains:
18
89
 
19
- ### Version [0.0.1] --> _date & hour_
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
+ ```
20
106
 
21
- - Première version de la bibliothèque
107
+ ## 🏗️ Project structure
22
108
 
23
- </details>
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
+ ```
121
+
122
+ ## 🧪 Development scripts
123
+
124
+ ```bash
125
+ # Run tests
126
+ pnpm test
127
+
128
+ # Linting
129
+ pnpm lint
130
+
131
+ # Build
132
+ pnpm build
133
+
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))
24
192
 
25
193
  <br/>
26
194
 
27
- ## Auteur
195
+ ## [CHANGE_LOG](CHANGE_LOG.md)
196
+
197
+ <br/>
28
198
 
29
- chlbri (bri_lvi@icloud.com)
199
+ ## Author
30
200
 
31
- [My github](https://github.com/chlbri?tab=repositories)
201
+ [chlbri](bri_lvi@icloud.com), my
202
+ [github](https://github.com/chlbri?tab=repositories)
32
203
 
33
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)
34
205
 
35
206
  <br/>
36
207
 
37
- ## Liens
208
+ ## Links
38
209
 
39
- - [Documentation](https://github.com/chlbri/new-package)
210
+ - [Documentation](https://github.com/chlbri/codebase)
package/lib/cli/cli.cjs CHANGED
@@ -14,10 +14,12 @@ const cli = cmdTs.command({
14
14
  description: 'Output file path',
15
15
  defaultValue: () => constants.CODEBASE_FILE,
16
16
  }),
17
- excludes: cmdTs.restPositionals({
18
- description: 'The files to exclude, relative to process.cwd()',
19
- displayName: 'Excludes',
20
- type: cmdTs.string,
17
+ excludes: cmdTs.multioption({
18
+ description: 'The files to exclude, globs',
19
+ long: 'excludes',
20
+ short: 'x',
21
+ type: cmdTs.array(cmdTs.string),
22
+ defaultValue: () => [],
21
23
  }),
22
24
  },
23
25
  handler: functions_generate.generate,
@@ -1 +1 @@
1
- {"version":3,"file":"cli.cjs","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { command, option, restPositionals, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: restPositionals({\n description: 'The files to exclude, relative to process.cwd()',\n displayName: 'Excludes',\n type: string,\n }),\n },\n handler,\n});\n"],"names":["command","option","string","CODEBASE_FILE","restPositionals","handler"],"mappings":";;;;;;AAIO,MAAM,GAAG,GAAGA,aAAO,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;AAEhB,IAAA,IAAI,EAAE;QACJ,MAAM,EAAEC,YAAM,CAAC;AACb,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAEC,YAAM;AACZ,YAAA,WAAW,EAAE,kBAAkB;AAC/B,YAAA,YAAY,EAAE,MAAMC,uBAAa;SAClC,CAAC;QACF,QAAQ,EAAEC,qBAAe,CAAC;AACxB,YAAA,WAAW,EAAE,iDAAiD;AAC9D,YAAA,WAAW,EAAE,UAAU;AACvB,YAAA,IAAI,EAAEF,YAAM;SACb,CAAC;AACH,KAAA;aACDG,2BAAO;AACR,CAAA;;;;"}
1
+ {"version":3,"file":"cli.cjs","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"names":["command","option","string","CODEBASE_FILE","multioption","array","handler"],"mappings":";;;;;;AAIO,MAAM,GAAG,GAAGA,aAAO,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;AAEhB,IAAA,IAAI,EAAE;QACJ,MAAM,EAAEC,YAAM,CAAC;AACb,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAEC,YAAM;AACZ,YAAA,WAAW,EAAE,kBAAkB;AAC/B,YAAA,YAAY,EAAE,MAAMC,uBAAa;SAClC,CAAC;QACF,QAAQ,EAAEC,iBAAW,CAAC;AACpB,YAAA,WAAW,EAAE,6BAA6B;AAC1C,YAAA,IAAI,EAAE,UAAU;AAChB,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAEC,WAAK,CAACH,YAAM,CAAC;AACnB,YAAA,YAAY,EAAE,MAAM,EAAE;SACvB,CAAC;AACH,KAAA;aACDI,2BAAO;AACR,CAAA;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG;;;;;;;;;;oJAkBd,CAAC"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli/cli.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,GAAG;;;;;;;;;;oJAoBd,CAAC"}
package/lib/cli/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { command, restPositionals, option, string } from 'cmd-ts';
1
+ import { command, multioption, option, array, string } from 'cmd-ts';
2
2
  import { CODEBASE_FILE } from '../constants.js';
3
3
  import { generate } from '../functions/generate.js';
4
4
 
@@ -12,10 +12,12 @@ const cli = command({
12
12
  description: 'Output file path',
13
13
  defaultValue: () => CODEBASE_FILE,
14
14
  }),
15
- excludes: restPositionals({
16
- description: 'The files to exclude, relative to process.cwd()',
17
- displayName: 'Excludes',
18
- type: string,
15
+ excludes: multioption({
16
+ description: 'The files to exclude, globs',
17
+ long: 'excludes',
18
+ short: 'x',
19
+ type: array(string),
20
+ defaultValue: () => [],
19
21
  }),
20
22
  },
21
23
  handler: generate,
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { command, option, restPositionals, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: restPositionals({\n description: 'The files to exclude, relative to process.cwd()',\n displayName: 'Excludes',\n type: string,\n }),\n },\n handler,\n});\n"],"names":["handler"],"mappings":";;;;AAIO,MAAM,GAAG,GAAG,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;AAEhB,IAAA,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;AACb,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,WAAW,EAAE,kBAAkB;AAC/B,YAAA,YAAY,EAAE,MAAM,aAAa;SAClC,CAAC;QACF,QAAQ,EAAE,eAAe,CAAC;AACxB,YAAA,WAAW,EAAE,iDAAiD;AAC9D,YAAA,WAAW,EAAE,UAAU;AACvB,YAAA,IAAI,EAAE,MAAM;SACb,CAAC;AACH,KAAA;aACDA,QAAO;AACR,CAAA;;;;"}
1
+ {"version":3,"file":"cli.js","sources":["../../src/cli/cli.ts"],"sourcesContent":["import { array, command, multioption, option, string } from 'cmd-ts';\nimport { CODEBASE_FILE } from '../constants';\nimport { generate as handler } from '../functions/generate';\n\nexport const cli = command({\n name: 'generate',\n\n args: {\n output: option({\n long: 'output',\n short: 'o',\n type: string,\n description: 'Output file path',\n defaultValue: () => CODEBASE_FILE,\n }),\n excludes: multioption({\n description: 'The files to exclude, globs',\n long: 'excludes',\n short: 'x',\n type: array(string),\n defaultValue: () => [],\n }),\n },\n handler,\n});\n"],"names":["handler"],"mappings":";;;;AAIO,MAAM,GAAG,GAAG,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,UAAU;AAEhB,IAAA,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;AACb,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,WAAW,EAAE,kBAAkB;AAC/B,YAAA,YAAY,EAAE,MAAM,aAAa;SAClC,CAAC;QACF,QAAQ,EAAE,WAAW,CAAC;AACpB,YAAA,WAAW,EAAE,6BAA6B;AAC1C,YAAA,IAAI,EAAE,UAAU;AAChB,YAAA,KAAK,EAAE,GAAG;AACV,YAAA,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;AACnB,YAAA,YAAY,EAAE,MAAM,EAAE;SACvB,CAAC;AACH,KAAA;aACDA,QAAO;AACR,CAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemedev/codebase",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "The CLI for to generate codebase, and import partially a library. From @bemedev",
5
5
  "author": {
6
6
  "email": "bri_lvi@icloud.com",
@@ -38,7 +38,10 @@
38
38
  ],
39
39
  "files": [
40
40
  "lib",
41
- "public"
41
+ "public",
42
+ "CHANGE_LOG.md",
43
+ "README.md",
44
+ "LICENSE"
42
45
  ],
43
46
  "engines": {
44
47
  "node": ">=22"