rman 2.15.2 → 2.16.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.
@@ -61,6 +61,17 @@ export declare namespace RmanNodeConfig {
61
61
  * own "Unknown command: stage" is a better message than a guess made somewhere else.
62
62
  */
63
63
  staged?: ConfigValue<boolean>;
64
+ /**
65
+ * The prerelease identifiers that are **not previews** for this package - a version on one of
66
+ * them publishes to `latest` like a release, instead of under a dist-tag of its own.
67
+ *
68
+ * For a package whose every release is a prerelease by design: `["rev"]` publishes
69
+ * `4.13.3-rev.9` to `latest`, while a `4.14.0-beta.0` of the same package keeps its own `beta`
70
+ * tag. Pairs with `.rmanrc "version.preid"`.
71
+ *
72
+ * @example ["rev"]
73
+ */
74
+ latestPrereleases?: ConfigValue<string[]>;
64
75
  }
65
76
  }
66
77
  /**
@@ -501,7 +501,7 @@ function retiredDirectoryKey(pkg) {
501
501
  * checks; they agree deliberately.
502
502
  */
503
503
  function distTagFor(pkg, tag) {
504
- const isPreview = !isCalendarVersion(pkg.version) && pkg.versionScheme.isPrerelease(pkg.version);
504
+ const isPreview = !isCalendarVersion(pkg.version) && pkg.versionScheme.isPrerelease(pkg.version) && !releasesAsLatest(pkg);
505
505
  if (!isPreview)
506
506
  return { tag };
507
507
  if (tag) {
@@ -553,3 +553,18 @@ function resolveStaged(pkg, override) {
553
553
  return override;
554
554
  return !!pkg.config?.publish?.npm?.staged;
555
555
  }
556
+ /**
557
+ * Whether `pkg`'s prerelease identifier is one `.rmanrc "publish.npm.latestPrereleases"` lists - a
558
+ * line the package releases on for good, which publishes to `latest` like any release.
559
+ */
560
+ /* **An explicit list, not "whatever `version.preid` says".** A repository can put its previews on a
561
+ * declared line too (`preid: beta`), and reading the bump's setting as a statement about the
562
+ * registry would have every such beta land on `latest` - the one mistake `distTagFor` exists to
563
+ * stop. Naming the identifier also keeps the protection for every other one: a `-beta.0` of a
564
+ * package publishing `-rev.N` to `latest` still gets its own tag. Requested from `panates/browsery`,
565
+ * which repackages upstream modules as `<upstream version>-rev.N`. */
566
+ function releasesAsLatest(pkg) {
567
+ const listed = pkg.config?.publish?.npm?.latestPrereleases;
568
+ const id = pkg.versionScheme.prereleaseId(pkg.version);
569
+ return !!id && Array.isArray(listed) && listed.includes(id);
570
+ }
@@ -58,8 +58,10 @@ declare const config: {
58
58
  describe: string;
59
59
  type: "boolean";
60
60
  };
61
+ /** `target: 'both'`: a flag for one prerelease, and `.rmanrc "version.preid"` for a repository
62
+ * that releases on a prerelease line for good (`4.13.3-rev.N`). */
61
63
  preid: {
62
- target: "cli";
64
+ target: "both";
63
65
  describe: string;
64
66
  type: "string";
65
67
  };
@@ -257,8 +259,10 @@ declare const versionCommand: (app: import("../index.js").RmanApplication) => {
257
259
  describe: string;
258
260
  type: "boolean";
259
261
  };
262
+ /** `target: 'both'`: a flag for one prerelease, and `.rmanrc "version.preid"` for a repository
263
+ * that releases on a prerelease line for good (`4.13.3-rev.N`). */
260
264
  preid: {
261
- target: "cli";
265
+ target: "both";
262
266
  describe: string;
263
267
  type: "string";
264
268
  };
@@ -77,11 +77,14 @@ const config = {
77
77
  '"version.changelog", or false - --no-changelog forces it off even when that\'s true.',
78
78
  type: 'boolean',
79
79
  },
80
+ /** `target: 'both'`: a flag for one prerelease, and `.rmanrc "version.preid"` for a repository
81
+ * that releases on a prerelease line for good (`4.13.3-rev.N`). */
80
82
  preid: {
81
- target: 'cli',
83
+ target: 'both',
82
84
  describe: 'Make the bump a prerelease with this identifier (e.g. "beta" -> 1.2.3-beta.0). ' +
83
85
  'Running again with the same --preid increments it (-> 1.2.3-beta.1); a different ' +
84
- 'identifier starts a fresh prerelease line. Ignored when bump is an explicit version.',
86
+ 'identifier starts a fresh prerelease line. Ignored when bump is an explicit version. ' +
87
+ 'Default: .rmanrc "version.preid", which every member of a group has to agree on.',
85
88
  type: 'string',
86
89
  },
87
90
  /**
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.15.2';
1
+ export const version = '2.16.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.15.2",
4
+ "version": "2.16.0",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {
@@ -129,6 +129,12 @@ export declare abstract class VersionPlanService {
129
129
  * case the technology's own `cascade` answers. Members disagreeing take the widest, the same rule
130
130
  * and the same direction `cascadeFor` applies to two technologies.
131
131
  */
132
+ /**
133
+ * The prerelease identifier a group's members declare in `.rmanrc "version.preid"`, or `undefined`
134
+ * when none does. Members declaring different ones are an error naming them: a group is one
135
+ * version line, and a line cannot be on two prerelease identifiers at once.
136
+ */
137
+ protected declaredPreid(members: Package[], label: string): string | undefined;
132
138
  protected declaredCascade(members: Package[]): VersionPlanService.Cascade | undefined;
133
139
  /**
134
140
  * The largest bump `commits` ask for, in `scheme`'s own names.
@@ -160,7 +160,8 @@ export class VersionPlanService {
160
160
  groups.set(key, [pkg]);
161
161
  }
162
162
  for (const [key, members] of groups) {
163
- this.computeGroupPlan(key, members, changeByPackage, explicitVersion, options.preid, entries);
163
+ const preid = options.preid ?? this.declaredPreid(members, this.groupLabel(key));
164
+ this.computeGroupPlan(key, members, changeByPackage, explicitVersion, preid, entries);
164
165
  }
165
166
  this.rippleCrossGroup(packages, entries, options.preid);
166
167
  const result = packages.map(pkg => entries.get(pkg.name));
@@ -267,6 +268,31 @@ export class VersionPlanService {
267
268
  * `^1.0.0` does not admit `2.0.0` and an in-group dependent left at the old number would declare
268
269
  * a range its own group no longer satisfies. So `changed` means "no floor of my own", not "never
269
270
  * more than the changed packages". */
271
+ /**
272
+ * The prerelease identifier a group's members declare in `.rmanrc "version.preid"`, or `undefined`
273
+ * when none does. Members declaring different ones are an error naming them: a group is one
274
+ * version line, and a line cannot be on two prerelease identifiers at once.
275
+ */
276
+ /* **A member saying nothing agrees with whoever does.** The usual shape is one declaration above
277
+ * the group (`"[*]"`, or a shared preset), which reaches every member; a group where only some
278
+ * members say it is still one line, and refusing it would make adding a package to a group a way
279
+ * to break its release. Two different words are the only disagreement, and that one has no
280
+ * answer: `4.13.3-rev.9` and `4.13.3-beta.0` cannot both be the group's next version. */
281
+ declaredPreid(members, label) {
282
+ const declared = new Map();
283
+ for (const m of members) {
284
+ const preid = m.config?.version?.preid;
285
+ if (typeof preid !== 'string' || !preid)
286
+ continue;
287
+ declared.set(preid, [...(declared.get(preid) ?? []), m.name]);
288
+ }
289
+ if (declared.size > 1) {
290
+ const sides = [...declared].map(([preid, names]) => `"${preid}" (${names.join(', ')})`).join(' and ');
291
+ throw new Error(`Group ${label} is one version line, but its members declare different "version.preid": ${sides}. ` +
292
+ 'Declare one identifier for the whole group.');
293
+ }
294
+ return declared.keys().next().value;
295
+ }
270
296
  declaredCascade(members) {
271
297
  const declared = new Set(members.map(m => m.config?.version?.cascade).filter((c) => !!c));
272
298
  if (!declared.size)
@@ -454,7 +480,10 @@ export class VersionPlanService {
454
480
  const next = {
455
481
  ...entry,
456
482
  status: 'bump',
457
- to: pkg.versionScheme.next(groupCeiling, pkg.versionScheme.smallestBump(), { preid }),
483
+ to: pkg.versionScheme.next(groupCeiling, pkg.versionScheme.smallestBump(), {
484
+ preid: preid ??
485
+ this.declaredPreid(packages.filter(p => entries.get(p.name).groupKey === entry.groupKey), entry.group ?? entry.groupKey),
486
+ }),
458
487
  reason: `depends on ${source.package.name}@${source.to}`,
459
488
  };
460
489
  entries.set(pkg.name, next);