inup 1.4.9 → 1.4.12
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 +4 -1
- package/dist/cli.js +10 -2
- package/dist/config/constants.js +1 -2
- package/dist/core/package-detector.js +184 -96
- package/dist/core/upgrade-runner.js +62 -13
- package/dist/interactive-ui.js +116 -62
- package/dist/services/changelog-fetcher.js +59 -34
- package/dist/services/index.js +0 -2
- package/dist/services/jsdelivr-registry.js +92 -176
- package/dist/services/npm-registry.js +97 -27
- package/dist/ui/input-handler.js +1 -1
- package/dist/ui/renderer/index.js +2 -2
- package/dist/ui/renderer/package-list.js +32 -5
- package/dist/ui/state/state-manager.js +7 -5
- package/dist/utils/filesystem.js +149 -22
- package/package.json +4 -4
|
@@ -68,7 +68,7 @@ class StateManager {
|
|
|
68
68
|
return;
|
|
69
69
|
const currentRow = this.navigationManager.getCurrentRow();
|
|
70
70
|
const currentState = states[currentRow];
|
|
71
|
-
if (!currentState)
|
|
71
|
+
if (!currentState || currentState.loadState !== 'ready')
|
|
72
72
|
return;
|
|
73
73
|
if (direction === 'left') {
|
|
74
74
|
// Move selection left with wraparound: latest -> range -> none -> latest
|
|
@@ -122,7 +122,7 @@ class StateManager {
|
|
|
122
122
|
if (states.length === 0)
|
|
123
123
|
return;
|
|
124
124
|
states.forEach((state) => {
|
|
125
|
-
if (state.hasRangeUpdate) {
|
|
125
|
+
if (state.loadState === 'ready' && state.hasRangeUpdate) {
|
|
126
126
|
state.selectedOption = 'range';
|
|
127
127
|
}
|
|
128
128
|
});
|
|
@@ -131,10 +131,10 @@ class StateManager {
|
|
|
131
131
|
if (states.length === 0)
|
|
132
132
|
return;
|
|
133
133
|
states.forEach((state) => {
|
|
134
|
-
if (state.hasMajorUpdate) {
|
|
134
|
+
if (state.loadState === 'ready' && state.hasMajorUpdate) {
|
|
135
135
|
state.selectedOption = 'latest';
|
|
136
136
|
}
|
|
137
|
-
else if (state.hasRangeUpdate) {
|
|
137
|
+
else if (state.loadState === 'ready' && state.hasRangeUpdate) {
|
|
138
138
|
state.selectedOption = 'range';
|
|
139
139
|
}
|
|
140
140
|
});
|
|
@@ -143,7 +143,9 @@ class StateManager {
|
|
|
143
143
|
if (states.length === 0)
|
|
144
144
|
return;
|
|
145
145
|
states.forEach((state) => {
|
|
146
|
-
state.
|
|
146
|
+
if (state.loadState === 'ready') {
|
|
147
|
+
state.selectedOption = 'none';
|
|
148
|
+
}
|
|
147
149
|
});
|
|
148
150
|
}
|
|
149
151
|
// Modal delegation
|
package/dist/utils/filesystem.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.readPackageJsonAsync = readPackageJsonAsync;
|
|
|
7
7
|
exports.collectAllDependencies = collectAllDependencies;
|
|
8
8
|
exports.collectAllDependenciesAsync = collectAllDependenciesAsync;
|
|
9
9
|
exports.findAllPackageJsonFiles = findAllPackageJsonFiles;
|
|
10
|
+
exports.findAllPackageJsonFilesAsync = findAllPackageJsonFilesAsync;
|
|
10
11
|
const fs_1 = require("fs");
|
|
11
12
|
const fs_2 = require("fs");
|
|
12
13
|
const path_1 = require("path");
|
|
@@ -55,6 +56,20 @@ async function readPackageJsonAsync(path) {
|
|
|
55
56
|
throw new Error(`Failed to read package.json: ${error}`);
|
|
56
57
|
}
|
|
57
58
|
}
|
|
59
|
+
const SKIP_DIRS = new Set([
|
|
60
|
+
'node_modules',
|
|
61
|
+
'dist',
|
|
62
|
+
'build',
|
|
63
|
+
'coverage',
|
|
64
|
+
'out',
|
|
65
|
+
'lib',
|
|
66
|
+
'es',
|
|
67
|
+
'esm',
|
|
68
|
+
'cjs',
|
|
69
|
+
]);
|
|
70
|
+
function shouldSkipDirectory(name) {
|
|
71
|
+
return name.startsWith('.') || SKIP_DIRS.has(name);
|
|
72
|
+
}
|
|
58
73
|
/**
|
|
59
74
|
* Collects all dependencies from multiple package.json files.
|
|
60
75
|
* Always includes regular dependencies and devDependencies.
|
|
@@ -135,11 +150,24 @@ function findAllPackageJsonFiles(rootDir = process.cwd(), excludePatterns = [],
|
|
|
135
150
|
const packageJsonFiles = [];
|
|
136
151
|
const visitedPaths = new Set();
|
|
137
152
|
let directoriesScanned = 0;
|
|
153
|
+
let lastProgressAt = 0;
|
|
154
|
+
const progressIntervalMs = 250;
|
|
138
155
|
// Compile regex patterns for exclude filtering
|
|
139
156
|
const excludeRegexes = excludePatterns.map((pattern) => new RegExp(pattern, 'i'));
|
|
140
157
|
function shouldExcludePath(relativePath) {
|
|
141
158
|
return excludeRegexes.some((regex) => regex.test(relativePath));
|
|
142
159
|
}
|
|
160
|
+
function reportProgress(currentDir, force = false) {
|
|
161
|
+
if (!onProgress)
|
|
162
|
+
return;
|
|
163
|
+
const now = Date.now();
|
|
164
|
+
if (!force && now - lastProgressAt < progressIntervalMs) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
lastProgressAt = now;
|
|
168
|
+
const relativePath = (0, path_1.relative)(rootDir, currentDir) || '.';
|
|
169
|
+
onProgress(relativePath, packageJsonFiles.length);
|
|
170
|
+
}
|
|
143
171
|
function traverseDirectory(dir, depth = 0) {
|
|
144
172
|
// Prevent infinite recursion with depth limit
|
|
145
173
|
if (depth > maxDepth) {
|
|
@@ -155,11 +183,11 @@ function findAllPackageJsonFiles(rootDir = process.cwd(), excludePatterns = [],
|
|
|
155
183
|
directoriesScanned++;
|
|
156
184
|
// Report progress every 10 directories or on first scan
|
|
157
185
|
if (onProgress && (directoriesScanned % 10 === 0 || directoriesScanned === 1)) {
|
|
158
|
-
|
|
159
|
-
onProgress(relativePath, packageJsonFiles.length);
|
|
186
|
+
reportProgress(dir, true);
|
|
160
187
|
}
|
|
161
188
|
const files = (0, fs_1.readdirSync)(dir);
|
|
162
189
|
for (const file of files) {
|
|
190
|
+
reportProgress(dir);
|
|
163
191
|
const fullPath = (0, path_1.join)(dir, file);
|
|
164
192
|
const relativePath = (0, path_1.relative)(rootDir, fullPath);
|
|
165
193
|
// Skip if path matches exclude patterns
|
|
@@ -174,26 +202,7 @@ function findAllPackageJsonFiles(rootDir = process.cwd(), excludePatterns = [],
|
|
|
174
202
|
// Skip files/dirs we can't stat (broken symlinks, permission issues)
|
|
175
203
|
continue;
|
|
176
204
|
}
|
|
177
|
-
|
|
178
|
-
const skipDirs = [
|
|
179
|
-
'node_modules',
|
|
180
|
-
'.git',
|
|
181
|
-
'dist',
|
|
182
|
-
'build',
|
|
183
|
-
'.next',
|
|
184
|
-
'coverage',
|
|
185
|
-
'.cache',
|
|
186
|
-
'out',
|
|
187
|
-
'.output',
|
|
188
|
-
'.nuxt',
|
|
189
|
-
'.vercel',
|
|
190
|
-
'.netlify',
|
|
191
|
-
'lib',
|
|
192
|
-
'es',
|
|
193
|
-
'esm',
|
|
194
|
-
'cjs',
|
|
195
|
-
];
|
|
196
|
-
if (stat.isDirectory() && !file.startsWith('.') && !skipDirs.includes(file)) {
|
|
205
|
+
if (stat.isDirectory() && !shouldSkipDirectory(file)) {
|
|
197
206
|
traverseDirectory(fullPath, depth + 1);
|
|
198
207
|
}
|
|
199
208
|
else if (file === 'package.json' && stat.isFile()) {
|
|
@@ -208,4 +217,122 @@ function findAllPackageJsonFiles(rootDir = process.cwd(), excludePatterns = [],
|
|
|
208
217
|
traverseDirectory(rootDir);
|
|
209
218
|
return packageJsonFiles;
|
|
210
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Find all package.json files recursively with bounded parallel directory traversal.
|
|
222
|
+
*/
|
|
223
|
+
async function findAllPackageJsonFilesAsync(rootDir = process.cwd(), excludePatterns = [], maxDepth = 10, onProgress, options = {}) {
|
|
224
|
+
const packageJsonFiles = [];
|
|
225
|
+
const visitedPaths = new Set();
|
|
226
|
+
let directoriesScanned = 0;
|
|
227
|
+
let lastProgressAt = 0;
|
|
228
|
+
const progressIntervalMs = 250;
|
|
229
|
+
const concurrency = Math.max(1, Math.min(options.concurrency ?? 16, 64));
|
|
230
|
+
const excludeRegexes = excludePatterns.map((pattern) => new RegExp(pattern, 'i'));
|
|
231
|
+
function shouldExcludePath(relativePath) {
|
|
232
|
+
return excludeRegexes.some((regex) => regex.test(relativePath));
|
|
233
|
+
}
|
|
234
|
+
function reportProgress(currentDir, force = false) {
|
|
235
|
+
if (!onProgress)
|
|
236
|
+
return;
|
|
237
|
+
const now = Date.now();
|
|
238
|
+
if (!force && now - lastProgressAt < progressIntervalMs) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
lastProgressAt = now;
|
|
242
|
+
const relativePath = (0, path_1.relative)(rootDir, currentDir) || '.';
|
|
243
|
+
onProgress(relativePath, packageJsonFiles.length);
|
|
244
|
+
}
|
|
245
|
+
const pending = [];
|
|
246
|
+
let activeTasks = 0;
|
|
247
|
+
let failedError = null;
|
|
248
|
+
let resolveDone = null;
|
|
249
|
+
let rejectDone = null;
|
|
250
|
+
const done = new Promise((resolve, reject) => {
|
|
251
|
+
resolveDone = resolve;
|
|
252
|
+
rejectDone = reject;
|
|
253
|
+
});
|
|
254
|
+
function finishIfIdle() {
|
|
255
|
+
if (pending.length === 0 && activeTasks === 0) {
|
|
256
|
+
resolveDone?.();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
function schedule(dir, depth) {
|
|
260
|
+
pending.push({ dir, depth });
|
|
261
|
+
pump();
|
|
262
|
+
}
|
|
263
|
+
async function processDirectory(dir, depth) {
|
|
264
|
+
if (depth > maxDepth) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
let realPath;
|
|
268
|
+
try {
|
|
269
|
+
realPath = await fs_2.promises.realpath(dir);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (visitedPaths.has(realPath)) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
visitedPaths.add(realPath);
|
|
278
|
+
directoriesScanned++;
|
|
279
|
+
if (directoriesScanned % 10 === 0 || directoriesScanned === 1) {
|
|
280
|
+
reportProgress(dir, true);
|
|
281
|
+
}
|
|
282
|
+
let files;
|
|
283
|
+
try {
|
|
284
|
+
files = await fs_2.promises.readdir(dir);
|
|
285
|
+
}
|
|
286
|
+
catch {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
for (const file of files) {
|
|
290
|
+
reportProgress(dir);
|
|
291
|
+
const fullPath = (0, path_1.join)(dir, file);
|
|
292
|
+
const relativePath = (0, path_1.relative)(rootDir, fullPath);
|
|
293
|
+
if (shouldExcludePath(relativePath)) {
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
let stat;
|
|
297
|
+
try {
|
|
298
|
+
stat = await fs_2.promises.stat(fullPath);
|
|
299
|
+
}
|
|
300
|
+
catch {
|
|
301
|
+
continue;
|
|
302
|
+
}
|
|
303
|
+
if (stat.isDirectory() && !shouldSkipDirectory(file)) {
|
|
304
|
+
schedule(fullPath, depth + 1);
|
|
305
|
+
}
|
|
306
|
+
else if (file === 'package.json' && stat.isFile()) {
|
|
307
|
+
packageJsonFiles.push(fullPath);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
function pump() {
|
|
312
|
+
while (activeTasks < concurrency && pending.length > 0 && !failedError) {
|
|
313
|
+
const next = pending.shift();
|
|
314
|
+
if (!next)
|
|
315
|
+
break;
|
|
316
|
+
activeTasks++;
|
|
317
|
+
void processDirectory(next.dir, next.depth)
|
|
318
|
+
.catch((error) => {
|
|
319
|
+
if (!failedError) {
|
|
320
|
+
failedError = error;
|
|
321
|
+
rejectDone?.(error);
|
|
322
|
+
}
|
|
323
|
+
})
|
|
324
|
+
.finally(() => {
|
|
325
|
+
activeTasks--;
|
|
326
|
+
if (failedError) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
pump();
|
|
330
|
+
finishIfIdle();
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
schedule(rootDir, 0);
|
|
335
|
+
await done;
|
|
336
|
+
return packageJsonFiles;
|
|
337
|
+
}
|
|
211
338
|
//# sourceMappingURL=filesystem.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inup",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.12",
|
|
4
4
|
"description": "Interactive CLI tool for upgrading dependencies with ease. Auto-detects and works with npm, yarn, pnpm, and bun. Inspired by yarn upgrade-interactive. Supports monorepos, workspaces, and batch upgrades.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/inquirer": "^9.0.9",
|
|
40
40
|
"@types/keypress.js": "^2.1.3",
|
|
41
|
-
"@types/node": "^24.
|
|
41
|
+
"@types/node": "^24.12.0",
|
|
42
42
|
"@types/semver": "^7.7.1",
|
|
43
|
-
"@vitest/coverage-v8": "^
|
|
43
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
44
44
|
"prettier": "^3.8.1",
|
|
45
45
|
"typescript": "^5.9.3",
|
|
46
|
-
"vitest": "^
|
|
46
|
+
"vitest": "^4.1.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"chalk": "^5.6.2",
|