devcompass 1.0.1 ā 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/README.md +79 -4
- package/bin/devcompass.js +9 -0
- package/package.json +1 -1
- package/src/analyzers/unused-deps.js +22 -1
package/README.md
CHANGED
|
@@ -15,13 +15,25 @@ Analyze your JavaScript projects to find unused dependencies, outdated packages,
|
|
|
15
15
|
- š **Project health score** - Get a 0-10 rating for your dependencies
|
|
16
16
|
- šØ **Beautiful terminal UI** - Colored output with clear sections
|
|
17
17
|
- ā” **Fast analysis** - Scans projects in seconds
|
|
18
|
-
- š§ **Framework-aware** - Handles React, Next.js, Angular, NestJS
|
|
18
|
+
- š§ **Framework-aware** - Handles React, Next.js, Angular, NestJS, PostCSS, Tailwind
|
|
19
19
|
|
|
20
20
|
## š Installation
|
|
21
|
+
|
|
22
|
+
**Global installation (recommended):**
|
|
21
23
|
```bash
|
|
22
24
|
npm install -g devcompass
|
|
23
25
|
```
|
|
24
26
|
|
|
27
|
+
**Local installation:**
|
|
28
|
+
```bash
|
|
29
|
+
npm install --save-dev devcompass
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**One-time use (no installation):**
|
|
33
|
+
```bash
|
|
34
|
+
npx devcompass analyze
|
|
35
|
+
```
|
|
36
|
+
|
|
25
37
|
## š Usage
|
|
26
38
|
|
|
27
39
|
Navigate to your project directory and run:
|
|
@@ -31,7 +43,7 @@ devcompass analyze
|
|
|
31
43
|
|
|
32
44
|
### Example Output
|
|
33
45
|
```
|
|
34
|
-
š DevCompass v1.0.
|
|
46
|
+
š DevCompass v1.0.1 - Analyzing your project...
|
|
35
47
|
ā Scanned 15 dependencies in project
|
|
36
48
|
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
37
49
|
|
|
@@ -72,7 +84,16 @@ devcompass analyze
|
|
|
72
84
|
- Uses AST parsing via [depcheck](https://github.com/depcheck/depcheck)
|
|
73
85
|
- Scans all `.js`, `.jsx`, `.ts`, `.tsx` files
|
|
74
86
|
- Excludes `node_modules`, `dist`, `build` folders
|
|
75
|
-
- Framework-aware (
|
|
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
|
|
76
97
|
|
|
77
98
|
### Outdated Packages
|
|
78
99
|
- Checks against npm registry
|
|
@@ -90,6 +111,9 @@ devcompass analyze
|
|
|
90
111
|
# Analyze current directory
|
|
91
112
|
devcompass analyze
|
|
92
113
|
|
|
114
|
+
# Analyze specific directory
|
|
115
|
+
devcompass analyze --path /path/to/project
|
|
116
|
+
|
|
93
117
|
# Show version
|
|
94
118
|
devcompass --version
|
|
95
119
|
|
|
@@ -97,11 +121,36 @@ devcompass --version
|
|
|
97
121
|
devcompass --help
|
|
98
122
|
```
|
|
99
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
|
+
|
|
100
142
|
## š ļø Requirements
|
|
101
143
|
|
|
102
144
|
- Node.js >= 14.0.0
|
|
103
145
|
- npm or yarn
|
|
104
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
|
+
|
|
105
154
|
## š¤ Contributing
|
|
106
155
|
|
|
107
156
|
Contributions are welcome! Feel free to:
|
|
@@ -112,6 +161,23 @@ Contributions are welcome! Feel free to:
|
|
|
112
161
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
113
162
|
5. Open a Pull Request
|
|
114
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
|
+
```
|
|
180
|
+
|
|
115
181
|
## š License
|
|
116
182
|
|
|
117
183
|
MIT Ā© [Ajay Thorat](https://github.com/AjayBThorat-20)
|
|
@@ -121,6 +187,7 @@ MIT Ā© [Ajay Thorat](https://github.com/AjayBThorat-20)
|
|
|
121
187
|
- [npm Package](https://www.npmjs.com/package/devcompass)
|
|
122
188
|
- [GitHub Repository](https://github.com/AjayBThorat-20/devcompass)
|
|
123
189
|
- [Report Issues](https://github.com/AjayBThorat-20/devcompass/issues)
|
|
190
|
+
- [Changelog](https://github.com/AjayBThorat-20/devcompass/blob/main/CHANGELOG.md)
|
|
124
191
|
|
|
125
192
|
## š Acknowledgments
|
|
126
193
|
|
|
@@ -131,6 +198,14 @@ Built with:
|
|
|
131
198
|
- [ora](https://github.com/sindresorhus/ora) - Spinners
|
|
132
199
|
- [commander](https://github.com/tj/commander.js) - CLI framework
|
|
133
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
|
+
|
|
134
207
|
---
|
|
135
208
|
|
|
136
|
-
**Made with ā¤ļø by [Ajay Thorat](https://github.com/AjayBThorat-20)**
|
|
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
|
};
|