rman 2.26.0 → 2.27.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.
@@ -71,6 +71,9 @@ export class NodeDependencyUpdater {
71
71
  const entry = this.toEntry(d);
72
72
  entry.installed = this.installedVersion(d.pkg, d.name);
73
73
  entry.resolved = this.resolvedVersion(d, entry.current);
74
+ if (entry.installed && semver.validRange(entry.current)) {
75
+ entry.installedInRange = semver.satisfies(entry.installed, entry.current, { includePrerelease: true });
76
+ }
74
77
  return entry;
75
78
  });
76
79
  }
@@ -183,6 +183,7 @@ function jsonPlan(entries) {
183
183
  status: e.status,
184
184
  current: e.current,
185
185
  installed: e.installed,
186
+ installedInRange: e.installedInRange,
186
187
  resolved: e.resolved,
187
188
  target: e.target,
188
189
  latest: e.latest,
@@ -246,7 +247,13 @@ function printPlan(entries, root) {
246
247
  const note = e.reason ?? (reinstall(e) ? `"${e.current}" takes ${e.resolved} - install again` : undefined);
247
248
  if (note)
248
249
  values[last] = values[last].padEnd(widths[last]);
249
- const text = line(values, (v, column) => (column === 4 || column === 5 ? paint(v) : v));
250
+ const text = line(values, (v, column) => {
251
+ if (column === 2 && e.installedInRange === false)
252
+ return colors.red(v);
253
+ if (column === 3 && values[3] !== '-')
254
+ return reachesLatest(e) ? colors.green(v) : colors.yellow(v);
255
+ return column === 4 || column === 5 ? paint(v) : v;
256
+ });
250
257
  if (!note) {
251
258
  console.log(text);
252
259
  continue;
@@ -291,7 +298,25 @@ function changeOf(e) {
291
298
  * against the older version.
292
299
  */
293
300
  function reinstall(e) {
294
- return e.status === 'up-to-date' && !!e.installed && !!e.resolved && e.installed !== e.resolved;
301
+ return e.status === 'up-to-date' && installedDiffers(e);
302
+ }
303
+ /** What is installed is not what the declared range takes. */
304
+ function installedDiffers(e) {
305
+ return !!e.installed && !!e.resolved && e.installed !== e.resolved;
306
+ }
307
+ /**
308
+ * Whether this row ends on the newest version - an upgrade that goes all the way, or a range that
309
+ * already takes it. What the Latest column's colour says at a glance: green when it is reached,
310
+ * yellow when the row stops short of it (skipped, held, or an upgrade cut short), so a reader need
311
+ * not go to the note to tell the two apart.
312
+ */
313
+ /* **Installed is red only outside the declared range**, never merely behind the newest: a lockfile
314
+ * pinning an older version inside the range is the ordinary state of every row that moves, and
315
+ * colouring it would light up the whole column - the user's first version, yellow everywhere. */
316
+ function reachesLatest(e) {
317
+ if (e.status === 'update')
318
+ return !e.reason;
319
+ return e.status === 'up-to-date';
295
320
  }
296
321
  /** `held` and `skipped` in yellow, an error in red - a row with no move to colour by size. */
297
322
  function changeColor(status) {
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.26.0';
1
+ export const version = '2.27.0';
@@ -79,6 +79,9 @@ export declare namespace DependencyUpdater {
79
79
  /** The version installed now, as the package would resolve it - unset when it is not
80
80
  * installed, or the ecosystem cannot say. */
81
81
  installed?: string;
82
+ /** Whether `installed` is one the declared range accepts - `false` means the installed copy
83
+ * is not what the manifest says, and an install is due. Unset when nothing is installed. */
84
+ installedInRange?: boolean;
82
85
  /** The newest version the declared range takes - what an install would put there. An
83
86
  * `'up-to-date'` entry whose `installed` differs from it is still listed. */
84
87
  resolved?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.26.0",
4
+ "version": "2.27.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {