rman 2.40.3 → 2.41.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/builtins/platforms/node/services/publish.service.js +23 -23
- package/builtins/platforms/node/utils/consumer-needs.d.ts +4 -0
- package/builtins/platforms/node/utils/consumer-needs.js +18 -0
- package/builtins/publish-targets/spm/spm-publish.service.d.ts +3 -1
- package/builtins/publish-targets/spm/spm-publish.service.js +18 -1
- package/commands/version.command.js +4 -2
- package/constants.js +1 -1
- package/package.json +2 -2
- package/services/conventional-commits.service.js +6 -2
- package/services/version.service.d.ts +9 -4
- package/services/version.service.js +26 -9
|
@@ -23,6 +23,7 @@ import { filterPackages } from '../../../../utils/package-filter.js';
|
|
|
23
23
|
import { isCalendarVersion } from '../../../../utils/release-version.js';
|
|
24
24
|
import { npmViewPackage } from '../../../publish-targets/npm/npm-view.js';
|
|
25
25
|
import { DEPENDENCY_KEYS } from '../node-manifest.provider.js';
|
|
26
|
+
import { consumerNeeds } from '../utils/consumer-needs.js';
|
|
26
27
|
import { parseWorkspaceRange, resolveWorkspaceRange } from '../utils/workspace-range.js';
|
|
27
28
|
import { CiService } from './ci.service.js';
|
|
28
29
|
function preparePublishManifest(pkg, publishDir, packagesByName) {
|
|
@@ -460,24 +461,6 @@ function resolvePublishDir(pkg, contentsOverride) {
|
|
|
460
461
|
function privateBySource(pkg) {
|
|
461
462
|
return !!pkg.manifest.raw.private && !pkg.manifest.raw.publishConfig;
|
|
462
463
|
}
|
|
463
|
-
/** Whether a consumer installing `pkg` needs `name` to resolve: a `dependencies` entry, or a peer
|
|
464
|
-
* not marked optional. */
|
|
465
|
-
/* **Not every edge blocks a publish**, and blocking on all of them cost a release. A failed publish
|
|
466
|
-
* stops its dependents because their published range would point at a version that is not there -
|
|
467
|
-
* which is only true of what reaches the consumer:
|
|
468
|
-
* - `devDependencies` are removed from the published manifest (`derivePublishManifest`);
|
|
469
|
-
* - an optional peer that cannot be satisfied does not fail an install;
|
|
470
|
-
* - `optionalDependencies` are the ones npm proceeds without "if it cannot be found or fails to
|
|
471
|
-
* install" (npm's own documentation; not measured here).
|
|
472
|
-
* Measured on opra's 1.31.0 release: `@opra/api-ui` failed its first publish, and `@opra/http` -
|
|
473
|
-
* which lists it as an optional peer and a devDependency only - was blocked, taking elastic, mongodb
|
|
474
|
-
* and sqb with it, though none of their installs would have needed api-ui. */
|
|
475
|
-
function consumerNeeds(pkg, name) {
|
|
476
|
-
const raw = pkg.manifest.raw;
|
|
477
|
-
if (raw.dependencies?.[name] !== undefined)
|
|
478
|
-
return true;
|
|
479
|
-
return raw.peerDependencies?.[name] !== undefined && !raw.peerDependenciesMeta?.[name]?.optional;
|
|
480
|
-
}
|
|
481
464
|
/** Whether `pkg` is published from its own directory, whose `package.json` is then the manifest. */
|
|
482
465
|
/* In place, `private` is the source's whatever `publishConfig` says - npm refuses to publish it. */
|
|
483
466
|
function publishesInPlace(pkg, contentsOverride) {
|
|
@@ -528,8 +511,15 @@ function resolveRegistry(pkg, override) {
|
|
|
528
511
|
const native = pkg.manifest.raw.publishConfig?.registry;
|
|
529
512
|
return override || (typeof native === 'string' && native ? native : undefined);
|
|
530
513
|
}
|
|
531
|
-
/** Why a failed publish is worth trying again, read off
|
|
532
|
-
|
|
514
|
+
/** Why a failed publish is worth trying again, read off the package manager's output - `undefined`
|
|
515
|
+
* when it is not. */
|
|
516
|
+
/* **npm's and pnpm's spellings both.** npm says `code E503`; pnpm 12 says `Failed to publish package
|
|
517
|
+
* x@1.0.0 (status 503 Service Unavailable)` (`FailedToPublishError`, pnpm/crates/publish), with the
|
|
518
|
+
* status text empty when the registry sent none - hence `(status 5xx` alone. pnpm retries the sigstore
|
|
519
|
+
* signing exchange itself (`sign_with_retry`, two retries), so a transparency-log conflict rarely
|
|
520
|
+
* reaches rman from pnpm; its network errors are not recognized here, not having been seen.
|
|
521
|
+
*
|
|
522
|
+
* The pattern names are npm's own error codes. `TLOG_CREATE_ENTRY_ERROR` is the Sigstore conflict
|
|
533
523
|
* opra's release hit; the rest are a registry or a network that did not answer this time. A 4xx
|
|
534
524
|
* other than 429 is left out on purpose: the registry has decided, and asking again changes nothing. */
|
|
535
525
|
function transientPublishError(output) {
|
|
@@ -542,10 +532,10 @@ function transientPublishError(output) {
|
|
|
542
532
|
const TRANSIENT_PUBLISH_ERRORS = [
|
|
543
533
|
[/TLOG_CREATE_ENTRY_ERROR/, 'transparency-log conflict'],
|
|
544
534
|
[
|
|
545
|
-
/\bcode E(5\d\d)\b|\b5\d\d (Internal Server Error|Bad Gateway|Service Unavailable|Gateway Time-?out)\b/i,
|
|
535
|
+
/\bcode E(5\d\d)\b|\(status 5\d\d\b|\b5\d\d (Internal Server Error|Bad Gateway|Service Unavailable|Gateway Time-?out)\b/i,
|
|
546
536
|
'registry server error',
|
|
547
537
|
],
|
|
548
|
-
[/\bcode E429\b|\b429 Too Many Requests\b/i, 'registry rate limit'],
|
|
538
|
+
[/\bcode E429\b|\(status 429\b|\b429 Too Many Requests\b/i, 'registry rate limit'],
|
|
549
539
|
[/\b(ETIMEDOUT|ECONNRESET|ECONNREFUSED|EAI_AGAIN|ESOCKETTIMEDOUT|EPIPE)\b|socket hang up/, 'network error'],
|
|
550
540
|
];
|
|
551
541
|
/** Whether the registry already serves `version` of `pkg` - asked past npm's cache. */
|
|
@@ -636,7 +626,13 @@ function distTagFor(pkg, tag) {
|
|
|
636
626
|
* The publish flags are passed through unchanged. `--otp` is the one that reads oddly beside it,
|
|
637
627
|
* since staging is what *defers* the 2FA challenge to approval time - it is passed anyway rather
|
|
638
628
|
* than refused, because whether npm accepts it there is npm's to answer and a guess here would be a
|
|
639
|
-
* rule rman invented.
|
|
629
|
+
* rule rman invented.
|
|
630
|
+
*
|
|
631
|
+
* **`--no-git-checks` for pnpm**, which otherwise refuses to publish from any branch but
|
|
632
|
+
* `main`/`master` and from a tree with changes. Both are rman's to decide, and both disagree with how
|
|
633
|
+
* rman publishes: a repository releasing prereleases from `alpha`/`beta` (`--allow-branch`) would be
|
|
634
|
+
* refused, and a package published in place has its derived manifest written over `package.json`
|
|
635
|
+
* first, which pnpm reads as a dirty tree. npm makes neither check. */
|
|
640
636
|
function buildPublishCommand(packageManager, options) {
|
|
641
637
|
const args = options.staged ? ['stage', 'publish'] : ['publish'];
|
|
642
638
|
if (options.access)
|
|
@@ -649,6 +645,10 @@ function buildPublishCommand(packageManager, options) {
|
|
|
649
645
|
args.push('--registry', options.registry);
|
|
650
646
|
if (options.userconfig)
|
|
651
647
|
args.push('--userconfig', options.userconfig);
|
|
648
|
+
/** rman has already decided the tree is clean and the branch is allowed (`dirtyReason`,
|
|
649
|
+
* `allowBranch`); pnpm's own checks would decide again, by a rule of its own. */
|
|
650
|
+
if (packageManager === 'pnpm')
|
|
651
|
+
args.push('--no-git-checks');
|
|
652
652
|
return `${packageManager} ${args.join(' ')}`;
|
|
653
653
|
}
|
|
654
654
|
/** Whether this package stages: `--staged`/`--no-staged` when given, else its own
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Package } from '../../../../core/classes/package.js';
|
|
2
|
+
/** Whether a consumer installing `pkg` needs `name` to resolve: a `dependencies` entry, or a peer
|
|
3
|
+
* not marked optional. */
|
|
4
|
+
export declare function consumerNeeds(pkg: Package, name: string): boolean;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Whether a consumer installing `pkg` needs `name` to resolve: a `dependencies` entry, or a peer
|
|
2
|
+
* not marked optional. */
|
|
3
|
+
/* **Not every edge blocks a publish**, and blocking on all of them cost a release. A failed publish
|
|
4
|
+
* stops its dependents because their published range would point at a version that is not there -
|
|
5
|
+
* which is only true of what reaches the consumer:
|
|
6
|
+
* - `devDependencies` are removed from the published manifest (`derivePublishManifest`);
|
|
7
|
+
* - an optional peer that cannot be satisfied does not fail an install;
|
|
8
|
+
* - `optionalDependencies` are the ones npm proceeds without "if it cannot be found or fails to
|
|
9
|
+
* install" (npm's own documentation; not measured here).
|
|
10
|
+
* Measured on opra's 1.31.0 release: `@opra/api-ui` failed its first publish, and `@opra/http` -
|
|
11
|
+
* which lists it as an optional peer and a devDependency only - was blocked, taking elastic, mongodb
|
|
12
|
+
* and sqb with it, though none of their installs would have needed api-ui. */
|
|
13
|
+
export function consumerNeeds(pkg, name) {
|
|
14
|
+
const raw = pkg.manifest.raw;
|
|
15
|
+
if (raw.dependencies?.[name] !== undefined)
|
|
16
|
+
return true;
|
|
17
|
+
return raw.peerDependencies?.[name] !== undefined && !raw.peerDependenciesMeta?.[name]?.optional;
|
|
18
|
+
}
|
|
@@ -24,7 +24,9 @@ export declare class SpmPublishService extends Service {
|
|
|
24
24
|
getPlan(options?: SpmPublishService.Options, deps?: SpmPublishService.Deps): Promise<SpmPublishService.Entry[]>;
|
|
25
25
|
/**
|
|
26
26
|
* Publishes every `'publish'` entry with `spm publish --skip-existing`, one package after another,
|
|
27
|
-
* in the package's own directory. A failure is
|
|
27
|
+
* in the package's own directory. A failure is reported on its entry, and every later entry whose
|
|
28
|
+
* consumers need the failed package - a dependency, or a peer not marked optional - is marked
|
|
29
|
+
* `'error'` without being tried.
|
|
28
30
|
*/
|
|
29
31
|
applyPlan(plan: SpmPublishService.Entry[]): Promise<SpmPublishService.Entry[]>;
|
|
30
32
|
/** The access and registry `pkg` publishes with: the flag, else its `.rmanrc "publish.spm"`. */
|
|
@@ -4,6 +4,7 @@ import { filesOwnedBy } from '../../../utils/bundled-packages.js';
|
|
|
4
4
|
import { dirtyReason, GitHelper } from '../../../utils/git.js';
|
|
5
5
|
import { filterPackages } from '../../../utils/package-filter.js';
|
|
6
6
|
import { runBin } from '../../../utils/run-bin.js';
|
|
7
|
+
import { consumerNeeds } from '../../platforms/node/utils/consumer-needs.js';
|
|
7
8
|
/** The name this target answers to in `publish.target` and `--target`. */
|
|
8
9
|
export const SPM_TARGET = 'spm';
|
|
9
10
|
/**
|
|
@@ -61,15 +62,30 @@ export class SpmPublishService extends Service {
|
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
64
|
* Publishes every `'publish'` entry with `spm publish --skip-existing`, one package after another,
|
|
64
|
-
* in the package's own directory. A failure is
|
|
65
|
+
* in the package's own directory. A failure is reported on its entry, and every later entry whose
|
|
66
|
+
* consumers need the failed package - a dependency, or a peer not marked optional - is marked
|
|
67
|
+
* `'error'` without being tried.
|
|
65
68
|
*/
|
|
69
|
+
/* **A failure stops what a consumer's install needs it for**, as the npm target does: the plan is in
|
|
70
|
+
* dependency order, so a module whose dependency or required peer failed would be refused by the
|
|
71
|
+
* registry anyway - its range points at a version that is not there - and trying it only adds a
|
|
72
|
+
* second error further from the cause. The same `consumerNeeds` rule, so an optional peer or a
|
|
73
|
+
* devDependency does not block. */
|
|
66
74
|
async applyPlan(plan) {
|
|
67
75
|
const result = [];
|
|
76
|
+
const failed = new Set();
|
|
68
77
|
for (const entry of plan) {
|
|
69
78
|
if (entry.status !== 'publish') {
|
|
70
79
|
result.push(entry);
|
|
71
80
|
continue;
|
|
72
81
|
}
|
|
82
|
+
const pkg = entry.package;
|
|
83
|
+
const blocker = pkg.dependencies.find(d => failed.has(d.name) && consumerNeeds(pkg, d.name));
|
|
84
|
+
if (blocker) {
|
|
85
|
+
failed.add(pkg.name);
|
|
86
|
+
result.push({ ...entry, status: 'error', reason: `dependency "${blocker.name}" failed to publish` });
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
73
89
|
try {
|
|
74
90
|
const skipped = await this.publish(entry);
|
|
75
91
|
result.push(skipped
|
|
@@ -81,6 +97,7 @@ export class SpmPublishService extends Service {
|
|
|
81
97
|
: entry);
|
|
82
98
|
}
|
|
83
99
|
catch (e) {
|
|
100
|
+
failed.add(pkg.name);
|
|
84
101
|
result.push({ ...entry, status: 'error', reason: e.message });
|
|
85
102
|
}
|
|
86
103
|
}
|
|
@@ -104,8 +104,10 @@ const config = {
|
|
|
104
104
|
},
|
|
105
105
|
commitMessage: {
|
|
106
106
|
target: 'config',
|
|
107
|
-
describe: 'The commit message for each group this run commits - "{version}"
|
|
108
|
-
'commit
|
|
107
|
+
describe: 'The commit message for each group this run commits - "{version}" and "{name}" (the ' +
|
|
108
|
+
"packages' names, comma-separated) are substituted when a commit's own group shares one " +
|
|
109
|
+
'version. Default "chore(release): v{version}" with one version line, and ' +
|
|
110
|
+
'"chore(release): <name>@<version>, ..." with several.',
|
|
109
111
|
type: 'string',
|
|
110
112
|
},
|
|
111
113
|
cascade: {
|
package/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '2.
|
|
1
|
+
export const version = '2.41.1';
|
package/package.json
CHANGED
|
@@ -109,8 +109,12 @@ function escapeRegExp(value) {
|
|
|
109
109
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
110
110
|
}
|
|
111
111
|
/** Turns a `version.commitMessage` template into a matcher for the commits it produces: every
|
|
112
|
-
* literal part escaped, each `{version}` placeholder standing in for any semver
|
|
112
|
+
* literal part escaped, each `{version}` placeholder standing in for any semver and each `{name}`
|
|
113
|
+
* for any non-empty text (package names, comma-separated). */
|
|
113
114
|
function templatePattern(template) {
|
|
114
|
-
const source = template
|
|
115
|
+
const source = template
|
|
116
|
+
.split('{version}')
|
|
117
|
+
.map(part => part.split('{name}').map(escapeRegExp).join('.+?'))
|
|
118
|
+
.join(SEMVER_SOURCE);
|
|
115
119
|
return new RegExp(`^${source}$`);
|
|
116
120
|
}
|
|
@@ -85,10 +85,15 @@ export declare namespace VersionService {
|
|
|
85
85
|
/** True for the repository's own release tag, which belongs to no single package. */
|
|
86
86
|
release?: boolean;
|
|
87
87
|
}
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
88
|
+
/**
|
|
89
|
+
* The message of one group's release commit.
|
|
90
|
+
*
|
|
91
|
+
* `.rmanrc version.commitMessage` (root-level) when it is set and every package in the commit
|
|
92
|
+
* shares one version - `{version}` is that version, `{name}` the packages' names, comma-separated.
|
|
93
|
+
* Unset, `chore(release): v{version}` while the repository releases along one version line, and
|
|
94
|
+
* `chore(release): <name>@<version>, ...` once it releases along several, so each commit says what
|
|
95
|
+
* it released. A commit spanning different versions always takes that listing form.
|
|
96
|
+
*/
|
|
92
97
|
function buildCommitMessage(repository: Repository, entries: VersionPlanService.Entry[], messageOverride?: string): string;
|
|
93
98
|
/**
|
|
94
99
|
* A `version.<slot>` value: one step, or several to run in sequence - the same shape, and now the
|
|
@@ -6,7 +6,7 @@ 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
8
|
import { expandReleaseTag, isCalendarVersion } from '../utils/release-version.js';
|
|
9
|
-
import { groupKeyOf } from '../utils/version-group.js';
|
|
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';
|
|
12
12
|
import { changelogGroupBy } from './changelog.service.js';
|
|
@@ -301,22 +301,39 @@ export class VersionService extends Service {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
(function (VersionService) {
|
|
304
|
-
/**
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
304
|
+
/**
|
|
305
|
+
* The message of one group's release commit.
|
|
306
|
+
*
|
|
307
|
+
* `.rmanrc version.commitMessage` (root-level) when it is set and every package in the commit
|
|
308
|
+
* shares one version - `{version}` is that version, `{name}` the packages' names, comma-separated.
|
|
309
|
+
* Unset, `chore(release): v{version}` while the repository releases along one version line, and
|
|
310
|
+
* `chore(release): <name>@<version>, ...` once it releases along several, so each commit says what
|
|
311
|
+
* it released. A commit spanning different versions always takes that listing form.
|
|
312
|
+
*/
|
|
313
|
+
/* **The listing once there is more than one line, because one message per commit cannot then name
|
|
314
|
+
* a release.** Reported from `syncbridge-io/syncbridge-extensions`: nine packages, each its own
|
|
315
|
+
* line, and every release left nine commits reading `chore(release): v2.1.0` - `git log` could not
|
|
316
|
+
* say which commit released which package. One line keeps the old message, so a repository whose
|
|
317
|
+
* packages move together sees no change; the test is `versionLineCount`, the same structural
|
|
318
|
+
* question that makes the tag pattern `{name}@*`, so the commit and its tag name the same thing.
|
|
319
|
+
*
|
|
320
|
+
* Both forms are ones `ConventionalCommitsService.isReleaseCommit` already recognizes - the listing
|
|
321
|
+
* is the cross-group-ripple shape - so no history needed a new matcher. */
|
|
308
322
|
function buildCommitMessage(repository, entries, messageOverride) {
|
|
309
323
|
const versions = new Set(entries.map(e => e.to));
|
|
324
|
+
const listing = `chore(release): ${entries.map(e => `${e.package.name}@${e.to}`).join(', ')}`;
|
|
310
325
|
if (versions.size === 1) {
|
|
311
326
|
const template = messageOverride ?? repository.rootPackage.config?.version?.commitMessage;
|
|
312
327
|
const version = entries[0].to;
|
|
313
|
-
if (typeof template === 'string' && template)
|
|
314
|
-
|
|
315
|
-
|
|
328
|
+
if (typeof template === 'string' && template) {
|
|
329
|
+
const names = entries.map(e => e.package.name).join(', ');
|
|
330
|
+
return template.replace(/\{version\}/g, version).replace(/\{name\}/g, names);
|
|
331
|
+
}
|
|
332
|
+
return versionLineCount(entries[0].package) > 1 ? listing : `chore(release): v${version}`;
|
|
316
333
|
}
|
|
317
334
|
if (messageOverride)
|
|
318
335
|
return messageOverride;
|
|
319
|
-
return
|
|
336
|
+
return listing;
|
|
320
337
|
}
|
|
321
338
|
VersionService.buildCommitMessage = buildCommitMessage;
|
|
322
339
|
/**
|