node-power-user 1.0.21 → 2.0.1

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/CHANGELOG.md CHANGED
@@ -14,6 +14,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
14
14
  - `Fixed` for any bug fixes.
15
15
  - `Security` in case of vulnerabilities.
16
16
 
17
+ ---
18
+ ## [2.0.0] - 2026-02-24
19
+ ### BREAKING
20
+ - Upgraded yargs v16 to v18: updated CLI entry point to use `parseSync()` API
21
+ - Upgraded chalk v4 to v5: requires Node 22+ for ESM `require()` support
22
+ - Upgraded @inquirer/prompts v7 to v8
23
+
24
+ ### Changed
25
+ - Updated all `require('chalk')` to `require('chalk').default` for chalk v5 ESM compatibility
26
+ - Improved outdated command menu: Minor/Major options only show when relevant updates exist
27
+ - Made breaking changes legend conditional on actual major updates being present
28
+ - Updated npm-check-updates to v19.5 and itwcw-package-analytics to v1.0.8
29
+
17
30
  ---
18
31
  ## [1.0.0] - 2024-06-19
19
32
  ### Added
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
- const argv = require('yargs').argv;
3
- const cli = new (require('../dist/cli.js'))(argv);
2
+ const { hideBin } = require('yargs/helpers');
3
+ const argv = require('yargs')(hideBin(process.argv)).parseSync();
4
+ const cli = new (require('../dist/cli.js'))();
4
5
  (async function() {
5
6
  'use strict';
6
7
  await cli.process(argv);
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ Main.prototype.process = async function (options) {
62
62
 
63
63
  // Execute the command
64
64
  const Command = require(commandFile);
65
- await Command(options);
65
+ return await Command(options);
66
66
  } catch (e) {
67
67
  console.error(`Error executing command "${command}": ${e.message}`);
68
68
 
@@ -7,7 +7,7 @@ const version = require('wonderful-version');
7
7
  const { table } = require('table');
8
8
  const ProgressBar = require('cli-progress');
9
9
  const Npm = require('npm-api');
10
- const chalk = require('chalk');
10
+ const chalk = require('chalk').default;
11
11
 
12
12
  const npm = new Npm();
13
13
 
@@ -1,6 +1,6 @@
1
1
  // Libraries
2
2
  const logger = new (require('../lib/logger'))('node-power-user');
3
- const chalk = require('chalk');
3
+ const chalk = require('chalk').default;
4
4
  const { table } = require('table');
5
5
  const jetpack = require('fs-jetpack');
6
6
  const path = require('path');
@@ -117,14 +117,34 @@ module.exports = async function (options) {
117
117
  }
118
118
 
119
119
  console.log(table(dataTable));
120
- logger.log(chalk.dim('Legend: ') + chalk.magenta('⚠ = major version (breaking changes)'));
121
120
 
122
- // Get counts for menu
121
+ // Only show legend if there are major updates
122
+ const hasMajorUpdates = [...allPackages.values()].some(pkg => pkg.hasMajorUpdate);
123
+ if (hasMajorUpdates) {
124
+ logger.log(chalk.dim('Legend: ') + chalk.magenta('⚠ = major version (breaking changes)'));
125
+ }
126
+
127
+ // Get counts for menu (only show a tier if it offers upgrades beyond the tier below)
123
128
  const discrepancies = [...allPackages.values()].filter(pkg => pkg.hasDiscrepancy);
124
129
  const patchCount = Object.keys(patchUpgrades).length;
125
130
  const minorCount = Object.keys(minorUpgrades).length;
126
131
  const majorCount = Object.keys(latestUpgrades).length;
127
132
 
133
+ // Check if minor offers any versions beyond what patch gives
134
+ const hasMinorBeyondPatch = Object.keys(minorUpgrades).some(dep =>
135
+ minorUpgrades[dep] !== (patchUpgrades[dep] || allDependencies[dep])
136
+ );
137
+
138
+ // Check if major/latest offers any versions beyond what minor gives
139
+ const hasMajorBeyondMinor = Object.keys(latestUpgrades).some(dep =>
140
+ latestUpgrades[dep] !== (minorUpgrades[dep] || allDependencies[dep])
141
+ );
142
+
143
+ // If noPrompt, return data without showing menu (used by tests)
144
+ if (options.noPrompt) {
145
+ return { allPackages };
146
+ }
147
+
128
148
  // Check for shortcut flags (skip menu)
129
149
  let action = null;
130
150
  if (options.r || options.reconcile) {
@@ -155,14 +175,14 @@ module.exports = async function (options) {
155
175
  });
156
176
  }
157
177
 
158
- if (minorCount > 0) {
178
+ if (hasMinorBeyondPatch) {
159
179
  choices.push({
160
180
  name: `Minor (${minorCount}) - new features, no breaking changes`,
161
181
  value: 'minor',
162
182
  });
163
183
  }
164
184
 
165
- if (majorCount > 0) {
185
+ if (hasMajorBeyondMinor) {
166
186
  choices.push({
167
187
  name: `Major (${majorCount}) - all updates including breaking changes ⚠`,
168
188
  value: 'latest',
@@ -2,7 +2,7 @@
2
2
  const logger = new (require('../lib/logger'))('node-power-user');
3
3
  const path = require('path');
4
4
  const jetpack = require('fs-jetpack');
5
- const chalk = require('chalk');
5
+ const chalk = require('chalk').default;
6
6
  const { table } = require('table');
7
7
 
8
8
  // Load package.json
@@ -10,4 +10,6 @@ const project = jetpack.read(path.join(process.cwd(), 'package.json'), 'json');
10
10
  module.exports = async function (options) {
11
11
  // Log version
12
12
  console.log(package.version);
13
+
14
+ return package.version;
13
15
  };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./cli.js');
@@ -1,5 +1,5 @@
1
1
  // Libraries
2
- const chalk = require('chalk');
2
+ const chalk = require('chalk').default;
3
3
 
4
4
  // Logger class
5
5
  function Logger(name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-power-user",
3
- "version": "1.0.21",
3
+ "version": "2.0.1",
4
4
  "description": "Easy tools for every Node.js developer!",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -36,17 +36,17 @@
36
36
  "replace": {}
37
37
  },
38
38
  "dependencies": {
39
- "@inquirer/prompts": "^7.10.1",
40
- "chalk": "^4.1.2",
39
+ "@inquirer/prompts": "^8.3.0",
40
+ "chalk": "^5.6.2",
41
41
  "cli-progress": "^3.12.0",
42
42
  "fs-jetpack": "^5.1.0",
43
- "itwcw-package-analytics": "^1.0.6",
43
+ "itwcw-package-analytics": "^1.0.8",
44
44
  "node-powertools": "^2.3.2",
45
45
  "npm-api": "^1.0.1",
46
- "npm-check-updates": "^19.3.2",
46
+ "npm-check-updates": "^19.5.0",
47
47
  "table": "^6.9.0",
48
48
  "wonderful-version": "^1.3.2",
49
- "yargs": "^16.2.0"
49
+ "yargs": "^18.0.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "mocha": "^8.4.0",