devcompass 1.0.0 ā 1.0.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 +21 -0
- package/README.md +190 -20
- package/bin/devcompass.js +9 -0
- package/package.json +1 -1
- package/src/analyzers/unused-deps.js +22 -1
package/LICENSE
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ajay Thorat
|
|
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,41 +1,211 @@
|
|
|
1
|
-
# DevCompass
|
|
1
|
+
# š§ DevCompass
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Dependency health checker for JavaScript/TypeScript projects**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/devcompass)
|
|
6
|
+
[](https://www.npmjs.com/package/devcompass)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npx devcompass analyze
|
|
10
|
-
```
|
|
9
|
+
Analyze your JavaScript projects to find unused dependencies, outdated packages, and get a health score.
|
|
11
10
|
|
|
12
11
|
## ⨠Features
|
|
13
12
|
|
|
14
|
-
- š
|
|
15
|
-
- š¦ Check for outdated packages
|
|
16
|
-
- š
|
|
17
|
-
-
|
|
18
|
-
- ā” Fast analysis
|
|
13
|
+
- š **Detect unused dependencies** - Find packages you're not actually using
|
|
14
|
+
- š¦ **Check for outdated packages** - See what needs updating
|
|
15
|
+
- š **Project health score** - Get a 0-10 rating for your dependencies
|
|
16
|
+
- šØ **Beautiful terminal UI** - Colored output with clear sections
|
|
17
|
+
- ā” **Fast analysis** - Scans projects in seconds
|
|
18
|
+
- š§ **Framework-aware** - Handles React, Next.js, Angular, NestJS, PostCSS, Tailwind
|
|
19
|
+
|
|
20
|
+
## š Installation
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
**Global installation (recommended):**
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g devcompass
|
|
25
|
+
```
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
**Local installation:**
|
|
28
|
+
```bash
|
|
29
|
+
npm install --save-dev devcompass
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**One-time use (no installation):**
|
|
23
33
|
```bash
|
|
24
34
|
npx devcompass analyze
|
|
25
35
|
```
|
|
26
36
|
|
|
27
|
-
|
|
37
|
+
## š Usage
|
|
38
|
+
|
|
39
|
+
Navigate to your project directory and run:
|
|
28
40
|
```bash
|
|
29
|
-
npm install -g devcompass
|
|
30
41
|
devcompass analyze
|
|
31
42
|
```
|
|
32
43
|
|
|
44
|
+
### Example Output
|
|
45
|
+
```
|
|
46
|
+
š DevCompass v1.0.1 - Analyzing your project...
|
|
47
|
+
ā Scanned 15 dependencies in project
|
|
48
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
49
|
+
|
|
50
|
+
š“ UNUSED DEPENDENCIES (2)
|
|
51
|
+
ā lodash
|
|
52
|
+
ā moment
|
|
53
|
+
|
|
54
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
55
|
+
|
|
56
|
+
š” OUTDATED PACKAGES (3)
|
|
57
|
+
react 18.2.0 ā ^19.0.0 (major update)
|
|
58
|
+
axios 1.4.0 ā ^1.6.0 (minor update)
|
|
59
|
+
express 4.18.0 ā ^4.19.0 (patch update)
|
|
60
|
+
|
|
61
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
62
|
+
|
|
63
|
+
š PROJECT HEALTH
|
|
64
|
+
Overall Score: 6.5/10
|
|
65
|
+
Total Dependencies: 15
|
|
66
|
+
Unused: 2
|
|
67
|
+
Outdated: 3
|
|
68
|
+
|
|
69
|
+
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
70
|
+
|
|
71
|
+
š” QUICK WIN
|
|
72
|
+
Clean up unused dependencies:
|
|
73
|
+
npm uninstall lodash moment
|
|
74
|
+
|
|
75
|
+
Expected impact:
|
|
76
|
+
ā Remove 2 unused packages
|
|
77
|
+
ā Reduce node_modules size
|
|
78
|
+
ā Improve health score ā 7.5/10
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## šÆ What It Detects
|
|
82
|
+
|
|
83
|
+
### Unused Dependencies
|
|
84
|
+
- Uses AST parsing via [depcheck](https://github.com/depcheck/depcheck)
|
|
85
|
+
- Scans all `.js`, `.jsx`, `.ts`, `.tsx` files
|
|
86
|
+
- Excludes `node_modules`, `dist`, `build` folders
|
|
87
|
+
- Framework-aware (automatically ignores framework core packages)
|
|
88
|
+
|
|
89
|
+
### Automatically Ignored Packages
|
|
90
|
+
DevCompass won't flag these as unused (they're typically used in config files):
|
|
91
|
+
- **Frameworks:** React, Next.js, Angular, NestJS
|
|
92
|
+
- **Build tools:** Webpack, Vite, Rollup, ESBuild
|
|
93
|
+
- **Testing:** Jest, Vitest, Mocha, Testing Library
|
|
94
|
+
- **CSS/PostCSS:** PostCSS, Autoprefixer, Tailwind CSS, cssnano
|
|
95
|
+
- **Linting/Formatting:** ESLint, Prettier, ESLint plugins/configs
|
|
96
|
+
- **TypeScript:** TypeScript, @types/* packages
|
|
97
|
+
|
|
98
|
+
### Outdated Packages
|
|
99
|
+
- Checks against npm registry
|
|
100
|
+
- Shows current vs latest versions
|
|
101
|
+
- Indicates update type (major/minor/patch)
|
|
102
|
+
|
|
103
|
+
### Health Score
|
|
104
|
+
- Calculated from 0-10 based on:
|
|
105
|
+
- Percentage of unused dependencies (-4 points per 100%)
|
|
106
|
+
- Percentage of outdated packages (-3 points per 100%)
|
|
107
|
+
- Higher score = healthier project
|
|
108
|
+
|
|
109
|
+
## āļø Options
|
|
110
|
+
```bash
|
|
111
|
+
# Analyze current directory
|
|
112
|
+
devcompass analyze
|
|
113
|
+
|
|
114
|
+
# Analyze specific directory
|
|
115
|
+
devcompass analyze --path /path/to/project
|
|
116
|
+
|
|
117
|
+
# Show version
|
|
118
|
+
devcompass --version
|
|
119
|
+
|
|
120
|
+
# Show help
|
|
121
|
+
devcompass --help
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## ā ļø Known Issues & Best Practices
|
|
125
|
+
|
|
126
|
+
### Installation
|
|
127
|
+
- **Recommended:** Install globally with `npm install -g devcompass`
|
|
128
|
+
- If installed locally, DevCompass may appear in the unused dependencies list (this is expected)
|
|
129
|
+
- You'll see a warning if running from local installation
|
|
130
|
+
|
|
131
|
+
### Dependency Warnings
|
|
132
|
+
Some deprecation warnings may appear during installation. These come from third-party dependencies (depcheck, npm-check-updates) and don't affect functionality.
|
|
133
|
+
|
|
134
|
+
### False Positives
|
|
135
|
+
DevCompass is smart about config-based dependencies, but occasionally may flag packages that are only used in:
|
|
136
|
+
- Config files (webpack.config.js, next.config.js, etc.)
|
|
137
|
+
- Build scripts
|
|
138
|
+
- Type definitions
|
|
139
|
+
|
|
140
|
+
If you encounter a false positive, please [report it](https://github.com/AjayBThorat-20/devcompass/issues)!
|
|
141
|
+
|
|
33
142
|
## š ļø Requirements
|
|
34
143
|
|
|
35
|
-
- Node.js >=
|
|
36
|
-
- npm
|
|
37
|
-
|
|
144
|
+
- Node.js >= 14.0.0
|
|
145
|
+
- npm or yarn
|
|
146
|
+
|
|
147
|
+
## š” Tips
|
|
148
|
+
|
|
149
|
+
1. **Run regularly** - Add to your CI/CD pipeline or git hooks
|
|
150
|
+
2. **Check before updates** - See what's outdated before updating
|
|
151
|
+
3. **Clean up first** - Remove unused deps before adding new ones
|
|
152
|
+
4. **Verify before uninstalling** - DevCompass helps identify candidates, but always verify before removing
|
|
153
|
+
|
|
154
|
+
## š¤ Contributing
|
|
155
|
+
|
|
156
|
+
Contributions are welcome! Feel free to:
|
|
157
|
+
|
|
158
|
+
1. Fork the repository
|
|
159
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
160
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
161
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
162
|
+
5. Open a Pull Request
|
|
163
|
+
|
|
164
|
+
### Development
|
|
165
|
+
```bash
|
|
166
|
+
# Clone the repo
|
|
167
|
+
git clone https://github.com/AjayBThorat-20/devcompass.git
|
|
168
|
+
cd devcompass
|
|
169
|
+
|
|
170
|
+
# Install dependencies
|
|
171
|
+
npm install
|
|
172
|
+
|
|
173
|
+
# Test locally
|
|
174
|
+
node bin/devcompass.js analyze
|
|
175
|
+
|
|
176
|
+
# Run on test projects
|
|
177
|
+
cd examples/test-project
|
|
178
|
+
node ../../bin/devcompass.js analyze
|
|
179
|
+
```
|
|
38
180
|
|
|
39
181
|
## š License
|
|
40
182
|
|
|
41
|
-
MIT
|
|
183
|
+
MIT Ā© [Ajay Thorat](https://github.com/AjayBThorat-20)
|
|
184
|
+
|
|
185
|
+
## š Links
|
|
186
|
+
|
|
187
|
+
- [npm Package](https://www.npmjs.com/package/devcompass)
|
|
188
|
+
- [GitHub Repository](https://github.com/AjayBThorat-20/devcompass)
|
|
189
|
+
- [Report Issues](https://github.com/AjayBThorat-20/devcompass/issues)
|
|
190
|
+
- [Changelog](https://github.com/AjayBThorat-20/devcompass/blob/main/CHANGELOG.md)
|
|
191
|
+
|
|
192
|
+
## š Acknowledgments
|
|
193
|
+
|
|
194
|
+
Built with:
|
|
195
|
+
- [depcheck](https://github.com/depcheck/depcheck) - Dependency checker
|
|
196
|
+
- [npm-check-updates](https://github.com/raineorshine/npm-check-updates) - Package updater
|
|
197
|
+
- [chalk](https://github.com/chalk/chalk) - Terminal colors
|
|
198
|
+
- [ora](https://github.com/sindresorhus/ora) - Spinners
|
|
199
|
+
- [commander](https://github.com/tj/commander.js) - CLI framework
|
|
200
|
+
|
|
201
|
+
## š Stats
|
|
202
|
+
|
|
203
|
+
Check out DevCompass stats:
|
|
204
|
+
- [npm trends](https://npmtrends.com/devcompass)
|
|
205
|
+
- [npm-stat](https://npm-stat.com/charts.html?package=devcompass)
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
**Made with ā¤ļø by [Ajay Thorat](https://github.com/AjayBThorat-20)**
|
|
210
|
+
|
|
211
|
+
*DevCompass - Keep your dependencies healthy!* š§
|
package/bin/devcompass.js
CHANGED
|
@@ -2,9 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
const { Command } = require('commander');
|
|
4
4
|
const chalk = require('chalk');
|
|
5
|
+
const path = require('path');
|
|
5
6
|
const { analyze } = require('../src/commands/analyze');
|
|
6
7
|
const packageJson = require('../package.json');
|
|
7
8
|
|
|
9
|
+
// Check if running from local node_modules
|
|
10
|
+
const isLocalInstall = __dirname.includes('node_modules');
|
|
11
|
+
if (isLocalInstall && process.argv.includes('analyze')) {
|
|
12
|
+
console.log(chalk.yellow('\nā ļø DevCompass is installed locally as a dependency.'));
|
|
13
|
+
console.log(chalk.yellow(' For best results, install globally:'));
|
|
14
|
+
console.log(chalk.cyan(' npm install -g devcompass\n'));
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
const program = new Command();
|
|
9
18
|
|
|
10
19
|
program
|
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ async function findUnusedDeps(projectPath, dependencies) {
|
|
|
14
14
|
'*.min.js'
|
|
15
15
|
],
|
|
16
16
|
ignoreMatches: [
|
|
17
|
+
// Framework core packages
|
|
17
18
|
'react',
|
|
18
19
|
'react-dom',
|
|
19
20
|
'react-native',
|
|
@@ -26,14 +27,34 @@ async function findUnusedDeps(projectPath, dependencies) {
|
|
|
26
27
|
'@nestjs/platform-express',
|
|
27
28
|
'typescript',
|
|
28
29
|
'@types/*',
|
|
30
|
+
|
|
31
|
+
// Build tools
|
|
29
32
|
'webpack',
|
|
30
33
|
'vite',
|
|
31
34
|
'rollup',
|
|
32
35
|
'esbuild',
|
|
36
|
+
|
|
37
|
+
// Testing
|
|
33
38
|
'jest',
|
|
34
39
|
'vitest',
|
|
35
40
|
'mocha',
|
|
36
|
-
'@testing-library/*'
|
|
41
|
+
'@testing-library/*',
|
|
42
|
+
|
|
43
|
+
// CSS/PostCSS (used in config files)
|
|
44
|
+
'postcss',
|
|
45
|
+
'autoprefixer',
|
|
46
|
+
'tailwindcss',
|
|
47
|
+
'cssnano',
|
|
48
|
+
|
|
49
|
+
// Linting/Formatting (used in config files)
|
|
50
|
+
'prettier',
|
|
51
|
+
'eslint',
|
|
52
|
+
'eslint-config-*',
|
|
53
|
+
'@eslint/*',
|
|
54
|
+
'eslint-plugin-*',
|
|
55
|
+
|
|
56
|
+
// Self-reference (don't flag devcompass as unused)
|
|
57
|
+
'devcompass'
|
|
37
58
|
]
|
|
38
59
|
// REMOVED parsers - let depcheck use defaults
|
|
39
60
|
};
|