rman 2.18.0 → 2.18.1

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.
@@ -83,7 +83,8 @@ const config = {
83
83
  target: 'both',
84
84
  describe: 'Make the bump a prerelease with this identifier (e.g. "beta" -> 1.2.3-beta.0). ' +
85
85
  'Running again with the same --preid increments it (-> 1.2.3-beta.1); a different ' +
86
- 'identifier starts a fresh prerelease line. Ignored when bump is an explicit version. ' +
86
+ 'identifier keeps the version when it already holds the change (2.19.0-alpha.1 -> ' +
87
+ '2.19.0-beta.0). Ignored when bump is an explicit version. ' +
87
88
  'Default: .rmanrc "version.preid", which every member of a group has to agree on.',
88
89
  type: 'string',
89
90
  },
package/constants.js CHANGED
@@ -1 +1 @@
1
- export const version = '2.18.0';
1
+ export const version = '2.18.1';
@@ -133,6 +133,12 @@ export declare class SemverScheme extends VersionScheme {
133
133
  * inventing one. Same answer for a release, which has no prerelease at all.
134
134
  */
135
135
  prereleaseId(version: string): string | undefined;
136
+ /**
137
+ * Whether the release a prerelease of `version` leads to already holds a change of size `bump` -
138
+ * `X.Y.0` a minor, `X.0.0` a major, and anything a patch. The rule `semver.inc` itself applies:
139
+ * `minor` on `2.19.0-alpha.1` is `2.19.0`, not `2.20.0`.
140
+ */
141
+ protected coversBump(version: string, bump: string): boolean;
136
142
  }
137
143
  /**
138
144
  * The default, and what every package gets unless something says otherwise - so nothing about
@@ -128,8 +128,18 @@ export class SemverScheme extends VersionScheme {
128
128
  */
129
129
  const existing = semver.prerelease(current);
130
130
  const sameLine = existing && String(existing[0]) === preid;
131
- const preType = sameLine ? 'prerelease' : `pre${releaseType}`;
132
- return semver.inc(current, preType, preid) ?? current;
131
+ if (sameLine)
132
+ return semver.inc(current, 'prerelease', preid) ?? current;
133
+ /**
134
+ * **A prerelease moving to another identifier keeps its version when that version already
135
+ * holds the change** - `2.19.0-alpha.1` -> `2.19.0-beta.0` for a fix or a feature, since
136
+ * `2.19.0` is a minor's target already. It moves on only when the change needs more than the
137
+ * target gives: a breaking change on `2.19.0-alpha.1` is `3.0.0-beta.0`.
138
+ */
139
+ if (existing && this.coversBump(current, bump)) {
140
+ return `${semver.major(current)}.${semver.minor(current)}.${semver.patch(current)}-${preid}.0`;
141
+ }
142
+ return semver.inc(current, `pre${releaseType}`, preid) ?? current;
133
143
  }
134
144
  isPrerelease(version) {
135
145
  return !!semver.prerelease(version);
@@ -145,6 +155,22 @@ export class SemverScheme extends VersionScheme {
145
155
  const first = semver.prerelease(version)?.[0];
146
156
  return typeof first === 'string' ? first : undefined;
147
157
  }
158
+ /**
159
+ * Whether the release a prerelease of `version` leads to already holds a change of size `bump` -
160
+ * `X.Y.0` a minor, `X.0.0` a major, and anything a patch. The rule `semver.inc` itself applies:
161
+ * `minor` on `2.19.0-alpha.1` is `2.19.0`, not `2.20.0`.
162
+ */
163
+ /* **Only consulted when the identifier changes.** On the same identifier the counter advances
164
+ * whatever the size - a permanent `-rev.N` line (`version.preid: rev`) counts revisions of one
165
+ * upstream version, so a feature there is `rev.9`, not a new base. That is a statement about the
166
+ * line, and changing it would move `panates/browsery` off the version it wraps. */
167
+ coversBump(version, bump) {
168
+ if (bump === 'major')
169
+ return semver.minor(version) === 0 && semver.patch(version) === 0;
170
+ if (bump === 'minor')
171
+ return semver.patch(version) === 0;
172
+ return true;
173
+ }
148
174
  }
149
175
  /**
150
176
  * The default, and what every package gets unless something says otherwise - so nothing about
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rman",
3
3
  "description": "Repository manager",
4
- "version": "2.18.0",
4
+ "version": "2.18.1",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
7
7
  "dependencies": {