node-power-user 1.0.20 → 2.0.0
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 +13 -0
- package/bin/node-power-user +3 -2
- package/dist/commands/global.js +1 -1
- package/dist/commands/outdated.js +21 -9
- package/dist/commands/packages.js +1 -1
- package/dist/lib/logger.js +1 -1
- package/package.json +6 -6
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
|
package/bin/node-power-user
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const
|
|
3
|
-
const
|
|
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/commands/global.js
CHANGED
|
@@ -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');
|
|
@@ -26,11 +26,16 @@ module.exports = async function (options) {
|
|
|
26
26
|
// Log start
|
|
27
27
|
logger.log(`Checking packages for ${logger.format.bold(projectJson.name || 'Unknown Project')}...`);
|
|
28
28
|
|
|
29
|
-
// Run ncu for patch, minor, and latest
|
|
29
|
+
// Run ncu for patch, minor, and latest (include peer dependencies)
|
|
30
|
+
const ncuOptions = {
|
|
31
|
+
packageFile: packageJsonPath,
|
|
32
|
+
dep: 'prod,dev,peer,optional',
|
|
33
|
+
};
|
|
34
|
+
|
|
30
35
|
const [patchUpgrades, minorUpgrades, latestUpgrades] = await Promise.all([
|
|
31
|
-
ncu.run({
|
|
32
|
-
ncu.run({
|
|
33
|
-
ncu.run({
|
|
36
|
+
ncu.run({ ...ncuOptions, target: 'patch' }),
|
|
37
|
+
ncu.run({ ...ncuOptions, target: 'minor' }),
|
|
38
|
+
ncu.run({ ...ncuOptions, target: 'latest' }),
|
|
34
39
|
]);
|
|
35
40
|
|
|
36
41
|
// Get all dependencies
|
|
@@ -112,13 +117,20 @@ module.exports = async function (options) {
|
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
console.log(table(dataTable));
|
|
115
|
-
logger.log(chalk.dim('Legend: ') + chalk.magenta('⚠ = major version (breaking changes)'));
|
|
116
120
|
|
|
117
|
-
//
|
|
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 has updates beyond the tier below)
|
|
118
128
|
const discrepancies = [...allPackages.values()].filter(pkg => pkg.hasDiscrepancy);
|
|
119
129
|
const patchCount = Object.keys(patchUpgrades).length;
|
|
120
130
|
const minorCount = Object.keys(minorUpgrades).length;
|
|
121
131
|
const majorCount = Object.keys(latestUpgrades).length;
|
|
132
|
+
const hasMinorBeyondPatch = minorCount > patchCount;
|
|
133
|
+
const hasMajorBeyondMinor = majorCount > minorCount;
|
|
122
134
|
|
|
123
135
|
// Check for shortcut flags (skip menu)
|
|
124
136
|
let action = null;
|
|
@@ -150,14 +162,14 @@ module.exports = async function (options) {
|
|
|
150
162
|
});
|
|
151
163
|
}
|
|
152
164
|
|
|
153
|
-
if (
|
|
165
|
+
if (hasMinorBeyondPatch) {
|
|
154
166
|
choices.push({
|
|
155
167
|
name: `Minor (${minorCount}) - new features, no breaking changes`,
|
|
156
168
|
value: 'minor',
|
|
157
169
|
});
|
|
158
170
|
}
|
|
159
171
|
|
|
160
|
-
if (
|
|
172
|
+
if (hasMajorBeyondMinor) {
|
|
161
173
|
choices.push({
|
|
162
174
|
name: `Major (${majorCount}) - all updates including breaking changes ⚠`,
|
|
163
175
|
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
|
package/dist/lib/logger.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-power-user",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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": "^
|
|
40
|
-
"chalk": "^
|
|
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.
|
|
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.
|
|
46
|
+
"npm-check-updates": "^19.5.0",
|
|
47
47
|
"table": "^6.9.0",
|
|
48
48
|
"wonderful-version": "^1.3.2",
|
|
49
|
-
"yargs": "^
|
|
49
|
+
"yargs": "^18.0.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"mocha": "^8.4.0",
|