@exadev/semantic-release-workspace 3.2.16 → 3.2.18
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/dist/cli.js +21 -41
- package/dist/index.cjs +19 -38
- package/dist/index.d.cts +0 -20
- package/dist/index.d.ts +0 -20
- package/dist/index.js +18 -36
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,10 +13,9 @@ import { analyzeCommits } from "@semantic-release/commit-analyzer";
|
|
|
13
13
|
import { generateNotes } from "@semantic-release/release-notes-generator";
|
|
14
14
|
import semanticRelease from "semantic-release";
|
|
15
15
|
import { pathToFileURL } from "node:url";
|
|
16
|
-
|
|
17
|
-
var version = "3.2.
|
|
18
|
-
|
|
19
|
-
//#region src/errors.ts
|
|
16
|
+
// package.json
|
|
17
|
+
var version = "3.2.18";
|
|
18
|
+
// src/errors.ts
|
|
20
19
|
/**
|
|
21
20
|
* Every failure this package raises deliberately is one of these, so a caller (or the CLI) can tell an orchestration failure it should report cleanly apart from an unexpected crash it should let propagate with a stack trace.
|
|
22
21
|
*
|
|
@@ -74,8 +73,7 @@ function validateTagFormat(tagFormat) {
|
|
|
74
73
|
function formatTagForPackage(tagFormat, name) {
|
|
75
74
|
return tagFormat.replaceAll("${name}", name);
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
//#region src/json.ts
|
|
76
|
+
// src/json.ts
|
|
79
77
|
function isJsonObject(value) {
|
|
80
78
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81
79
|
}
|
|
@@ -105,8 +103,7 @@ function stringifyJsonLike(value, originalText) {
|
|
|
105
103
|
const serialised = JSON.stringify(value, null, detectIndent(originalText));
|
|
106
104
|
return originalText.endsWith("\n") ? `${serialised}\n` : serialised;
|
|
107
105
|
}
|
|
108
|
-
|
|
109
|
-
//#region src/manifest.ts
|
|
106
|
+
// src/manifest.ts
|
|
110
107
|
const DEPENDENCY_FIELDS = [
|
|
111
108
|
"dependencies",
|
|
112
109
|
"devDependencies",
|
|
@@ -156,8 +153,7 @@ async function writeDependencyRange(path, field, dependency, range) {
|
|
|
156
153
|
declared[dependency] = range;
|
|
157
154
|
await writeFile(path, stringifyJsonLike(parsed, text), "utf8");
|
|
158
155
|
}
|
|
159
|
-
|
|
160
|
-
//#region src/version-range.ts
|
|
156
|
+
// src/version-range.ts
|
|
161
157
|
const WORKSPACE_PROTOCOL = "workspace:";
|
|
162
158
|
const CATALOG_PROTOCOL = "catalog:";
|
|
163
159
|
const NPM_ALIAS_PROTOCOL = "npm:";
|
|
@@ -234,8 +230,7 @@ function updateDependencyRange(current, version) {
|
|
|
234
230
|
range: shape.workspacePrefixed ? `${WORKSPACE_PROTOCOL}${rewritten}` : rewritten
|
|
235
231
|
};
|
|
236
232
|
}
|
|
237
|
-
|
|
238
|
-
//#region src/publishable-dependencies.ts
|
|
233
|
+
// src/publishable-dependencies.ts
|
|
239
234
|
/**
|
|
240
235
|
* Throws `UnsupportedDependencyRangeError` unless every publishable package's installed dependencies (`dependencies`, `peerDependencies`, `optionalDependencies`) are ranges a consumer's package manager can resolve.
|
|
241
236
|
*
|
|
@@ -255,8 +250,7 @@ function assertPublishableDependencies(packages) {
|
|
|
255
250
|
}
|
|
256
251
|
if (offences.length > 0) throw new UnsupportedDependencyRangeError(`Refusing to release: npm publish ships these dependency specifiers unchanged, so the published package could not be installed.\n${offences.join("\n")}\nDeclare a plain version range instead (for example "^1.2.3"). For a sibling in this workspace, keep "linkWorkspacePackages: true" in pnpm-workspace.yaml so pnpm still links it locally; this tool rewrites the range whenever the sibling releases. Packages marked "private" are never published and are exempt.`);
|
|
257
252
|
}
|
|
258
|
-
|
|
259
|
-
//#region src/exec-file.ts
|
|
253
|
+
// src/exec-file.ts
|
|
260
254
|
/**
|
|
261
255
|
* A hand-written promise wrapper around `child_process.execFile`, in place of `util.promisify(execFile)`: `execFile` synchronously returns a `ChildProcess` in addition to invoking its callback, which trips `@typescript-eslint/strict-void-return` when the whole function is handed to `promisify` (a value-returning function used where a void-returning one is contextually expected there) -- exactly the void-return contravariance leniency that rule exists to catch, even though `tsc` itself accepts the pattern. Calling `execFile` directly with our own callback, whose own return type really is `void`, sidesteps the mismatch instead of suppressing it.
|
|
262
256
|
*/
|
|
@@ -278,8 +272,7 @@ async function execFile$1(command, args, options) {
|
|
|
278
272
|
});
|
|
279
273
|
});
|
|
280
274
|
}
|
|
281
|
-
|
|
282
|
-
//#region src/git.ts
|
|
275
|
+
// src/git.ts
|
|
283
276
|
/** Separates one commit's record in `git log --format` output. Chosen from the C0 control range so it can never appear in a hash or a file path. */
|
|
284
277
|
const COMMIT_RECORD_SEPARATOR = "";
|
|
285
278
|
/** The identity semantic-release's own core writes release commits under in CI when nothing else is configured (its COMMIT_NAME/COMMIT_EMAIL constants); dependency-bump commits use the same fallback so every commit a release run produces has a consistent author when the repository declares none. */
|
|
@@ -520,8 +513,7 @@ function toGitCommandError(args, cwd, cause) {
|
|
|
520
513
|
const stderr = cause instanceof Error && "stderr" in cause && typeof cause.stderr === "string" ? cause.stderr.trim() : "";
|
|
521
514
|
return new GitCommandError(args, cwd, exitCode, stderr !== "" ? stderr : cause instanceof Error ? cause.message : String(cause));
|
|
522
515
|
}
|
|
523
|
-
|
|
524
|
-
//#region src/workspace.ts
|
|
516
|
+
// src/workspace.ts
|
|
525
517
|
/** The one filename pnpm recognises as a workspace definition. */
|
|
526
518
|
const WORKSPACE_MANIFEST = "pnpm-workspace.yaml";
|
|
527
519
|
/** Never treat an installed dependency's own manifest as a workspace package, however permissive the configured globs are. pnpm applies the same exclusion. */
|
|
@@ -601,8 +593,7 @@ function trimTrailingSlashes(pattern) {
|
|
|
601
593
|
function toPosix(path) {
|
|
602
594
|
return sep === "/" ? path : path.split(sep).join("/");
|
|
603
595
|
}
|
|
604
|
-
|
|
605
|
-
//#region src/graph.ts
|
|
596
|
+
// src/graph.ts
|
|
606
597
|
/**
|
|
607
598
|
* Builds the inter-package dependency graph from the manifests alone.
|
|
608
599
|
*
|
|
@@ -700,8 +691,7 @@ function mustGet(map, key, what) {
|
|
|
700
691
|
if (value === void 0) throw new WorkspaceReleaseError(`Internal error: ${what} "${key}" disappeared from the dependency graph mid-run.`);
|
|
701
692
|
return value;
|
|
702
693
|
}
|
|
703
|
-
|
|
704
|
-
//#region src/bundling.ts
|
|
694
|
+
// src/bundling.ts
|
|
705
695
|
/**
|
|
706
696
|
* Validates `bundlingPackages` against the workspace and works out, for every package, which workspace dependencies it bundles.
|
|
707
697
|
*
|
|
@@ -732,11 +722,9 @@ function resolveBundledDependencies(graph, bundlingPackages) {
|
|
|
732
722
|
function isPrivateRuntimeEdge(edge, graph) {
|
|
733
723
|
return edge.field !== "devDependencies" && mustGet(graph.packages, edge.dependency, "package").private;
|
|
734
724
|
}
|
|
735
|
-
|
|
736
|
-
//#region src/package-name.ts
|
|
725
|
+
// src/package-name.ts
|
|
737
726
|
const packageName = "@exadev/semantic-release-workspace";
|
|
738
|
-
|
|
739
|
-
//#region src/release-type.ts
|
|
727
|
+
// src/release-type.ts
|
|
740
728
|
/** Every release type semantic-release knows, highest first: the order `@semantic-release/commit-analyzer` itself ranks them in (its `lib/default-release-types.js`), so comparing two types here agrees with how the analyzer picks the highest type among a package's own commits. */
|
|
741
729
|
const RELEASE_TYPES_HIGHEST_FIRST = [
|
|
742
730
|
"major",
|
|
@@ -762,8 +750,7 @@ function highestReleaseType(types) {
|
|
|
762
750
|
function raiseReleaseType(base, other) {
|
|
763
751
|
return other === void 0 || RELEASE_TYPES_HIGHEST_FIRST.indexOf(base) <= RELEASE_TYPES_HIGHEST_FIRST.indexOf(other) ? base : other;
|
|
764
752
|
}
|
|
765
|
-
|
|
766
|
-
//#region src/dependency-bump-commit.ts
|
|
753
|
+
// src/dependency-bump-commit.ts
|
|
767
754
|
/**
|
|
768
755
|
* The commit message format for a cross-package dependency-range bump, shared between the code that writes it (`bumpDependents` in `release.ts`) and the code that reads it back (`createScopedPlugins` in `plugins.ts`).
|
|
769
756
|
*
|
|
@@ -803,8 +790,7 @@ function matchTrailerLine(message, key) {
|
|
|
803
790
|
const line = message.split("\n").find((candidate) => candidate.startsWith(prefix));
|
|
804
791
|
return line === void 0 ? void 0 : line.slice(prefix.length).trim();
|
|
805
792
|
}
|
|
806
|
-
|
|
807
|
-
//#region src/plugins.ts
|
|
793
|
+
// src/plugins.ts
|
|
808
794
|
/** The one plugin a private package is kept off by default: see `resolveWorkspacePublishPlugins` for why a package that never reaches a registry does not get a public GitHub Release either. */
|
|
809
795
|
const GITHUB_RELEASE_PLUGIN = "@semantic-release/github";
|
|
810
796
|
/** semantic-release's own `getLastRelease` returns `{}` for a package with no prior tag -- not `undefined`, and not a fully-populated `LastRelease` -- contradicting the `gitHead: string` its own type declares. Narrows structurally rather than trusting that declared type, so a first-release context's `lastRelease` (correctly, at runtime) never claims a `gitHead` it does not have. */
|
|
@@ -1017,8 +1003,7 @@ async function releasePackageAcrossBranchMoves(name, branch, attempt, log) {
|
|
|
1017
1003
|
log(`${name}: reported no release while the branch moved from ${tipBefore} to ${tipAfter}, which is also what a stale branch looks like; integrating and releasing it again.`);
|
|
1018
1004
|
}
|
|
1019
1005
|
}
|
|
1020
|
-
|
|
1021
|
-
//#region src/pnpm.ts
|
|
1006
|
+
// src/pnpm.ts
|
|
1022
1007
|
/**
|
|
1023
1008
|
* Regenerates `pnpm-lock.yaml` for the whole workspace from the manifests currently on disk, without touching `node_modules` or installing anything -- the same lockfile-refresh step a contributor runs by hand after editing a `package.json` dependency range.
|
|
1024
1009
|
*
|
|
@@ -1033,8 +1018,7 @@ async function regenerateLockfile(options) {
|
|
|
1033
1018
|
throw new PnpmCommandError(options.cwd, detail);
|
|
1034
1019
|
}
|
|
1035
1020
|
}
|
|
1036
|
-
|
|
1037
|
-
//#region src/single-commit-release.ts
|
|
1021
|
+
// src/single-commit-release.ts
|
|
1038
1022
|
/**
|
|
1039
1023
|
* `commitStrategy: 'single'`: one combined commit for the whole run instead of one commit per package release plus one per dependency bump.
|
|
1040
1024
|
*
|
|
@@ -1380,8 +1364,7 @@ async function loadReleasePlugin(absolutePath, cache) {
|
|
|
1380
1364
|
cache.set(absolutePath, loaded);
|
|
1381
1365
|
return loaded;
|
|
1382
1366
|
}
|
|
1383
|
-
|
|
1384
|
-
//#region src/release.ts
|
|
1367
|
+
// src/release.ts
|
|
1385
1368
|
/**
|
|
1386
1369
|
* Releases every package in a pnpm workspace with independent versions, in dependency order.
|
|
1387
1370
|
*
|
|
@@ -1590,8 +1573,7 @@ function branchTracker(workspace, log) {
|
|
|
1590
1573
|
tip: async () => await fetchBranchTip(await currentBranch({ cwd: workspace.root }), { cwd: workspace.root })
|
|
1591
1574
|
};
|
|
1592
1575
|
}
|
|
1593
|
-
|
|
1594
|
-
//#region src/gate-publish.ts
|
|
1576
|
+
// src/gate-publish.ts
|
|
1595
1577
|
/**
|
|
1596
1578
|
* The `gatePublish: true` half of `releaseWorkspace`: tags and pushes every due package via `@exadev/release-gate`'s `detachRelease`, but never publishes. Built on the same `runReleaseLoop` the normal per-package path uses, so dependency-range bumps between packages happen identically either way -- only the release call itself (`detachRelease` instead of `semanticRelease`) and how "did it release" gets read differ.
|
|
1597
1579
|
*/
|
|
@@ -1745,8 +1727,7 @@ async function resumeWorkspaceRelease(options) {
|
|
|
1745
1727
|
packages
|
|
1746
1728
|
};
|
|
1747
1729
|
}
|
|
1748
|
-
|
|
1749
|
-
//#region src/cli.ts
|
|
1730
|
+
// src/cli.ts
|
|
1750
1731
|
const CONFIG_OPTION_KEYS = /* @__PURE__ */ new Set([
|
|
1751
1732
|
"dryRun",
|
|
1752
1733
|
"branches",
|
|
@@ -1948,5 +1929,4 @@ createProgram().parseAsync(process.argv).catch((cause) => {
|
|
|
1948
1929
|
else console.error(String(cause));
|
|
1949
1930
|
process.exitCode = 1;
|
|
1950
1931
|
});
|
|
1951
|
-
//#endregion
|
|
1952
1932
|
export { createProgram, readReleaseConfigFile };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,7 +20,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let node_fs_promises = require("node:fs/promises");
|
|
25
24
|
let node_path = require("node:path");
|
|
26
25
|
let tinyglobby = require("tinyglobby");
|
|
@@ -35,10 +34,9 @@ let semantic_release = require("semantic-release");
|
|
|
35
34
|
semantic_release = __toESM(semantic_release, 1);
|
|
36
35
|
let node_url = require("node:url");
|
|
37
36
|
let _exadev_release_gate = require("@exadev/release-gate");
|
|
38
|
-
|
|
37
|
+
// src/package-name.ts
|
|
39
38
|
const packageName = "@exadev/semantic-release-workspace";
|
|
40
|
-
|
|
41
|
-
//#region src/errors.ts
|
|
39
|
+
// src/errors.ts
|
|
42
40
|
/**
|
|
43
41
|
* Every failure this package raises deliberately is one of these, so a caller (or the CLI) can tell an orchestration failure it should report cleanly apart from an unexpected crash it should let propagate with a stack trace.
|
|
44
42
|
*
|
|
@@ -81,8 +79,7 @@ var PnpmCommandError = class extends WorkspaceReleaseError {
|
|
|
81
79
|
super(`pnpm install --lockfile-only failed in ${cwd}: ${detail}`);
|
|
82
80
|
}
|
|
83
81
|
};
|
|
84
|
-
|
|
85
|
-
//#region src/exec-file.ts
|
|
82
|
+
// src/exec-file.ts
|
|
86
83
|
/**
|
|
87
84
|
* A hand-written promise wrapper around `child_process.execFile`, in place of `util.promisify(execFile)`: `execFile` synchronously returns a `ChildProcess` in addition to invoking its callback, which trips `@typescript-eslint/strict-void-return` when the whole function is handed to `promisify` (a value-returning function used where a void-returning one is contextually expected there) -- exactly the void-return contravariance leniency that rule exists to catch, even though `tsc` itself accepts the pattern. Calling `execFile` directly with our own callback, whose own return type really is `void`, sidesteps the mismatch instead of suppressing it.
|
|
88
85
|
*/
|
|
@@ -104,8 +101,7 @@ async function execFile(command, args, options) {
|
|
|
104
101
|
});
|
|
105
102
|
});
|
|
106
103
|
}
|
|
107
|
-
|
|
108
|
-
//#region src/git.ts
|
|
104
|
+
// src/git.ts
|
|
109
105
|
/** Separates one commit's record in `git log --format` output. Chosen from the C0 control range so it can never appear in a hash or a file path. */
|
|
110
106
|
const COMMIT_RECORD_SEPARATOR = "";
|
|
111
107
|
/** The identity semantic-release's own core writes release commits under in CI when nothing else is configured (its COMMIT_NAME/COMMIT_EMAIL constants); dependency-bump commits use the same fallback so every commit a release run produces has a consistent author when the repository declares none. */
|
|
@@ -346,8 +342,7 @@ function toGitCommandError(args, cwd, cause) {
|
|
|
346
342
|
const stderr = cause instanceof Error && "stderr" in cause && typeof cause.stderr === "string" ? cause.stderr.trim() : "";
|
|
347
343
|
return new GitCommandError(args, cwd, exitCode, stderr !== "" ? stderr : cause instanceof Error ? cause.message : String(cause));
|
|
348
344
|
}
|
|
349
|
-
|
|
350
|
-
//#region src/json.ts
|
|
345
|
+
// src/json.ts
|
|
351
346
|
function isJsonObject(value) {
|
|
352
347
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
353
348
|
}
|
|
@@ -371,8 +366,7 @@ function stringifyJsonLike(value, originalText) {
|
|
|
371
366
|
const serialised = JSON.stringify(value, null, detectIndent(originalText));
|
|
372
367
|
return originalText.endsWith("\n") ? `${serialised}\n` : serialised;
|
|
373
368
|
}
|
|
374
|
-
|
|
375
|
-
//#region src/manifest.ts
|
|
369
|
+
// src/manifest.ts
|
|
376
370
|
const DEPENDENCY_FIELDS = [
|
|
377
371
|
"dependencies",
|
|
378
372
|
"devDependencies",
|
|
@@ -422,8 +416,7 @@ async function writeDependencyRange(path, field, dependency, range) {
|
|
|
422
416
|
declared[dependency] = range;
|
|
423
417
|
await (0, node_fs_promises.writeFile)(path, stringifyJsonLike(parsed, text), "utf8");
|
|
424
418
|
}
|
|
425
|
-
|
|
426
|
-
//#region src/workspace.ts
|
|
419
|
+
// src/workspace.ts
|
|
427
420
|
/** The one filename pnpm recognises as a workspace definition. */
|
|
428
421
|
const WORKSPACE_MANIFEST = "pnpm-workspace.yaml";
|
|
429
422
|
/** Never treat an installed dependency's own manifest as a workspace package, however permissive the configured globs are. pnpm applies the same exclusion. */
|
|
@@ -503,8 +496,7 @@ function trimTrailingSlashes(pattern) {
|
|
|
503
496
|
function toPosix(path) {
|
|
504
497
|
return node_path.sep === "/" ? path : path.split(node_path.sep).join("/");
|
|
505
498
|
}
|
|
506
|
-
|
|
507
|
-
//#region src/version-range.ts
|
|
499
|
+
// src/version-range.ts
|
|
508
500
|
const WORKSPACE_PROTOCOL = "workspace:";
|
|
509
501
|
const CATALOG_PROTOCOL = "catalog:";
|
|
510
502
|
const NPM_ALIAS_PROTOCOL = "npm:";
|
|
@@ -581,8 +573,7 @@ function updateDependencyRange(current, version) {
|
|
|
581
573
|
range: shape.workspacePrefixed ? `${WORKSPACE_PROTOCOL}${rewritten}` : rewritten
|
|
582
574
|
};
|
|
583
575
|
}
|
|
584
|
-
|
|
585
|
-
//#region src/publishable-dependencies.ts
|
|
576
|
+
// src/publishable-dependencies.ts
|
|
586
577
|
/**
|
|
587
578
|
* Throws `UnsupportedDependencyRangeError` unless every publishable package's installed dependencies (`dependencies`, `peerDependencies`, `optionalDependencies`) are ranges a consumer's package manager can resolve.
|
|
588
579
|
*
|
|
@@ -602,8 +593,7 @@ function assertPublishableDependencies(packages) {
|
|
|
602
593
|
}
|
|
603
594
|
if (offences.length > 0) throw new UnsupportedDependencyRangeError(`Refusing to release: npm publish ships these dependency specifiers unchanged, so the published package could not be installed.\n${offences.join("\n")}\nDeclare a plain version range instead (for example "^1.2.3"). For a sibling in this workspace, keep "linkWorkspacePackages: true" in pnpm-workspace.yaml so pnpm still links it locally; this tool rewrites the range whenever the sibling releases. Packages marked "private" are never published and are exempt.`);
|
|
604
595
|
}
|
|
605
|
-
|
|
606
|
-
//#region src/graph.ts
|
|
596
|
+
// src/graph.ts
|
|
607
597
|
/**
|
|
608
598
|
* Builds the inter-package dependency graph from the manifests alone.
|
|
609
599
|
*
|
|
@@ -701,8 +691,7 @@ function mustGet(map, key, what) {
|
|
|
701
691
|
if (value === void 0) throw new WorkspaceReleaseError(`Internal error: ${what} "${key}" disappeared from the dependency graph mid-run.`);
|
|
702
692
|
return value;
|
|
703
693
|
}
|
|
704
|
-
|
|
705
|
-
//#region src/bundling.ts
|
|
694
|
+
// src/bundling.ts
|
|
706
695
|
/**
|
|
707
696
|
* Validates `bundlingPackages` against the workspace and works out, for every package, which workspace dependencies it bundles.
|
|
708
697
|
*
|
|
@@ -733,8 +722,7 @@ function resolveBundledDependencies(graph, bundlingPackages) {
|
|
|
733
722
|
function isPrivateRuntimeEdge(edge, graph) {
|
|
734
723
|
return edge.field !== "devDependencies" && mustGet(graph.packages, edge.dependency, "package").private;
|
|
735
724
|
}
|
|
736
|
-
|
|
737
|
-
//#region src/release-type.ts
|
|
725
|
+
// src/release-type.ts
|
|
738
726
|
/** Every release type semantic-release knows, highest first: the order `@semantic-release/commit-analyzer` itself ranks them in (its `lib/default-release-types.js`), so comparing two types here agrees with how the analyzer picks the highest type among a package's own commits. */
|
|
739
727
|
const RELEASE_TYPES_HIGHEST_FIRST = [
|
|
740
728
|
"major",
|
|
@@ -760,8 +748,7 @@ function highestReleaseType(types) {
|
|
|
760
748
|
function raiseReleaseType(base, other) {
|
|
761
749
|
return other === void 0 || RELEASE_TYPES_HIGHEST_FIRST.indexOf(base) <= RELEASE_TYPES_HIGHEST_FIRST.indexOf(other) ? base : other;
|
|
762
750
|
}
|
|
763
|
-
|
|
764
|
-
//#region src/dependency-bump-commit.ts
|
|
751
|
+
// src/dependency-bump-commit.ts
|
|
765
752
|
/**
|
|
766
753
|
* The commit message format for a cross-package dependency-range bump, shared between the code that writes it (`bumpDependents` in `release.ts`) and the code that reads it back (`createScopedPlugins` in `plugins.ts`).
|
|
767
754
|
*
|
|
@@ -801,8 +788,7 @@ function matchTrailerLine(message, key) {
|
|
|
801
788
|
const line = message.split("\n").find((candidate) => candidate.startsWith(prefix));
|
|
802
789
|
return line === void 0 ? void 0 : line.slice(prefix.length).trim();
|
|
803
790
|
}
|
|
804
|
-
|
|
805
|
-
//#region src/plugins.ts
|
|
791
|
+
// src/plugins.ts
|
|
806
792
|
/** The one plugin a private package is kept off by default: see `resolveWorkspacePublishPlugins` for why a package that never reaches a registry does not get a public GitHub Release either. */
|
|
807
793
|
const GITHUB_RELEASE_PLUGIN = "@semantic-release/github";
|
|
808
794
|
/** semantic-release's own `getLastRelease` returns `{}` for a package with no prior tag -- not `undefined`, and not a fully-populated `LastRelease` -- contradicting the `gitHead: string` its own type declares. Narrows structurally rather than trusting that declared type, so a first-release context's `lastRelease` (correctly, at runtime) never claims a `gitHead` it does not have. */
|
|
@@ -1015,8 +1001,7 @@ async function releasePackageAcrossBranchMoves(name, branch, attempt, log) {
|
|
|
1015
1001
|
log(`${name}: reported no release while the branch moved from ${tipBefore} to ${tipAfter}, which is also what a stale branch looks like; integrating and releasing it again.`);
|
|
1016
1002
|
}
|
|
1017
1003
|
}
|
|
1018
|
-
|
|
1019
|
-
//#region src/pnpm.ts
|
|
1004
|
+
// src/pnpm.ts
|
|
1020
1005
|
/**
|
|
1021
1006
|
* Regenerates `pnpm-lock.yaml` for the whole workspace from the manifests currently on disk, without touching `node_modules` or installing anything -- the same lockfile-refresh step a contributor runs by hand after editing a `package.json` dependency range.
|
|
1022
1007
|
*
|
|
@@ -1046,8 +1031,7 @@ function validateTagFormat(tagFormat) {
|
|
|
1046
1031
|
function formatTagForPackage(tagFormat, name) {
|
|
1047
1032
|
return tagFormat.replaceAll("${name}", name);
|
|
1048
1033
|
}
|
|
1049
|
-
|
|
1050
|
-
//#region src/single-commit-release.ts
|
|
1034
|
+
// src/single-commit-release.ts
|
|
1051
1035
|
/**
|
|
1052
1036
|
* `commitStrategy: 'single'`: one combined commit for the whole run instead of one commit per package release plus one per dependency bump.
|
|
1053
1037
|
*
|
|
@@ -1393,8 +1377,7 @@ async function loadReleasePlugin(absolutePath, cache) {
|
|
|
1393
1377
|
cache.set(absolutePath, loaded);
|
|
1394
1378
|
return loaded;
|
|
1395
1379
|
}
|
|
1396
|
-
|
|
1397
|
-
//#region src/gate-publish.ts
|
|
1380
|
+
// src/gate-publish.ts
|
|
1398
1381
|
/**
|
|
1399
1382
|
* The `gatePublish: true` half of `releaseWorkspace`: tags and pushes every due package via `@exadev/release-gate`'s `detachRelease`, but never publishes. Built on the same `runReleaseLoop` the normal per-package path uses, so dependency-range bumps between packages happen identically either way -- only the release call itself (`detachRelease` instead of `semanticRelease`) and how "did it release" gets read differ.
|
|
1400
1383
|
*/
|
|
@@ -1536,8 +1519,7 @@ async function resumeWorkspaceRelease(options) {
|
|
|
1536
1519
|
packages
|
|
1537
1520
|
};
|
|
1538
1521
|
}
|
|
1539
|
-
|
|
1540
|
-
//#region src/release.ts
|
|
1522
|
+
// src/release.ts
|
|
1541
1523
|
/**
|
|
1542
1524
|
* Releases every package in a pnpm workspace with independent versions, in dependency order.
|
|
1543
1525
|
*
|
|
@@ -1746,7 +1728,6 @@ function branchTracker(workspace, log) {
|
|
|
1746
1728
|
tip: async () => await fetchBranchTip(await currentBranch({ cwd: workspace.root }), { cwd: workspace.root })
|
|
1747
1729
|
};
|
|
1748
1730
|
}
|
|
1749
|
-
//#endregion
|
|
1750
1731
|
exports.DEFAULT_PUBLISH_PLUGINS = DEFAULT_PUBLISH_PLUGINS;
|
|
1751
1732
|
exports.DependencyCycleError = DependencyCycleError;
|
|
1752
1733
|
exports.GitCommandError = GitCommandError;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { AnalyzeCommitsContext, BranchSpec, Commit, GenerateNotesContext, ReleaseType } from "semantic-release";
|
|
2
2
|
import { ReleaseGateState } from "@exadev/release-gate";
|
|
3
|
-
//#region src/package-name.d.ts
|
|
4
3
|
export declare const packageName = "@exadev/semantic-release-workspace";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/manifest.d.ts
|
|
7
4
|
/**
|
|
8
5
|
* The manifest fields that can name a workspace sibling.
|
|
9
6
|
*
|
|
@@ -25,8 +22,6 @@ export declare function readManifest(path: string): Promise<PackageManifest>;
|
|
|
25
22
|
* Deliberately re-reads the file rather than editing a copy held from discovery time: by the time a cross-package bump is applied, semantic-release's own `@semantic-release/npm` prepare step may already have rewritten `version` in this same file for an earlier package in the run. Writing back a manifest parsed before that would silently revert it.
|
|
26
23
|
*/
|
|
27
24
|
export declare function writeDependencyRange(path: string, field: DependencyField, dependency: string, range: string): Promise<void>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/workspace.d.ts
|
|
30
25
|
interface WorkspacePackage {
|
|
31
26
|
readonly name: string;
|
|
32
27
|
readonly version: string;
|
|
@@ -53,8 +48,6 @@ interface Workspace {
|
|
|
53
48
|
* Nothing here knows anything about a particular repository's layout: the globs come from the workspace file, and the package names, versions, and dependency ranges come from the manifests those globs match. Pointing this at any pnpm workspace is the entire configuration.
|
|
54
49
|
*/
|
|
55
50
|
export declare function discoverWorkspace(root: string): Promise<Workspace>;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/graph.d.ts
|
|
58
51
|
/** One package's dependency on another package in the same workspace. */
|
|
59
52
|
interface WorkspaceDependency {
|
|
60
53
|
/** The depending package's name. */
|
|
@@ -88,8 +81,6 @@ export declare function buildDependencyGraph(packages: readonly WorkspacePackage
|
|
|
88
81
|
export declare function topologicalOrder(graph: DependencyGraph): readonly string[];
|
|
89
82
|
/** The packages a release order names, in that order, for the stages that need each package's manifest rather than only its name. */
|
|
90
83
|
export declare function orderedPackages(graph: DependencyGraph, order: readonly string[]): readonly WorkspacePackage[];
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/version-range.d.ts
|
|
93
84
|
/**
|
|
94
85
|
* What happens to one dependency range when the sibling it points at releases a new version.
|
|
95
86
|
*
|
|
@@ -131,8 +122,6 @@ export declare function classifyDependencyRange(current: string): DependencyRang
|
|
|
131
122
|
* Computes what a dependency range on a workspace sibling becomes once that sibling releases `version`, by classifying the range's shape and then, for a rewritable shape, substituting `version` in place of the version it currently names.
|
|
132
123
|
*/
|
|
133
124
|
export declare function updateDependencyRange(current: string, version: string): DependencyRangeUpdate;
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/bundling.d.ts
|
|
136
125
|
/**
|
|
137
126
|
* Which of a package's workspace dependencies ship inside its published artefact, as far as release types are concerned. Built by `resolveBundledDependencies`.
|
|
138
127
|
*/
|
|
@@ -156,8 +145,6 @@ interface BundledDependencies {
|
|
|
156
145
|
* `bundlingPackages` names public workspace packages whose builds bundle their workspace `devDependencies`; `undefined` or an empty list leaves every package's release type as it was. Returns one entry per package in the graph. Throws `ReleaseConfigurationError` when a name is not a package in the workspace, or names a private package, which never publishes and so ships nothing to consumers.
|
|
157
146
|
*/
|
|
158
147
|
export declare function resolveBundledDependencies(graph: DependencyGraph, bundlingPackages: readonly string[] | undefined): ReadonlyMap<string, BundledDependencies>;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/plugins.d.ts
|
|
161
148
|
/**
|
|
162
149
|
* One workspace dependency range that changed because its package released a new version during this run. `rewritten` means the dependent's manifest was edited on disk; `resolved-at-publish` means a bare `workspace:^`-style range whose on-disk text is unchanged. Both count towards the dependent's release.
|
|
163
150
|
*/
|
|
@@ -248,8 +235,6 @@ export declare function resolveWorkspacePublishPlugins(packages: readonly Publis
|
|
|
248
235
|
readonly requireGitPlugin: boolean;
|
|
249
236
|
readonly forbidGitPlugin?: boolean;
|
|
250
237
|
}): ReadonlyMap<string, readonly ResolvedPublishPlugin[]>;
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region src/gate-publish.d.ts
|
|
253
238
|
/**
|
|
254
239
|
* One package's outcome from a gated (`gatePublish: true`) detach pass -- what `resumeWorkspaceRelease` needs later to finish publishing it. `relativeDirectory`, not the absolute `directory`, is what a resume pass actually uses to resolve `cwd`: a resume can run against a different checkout of the same repository (a separate CI job, a separate clone) at a different absolute path, and `relativeDirectory` is the portable part.
|
|
255
240
|
*/
|
|
@@ -272,8 +257,6 @@ interface ResumeWorkspaceReleaseOptions {
|
|
|
272
257
|
* Finishes every package a `gatePublish: true` `releaseWorkspace` run tagged and pushed but did not publish. Resumes each `detached` entry in the array's own order -- not re-derived from the workspace's dependency graph, since a resume pass may run in a separate process or checkout, where re-deriving order should only ever matter for directory lookup, not sequencing.
|
|
273
258
|
*/
|
|
274
259
|
export declare function resumeWorkspaceRelease(options: ResumeWorkspaceReleaseOptions): Promise<WorkspaceReleaseOutcome>;
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/release.d.ts
|
|
277
260
|
/**
|
|
278
261
|
* How a run commits its released changes:
|
|
279
262
|
*
|
|
@@ -366,8 +349,6 @@ interface WorkspaceReleaseOutcome {
|
|
|
366
349
|
* For each package, in topological order: run semantic-release's programmatic API with `cwd` scoped to the package directory, a `name@version` tag format to keep each package's tags distinct in the one shared tag namespace, and inline `analyzeCommits`/`generateNotes` plugins that filter the release range's commits down to the package's own directory before delegating to the standard plugins. When a package releases, every workspace package that depends on it and has not run yet gets its dependency range rewritten in its manifest and committed immediately -- before its own turn, so its commit analysis and its published manifest both see the new range.
|
|
367
350
|
*/
|
|
368
351
|
export declare function releaseWorkspace(options?: ReleaseWorkspaceOptions): Promise<WorkspaceReleaseOutcome>;
|
|
369
|
-
//#endregion
|
|
370
|
-
//#region src/errors.d.ts
|
|
371
352
|
/**
|
|
372
353
|
* Every failure this package raises deliberately is one of these, so a caller (or the CLI) can tell an orchestration failure it should report cleanly apart from an unexpected crash it should let propagate with a stack trace.
|
|
373
354
|
*
|
|
@@ -395,5 +376,4 @@ export declare class GitCommandError extends WorkspaceReleaseError {
|
|
|
395
376
|
}
|
|
396
377
|
/** The workspace's git state does not support the release operation -- for example a detached HEAD, which names no branch that dependency-bump commits could be pushed to. */
|
|
397
378
|
export declare class WorkspaceStateError extends WorkspaceReleaseError {}
|
|
398
|
-
//#endregion
|
|
399
379
|
export type { AppliedDependencyBump, BundledDependencies, CommitStrategy, DependencyBump, DependencyBumpSource, DependencyField, DependencyGraph, DependencyRangeShape, DependencyRangeUpdate, DetachedPackageRelease, PackageManifest, PackagePluginSpecs, PackageReleaseOutcome, PublishPluginPackage, PublishPluginSpec, ReleaseWorkspaceOptions, ResolvedPublishPlugin, ResumeWorkspaceReleaseOptions, ScopedPlugins, Workspace, WorkspaceDependency, WorkspacePackage, WorkspaceReleaseOutcome };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { AnalyzeCommitsContext, BranchSpec, Commit, GenerateNotesContext, ReleaseType } from "semantic-release";
|
|
2
2
|
import { ReleaseGateState } from "@exadev/release-gate";
|
|
3
|
-
//#region src/package-name.d.ts
|
|
4
3
|
export declare const packageName = "@exadev/semantic-release-workspace";
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/manifest.d.ts
|
|
7
4
|
/**
|
|
8
5
|
* The manifest fields that can name a workspace sibling.
|
|
9
6
|
*
|
|
@@ -25,8 +22,6 @@ export declare function readManifest(path: string): Promise<PackageManifest>;
|
|
|
25
22
|
* Deliberately re-reads the file rather than editing a copy held from discovery time: by the time a cross-package bump is applied, semantic-release's own `@semantic-release/npm` prepare step may already have rewritten `version` in this same file for an earlier package in the run. Writing back a manifest parsed before that would silently revert it.
|
|
26
23
|
*/
|
|
27
24
|
export declare function writeDependencyRange(path: string, field: DependencyField, dependency: string, range: string): Promise<void>;
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/workspace.d.ts
|
|
30
25
|
interface WorkspacePackage {
|
|
31
26
|
readonly name: string;
|
|
32
27
|
readonly version: string;
|
|
@@ -53,8 +48,6 @@ interface Workspace {
|
|
|
53
48
|
* Nothing here knows anything about a particular repository's layout: the globs come from the workspace file, and the package names, versions, and dependency ranges come from the manifests those globs match. Pointing this at any pnpm workspace is the entire configuration.
|
|
54
49
|
*/
|
|
55
50
|
export declare function discoverWorkspace(root: string): Promise<Workspace>;
|
|
56
|
-
//#endregion
|
|
57
|
-
//#region src/graph.d.ts
|
|
58
51
|
/** One package's dependency on another package in the same workspace. */
|
|
59
52
|
interface WorkspaceDependency {
|
|
60
53
|
/** The depending package's name. */
|
|
@@ -88,8 +81,6 @@ export declare function buildDependencyGraph(packages: readonly WorkspacePackage
|
|
|
88
81
|
export declare function topologicalOrder(graph: DependencyGraph): readonly string[];
|
|
89
82
|
/** The packages a release order names, in that order, for the stages that need each package's manifest rather than only its name. */
|
|
90
83
|
export declare function orderedPackages(graph: DependencyGraph, order: readonly string[]): readonly WorkspacePackage[];
|
|
91
|
-
//#endregion
|
|
92
|
-
//#region src/version-range.d.ts
|
|
93
84
|
/**
|
|
94
85
|
* What happens to one dependency range when the sibling it points at releases a new version.
|
|
95
86
|
*
|
|
@@ -131,8 +122,6 @@ export declare function classifyDependencyRange(current: string): DependencyRang
|
|
|
131
122
|
* Computes what a dependency range on a workspace sibling becomes once that sibling releases `version`, by classifying the range's shape and then, for a rewritable shape, substituting `version` in place of the version it currently names.
|
|
132
123
|
*/
|
|
133
124
|
export declare function updateDependencyRange(current: string, version: string): DependencyRangeUpdate;
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region src/bundling.d.ts
|
|
136
125
|
/**
|
|
137
126
|
* Which of a package's workspace dependencies ship inside its published artefact, as far as release types are concerned. Built by `resolveBundledDependencies`.
|
|
138
127
|
*/
|
|
@@ -156,8 +145,6 @@ interface BundledDependencies {
|
|
|
156
145
|
* `bundlingPackages` names public workspace packages whose builds bundle their workspace `devDependencies`; `undefined` or an empty list leaves every package's release type as it was. Returns one entry per package in the graph. Throws `ReleaseConfigurationError` when a name is not a package in the workspace, or names a private package, which never publishes and so ships nothing to consumers.
|
|
157
146
|
*/
|
|
158
147
|
export declare function resolveBundledDependencies(graph: DependencyGraph, bundlingPackages: readonly string[] | undefined): ReadonlyMap<string, BundledDependencies>;
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region src/plugins.d.ts
|
|
161
148
|
/**
|
|
162
149
|
* One workspace dependency range that changed because its package released a new version during this run. `rewritten` means the dependent's manifest was edited on disk; `resolved-at-publish` means a bare `workspace:^`-style range whose on-disk text is unchanged. Both count towards the dependent's release.
|
|
163
150
|
*/
|
|
@@ -248,8 +235,6 @@ export declare function resolveWorkspacePublishPlugins(packages: readonly Publis
|
|
|
248
235
|
readonly requireGitPlugin: boolean;
|
|
249
236
|
readonly forbidGitPlugin?: boolean;
|
|
250
237
|
}): ReadonlyMap<string, readonly ResolvedPublishPlugin[]>;
|
|
251
|
-
//#endregion
|
|
252
|
-
//#region src/gate-publish.d.ts
|
|
253
238
|
/**
|
|
254
239
|
* One package's outcome from a gated (`gatePublish: true`) detach pass -- what `resumeWorkspaceRelease` needs later to finish publishing it. `relativeDirectory`, not the absolute `directory`, is what a resume pass actually uses to resolve `cwd`: a resume can run against a different checkout of the same repository (a separate CI job, a separate clone) at a different absolute path, and `relativeDirectory` is the portable part.
|
|
255
240
|
*/
|
|
@@ -272,8 +257,6 @@ interface ResumeWorkspaceReleaseOptions {
|
|
|
272
257
|
* Finishes every package a `gatePublish: true` `releaseWorkspace` run tagged and pushed but did not publish. Resumes each `detached` entry in the array's own order -- not re-derived from the workspace's dependency graph, since a resume pass may run in a separate process or checkout, where re-deriving order should only ever matter for directory lookup, not sequencing.
|
|
273
258
|
*/
|
|
274
259
|
export declare function resumeWorkspaceRelease(options: ResumeWorkspaceReleaseOptions): Promise<WorkspaceReleaseOutcome>;
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/release.d.ts
|
|
277
260
|
/**
|
|
278
261
|
* How a run commits its released changes:
|
|
279
262
|
*
|
|
@@ -366,8 +349,6 @@ interface WorkspaceReleaseOutcome {
|
|
|
366
349
|
* For each package, in topological order: run semantic-release's programmatic API with `cwd` scoped to the package directory, a `name@version` tag format to keep each package's tags distinct in the one shared tag namespace, and inline `analyzeCommits`/`generateNotes` plugins that filter the release range's commits down to the package's own directory before delegating to the standard plugins. When a package releases, every workspace package that depends on it and has not run yet gets its dependency range rewritten in its manifest and committed immediately -- before its own turn, so its commit analysis and its published manifest both see the new range.
|
|
367
350
|
*/
|
|
368
351
|
export declare function releaseWorkspace(options?: ReleaseWorkspaceOptions): Promise<WorkspaceReleaseOutcome>;
|
|
369
|
-
//#endregion
|
|
370
|
-
//#region src/errors.d.ts
|
|
371
352
|
/**
|
|
372
353
|
* Every failure this package raises deliberately is one of these, so a caller (or the CLI) can tell an orchestration failure it should report cleanly apart from an unexpected crash it should let propagate with a stack trace.
|
|
373
354
|
*
|
|
@@ -395,5 +376,4 @@ export declare class GitCommandError extends WorkspaceReleaseError {
|
|
|
395
376
|
}
|
|
396
377
|
/** The workspace's git state does not support the release operation -- for example a detached HEAD, which names no branch that dependency-bump commits could be pushed to. */
|
|
397
378
|
export declare class WorkspaceStateError extends WorkspaceReleaseError {}
|
|
398
|
-
//#endregion
|
|
399
379
|
export type { AppliedDependencyBump, BundledDependencies, CommitStrategy, DependencyBump, DependencyBumpSource, DependencyField, DependencyGraph, DependencyRangeShape, DependencyRangeUpdate, DetachedPackageRelease, PackageManifest, PackagePluginSpecs, PackageReleaseOutcome, PublishPluginPackage, PublishPluginSpec, ReleaseWorkspaceOptions, ResolvedPublishPlugin, ResumeWorkspaceReleaseOptions, ScopedPlugins, Workspace, WorkspaceDependency, WorkspacePackage, WorkspaceReleaseOutcome };
|
package/dist/index.js
CHANGED
|
@@ -10,10 +10,9 @@ import { generateNotes } from "@semantic-release/release-notes-generator";
|
|
|
10
10
|
import semanticRelease from "semantic-release";
|
|
11
11
|
import { pathToFileURL } from "node:url";
|
|
12
12
|
import { detachRelease, resumeRelease } from "@exadev/release-gate";
|
|
13
|
-
|
|
13
|
+
// src/package-name.ts
|
|
14
14
|
const packageName = "@exadev/semantic-release-workspace";
|
|
15
|
-
|
|
16
|
-
//#region src/errors.ts
|
|
15
|
+
// src/errors.ts
|
|
17
16
|
/**
|
|
18
17
|
* Every failure this package raises deliberately is one of these, so a caller (or the CLI) can tell an orchestration failure it should report cleanly apart from an unexpected crash it should let propagate with a stack trace.
|
|
19
18
|
*
|
|
@@ -56,8 +55,7 @@ var PnpmCommandError = class extends WorkspaceReleaseError {
|
|
|
56
55
|
super(`pnpm install --lockfile-only failed in ${cwd}: ${detail}`);
|
|
57
56
|
}
|
|
58
57
|
};
|
|
59
|
-
|
|
60
|
-
//#region src/exec-file.ts
|
|
58
|
+
// src/exec-file.ts
|
|
61
59
|
/**
|
|
62
60
|
* A hand-written promise wrapper around `child_process.execFile`, in place of `util.promisify(execFile)`: `execFile` synchronously returns a `ChildProcess` in addition to invoking its callback, which trips `@typescript-eslint/strict-void-return` when the whole function is handed to `promisify` (a value-returning function used where a void-returning one is contextually expected there) -- exactly the void-return contravariance leniency that rule exists to catch, even though `tsc` itself accepts the pattern. Calling `execFile` directly with our own callback, whose own return type really is `void`, sidesteps the mismatch instead of suppressing it.
|
|
63
61
|
*/
|
|
@@ -79,8 +77,7 @@ async function execFile$1(command, args, options) {
|
|
|
79
77
|
});
|
|
80
78
|
});
|
|
81
79
|
}
|
|
82
|
-
|
|
83
|
-
//#region src/git.ts
|
|
80
|
+
// src/git.ts
|
|
84
81
|
/** Separates one commit's record in `git log --format` output. Chosen from the C0 control range so it can never appear in a hash or a file path. */
|
|
85
82
|
const COMMIT_RECORD_SEPARATOR = "";
|
|
86
83
|
/** The identity semantic-release's own core writes release commits under in CI when nothing else is configured (its COMMIT_NAME/COMMIT_EMAIL constants); dependency-bump commits use the same fallback so every commit a release run produces has a consistent author when the repository declares none. */
|
|
@@ -321,8 +318,7 @@ function toGitCommandError(args, cwd, cause) {
|
|
|
321
318
|
const stderr = cause instanceof Error && "stderr" in cause && typeof cause.stderr === "string" ? cause.stderr.trim() : "";
|
|
322
319
|
return new GitCommandError(args, cwd, exitCode, stderr !== "" ? stderr : cause instanceof Error ? cause.message : String(cause));
|
|
323
320
|
}
|
|
324
|
-
|
|
325
|
-
//#region src/json.ts
|
|
321
|
+
// src/json.ts
|
|
326
322
|
function isJsonObject(value) {
|
|
327
323
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
328
324
|
}
|
|
@@ -346,8 +342,7 @@ function stringifyJsonLike(value, originalText) {
|
|
|
346
342
|
const serialised = JSON.stringify(value, null, detectIndent(originalText));
|
|
347
343
|
return originalText.endsWith("\n") ? `${serialised}\n` : serialised;
|
|
348
344
|
}
|
|
349
|
-
|
|
350
|
-
//#region src/manifest.ts
|
|
345
|
+
// src/manifest.ts
|
|
351
346
|
const DEPENDENCY_FIELDS = [
|
|
352
347
|
"dependencies",
|
|
353
348
|
"devDependencies",
|
|
@@ -397,8 +392,7 @@ async function writeDependencyRange(path, field, dependency, range) {
|
|
|
397
392
|
declared[dependency] = range;
|
|
398
393
|
await writeFile(path, stringifyJsonLike(parsed, text), "utf8");
|
|
399
394
|
}
|
|
400
|
-
|
|
401
|
-
//#region src/workspace.ts
|
|
395
|
+
// src/workspace.ts
|
|
402
396
|
/** The one filename pnpm recognises as a workspace definition. */
|
|
403
397
|
const WORKSPACE_MANIFEST = "pnpm-workspace.yaml";
|
|
404
398
|
/** Never treat an installed dependency's own manifest as a workspace package, however permissive the configured globs are. pnpm applies the same exclusion. */
|
|
@@ -478,8 +472,7 @@ function trimTrailingSlashes(pattern) {
|
|
|
478
472
|
function toPosix(path) {
|
|
479
473
|
return sep === "/" ? path : path.split(sep).join("/");
|
|
480
474
|
}
|
|
481
|
-
|
|
482
|
-
//#region src/version-range.ts
|
|
475
|
+
// src/version-range.ts
|
|
483
476
|
const WORKSPACE_PROTOCOL = "workspace:";
|
|
484
477
|
const CATALOG_PROTOCOL = "catalog:";
|
|
485
478
|
const NPM_ALIAS_PROTOCOL = "npm:";
|
|
@@ -556,8 +549,7 @@ function updateDependencyRange(current, version) {
|
|
|
556
549
|
range: shape.workspacePrefixed ? `${WORKSPACE_PROTOCOL}${rewritten}` : rewritten
|
|
557
550
|
};
|
|
558
551
|
}
|
|
559
|
-
|
|
560
|
-
//#region src/publishable-dependencies.ts
|
|
552
|
+
// src/publishable-dependencies.ts
|
|
561
553
|
/**
|
|
562
554
|
* Throws `UnsupportedDependencyRangeError` unless every publishable package's installed dependencies (`dependencies`, `peerDependencies`, `optionalDependencies`) are ranges a consumer's package manager can resolve.
|
|
563
555
|
*
|
|
@@ -577,8 +569,7 @@ function assertPublishableDependencies(packages) {
|
|
|
577
569
|
}
|
|
578
570
|
if (offences.length > 0) throw new UnsupportedDependencyRangeError(`Refusing to release: npm publish ships these dependency specifiers unchanged, so the published package could not be installed.\n${offences.join("\n")}\nDeclare a plain version range instead (for example "^1.2.3"). For a sibling in this workspace, keep "linkWorkspacePackages: true" in pnpm-workspace.yaml so pnpm still links it locally; this tool rewrites the range whenever the sibling releases. Packages marked "private" are never published and are exempt.`);
|
|
579
571
|
}
|
|
580
|
-
|
|
581
|
-
//#region src/graph.ts
|
|
572
|
+
// src/graph.ts
|
|
582
573
|
/**
|
|
583
574
|
* Builds the inter-package dependency graph from the manifests alone.
|
|
584
575
|
*
|
|
@@ -676,8 +667,7 @@ function mustGet(map, key, what) {
|
|
|
676
667
|
if (value === void 0) throw new WorkspaceReleaseError(`Internal error: ${what} "${key}" disappeared from the dependency graph mid-run.`);
|
|
677
668
|
return value;
|
|
678
669
|
}
|
|
679
|
-
|
|
680
|
-
//#region src/bundling.ts
|
|
670
|
+
// src/bundling.ts
|
|
681
671
|
/**
|
|
682
672
|
* Validates `bundlingPackages` against the workspace and works out, for every package, which workspace dependencies it bundles.
|
|
683
673
|
*
|
|
@@ -708,8 +698,7 @@ function resolveBundledDependencies(graph, bundlingPackages) {
|
|
|
708
698
|
function isPrivateRuntimeEdge(edge, graph) {
|
|
709
699
|
return edge.field !== "devDependencies" && mustGet(graph.packages, edge.dependency, "package").private;
|
|
710
700
|
}
|
|
711
|
-
|
|
712
|
-
//#region src/release-type.ts
|
|
701
|
+
// src/release-type.ts
|
|
713
702
|
/** Every release type semantic-release knows, highest first: the order `@semantic-release/commit-analyzer` itself ranks them in (its `lib/default-release-types.js`), so comparing two types here agrees with how the analyzer picks the highest type among a package's own commits. */
|
|
714
703
|
const RELEASE_TYPES_HIGHEST_FIRST = [
|
|
715
704
|
"major",
|
|
@@ -735,8 +724,7 @@ function highestReleaseType(types) {
|
|
|
735
724
|
function raiseReleaseType(base, other) {
|
|
736
725
|
return other === void 0 || RELEASE_TYPES_HIGHEST_FIRST.indexOf(base) <= RELEASE_TYPES_HIGHEST_FIRST.indexOf(other) ? base : other;
|
|
737
726
|
}
|
|
738
|
-
|
|
739
|
-
//#region src/dependency-bump-commit.ts
|
|
727
|
+
// src/dependency-bump-commit.ts
|
|
740
728
|
/**
|
|
741
729
|
* The commit message format for a cross-package dependency-range bump, shared between the code that writes it (`bumpDependents` in `release.ts`) and the code that reads it back (`createScopedPlugins` in `plugins.ts`).
|
|
742
730
|
*
|
|
@@ -776,8 +764,7 @@ function matchTrailerLine(message, key) {
|
|
|
776
764
|
const line = message.split("\n").find((candidate) => candidate.startsWith(prefix));
|
|
777
765
|
return line === void 0 ? void 0 : line.slice(prefix.length).trim();
|
|
778
766
|
}
|
|
779
|
-
|
|
780
|
-
//#region src/plugins.ts
|
|
767
|
+
// src/plugins.ts
|
|
781
768
|
/** The one plugin a private package is kept off by default: see `resolveWorkspacePublishPlugins` for why a package that never reaches a registry does not get a public GitHub Release either. */
|
|
782
769
|
const GITHUB_RELEASE_PLUGIN = "@semantic-release/github";
|
|
783
770
|
/** semantic-release's own `getLastRelease` returns `{}` for a package with no prior tag -- not `undefined`, and not a fully-populated `LastRelease` -- contradicting the `gitHead: string` its own type declares. Narrows structurally rather than trusting that declared type, so a first-release context's `lastRelease` (correctly, at runtime) never claims a `gitHead` it does not have. */
|
|
@@ -990,8 +977,7 @@ async function releasePackageAcrossBranchMoves(name, branch, attempt, log) {
|
|
|
990
977
|
log(`${name}: reported no release while the branch moved from ${tipBefore} to ${tipAfter}, which is also what a stale branch looks like; integrating and releasing it again.`);
|
|
991
978
|
}
|
|
992
979
|
}
|
|
993
|
-
|
|
994
|
-
//#region src/pnpm.ts
|
|
980
|
+
// src/pnpm.ts
|
|
995
981
|
/**
|
|
996
982
|
* Regenerates `pnpm-lock.yaml` for the whole workspace from the manifests currently on disk, without touching `node_modules` or installing anything -- the same lockfile-refresh step a contributor runs by hand after editing a `package.json` dependency range.
|
|
997
983
|
*
|
|
@@ -1021,8 +1007,7 @@ function validateTagFormat(tagFormat) {
|
|
|
1021
1007
|
function formatTagForPackage(tagFormat, name) {
|
|
1022
1008
|
return tagFormat.replaceAll("${name}", name);
|
|
1023
1009
|
}
|
|
1024
|
-
|
|
1025
|
-
//#region src/single-commit-release.ts
|
|
1010
|
+
// src/single-commit-release.ts
|
|
1026
1011
|
/**
|
|
1027
1012
|
* `commitStrategy: 'single'`: one combined commit for the whole run instead of one commit per package release plus one per dependency bump.
|
|
1028
1013
|
*
|
|
@@ -1368,8 +1353,7 @@ async function loadReleasePlugin(absolutePath, cache) {
|
|
|
1368
1353
|
cache.set(absolutePath, loaded);
|
|
1369
1354
|
return loaded;
|
|
1370
1355
|
}
|
|
1371
|
-
|
|
1372
|
-
//#region src/gate-publish.ts
|
|
1356
|
+
// src/gate-publish.ts
|
|
1373
1357
|
/**
|
|
1374
1358
|
* The `gatePublish: true` half of `releaseWorkspace`: tags and pushes every due package via `@exadev/release-gate`'s `detachRelease`, but never publishes. Built on the same `runReleaseLoop` the normal per-package path uses, so dependency-range bumps between packages happen identically either way -- only the release call itself (`detachRelease` instead of `semanticRelease`) and how "did it release" gets read differ.
|
|
1375
1359
|
*/
|
|
@@ -1511,8 +1495,7 @@ async function resumeWorkspaceRelease(options) {
|
|
|
1511
1495
|
packages
|
|
1512
1496
|
};
|
|
1513
1497
|
}
|
|
1514
|
-
|
|
1515
|
-
//#region src/release.ts
|
|
1498
|
+
// src/release.ts
|
|
1516
1499
|
/**
|
|
1517
1500
|
* Releases every package in a pnpm workspace with independent versions, in dependency order.
|
|
1518
1501
|
*
|
|
@@ -1721,5 +1704,4 @@ function branchTracker(workspace, log) {
|
|
|
1721
1704
|
tip: async () => await fetchBranchTip(await currentBranch({ cwd: workspace.root }), { cwd: workspace.root })
|
|
1722
1705
|
};
|
|
1723
1706
|
}
|
|
1724
|
-
//#endregion
|
|
1725
1707
|
export { DEFAULT_PUBLISH_PLUGINS, DependencyCycleError, GitCommandError, ReleaseConfigurationError, SINGLE_COMMIT_DEFAULT_PUBLISH_PLUGINS, UnsupportedDependencyRangeError, WorkspaceDiscoveryError, WorkspaceReleaseError, WorkspaceStateError, buildDependencyGraph, classifyDependencyRange, createScopedPlugins, discoverWorkspace, filterCommitsToDirectory, orderedPackages, packageName, readManifest, releaseWorkspace, resolveBundledDependencies, resolvePublishPlugins, resolveWorkspacePublishPlugins, resumeWorkspaceRelease, topologicalOrder, updateDependencyRange, writeDependencyRange };
|
package/package.json
CHANGED