devcompass 1.0.3 → 1.0.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devcompass",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Analyze your JavaScript projects for unused dependencies and outdated packages",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -13,12 +13,13 @@ const {
13
13
  logDivider,
14
14
  getScoreColor
15
15
  } = require('../utils/logger');
16
+ const packageJson = require('../../package.json');
16
17
 
17
18
  async function analyze(options) {
18
19
  const projectPath = options.path || process.cwd();
19
20
 
20
21
  console.log('\n');
21
- log(chalk.cyan.bold('šŸ” DevCompass v1.0.0') + ' - Analyzing your project...\n');
22
+ log(chalk.cyan.bold(`šŸ” DevCompass v${packageJson.version}`) + ' - Analyzing your project...\n');
22
23
 
23
24
  const spinner = ora({
24
25
  text: 'Loading project...',
@@ -34,10 +35,10 @@ async function analyze(options) {
34
35
  process.exit(1);
35
36
  }
36
37
 
37
- let packageJson;
38
+ let projectPackageJson;
38
39
  try {
39
40
  const fileContent = fs.readFileSync(packageJsonPath, 'utf8');
40
- packageJson = JSON.parse(fileContent);
41
+ projectPackageJson = JSON.parse(fileContent);
41
42
  } catch (error) {
42
43
  spinner.fail(chalk.red('Invalid package.json format'));
43
44
  console.log(chalk.yellow(`\nšŸ’” Error: ${error.message}\n`));
@@ -45,8 +46,8 @@ async function analyze(options) {
45
46
  }
46
47
 
47
48
  const dependencies = {
48
- ...(packageJson.dependencies || {}),
49
- ...(packageJson.devDependencies || {})
49
+ ...(projectPackageJson.dependencies || {}),
50
+ ...(projectPackageJson.devDependencies || {})
50
51
  };
51
52
 
52
53
  const totalDeps = Object.keys(dependencies).length;
@@ -103,15 +104,11 @@ function displayResults(unusedDeps, outdatedDeps, score, totalDeps) {
103
104
  if (unusedDeps.length > 0) {
104
105
  logSection('šŸ”“ UNUSED DEPENDENCIES', unusedDeps.length);
105
106
 
106
- const displayCount = Math.min(5, unusedDeps.length);
107
- unusedDeps.slice(0, displayCount).forEach(dep => {
107
+ // Show ALL unused deps
108
+ unusedDeps.forEach(dep => {
108
109
  log(` ${chalk.red('ā—')} ${dep.name}`);
109
110
  });
110
111
 
111
- if (unusedDeps.length > 5) {
112
- log(chalk.gray(`\n ... and ${unusedDeps.length - 5} more\n`));
113
- }
114
-
115
112
  log(chalk.gray('\n Why marked unused:'));
116
113
  log(chalk.gray(' • No import/require found in source files'));
117
114
  log(chalk.gray(' • Excludes node_modules, build folders'));
@@ -126,8 +123,8 @@ function displayResults(unusedDeps, outdatedDeps, score, totalDeps) {
126
123
  if (outdatedDeps.length > 0) {
127
124
  logSection('🟔 OUTDATED PACKAGES', outdatedDeps.length);
128
125
 
129
- const displayCount = Math.min(5, outdatedDeps.length);
130
- outdatedDeps.slice(0, displayCount).forEach(dep => {
126
+ // Show ALL outdated packages
127
+ outdatedDeps.forEach(dep => {
131
128
  const nameCol = dep.name.padEnd(20);
132
129
  const currentVer = chalk.yellow(dep.current);
133
130
  const arrow = chalk.gray('→');
@@ -137,9 +134,7 @@ function displayResults(unusedDeps, outdatedDeps, score, totalDeps) {
137
134
  log(` ${nameCol} ${currentVer} ${arrow} ${latestVer} ${updateType}`);
138
135
  });
139
136
 
140
- if (outdatedDeps.length > 5) {
141
- log(chalk.gray(`\n ... and ${outdatedDeps.length - 5} more\n`));
142
- }
137
+ log('');
143
138
  } else {
144
139
  logSection('āœ… OUTDATED PACKAGES');
145
140
  log(chalk.green(' All packages are up to date!\n'));
@@ -162,7 +157,6 @@ function displayResults(unusedDeps, outdatedDeps, score, totalDeps) {
162
157
  log(' Clean up unused dependencies:\n');
163
158
 
164
159
  const packagesToRemove = unusedDeps
165
- .slice(0, 5)
166
160
  .map(d => d.name)
167
161
  .join(' ');
168
162