rman 2.42.0 → 2.42.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.
- package/constants.js +1 -1
- package/package.json +1 -1
- package/services/github-release.service.js +3 -11
- package/services/version-plan.service.d.ts +5 -0
- package/services/version-plan.service.js +16 -1
- package/services/version.service.js +22 -13
- package/utils/release-version.d.ts +6 -0
- package/utils/release-version.js +14 -0
package/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.42.
|
|
1
|
+
export const version = '2.42.1';
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { Package } from '../core/classes/package.js';
|
|
|
5
5
|
import { Repository } from '../core/classes/repository.js';
|
|
6
6
|
import { Service } from '../core/classes/service.js';
|
|
7
7
|
import { dirtyReason, GitHelper } from '../utils/git.js';
|
|
8
|
-
import {
|
|
8
|
+
import { isCalendarVersion, releaseTagPattern, repositoryReleaseTag } from '../utils/release-version.js';
|
|
9
9
|
import { ChangeHashService } from './change-hash.service.js';
|
|
10
10
|
/**
|
|
11
11
|
* A service class - see `ListService` for the shape and `Service` for the three measured
|
|
@@ -48,7 +48,7 @@ export class GithubReleaseService extends Service {
|
|
|
48
48
|
},
|
|
49
49
|
];
|
|
50
50
|
}
|
|
51
|
-
const tag =
|
|
51
|
+
const tag = repositoryReleaseTag(root, root.version);
|
|
52
52
|
const dirtyFiles = await git.listDirtyFiles();
|
|
53
53
|
if (dirtyFiles.length) {
|
|
54
54
|
return [
|
|
@@ -130,15 +130,7 @@ export class GithubReleaseService extends Service {
|
|
|
130
130
|
}
|
|
131
131
|
const GITHUB_API = 'https://api.github.com';
|
|
132
132
|
const GITHUB_UPLOADS = 'https://uploads.github.com';
|
|
133
|
-
/** The
|
|
134
|
-
* so the release needs a name of its own (`release-*`); a plain one means every package shares it,
|
|
135
|
-
* and that shared version's tag already *is* the release. */
|
|
136
|
-
function releaseTagFor(root) {
|
|
137
|
-
return isCalendarVersion(root.version)
|
|
138
|
-
? expandReleaseTag(root, root.version)
|
|
139
|
-
: ChangeHashService.expandTag(root, root.version);
|
|
140
|
-
}
|
|
141
|
-
/** The glob matching the tags `releaseTagFor` produces - for stepping back to the previous one. */
|
|
133
|
+
/** The glob matching the tags `repositoryReleaseTag` produces - for stepping back to the previous one. */
|
|
142
134
|
function releaseTagGlob(root) {
|
|
143
135
|
const pattern = isCalendarVersion(root.version) ? releaseTagPattern(root) : ChangeHashService.tagPattern(root);
|
|
144
136
|
return pattern.replace('{name}', root.name);
|
|
@@ -77,6 +77,11 @@ export declare abstract class VersionPlanService {
|
|
|
77
77
|
* commits count toward the published packages that carry it (`bundledPackages`).
|
|
78
78
|
*/
|
|
79
79
|
protected notVersionedReason(pkg: Package): string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* How many version lines the repository has - the distinct groups of every package it versions,
|
|
82
|
+
* whatever this run was filtered to. `buildRootEntry`'s `groupCount`.
|
|
83
|
+
*/
|
|
84
|
+
protected versionLines(repository: Repository): number;
|
|
80
85
|
/**
|
|
81
86
|
* The commit a package's changes are measured **since** - its last release boundary, or
|
|
82
87
|
* `undefined` for a package that has never been released (the caller then reads the whole
|
|
@@ -208,7 +208,7 @@ export class VersionPlanService {
|
|
|
208
208
|
const result = packages.map(pkg => entries.get(pkg.name));
|
|
209
209
|
if (repository.monorepo) {
|
|
210
210
|
result.push(this.buildRootEntry(repository, result, {
|
|
211
|
-
groupCount:
|
|
211
|
+
groupCount: this.versionLines(repository),
|
|
212
212
|
lastReleaseVersion: await findLastReleaseVersion(git, repository.rootPackage),
|
|
213
213
|
now: options.now ?? (() => new Date()),
|
|
214
214
|
}));
|
|
@@ -243,6 +243,21 @@ export class VersionPlanService {
|
|
|
243
243
|
notVersionedReason(pkg) {
|
|
244
244
|
return unversionedReason(pkg);
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* How many version lines the repository has - the distinct groups of every package it versions,
|
|
248
|
+
* whatever this run was filtered to. `buildRootEntry`'s `groupCount`.
|
|
249
|
+
*/
|
|
250
|
+
/* **Structural, not the groups this run built.** It was `groups.size`, and `groups` holds only the
|
|
251
|
+
* packages this run looks at: `rman version patch --scope pkg-a` on a repository with two version
|
|
252
|
+
* lines built one group, so the root took the semver path and reported `1.0.1` - a shared number
|
|
253
|
+
* claiming a release `pkg-b` never had. That went unseen while `version` created no root tag on
|
|
254
|
+
* semver; once it creates the one `github-release` looks for (`repositoryReleaseTag`), it tagged
|
|
255
|
+
* `v1.0.1`. A package the planner never versions (`notVersionedReason` - a `publish.skip` demo
|
|
256
|
+
* app) is left out: it moves no number, so it is no version line of the release's. */
|
|
257
|
+
versionLines(repository) {
|
|
258
|
+
const versioned = repository.getPackages().filter(pkg => !this.notVersionedReason(pkg));
|
|
259
|
+
return new Set(versioned.map(pkg => this.resolveGroupKey(pkg))).size;
|
|
260
|
+
}
|
|
246
261
|
/**
|
|
247
262
|
* Every version of `pkg` its registry already has - `[]` when it has none, or when the package is
|
|
248
263
|
* not published to a registry at all. A computed version never lands on or below the highest of
|
|
@@ -5,7 +5,7 @@ import { ConfigInterpolator } from '../core/config/config-interpolator.js';
|
|
|
5
5
|
import { Manifest } from '../core/interfaces/manifest.js';
|
|
6
6
|
import { GitHelper } from '../utils/git.js';
|
|
7
7
|
import { ROOT_SELECTOR } from '../utils/package-filter.js';
|
|
8
|
-
import {
|
|
8
|
+
import { isCalendarVersion, repositoryReleaseTag } from '../utils/release-version.js';
|
|
9
9
|
import { groupKeyOf, versionLineCount } from '../utils/version-group.js';
|
|
10
10
|
import { stampVersionLabel } from '../utils/version-stamp.js';
|
|
11
11
|
import { ChangeHashService } from './change-hash.service.js';
|
|
@@ -267,19 +267,28 @@ export class VersionService extends Service {
|
|
|
267
267
|
tagged.push({ name: tag, created: !exists });
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
/**
|
|
271
|
-
*
|
|
272
|
-
* (same version, same commit), and
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
270
|
+
/** The repository release tag `github-release` looks for (`repositoryReleaseTag`), on top of the
|
|
271
|
+
* per-group ones. On a calendar version it is always a name of its own. On a semver one it is
|
|
272
|
+
* usually the group's own tag already (same version, same commit), and then nothing is added -
|
|
273
|
+
* a second name would only be noise in every existing repo's tag space; it is created only when
|
|
274
|
+
* the members' tags are named otherwise (`{name}@*`). Created last, so it lands on HEAD rather
|
|
275
|
+
* than behind whichever group happened to be committed last. */
|
|
276
|
+
if (rootEntry?.status === 'bump') {
|
|
277
|
+
const releaseTag = repositoryReleaseTag(repository.rootPackage, rootEntry.to);
|
|
278
|
+
const exists = await git.tagExists(releaseTag);
|
|
279
|
+
if (isCalendarVersion(rootEntry.to)) {
|
|
280
|
+
if (exists) {
|
|
281
|
+
throw new Error(`Release tag "${releaseTag}" already exists - a second release within the same minute. ` +
|
|
282
|
+
'Wait a moment and run again.');
|
|
283
|
+
}
|
|
284
|
+
await git.createTag(releaseTag);
|
|
285
|
+
tagged.push({ name: releaseTag, created: true, release: true });
|
|
286
|
+
}
|
|
287
|
+
else if (!tagged.some(t => t.name === releaseTag)) {
|
|
288
|
+
if (!exists)
|
|
289
|
+
await git.createTag(releaseTag);
|
|
290
|
+
tagged.push({ name: releaseTag, created: !exists, release: true });
|
|
280
291
|
}
|
|
281
|
-
await git.createTag(releaseTag);
|
|
282
|
-
tagged.push({ name: releaseTag, created: true, release: true });
|
|
283
292
|
}
|
|
284
293
|
const pushed = !!options.push && bumped.length > 0;
|
|
285
294
|
if (pushed) {
|
|
@@ -43,6 +43,12 @@ export declare function usesCalendarVersion(options: {
|
|
|
43
43
|
/** The tag naming a given repository release - `releaseTagPattern` run forward, the way
|
|
44
44
|
* `expandTag` runs `changelog.tagPattern` forward for a package. */
|
|
45
45
|
export declare function expandReleaseTag(root: Package, version: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* The tag naming the repository's release at `version` (the root's): its release tag on a calendar
|
|
48
|
+
* version, the root's own `changelog.tagPattern` tag (`v*` unless configured) otherwise. `version`
|
|
49
|
+
* creates it and `github-release` looks it up, so both name it through this one function.
|
|
50
|
+
*/
|
|
51
|
+
export declare function repositoryReleaseTag(root: Package, version: string): string;
|
|
46
52
|
/** The version of the repository's most recent release, from its release tags (highest by version
|
|
47
53
|
* sort) - `undefined` for a repo that has never cut one, or whose tags aren't available (a shallow
|
|
48
54
|
* clone). The authoritative half of `usesCalendarVersion`'s stickiness check: tags record what was
|
package/utils/release-version.js
CHANGED
|
@@ -54,6 +54,20 @@ export function usesCalendarVersion(options) {
|
|
|
54
54
|
export function expandReleaseTag(root, version) {
|
|
55
55
|
return ChangeHashService.applyTagPattern(releaseTagPattern(root), root.name, version);
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The tag naming the repository's release at `version` (the root's): its release tag on a calendar
|
|
59
|
+
* version, the root's own `changelog.tagPattern` tag (`v*` unless configured) otherwise. `version`
|
|
60
|
+
* creates it and `github-release` looks it up, so both name it through this one function.
|
|
61
|
+
*/
|
|
62
|
+
/* **One function, because two copies drifted.** `github-release` expected `v<version>` for a semver
|
|
63
|
+
* root while `version` created a root tag only on the calendar path, trusting the group's own tag to
|
|
64
|
+
* be the same name. It is not whenever the members' tags are `{name}@*` - declared, or derived by
|
|
65
|
+
* `versionLineCount` counting a package the planner leaves out (a `publish.skip` app). Reported from
|
|
66
|
+
* panates/peacox-ui: one named group plus a private demo app, `version` tagged
|
|
67
|
+
* `@panates-prv/peacox-ui@2.0.0-beta.0` and `github-release` refused for want of `v2.0.0-beta.0`. */
|
|
68
|
+
export function repositoryReleaseTag(root, version) {
|
|
69
|
+
return isCalendarVersion(version) ? expandReleaseTag(root, version) : ChangeHashService.expandTag(root, version);
|
|
70
|
+
}
|
|
57
71
|
/** The version of the repository's most recent release, from its release tags (highest by version
|
|
58
72
|
* sort) - `undefined` for a repo that has never cut one, or whose tags aren't available (a shallow
|
|
59
73
|
* clone). The authoritative half of `usesCalendarVersion`'s stickiness check: tags record what was
|