ripencli 0.1.6 → 0.1.8
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/dist/cli.js +229 -153
- package/package.json +12 -2
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
2
|
import { Box, Text, render, useApp, useInput, useStdout } from "ink";
|
|
4
3
|
import { createRequire } from "module";
|
|
5
4
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
6
5
|
import { join } from "path";
|
|
6
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
7
7
|
import { execa } from "execa";
|
|
8
8
|
import { homedir } from "os";
|
|
9
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -44,13 +44,217 @@ function getProjectInfo(cwd) {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
//#endregion
|
|
47
|
+
//#region src/registry.ts
|
|
48
|
+
async function fetchVersions(packageName) {
|
|
49
|
+
try {
|
|
50
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`);
|
|
51
|
+
if (!res.ok) return [];
|
|
52
|
+
const data = await res.json();
|
|
53
|
+
const times = data.time ?? {};
|
|
54
|
+
const distTags = data["dist-tags"] ?? {};
|
|
55
|
+
const tagByVersion = {};
|
|
56
|
+
for (const [tag, ver] of Object.entries(distTags)) tagByVersion[ver] = tag;
|
|
57
|
+
return Object.keys(data.versions ?? {}).filter((v) => !v.includes("-") || tagByVersion[v]).map((v) => ({
|
|
58
|
+
version: v,
|
|
59
|
+
date: times[v] ? new Date(times[v]).toISOString().split("T")[0] : "",
|
|
60
|
+
tag: tagByVersion[v]
|
|
61
|
+
})).sort((a, b) => {
|
|
62
|
+
const pa = a.version.split(".").map(Number);
|
|
63
|
+
const pb = b.version.split(".").map(Number);
|
|
64
|
+
for (let i = 0; i < 3; i++) if ((pb[i] ?? 0) !== (pa[i] ?? 0)) return (pb[i] ?? 0) - (pa[i] ?? 0);
|
|
65
|
+
return 0;
|
|
66
|
+
});
|
|
67
|
+
} catch {
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function fetchChangelog(packageName, fromVersion, toVersion) {
|
|
72
|
+
try {
|
|
73
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
74
|
+
if (!res.ok) return [];
|
|
75
|
+
const data = await res.json();
|
|
76
|
+
const match = (typeof data.repository === "string" ? data.repository : data.repository?.url ?? "").match(/github\.com[/:]([^/]+\/[^/]+)/);
|
|
77
|
+
if (!match) return [];
|
|
78
|
+
const repo = match[1].replace(/\.git$/, "");
|
|
79
|
+
const ghRes = await fetch(`https://api.github.com/repos/${repo}/releases?per_page=30`, { headers: { Accept: "application/vnd.github+json" } });
|
|
80
|
+
if (!ghRes.ok) return [];
|
|
81
|
+
const releases = await ghRes.json();
|
|
82
|
+
const parseVer = (v) => v.replace(/^[^0-9]*/, "").split(".").map(Number);
|
|
83
|
+
const cmpVer = (a, b) => {
|
|
84
|
+
for (let i = 0; i < 3; i++) {
|
|
85
|
+
const diff = (a[i] ?? 0) - (b[i] ?? 0);
|
|
86
|
+
if (diff !== 0) return diff;
|
|
87
|
+
}
|
|
88
|
+
return 0;
|
|
89
|
+
};
|
|
90
|
+
const from = parseVer(fromVersion);
|
|
91
|
+
const to = parseVer(toVersion);
|
|
92
|
+
const filtered = releases.filter((r) => {
|
|
93
|
+
if (r.draft || r.prerelease) return false;
|
|
94
|
+
const ver = parseVer(r.tag_name);
|
|
95
|
+
return cmpVer(ver, from) > 0 && cmpVer(ver, to) <= 0;
|
|
96
|
+
}).map((r) => ({
|
|
97
|
+
version: r.tag_name,
|
|
98
|
+
body: r.body?.trim() ?? "No release notes.",
|
|
99
|
+
url: r.html_url
|
|
100
|
+
}));
|
|
101
|
+
if (filtered.length === 0 && releases.length > 0) {
|
|
102
|
+
const latest = releases[0];
|
|
103
|
+
return [{
|
|
104
|
+
version: latest.tag_name,
|
|
105
|
+
body: latest.body?.trim() ?? "No release notes.",
|
|
106
|
+
url: latest.html_url
|
|
107
|
+
}];
|
|
108
|
+
}
|
|
109
|
+
return filtered;
|
|
110
|
+
} catch {
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async function fetchLatestVersion(packageName) {
|
|
115
|
+
try {
|
|
116
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
117
|
+
if (!res.ok) return null;
|
|
118
|
+
return (await res.json()).version ?? null;
|
|
119
|
+
} catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function isNewerVersion(current, latest) {
|
|
124
|
+
const a = current.split(".").map(Number);
|
|
125
|
+
const b = latest.split(".").map(Number);
|
|
126
|
+
for (let i = 0; i < 3; i++) {
|
|
127
|
+
if ((b[i] ?? 0) > (a[i] ?? 0)) return true;
|
|
128
|
+
if ((b[i] ?? 0) < (a[i] ?? 0)) return false;
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
async function fetchRepoUrl(packageName) {
|
|
133
|
+
try {
|
|
134
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
135
|
+
if (!res.ok) return "";
|
|
136
|
+
const data = await res.json();
|
|
137
|
+
const match = (typeof data.repository === "string" ? data.repository : data.repository?.url ?? "").match(/github\.com[/:]([^/]+\/[^/]+)/);
|
|
138
|
+
if (!match) return "";
|
|
139
|
+
return `https://github.com/${match[1].replace(/\.git$/, "")}`;
|
|
140
|
+
} catch {
|
|
141
|
+
return "";
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
47
145
|
//#region src/fetcher.ts
|
|
146
|
+
/**
|
|
147
|
+
* Strip semver range prefixes to extract the base version and prefix.
|
|
148
|
+
* e.g. "^9.3.0" → { version: "9.3.0", prefix: "^" }
|
|
149
|
+
* Returns null for unparseable ranges (*, latest, git URLs, file: paths).
|
|
150
|
+
*/
|
|
151
|
+
function parseBaseVersion(range) {
|
|
152
|
+
let v = range.replace(/^workspace:/, "");
|
|
153
|
+
const prefixMatch = v.match(/^([~^>=<]+)/);
|
|
154
|
+
const prefix = prefixMatch ? prefixMatch[1] : "";
|
|
155
|
+
v = v.replace(/^[~^>=<]+/, "").trim();
|
|
156
|
+
if (/^\d+\.\d+\.\d+/.test(v)) return {
|
|
157
|
+
version: v,
|
|
158
|
+
prefix
|
|
159
|
+
};
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
function readPackageJsonDeps(cwd) {
|
|
163
|
+
const raw = readFileSync(join(cwd, "package.json"), "utf-8");
|
|
164
|
+
const pkg = JSON.parse(raw);
|
|
165
|
+
const entries = [];
|
|
166
|
+
for (const [depType, section] of [["dependencies", pkg.dependencies], ["devDependencies", pkg.devDependencies]]) {
|
|
167
|
+
if (!section || typeof section !== "object") continue;
|
|
168
|
+
for (const [name, range] of Object.entries(section)) {
|
|
169
|
+
if (typeof range !== "string") continue;
|
|
170
|
+
const parsed = parseBaseVersion(range);
|
|
171
|
+
if (parsed) entries.push({
|
|
172
|
+
name,
|
|
173
|
+
current: parsed.version,
|
|
174
|
+
prefix: parsed.prefix,
|
|
175
|
+
type: depType
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return entries;
|
|
180
|
+
}
|
|
181
|
+
async function fetchLatestWithRetry(packageName) {
|
|
182
|
+
for (let attempt = 0; attempt < 3; attempt++) try {
|
|
183
|
+
const controller = new AbortController();
|
|
184
|
+
const timeout = setTimeout(() => controller.abort(), 15e3);
|
|
185
|
+
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, { signal: controller.signal });
|
|
186
|
+
clearTimeout(timeout);
|
|
187
|
+
if (!res.ok) return null;
|
|
188
|
+
return (await res.json()).version ?? null;
|
|
189
|
+
} catch {
|
|
190
|
+
if (attempt === 2) return null;
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
194
|
+
async function fetchAllLatest(names, concurrency, onLine) {
|
|
195
|
+
const results = /* @__PURE__ */ new Map();
|
|
196
|
+
let index = 0;
|
|
197
|
+
let completed = 0;
|
|
198
|
+
async function worker() {
|
|
199
|
+
while (index < names.length) {
|
|
200
|
+
const name = names[index++];
|
|
201
|
+
onLine?.(`Checking ${name} (${completed + 1}/${names.length})...`);
|
|
202
|
+
results.set(name, await fetchLatestWithRetry(name));
|
|
203
|
+
completed++;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
await Promise.all(Array.from({ length: Math.min(concurrency, names.length) }, () => worker()));
|
|
207
|
+
return results;
|
|
208
|
+
}
|
|
48
209
|
async function getOutdatedPackages(manager, cwd, global = false, onLine) {
|
|
49
|
-
|
|
210
|
+
if (global) return getGlobalOutdatedPackages(manager, cwd, onLine);
|
|
211
|
+
let deps;
|
|
212
|
+
try {
|
|
213
|
+
deps = readPackageJsonDeps(cwd);
|
|
214
|
+
} catch {
|
|
215
|
+
return {
|
|
216
|
+
ok: false,
|
|
217
|
+
error: "Could not read package.json"
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
if (deps.length === 0) return {
|
|
221
|
+
ok: true,
|
|
222
|
+
packages: []
|
|
223
|
+
};
|
|
224
|
+
const latestVersions = await fetchAllLatest(deps.map((d) => d.name), 8, onLine);
|
|
225
|
+
if ([...latestVersions.values()].every((v) => v === null) && deps.length > 0) return {
|
|
226
|
+
ok: false,
|
|
227
|
+
error: "Could not reach the npm registry. Check your internet connection."
|
|
228
|
+
};
|
|
229
|
+
const packages = [];
|
|
230
|
+
for (const dep of deps) {
|
|
231
|
+
const latest = latestVersions.get(dep.name);
|
|
232
|
+
if (!latest) continue;
|
|
233
|
+
if (!isNewerVersion(dep.current, latest)) continue;
|
|
234
|
+
packages.push({
|
|
235
|
+
name: dep.name,
|
|
236
|
+
current: dep.current,
|
|
237
|
+
wanted: latest,
|
|
238
|
+
latest,
|
|
239
|
+
dependent: "",
|
|
240
|
+
type: dep.type,
|
|
241
|
+
selected: false,
|
|
242
|
+
targetVersion: latest,
|
|
243
|
+
rangePrefix: dep.prefix
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
ok: true,
|
|
248
|
+
packages
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
/** Global mode: shell out to manager's outdated command */
|
|
252
|
+
async function getGlobalOutdatedPackages(manager, cwd, onLine) {
|
|
253
|
+
const args = [
|
|
50
254
|
"outdated",
|
|
51
255
|
"--global",
|
|
52
256
|
"--json"
|
|
53
|
-
]
|
|
257
|
+
];
|
|
54
258
|
let stdout = "";
|
|
55
259
|
let stderr = "";
|
|
56
260
|
let exitCode = 0;
|
|
@@ -92,7 +296,7 @@ async function getOutdatedPackages(manager, cwd, global = false, onLine) {
|
|
|
92
296
|
if (manager === "yarn") try {
|
|
93
297
|
return {
|
|
94
298
|
ok: true,
|
|
95
|
-
packages: parseYarnOutdated(raw,
|
|
299
|
+
packages: parseYarnOutdated(raw, true)
|
|
96
300
|
};
|
|
97
301
|
} catch {
|
|
98
302
|
return {
|
|
@@ -109,7 +313,7 @@ async function getOutdatedPackages(manager, cwd, global = false, onLine) {
|
|
|
109
313
|
const data = JSON.parse(jsonStr);
|
|
110
314
|
return {
|
|
111
315
|
ok: true,
|
|
112
|
-
packages: manager === "pnpm" ? parsePnpmOutdated(data
|
|
316
|
+
packages: manager === "pnpm" ? parsePnpmOutdated(data) : parseNpmOutdated(data)
|
|
113
317
|
};
|
|
114
318
|
} catch {
|
|
115
319
|
return {
|
|
@@ -133,7 +337,7 @@ function extractJson(raw) {
|
|
|
133
337
|
}
|
|
134
338
|
return null;
|
|
135
339
|
}
|
|
136
|
-
function parsePnpmOutdated(data
|
|
340
|
+
function parsePnpmOutdated(data) {
|
|
137
341
|
if (Array.isArray(data) || typeof data !== "object") return [];
|
|
138
342
|
return Object.entries(data).map(([name, info]) => ({
|
|
139
343
|
name,
|
|
@@ -141,19 +345,19 @@ function parsePnpmOutdated(data, global) {
|
|
|
141
345
|
wanted: info.wanted ?? info.latest,
|
|
142
346
|
latest: info.latest,
|
|
143
347
|
dependent: "",
|
|
144
|
-
type:
|
|
348
|
+
type: "global",
|
|
145
349
|
selected: false,
|
|
146
350
|
targetVersion: info.latest
|
|
147
351
|
}));
|
|
148
352
|
}
|
|
149
|
-
function parseNpmOutdated(data
|
|
353
|
+
function parseNpmOutdated(data) {
|
|
150
354
|
return Object.entries(data).map(([name, info]) => ({
|
|
151
355
|
name,
|
|
152
356
|
current: info.current ?? "N/A",
|
|
153
357
|
wanted: info.wanted ?? info.latest,
|
|
154
358
|
latest: info.latest,
|
|
155
359
|
dependent: info.dependent ?? "",
|
|
156
|
-
type:
|
|
360
|
+
type: "global",
|
|
157
361
|
selected: false,
|
|
158
362
|
targetVersion: info.latest
|
|
159
363
|
}));
|
|
@@ -211,7 +415,7 @@ function parseYarnOutdated(raw, global) {
|
|
|
211
415
|
wanted: row[2] ?? row[3],
|
|
212
416
|
latest: row[3],
|
|
213
417
|
dependent: row[4] ?? "",
|
|
214
|
-
type:
|
|
418
|
+
type: "global",
|
|
215
419
|
selected: false,
|
|
216
420
|
targetVersion: row[3]
|
|
217
421
|
}));
|
|
@@ -254,7 +458,11 @@ async function updatePackages(manager, packages, cwd, global = false, onLine) {
|
|
|
254
458
|
}
|
|
255
459
|
}
|
|
256
460
|
for (const batch of batches) {
|
|
257
|
-
const pkgArgs = batch.pkgs.map((pkg) =>
|
|
461
|
+
const pkgArgs = batch.pkgs.map((pkg) => {
|
|
462
|
+
const version = pkg.targetVersion ?? pkg.latest;
|
|
463
|
+
const prefix = pkg.rangePrefix ?? "";
|
|
464
|
+
return `${pkg.name}@${prefix}${version}`;
|
|
465
|
+
});
|
|
258
466
|
const args = batch.mgr === "yarn" && global ? [
|
|
259
467
|
"global",
|
|
260
468
|
"add",
|
|
@@ -333,104 +541,6 @@ function saveConfig(config) {
|
|
|
333
541
|
} catch {}
|
|
334
542
|
}
|
|
335
543
|
//#endregion
|
|
336
|
-
//#region src/registry.ts
|
|
337
|
-
async function fetchVersions(packageName) {
|
|
338
|
-
try {
|
|
339
|
-
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`);
|
|
340
|
-
if (!res.ok) return [];
|
|
341
|
-
const data = await res.json();
|
|
342
|
-
const times = data.time ?? {};
|
|
343
|
-
const distTags = data["dist-tags"] ?? {};
|
|
344
|
-
const tagByVersion = {};
|
|
345
|
-
for (const [tag, ver] of Object.entries(distTags)) tagByVersion[ver] = tag;
|
|
346
|
-
return Object.keys(data.versions ?? {}).filter((v) => !v.includes("-") || tagByVersion[v]).map((v) => ({
|
|
347
|
-
version: v,
|
|
348
|
-
date: times[v] ? new Date(times[v]).toISOString().split("T")[0] : "",
|
|
349
|
-
tag: tagByVersion[v]
|
|
350
|
-
})).sort((a, b) => {
|
|
351
|
-
const pa = a.version.split(".").map(Number);
|
|
352
|
-
const pb = b.version.split(".").map(Number);
|
|
353
|
-
for (let i = 0; i < 3; i++) if ((pb[i] ?? 0) !== (pa[i] ?? 0)) return (pb[i] ?? 0) - (pa[i] ?? 0);
|
|
354
|
-
return 0;
|
|
355
|
-
});
|
|
356
|
-
} catch {
|
|
357
|
-
return [];
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
async function fetchChangelog(packageName, fromVersion, toVersion) {
|
|
361
|
-
try {
|
|
362
|
-
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
363
|
-
if (!res.ok) return [];
|
|
364
|
-
const data = await res.json();
|
|
365
|
-
const match = (typeof data.repository === "string" ? data.repository : data.repository?.url ?? "").match(/github\.com[/:]([^/]+\/[^/]+)/);
|
|
366
|
-
if (!match) return [];
|
|
367
|
-
const repo = match[1].replace(/\.git$/, "");
|
|
368
|
-
const ghRes = await fetch(`https://api.github.com/repos/${repo}/releases?per_page=30`, { headers: { Accept: "application/vnd.github+json" } });
|
|
369
|
-
if (!ghRes.ok) return [];
|
|
370
|
-
const releases = await ghRes.json();
|
|
371
|
-
const parseVer = (v) => v.replace(/^[^0-9]*/, "").split(".").map(Number);
|
|
372
|
-
const cmpVer = (a, b) => {
|
|
373
|
-
for (let i = 0; i < 3; i++) {
|
|
374
|
-
const diff = (a[i] ?? 0) - (b[i] ?? 0);
|
|
375
|
-
if (diff !== 0) return diff;
|
|
376
|
-
}
|
|
377
|
-
return 0;
|
|
378
|
-
};
|
|
379
|
-
const from = parseVer(fromVersion);
|
|
380
|
-
const to = parseVer(toVersion);
|
|
381
|
-
const filtered = releases.filter((r) => {
|
|
382
|
-
if (r.draft || r.prerelease) return false;
|
|
383
|
-
const ver = parseVer(r.tag_name);
|
|
384
|
-
return cmpVer(ver, from) > 0 && cmpVer(ver, to) <= 0;
|
|
385
|
-
}).map((r) => ({
|
|
386
|
-
version: r.tag_name,
|
|
387
|
-
body: r.body?.trim() ?? "No release notes.",
|
|
388
|
-
url: r.html_url
|
|
389
|
-
}));
|
|
390
|
-
if (filtered.length === 0 && releases.length > 0) {
|
|
391
|
-
const latest = releases[0];
|
|
392
|
-
return [{
|
|
393
|
-
version: latest.tag_name,
|
|
394
|
-
body: latest.body?.trim() ?? "No release notes.",
|
|
395
|
-
url: latest.html_url
|
|
396
|
-
}];
|
|
397
|
-
}
|
|
398
|
-
return filtered;
|
|
399
|
-
} catch {
|
|
400
|
-
return [];
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
async function fetchLatestVersion(packageName) {
|
|
404
|
-
try {
|
|
405
|
-
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
406
|
-
if (!res.ok) return null;
|
|
407
|
-
return (await res.json()).version ?? null;
|
|
408
|
-
} catch {
|
|
409
|
-
return null;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
function isNewerVersion(current, latest) {
|
|
413
|
-
const a = current.split(".").map(Number);
|
|
414
|
-
const b = latest.split(".").map(Number);
|
|
415
|
-
for (let i = 0; i < 3; i++) {
|
|
416
|
-
if ((b[i] ?? 0) > (a[i] ?? 0)) return true;
|
|
417
|
-
if ((b[i] ?? 0) < (a[i] ?? 0)) return false;
|
|
418
|
-
}
|
|
419
|
-
return false;
|
|
420
|
-
}
|
|
421
|
-
async function fetchRepoUrl(packageName) {
|
|
422
|
-
try {
|
|
423
|
-
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`);
|
|
424
|
-
if (!res.ok) return "";
|
|
425
|
-
const data = await res.json();
|
|
426
|
-
const match = (typeof data.repository === "string" ? data.repository : data.repository?.url ?? "").match(/github\.com[/:]([^/]+\/[^/]+)/);
|
|
427
|
-
if (!match) return "";
|
|
428
|
-
return `https://github.com/${match[1].replace(/\.git$/, "")}`;
|
|
429
|
-
} catch {
|
|
430
|
-
return "";
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
//#endregion
|
|
434
544
|
//#region src/ui/PackageList.tsx
|
|
435
545
|
const TYPE_COLORS = {
|
|
436
546
|
dependencies: "cyan",
|
|
@@ -761,7 +871,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
761
871
|
children: group.label
|
|
762
872
|
}),
|
|
763
873
|
/* @__PURE__ */ jsxs(Text, {
|
|
764
|
-
dimColor: true,
|
|
765
874
|
color: "gray",
|
|
766
875
|
children: [
|
|
767
876
|
"(",
|
|
@@ -770,7 +879,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
770
879
|
]
|
|
771
880
|
}),
|
|
772
881
|
needsScroll && focusedLocalIndex >= 0 && /* @__PURE__ */ jsxs(Text, {
|
|
773
|
-
dimColor: true,
|
|
774
882
|
color: "gray",
|
|
775
883
|
children: [
|
|
776
884
|
focusedLocalIndex + 1,
|
|
@@ -790,14 +898,12 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
790
898
|
marginBottom: 0,
|
|
791
899
|
children: [
|
|
792
900
|
/* @__PURE__ */ jsx(Text, {
|
|
793
|
-
dimColor: true,
|
|
794
901
|
color: "gray",
|
|
795
902
|
children: " "
|
|
796
903
|
}),
|
|
797
904
|
/* @__PURE__ */ jsx(Box, {
|
|
798
905
|
width: 28,
|
|
799
906
|
children: /* @__PURE__ */ jsx(Text, {
|
|
800
|
-
dimColor: true,
|
|
801
907
|
color: "gray",
|
|
802
908
|
children: "package"
|
|
803
909
|
})
|
|
@@ -805,7 +911,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
805
911
|
/* @__PURE__ */ jsx(Box, {
|
|
806
912
|
width: 10,
|
|
807
913
|
children: /* @__PURE__ */ jsx(Text, {
|
|
808
|
-
dimColor: true,
|
|
809
914
|
color: "gray",
|
|
810
915
|
children: "current"
|
|
811
916
|
})
|
|
@@ -813,7 +918,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
813
918
|
/* @__PURE__ */ jsx(Box, {
|
|
814
919
|
width: 10,
|
|
815
920
|
children: /* @__PURE__ */ jsx(Text, {
|
|
816
|
-
dimColor: true,
|
|
817
921
|
color: "gray",
|
|
818
922
|
children: "target"
|
|
819
923
|
})
|
|
@@ -821,7 +925,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
821
925
|
/* @__PURE__ */ jsx(Box, {
|
|
822
926
|
width: 10,
|
|
823
927
|
children: /* @__PURE__ */ jsx(Text, {
|
|
824
|
-
dimColor: true,
|
|
825
928
|
color: "gray",
|
|
826
929
|
children: "latest"
|
|
827
930
|
})
|
|
@@ -829,7 +932,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
829
932
|
]
|
|
830
933
|
}),
|
|
831
934
|
needsScroll && /* @__PURE__ */ jsx(Text, {
|
|
832
|
-
dimColor: true,
|
|
833
935
|
color: "gray",
|
|
834
936
|
children: offset > 0 ? ` ↑ ${offset} more above` : " "
|
|
835
937
|
}),
|
|
@@ -898,7 +1000,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
898
1000
|
width: 10,
|
|
899
1001
|
children: /* @__PURE__ */ jsx(Text, {
|
|
900
1002
|
color: "red",
|
|
901
|
-
dimColor: true,
|
|
902
1003
|
children: pkg.current
|
|
903
1004
|
})
|
|
904
1005
|
}),
|
|
@@ -927,7 +1028,6 @@ function PackageList({ packages, onToggle, onToggleGroup, onToggleMany, onSelect
|
|
|
927
1028
|
}, pkg.name);
|
|
928
1029
|
}),
|
|
929
1030
|
needsScroll && /* @__PURE__ */ jsx(Text, {
|
|
930
|
-
dimColor: true,
|
|
931
1031
|
color: "gray",
|
|
932
1032
|
children: offset + maxVisible < totalItems ? ` ↓ ${totalItems - offset - maxVisible} more below` : " "
|
|
933
1033
|
})
|
|
@@ -1068,7 +1168,6 @@ function VersionPicker({ pkg, onSelect, onCancel }) {
|
|
|
1068
1168
|
width: 10,
|
|
1069
1169
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1070
1170
|
color: "gray",
|
|
1071
|
-
dimColor: true,
|
|
1072
1171
|
children: v.date
|
|
1073
1172
|
})
|
|
1074
1173
|
}),
|
|
@@ -1084,7 +1183,6 @@ function VersionPicker({ pkg, onSelect, onCancel }) {
|
|
|
1084
1183
|
}, v.version);
|
|
1085
1184
|
}), versions.length > PAGE && /* @__PURE__ */ jsxs(Text, {
|
|
1086
1185
|
color: "gray",
|
|
1087
|
-
dimColor: true,
|
|
1088
1186
|
children: [
|
|
1089
1187
|
" ",
|
|
1090
1188
|
"showing ",
|
|
@@ -1180,20 +1278,17 @@ function MarkdownLine({ line, baseColor = "white", baseDim = false }) {
|
|
|
1180
1278
|
return /* @__PURE__ */ jsxs(Text, { children: [" " + " ".repeat(indent) + "• ", segments.map((s, i) => /* @__PURE__ */ jsx(Text, {
|
|
1181
1279
|
bold: s.bold,
|
|
1182
1280
|
color: s.code ? "cyan" : s.dim ? "gray" : baseColor,
|
|
1183
|
-
dimColor: s.dim || baseDim,
|
|
1184
1281
|
children: s.text
|
|
1185
1282
|
}, i))] });
|
|
1186
1283
|
}
|
|
1187
1284
|
if (/^[-*_]{3,}$/.test(raw.trim())) return /* @__PURE__ */ jsx(Text, {
|
|
1188
1285
|
color: "gray",
|
|
1189
|
-
dimColor: true,
|
|
1190
1286
|
children: " ────────────────────"
|
|
1191
1287
|
});
|
|
1192
1288
|
if (!raw.trim()) return /* @__PURE__ */ jsx(Text, { children: " " });
|
|
1193
1289
|
return /* @__PURE__ */ jsxs(Text, { children: [" ", parseInline(raw).map((s, i) => /* @__PURE__ */ jsx(Text, {
|
|
1194
1290
|
bold: s.bold,
|
|
1195
1291
|
color: s.code ? "cyan" : s.dim ? "gray" : baseColor,
|
|
1196
|
-
dimColor: s.dim || baseDim,
|
|
1197
1292
|
children: s.text
|
|
1198
1293
|
}, i))] });
|
|
1199
1294
|
}
|
|
@@ -1300,7 +1395,6 @@ function ChangelogPanel({ pkg, onClose }) {
|
|
|
1300
1395
|
}),
|
|
1301
1396
|
repoUrl && /* @__PURE__ */ jsxs(Text, {
|
|
1302
1397
|
color: "gray",
|
|
1303
|
-
dimColor: true,
|
|
1304
1398
|
children: [
|
|
1305
1399
|
" ",
|
|
1306
1400
|
repoUrl,
|
|
@@ -1323,10 +1417,7 @@ function ChangelogPanel({ pkg, onClose }) {
|
|
|
1323
1417
|
activeEntry > 0 ? /* @__PURE__ */ jsx(Text, {
|
|
1324
1418
|
color: "white",
|
|
1325
1419
|
children: "←"
|
|
1326
|
-
}) : /* @__PURE__ */ jsx(Text, {
|
|
1327
|
-
dimColor: true,
|
|
1328
|
-
children: "←"
|
|
1329
|
-
}),
|
|
1420
|
+
}) : /* @__PURE__ */ jsx(Text, { children: "←" }),
|
|
1330
1421
|
" ",
|
|
1331
1422
|
/* @__PURE__ */ jsx(Text, {
|
|
1332
1423
|
color: "cyanBright",
|
|
@@ -1334,24 +1425,18 @@ function ChangelogPanel({ pkg, onClose }) {
|
|
|
1334
1425
|
children: currentEntry?.version ?? ""
|
|
1335
1426
|
}),
|
|
1336
1427
|
" ",
|
|
1337
|
-
/* @__PURE__ */ jsxs(Text, {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
")"
|
|
1345
|
-
]
|
|
1346
|
-
}),
|
|
1428
|
+
/* @__PURE__ */ jsxs(Text, { children: [
|
|
1429
|
+
"(",
|
|
1430
|
+
activeEntry + 1,
|
|
1431
|
+
"/",
|
|
1432
|
+
entries.length,
|
|
1433
|
+
")"
|
|
1434
|
+
] }),
|
|
1347
1435
|
" ",
|
|
1348
1436
|
activeEntry < entries.length - 1 ? /* @__PURE__ */ jsx(Text, {
|
|
1349
1437
|
color: "white",
|
|
1350
1438
|
children: "→"
|
|
1351
|
-
}) : /* @__PURE__ */ jsx(Text, {
|
|
1352
|
-
dimColor: true,
|
|
1353
|
-
children: "→"
|
|
1354
|
-
})
|
|
1439
|
+
}) : /* @__PURE__ */ jsx(Text, { children: "→" })
|
|
1355
1440
|
]
|
|
1356
1441
|
})
|
|
1357
1442
|
}),
|
|
@@ -1485,7 +1570,6 @@ function UpdateResults({ results, onDone }) {
|
|
|
1485
1570
|
children: r.name
|
|
1486
1571
|
}),
|
|
1487
1572
|
/* @__PURE__ */ jsx(Text, {
|
|
1488
|
-
dimColor: true,
|
|
1489
1573
|
color: "gray",
|
|
1490
1574
|
children: r.fromVersion
|
|
1491
1575
|
}),
|
|
@@ -1513,7 +1597,6 @@ function UpdateResults({ results, onDone }) {
|
|
|
1513
1597
|
children: r.name
|
|
1514
1598
|
}),
|
|
1515
1599
|
/* @__PURE__ */ jsx(Text, {
|
|
1516
|
-
dimColor: true,
|
|
1517
1600
|
color: "gray",
|
|
1518
1601
|
children: r.fromVersion
|
|
1519
1602
|
}),
|
|
@@ -1528,7 +1611,6 @@ function UpdateResults({ results, onDone }) {
|
|
|
1528
1611
|
]
|
|
1529
1612
|
}), r.error && /* @__PURE__ */ jsxs(Text, {
|
|
1530
1613
|
color: "red",
|
|
1531
|
-
dimColor: true,
|
|
1532
1614
|
children: [" ", r.error.slice(0, 80)]
|
|
1533
1615
|
})]
|
|
1534
1616
|
}, r.name))
|
|
@@ -1605,7 +1687,6 @@ function Settings({ config, onConfigChange, onClose }) {
|
|
|
1605
1687
|
}), /* @__PURE__ */ jsx(Box, {
|
|
1606
1688
|
marginLeft: 6,
|
|
1607
1689
|
children: /* @__PURE__ */ jsx(Text, {
|
|
1608
|
-
dimColor: true,
|
|
1609
1690
|
color: "gray",
|
|
1610
1691
|
children: setting.description
|
|
1611
1692
|
})
|
|
@@ -1732,7 +1813,7 @@ function App({ project, global, version, installManager }) {
|
|
|
1732
1813
|
const [loadingMsg, setLoadingMsg] = useState("Checking for outdated packages…");
|
|
1733
1814
|
const MAX_TERMINAL_LINES = 3;
|
|
1734
1815
|
const [outputLines, setOutputLines] = useState([]);
|
|
1735
|
-
const [terminalCmd, setTerminalCmd] = useState(global ? "Checking all package managers…" :
|
|
1816
|
+
const [terminalCmd, setTerminalCmd] = useState(global ? "Checking all package managers…" : "Checking npm registry…");
|
|
1736
1817
|
useEffect(() => {
|
|
1737
1818
|
let cancelled = false;
|
|
1738
1819
|
fetchLatestVersion("ripencli").then((latest) => {
|
|
@@ -1896,12 +1977,10 @@ function App({ project, global, version, installManager }) {
|
|
|
1896
1977
|
color: "gray",
|
|
1897
1978
|
children: "$ "
|
|
1898
1979
|
}), /* @__PURE__ */ jsx(Text, {
|
|
1899
|
-
dimColor: true,
|
|
1900
1980
|
color: "gray",
|
|
1901
1981
|
children: terminalCmd
|
|
1902
1982
|
})] }), outputLines.map((line, i) => /* @__PURE__ */ jsx(Text, {
|
|
1903
1983
|
color: line.includes("WARN") || line.includes("ERR") ? "yellow" : "gray",
|
|
1904
|
-
dimColor: true,
|
|
1905
1984
|
wrap: "truncate",
|
|
1906
1985
|
children: line
|
|
1907
1986
|
}, i))]
|
|
@@ -1926,7 +2005,6 @@ function App({ project, global, version, installManager }) {
|
|
|
1926
2005
|
}),
|
|
1927
2006
|
/* @__PURE__ */ jsx(Text, {
|
|
1928
2007
|
color: "gray",
|
|
1929
|
-
dimColor: true,
|
|
1930
2008
|
children: errorMsg
|
|
1931
2009
|
}),
|
|
1932
2010
|
/* @__PURE__ */ jsx(Box, {
|
|
@@ -1988,12 +2066,10 @@ function App({ project, global, version, installManager }) {
|
|
|
1988
2066
|
color: "gray",
|
|
1989
2067
|
children: "$ "
|
|
1990
2068
|
}), /* @__PURE__ */ jsx(Text, {
|
|
1991
|
-
dimColor: true,
|
|
1992
2069
|
color: "gray",
|
|
1993
2070
|
children: terminalCmd
|
|
1994
2071
|
})] }), outputLines.map((line, i) => /* @__PURE__ */ jsx(Text, {
|
|
1995
2072
|
color: line.includes("WARN") || line.includes("ERR") ? "yellow" : "gray",
|
|
1996
|
-
dimColor: true,
|
|
1997
2073
|
wrap: "truncate",
|
|
1998
2074
|
children: line
|
|
1999
2075
|
}, i))]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ripencli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "Interactive dependency updater for npm, pnpm, and yarn",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -8,6 +8,16 @@
|
|
|
8
8
|
"email": "yusifaliyevpro@gmail.com",
|
|
9
9
|
"url": "https://yusifaliyevpro.com"
|
|
10
10
|
},
|
|
11
|
+
"funding": [
|
|
12
|
+
{
|
|
13
|
+
"type": "patreon",
|
|
14
|
+
"url": "https://patreon.com/yusifaliyevpro"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "kofe.al",
|
|
18
|
+
"url": "https://kofe.al/@yusifaliyevpro"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
11
21
|
"homepage": "https://github.com/yusifaliyevpro/ripen#readme",
|
|
12
22
|
"repository": {
|
|
13
23
|
"type": "git",
|
|
@@ -43,7 +53,7 @@
|
|
|
43
53
|
"dist"
|
|
44
54
|
],
|
|
45
55
|
"dependencies": {
|
|
46
|
-
"execa": "^9.
|
|
56
|
+
"execa": "^9.6.1",
|
|
47
57
|
"ink": "^6.8.0",
|
|
48
58
|
"ink-scroll-view": "^0.3.6",
|
|
49
59
|
"react": "^19.2.4"
|