@effected/changesets 0.4.1 → 0.5.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.
- package/BreakingFloors.js +140 -0
- package/ReleaseEdits.js +1 -1
- package/ReleasePlan.js +55 -1
- package/index.d.ts +121 -27
- package/index.js +2 -1
- package/internal/versions.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { WORKSPACE, cleanVersion, parseRange, satisfies } from "./internal/versions.js";
|
|
2
|
+
import { computeEdits } from "./ReleaseEdits.js";
|
|
3
|
+
import { SemVer } from "@effected/semver";
|
|
4
|
+
import { Result, Schema } from "effect";
|
|
5
|
+
|
|
6
|
+
// src/BreakingFloors.ts
|
|
7
|
+
/**
|
|
8
|
+
* The one manifest field whose floor can strand a consumer. A regular or optional dependency is
|
|
9
|
+
* installed for the dependent alone, so a newer one nests beside the consumer's; a peer binds to
|
|
10
|
+
* the consumer's copy, and that copy may be on the old line.
|
|
11
|
+
*/
|
|
12
|
+
const RUNTIME_KINDS = ["peerDependencies"];
|
|
13
|
+
/**
|
|
14
|
+
* One dependency whose breaking release moves a dependent's published floor.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
var FloorCause = class extends Schema.Class("FloorCause")({
|
|
19
|
+
/** The manifest field naming the dependency. */
|
|
20
|
+
kind: Schema.Literals(RUNTIME_KINDS),
|
|
21
|
+
/** The dependency's package name. */
|
|
22
|
+
dependency: Schema.String,
|
|
23
|
+
/** The dependency's version now. */
|
|
24
|
+
oldVersion: Schema.String,
|
|
25
|
+
/** The dependency's version after the release, on a new breaking line. */
|
|
26
|
+
newVersion: Schema.String,
|
|
27
|
+
/** The range the dependent publishes on the dependency, which no longer admits `oldVersion`. */
|
|
28
|
+
range: Schema.String
|
|
29
|
+
}) {};
|
|
30
|
+
/**
|
|
31
|
+
* A release that stays on its own breaking line while a range it publishes
|
|
32
|
+
* crosses a dependency's breaking line: a consumer on the old line of both
|
|
33
|
+
* would resolve this release and miss what it now requires.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
37
|
+
var BreakingFloor = class extends Schema.Class("BreakingFloor")({
|
|
38
|
+
/** The dependent's package name. */
|
|
39
|
+
name: Schema.String,
|
|
40
|
+
/** The bump the plan gives it. */
|
|
41
|
+
type: Schema.Literals([
|
|
42
|
+
"patch",
|
|
43
|
+
"minor",
|
|
44
|
+
"major"
|
|
45
|
+
]),
|
|
46
|
+
/** Its version now. */
|
|
47
|
+
oldVersion: Schema.String,
|
|
48
|
+
/** The version the plan gives it, on the same breaking line as `oldVersion`. */
|
|
49
|
+
newVersion: Schema.String,
|
|
50
|
+
/** The smallest bump that moves it to a new breaking line. */
|
|
51
|
+
required: Schema.Literals([
|
|
52
|
+
"patch",
|
|
53
|
+
"minor",
|
|
54
|
+
"major"
|
|
55
|
+
]),
|
|
56
|
+
/** Every dependency whose floor it crosses, sorted by name. */
|
|
57
|
+
causes: Schema.Array(FloorCause)
|
|
58
|
+
}) {};
|
|
59
|
+
const parse = (version) => Result.getOrUndefined(SemVer.parseResult(cleanVersion(version)));
|
|
60
|
+
/**
|
|
61
|
+
* The caret line a version sits on: `1` for `1.4.2`, `0.4` for `0.4.2`,
|
|
62
|
+
* `0.0.4` for `0.0.4`. Two versions on one line are caret-compatible, so a
|
|
63
|
+
* release that changes the line is breaking.
|
|
64
|
+
*/
|
|
65
|
+
const line = (version) => version.major > 0 ? `${version.major}` : version.minor > 0 ? `0.${version.minor}` : `0.0.${version.patch}`;
|
|
66
|
+
/** The smallest bump that leaves `version`'s caret line. */
|
|
67
|
+
const leaveLine = (version) => version.major > 0 ? "major" : version.minor > 0 ? "minor" : "patch";
|
|
68
|
+
/**
|
|
69
|
+
* The range `pnpm publish` writes for a specifier as `changeset version`
|
|
70
|
+
* leaves it, once the dependency is at `newVersion`; `undefined` when it is
|
|
71
|
+
* not a range at all. `workspace:*` and a `workspace:` path publish the exact
|
|
72
|
+
* version, `workspace:^` and `workspace:~` the operator before it, and a
|
|
73
|
+
* `workspace:<range>` or a literal range publishes as written.
|
|
74
|
+
*/
|
|
75
|
+
const publishedRange = (specifier, newVersion) => {
|
|
76
|
+
if (WORKSPACE.test(specifier)) {
|
|
77
|
+
const bare = specifier.replace(WORKSPACE, "");
|
|
78
|
+
if (bare === "*") return newVersion;
|
|
79
|
+
if (bare === "^" || bare === "~") return `${bare}${newVersion}`;
|
|
80
|
+
if (parseRange(bare) !== void 0) return bare;
|
|
81
|
+
return newVersion;
|
|
82
|
+
}
|
|
83
|
+
return parseRange(specifier) === void 0 ? void 0 : specifier;
|
|
84
|
+
};
|
|
85
|
+
/** @internal */
|
|
86
|
+
const computeBreakingFloors = (plan, packages, config) => {
|
|
87
|
+
const edits = computeEdits(plan, {
|
|
88
|
+
packages,
|
|
89
|
+
config
|
|
90
|
+
});
|
|
91
|
+
if (Result.isFailure(edits)) return Result.fail(edits.failure);
|
|
92
|
+
const written = /* @__PURE__ */ new Map();
|
|
93
|
+
for (const manifest of edits.success.manifests) for (const edit of manifest.ranges) if (edit.kind === "peerDependencies") written.set(`${manifest.name}\0${edit.dependency}`, edit.to);
|
|
94
|
+
const { releases } = plan;
|
|
95
|
+
const byName = new Map(packages.map((pkg) => [pkg.name, pkg]));
|
|
96
|
+
const breaking = /* @__PURE__ */ new Map();
|
|
97
|
+
for (const release of releases) {
|
|
98
|
+
const current = byName.get(release.name)?.version;
|
|
99
|
+
const from = current === void 0 ? void 0 : parse(current);
|
|
100
|
+
const to = parse(release.newVersion);
|
|
101
|
+
if (release.type === "none" || from === void 0 || to === void 0) continue;
|
|
102
|
+
if (line(from) !== line(to)) breaking.set(release.name, {
|
|
103
|
+
oldVersion: current ?? "",
|
|
104
|
+
newVersion: release.newVersion
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const floors = [];
|
|
108
|
+
for (const release of releases) {
|
|
109
|
+
if (release.type === "none" || breaking.has(release.name)) continue;
|
|
110
|
+
const pkg = byName.get(release.name);
|
|
111
|
+
const from = pkg?.version === void 0 ? void 0 : parse(pkg.version);
|
|
112
|
+
if (pkg === void 0 || from === void 0) continue;
|
|
113
|
+
const causes = [];
|
|
114
|
+
for (const kind of RUNTIME_KINDS) for (const [dependency, specifier] of Object.entries(pkg[kind])) {
|
|
115
|
+
const moved = breaking.get(dependency);
|
|
116
|
+
if (moved === void 0) continue;
|
|
117
|
+
const range = publishedRange(written.get(`${release.name}\0${dependency}`) ?? specifier, moved.newVersion);
|
|
118
|
+
if (range === void 0 || satisfies(moved.oldVersion, range)) continue;
|
|
119
|
+
causes.push(FloorCause.make({
|
|
120
|
+
kind,
|
|
121
|
+
dependency,
|
|
122
|
+
...moved,
|
|
123
|
+
range
|
|
124
|
+
}));
|
|
125
|
+
}
|
|
126
|
+
if (causes.length === 0) continue;
|
|
127
|
+
causes.sort((a, b) => a.dependency < b.dependency ? -1 : a.dependency > b.dependency ? 1 : 0);
|
|
128
|
+
floors.push(BreakingFloor.make({
|
|
129
|
+
name: release.name,
|
|
130
|
+
type: release.type,
|
|
131
|
+
oldVersion: pkg.version ?? "",
|
|
132
|
+
newVersion: release.newVersion,
|
|
133
|
+
required: leaveLine(from),
|
|
134
|
+
causes
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
return Result.succeed(floors);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export { BreakingFloor, FloorCause, computeBreakingFloors };
|
package/ReleaseEdits.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { MissingPackageError } from "./errors.js";
|
|
2
2
|
import { DEPENDENCY_KINDS, WORKSPACE, cleanVersion, increment, matchNames, parseRange, satisfies, shouldUpdate, writtenSets } from "./internal/versions.js";
|
|
3
3
|
import { PreState } from "./PreState.js";
|
|
4
|
+
import { InvalidVersionError, SemVer } from "@effected/semver";
|
|
4
5
|
import { Result, Schema } from "effect";
|
|
5
6
|
import { posix } from "node:path";
|
|
6
|
-
import { InvalidVersionError, SemVer } from "@effected/semver";
|
|
7
7
|
|
|
8
8
|
// src/ReleaseEdits.ts
|
|
9
9
|
/**
|
package/ReleasePlan.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import { computeBreakingFloors } from "./BreakingFloors.js";
|
|
1
2
|
import { ChangesetConfig } from "./ChangesetConfig.js";
|
|
2
3
|
import { ChangesetConfigError, SnapshotPreModeError, SnapshotTemplateError, UnknownPackageError } from "./errors.js";
|
|
3
4
|
import { DEPENDENCY_KINDS, WORKSPACE, cleanVersion, increment, matchNames, parseRange, satisfies } from "./internal/versions.js";
|
|
4
5
|
import { PendingChangeset, PendingChangesets } from "./PendingChangesets.js";
|
|
5
6
|
import { PreState } from "./PreState.js";
|
|
6
7
|
import { computeEdits } from "./ReleaseEdits.js";
|
|
8
|
+
import { InvalidVersionError, Range, SemVer } from "@effected/semver";
|
|
7
9
|
import { Effect, FileSystem, Option, Path, Result, Schema } from "effect";
|
|
8
10
|
import { posix } from "node:path";
|
|
9
|
-
import { InvalidVersionError, Range, SemVer } from "@effected/semver";
|
|
10
11
|
import { WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspacePackage } from "@effected/workspaces";
|
|
11
12
|
|
|
12
13
|
// src/ReleasePlan.ts
|
|
@@ -522,6 +523,59 @@ var ReleasePlan = class extends Schema.Class("ReleasePlan")({
|
|
|
522
523
|
return computeEdits(plan, input);
|
|
523
524
|
}
|
|
524
525
|
/**
|
|
526
|
+
* The releases in `plan` that stay on their own breaking line while a range
|
|
527
|
+
* they publish crosses a dependency's breaking line. Nothing is written; a
|
|
528
|
+
* caller raises each to its `required` bump, then plans again, because the
|
|
529
|
+
* raised release can itself cross a dependent's floor.
|
|
530
|
+
*
|
|
531
|
+
* A breaking line is a caret line: `1.x` for a `1.4.2`, `0.4.x` for a
|
|
532
|
+
* `0.4.2`, the single version for a `0.0.4`. A release is breaking when its
|
|
533
|
+
* new version is on another line than the package's version now; for a
|
|
534
|
+
* member of a fixed or linked group that is the package's own version, not
|
|
535
|
+
* the group's `oldVersion`, because consumers hold the package's own.
|
|
536
|
+
*
|
|
537
|
+
* The rule, for every release R that is not `none` and not already breaking:
|
|
538
|
+
*
|
|
539
|
+
* - For each `peerDependencies` entry naming a package D that the plan
|
|
540
|
+
* releases as breaking, find the
|
|
541
|
+
* range R publishes on D. `workspace:^` and `workspace:~` publish the
|
|
542
|
+
* operator before D's new version, `workspace:*` and a `workspace:` path
|
|
543
|
+
* publish D's new version exactly, and `workspace:<range>` or a literal
|
|
544
|
+
* range publishes as {@link ReleasePlan.edits} leaves it. That rewrites
|
|
545
|
+
* the range when D's new version leaves it, and also a held peer range
|
|
546
|
+
* unless `onlyUpdatePeerDependentsWhenOutOfRange` is on, keeping only
|
|
547
|
+
* the leading operator: `^0.3.0 || ^0.4.0` publishes as `^0.4.0`.
|
|
548
|
+
* - When that range does not admit D's version now, R crosses D's floor: a
|
|
549
|
+
* consumer holding R's old line and D's old line resolves R's release
|
|
550
|
+
* and gets a D it cannot satisfy. R must leave its own line too, so R is
|
|
551
|
+
* reported with the smallest bump that does (`major` from `1.x`, `minor`
|
|
552
|
+
* from `0.x` with a non-zero minor, `patch` from `0.0.x`).
|
|
553
|
+
*
|
|
554
|
+
* Only peers are read. A regular or optional dependency is installed for R
|
|
555
|
+
* alone, so a newer D nests beside the consumer's and strands nothing; a
|
|
556
|
+
* peer binds to the consumer's D, which may be on the old line. A
|
|
557
|
+
* published range that still admits D's old version crosses nothing, so
|
|
558
|
+
* a widened range such as `^0.3.0 || ^0.4.0` avoids a raise only where
|
|
559
|
+
* `onlyUpdatePeerDependentsWhenOutOfRange` keeps it as written. A version
|
|
560
|
+
* that is not one is passed over.
|
|
561
|
+
*
|
|
562
|
+
* `@changesets/assemble-release-plan` has no such rule: it bumps a
|
|
563
|
+
* dependent `patch` however far the dependency moves, so a dependency's
|
|
564
|
+
* breaking release ripples as a patch of everything that peers on it.
|
|
565
|
+
*
|
|
566
|
+
* Fails as {@link ReleasePlan.edits} fails, which a plan
|
|
567
|
+
* {@link ReleasePlan.assemble} made from the same packages never does.
|
|
568
|
+
*
|
|
569
|
+
* @param plan - The plan to check.
|
|
570
|
+
* @param input - The workspace's packages and the config the plan was
|
|
571
|
+
* made with, as {@link ReleasePlan.edits} takes them.
|
|
572
|
+
* @returns every crossing, sorted by package name, each with its causes
|
|
573
|
+
* sorted by dependency name; empty when the plan crosses no floor.
|
|
574
|
+
*/
|
|
575
|
+
static breakingFloors(plan, input) {
|
|
576
|
+
return computeBreakingFloors(plan, input.packages, input.config);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
525
579
|
* Discover the workspace's packages, read its config, pending changesets and
|
|
526
580
|
* `.changeset/pre.json`, and {@link ReleasePlan.assemble | assemble} the
|
|
527
581
|
* plan. {@link ReleasePlan.readWithContext} reads the same plan and also
|
package/index.d.ts
CHANGED
|
@@ -10,34 +10,9 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @packageDocumentation
|
|
12
12
|
*/
|
|
13
|
-
import { Effect, FileSystem, Option, Path, PlatformError, Result, Schema } from "effect";
|
|
14
|
-
import { WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspacePackage, WorkspaceRootNotFoundError } from "@effected/workspaces";
|
|
15
13
|
import { InvalidVersionError } from "@effected/semver";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @public
|
|
20
|
-
*/
|
|
21
|
-
export declare const BumpType: Schema.Literals<readonly ["patch", "minor", "major"]>;
|
|
22
|
-
/**
|
|
23
|
-
* The type of a `BumpType` value.
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
export type BumpType = typeof BumpType.Type;
|
|
28
|
-
/**
|
|
29
|
-
* What a changeset can say about a package: a {@link (BumpType:variable)}, or `none`, which names the package and
|
|
30
|
-
* moves no version.
|
|
31
|
-
*
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export declare const ReleaseType: Schema.Literals<readonly ["patch", "minor", "major", "none"]>;
|
|
35
|
-
/**
|
|
36
|
-
* The type of a `ReleaseType` value.
|
|
37
|
-
*
|
|
38
|
-
* @public
|
|
39
|
-
*/
|
|
40
|
-
export type ReleaseType = typeof ReleaseType.Type;
|
|
14
|
+
import { WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspacePackage, WorkspaceRootNotFoundError } from "@effected/workspaces";
|
|
15
|
+
import { Effect, FileSystem, Option, Path, PlatformError, Result, Schema } from "effect";
|
|
41
16
|
declare const ChangesetParseError_base: Schema.Class<ChangesetParseError, Schema.TaggedStruct<"ChangesetParseError", {
|
|
42
17
|
/** What was wrong with the file. */
|
|
43
18
|
readonly reason: Schema.String;
|
|
@@ -236,6 +211,31 @@ export declare class ChangesetConfig extends ChangesetConfig_base {
|
|
|
236
211
|
*/
|
|
237
212
|
static readonly read: (root: string) => Effect.Effect<ChangesetConfig, ChangesetConfigError | PlatformError.PlatformError, FileSystem.FileSystem | Path.Path>;
|
|
238
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* A semver bump a changeset can request: `patch`, `minor` or `major`.
|
|
216
|
+
*
|
|
217
|
+
* @public
|
|
218
|
+
*/
|
|
219
|
+
export declare const BumpType: Schema.Literals<readonly ["patch", "minor", "major"]>;
|
|
220
|
+
/**
|
|
221
|
+
* The type of a `BumpType` value.
|
|
222
|
+
*
|
|
223
|
+
* @public
|
|
224
|
+
*/
|
|
225
|
+
export type BumpType = typeof BumpType.Type;
|
|
226
|
+
/**
|
|
227
|
+
* What a changeset can say about a package: a {@link (BumpType:variable)}, or `none`, which names the package and
|
|
228
|
+
* moves no version.
|
|
229
|
+
*
|
|
230
|
+
* @public
|
|
231
|
+
*/
|
|
232
|
+
export declare const ReleaseType: Schema.Literals<readonly ["patch", "minor", "major", "none"]>;
|
|
233
|
+
/**
|
|
234
|
+
* The type of a `ReleaseType` value.
|
|
235
|
+
*
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
export type ReleaseType = typeof ReleaseType.Type;
|
|
239
239
|
declare const PendingChangeset_base: Schema.Class<PendingChangeset, Schema.Struct<{
|
|
240
240
|
/**
|
|
241
241
|
* The file name, relative to `.changeset/`: `pre/<name>.md` for a
|
|
@@ -451,6 +451,46 @@ declare const ReleaseEdits_base: Schema.Class<ReleaseEdits, Schema.Struct<{
|
|
|
451
451
|
* @public
|
|
452
452
|
*/
|
|
453
453
|
export declare class ReleaseEdits extends ReleaseEdits_base {}
|
|
454
|
+
declare const FloorCause_base: Schema.Class<FloorCause, Schema.Struct<{
|
|
455
|
+
/** The manifest field naming the dependency. */
|
|
456
|
+
readonly kind: Schema.Literals<readonly ["peerDependencies"]>;
|
|
457
|
+
/** The dependency's package name. */
|
|
458
|
+
readonly dependency: Schema.String;
|
|
459
|
+
/** The dependency's version now. */
|
|
460
|
+
readonly oldVersion: Schema.String;
|
|
461
|
+
/** The dependency's version after the release, on a new breaking line. */
|
|
462
|
+
readonly newVersion: Schema.String;
|
|
463
|
+
/** The range the dependent publishes on the dependency, which no longer admits `oldVersion`. */
|
|
464
|
+
readonly range: Schema.String;
|
|
465
|
+
}>, {}>;
|
|
466
|
+
/**
|
|
467
|
+
* One dependency whose breaking release moves a dependent's published floor.
|
|
468
|
+
*
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
export declare class FloorCause extends FloorCause_base {}
|
|
472
|
+
declare const BreakingFloor_base: Schema.Class<BreakingFloor, Schema.Struct<{
|
|
473
|
+
/** The dependent's package name. */
|
|
474
|
+
readonly name: Schema.String;
|
|
475
|
+
/** The bump the plan gives it. */
|
|
476
|
+
readonly type: Schema.Literals<readonly ["patch", "minor", "major"]>;
|
|
477
|
+
/** Its version now. */
|
|
478
|
+
readonly oldVersion: Schema.String;
|
|
479
|
+
/** The version the plan gives it, on the same breaking line as `oldVersion`. */
|
|
480
|
+
readonly newVersion: Schema.String;
|
|
481
|
+
/** The smallest bump that moves it to a new breaking line. */
|
|
482
|
+
readonly required: Schema.Literals<readonly ["patch", "minor", "major"]>;
|
|
483
|
+
/** Every dependency whose floor it crosses, sorted by name. */
|
|
484
|
+
readonly causes: Schema.$Array<typeof FloorCause>;
|
|
485
|
+
}>, {}>;
|
|
486
|
+
/**
|
|
487
|
+
* A release that stays on its own breaking line while a range it publishes
|
|
488
|
+
* crosses a dependency's breaking line: a consumer on the old line of both
|
|
489
|
+
* would resolve this release and miss what it now requires.
|
|
490
|
+
*
|
|
491
|
+
* @public
|
|
492
|
+
*/
|
|
493
|
+
export declare class BreakingFloor extends BreakingFloor_base {}
|
|
454
494
|
/**
|
|
455
495
|
* The input for a snapshot plan, `changeset version --snapshot`'s parameters.
|
|
456
496
|
* {@link ReleasePlan.assemble} documents how each is read.
|
|
@@ -806,6 +846,60 @@ export declare class ReleasePlan extends ReleasePlan_base {
|
|
|
806
846
|
readonly packages: ReadonlyArray<WorkspacePackage>;
|
|
807
847
|
readonly config: ChangesetConfig;
|
|
808
848
|
}): Result.Result<ReleaseEdits, MissingPackageError | InvalidVersionError>;
|
|
849
|
+
/**
|
|
850
|
+
* The releases in `plan` that stay on their own breaking line while a range
|
|
851
|
+
* they publish crosses a dependency's breaking line. Nothing is written; a
|
|
852
|
+
* caller raises each to its `required` bump, then plans again, because the
|
|
853
|
+
* raised release can itself cross a dependent's floor.
|
|
854
|
+
*
|
|
855
|
+
* A breaking line is a caret line: `1.x` for a `1.4.2`, `0.4.x` for a
|
|
856
|
+
* `0.4.2`, the single version for a `0.0.4`. A release is breaking when its
|
|
857
|
+
* new version is on another line than the package's version now; for a
|
|
858
|
+
* member of a fixed or linked group that is the package's own version, not
|
|
859
|
+
* the group's `oldVersion`, because consumers hold the package's own.
|
|
860
|
+
*
|
|
861
|
+
* The rule, for every release R that is not `none` and not already breaking:
|
|
862
|
+
*
|
|
863
|
+
* - For each `peerDependencies` entry naming a package D that the plan
|
|
864
|
+
* releases as breaking, find the
|
|
865
|
+
* range R publishes on D. `workspace:^` and `workspace:~` publish the
|
|
866
|
+
* operator before D's new version, `workspace:*` and a `workspace:` path
|
|
867
|
+
* publish D's new version exactly, and `workspace:<range>` or a literal
|
|
868
|
+
* range publishes as {@link ReleasePlan.edits} leaves it. That rewrites
|
|
869
|
+
* the range when D's new version leaves it, and also a held peer range
|
|
870
|
+
* unless `onlyUpdatePeerDependentsWhenOutOfRange` is on, keeping only
|
|
871
|
+
* the leading operator: `^0.3.0 || ^0.4.0` publishes as `^0.4.0`.
|
|
872
|
+
* - When that range does not admit D's version now, R crosses D's floor: a
|
|
873
|
+
* consumer holding R's old line and D's old line resolves R's release
|
|
874
|
+
* and gets a D it cannot satisfy. R must leave its own line too, so R is
|
|
875
|
+
* reported with the smallest bump that does (`major` from `1.x`, `minor`
|
|
876
|
+
* from `0.x` with a non-zero minor, `patch` from `0.0.x`).
|
|
877
|
+
*
|
|
878
|
+
* Only peers are read. A regular or optional dependency is installed for R
|
|
879
|
+
* alone, so a newer D nests beside the consumer's and strands nothing; a
|
|
880
|
+
* peer binds to the consumer's D, which may be on the old line. A
|
|
881
|
+
* published range that still admits D's old version crosses nothing, so
|
|
882
|
+
* a widened range such as `^0.3.0 || ^0.4.0` avoids a raise only where
|
|
883
|
+
* `onlyUpdatePeerDependentsWhenOutOfRange` keeps it as written. A version
|
|
884
|
+
* that is not one is passed over.
|
|
885
|
+
*
|
|
886
|
+
* `@changesets/assemble-release-plan` has no such rule: it bumps a
|
|
887
|
+
* dependent `patch` however far the dependency moves, so a dependency's
|
|
888
|
+
* breaking release ripples as a patch of everything that peers on it.
|
|
889
|
+
*
|
|
890
|
+
* Fails as {@link ReleasePlan.edits} fails, which a plan
|
|
891
|
+
* {@link ReleasePlan.assemble} made from the same packages never does.
|
|
892
|
+
*
|
|
893
|
+
* @param plan - The plan to check.
|
|
894
|
+
* @param input - The workspace's packages and the config the plan was
|
|
895
|
+
* made with, as {@link ReleasePlan.edits} takes them.
|
|
896
|
+
* @returns every crossing, sorted by package name, each with its causes
|
|
897
|
+
* sorted by dependency name; empty when the plan crosses no floor.
|
|
898
|
+
*/
|
|
899
|
+
static breakingFloors(plan: ReleasePlan, input: {
|
|
900
|
+
readonly packages: ReadonlyArray<WorkspacePackage>;
|
|
901
|
+
readonly config: ChangesetConfig;
|
|
902
|
+
}): Result.Result<ReadonlyArray<BreakingFloor>, MissingPackageError | InvalidVersionError>;
|
|
809
903
|
/**
|
|
810
904
|
* Discover the workspace's packages, read its config, pending changesets and
|
|
811
905
|
* `.changeset/pre.json`, and {@link ReleasePlan.assemble | assemble} the
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BreakingFloor, FloorCause } from "./BreakingFloors.js";
|
|
1
2
|
import { BumpType, ReleaseType } from "./BumpType.js";
|
|
2
3
|
import { Changelog, ChangelogError, ComprehensiveRelease, ModCompWithPackage, NewChangeset, NewChangesetWithCommit, PackageJSON, VersionType } from "./Changelog.js";
|
|
3
4
|
import { ChangesetConfig } from "./ChangesetConfig.js";
|
|
@@ -8,4 +9,4 @@ import { PreState } from "./PreState.js";
|
|
|
8
9
|
import { ChangesetMove, ManifestEdit, RangeEdit, ReleaseEdits } from "./ReleaseEdits.js";
|
|
9
10
|
import { PlannedRelease, ReleaseContext, ReleasePlan } from "./ReleasePlan.js";
|
|
10
11
|
|
|
11
|
-
export { BumpType, Changelog, ChangelogError, ChangesetConfig, ChangesetConfigError, ChangesetFile, ChangesetMove, ChangesetParseError, ComprehensiveRelease, ManifestEdit, MissingPackageError, ModCompWithPackage, NewChangeset, NewChangesetWithCommit, PackageJSON, ParsedChangeset, PendingChangeset, PendingChangesets, PlannedRelease, PreState, RangeEdit, ReleaseContext, ReleaseEdits, ReleasePlan, ReleaseType, SnapshotPreModeError, SnapshotTemplateError, UnknownPackageError, VersionType };
|
|
12
|
+
export { BreakingFloor, BumpType, Changelog, ChangelogError, ChangesetConfig, ChangesetConfigError, ChangesetFile, ChangesetMove, ChangesetParseError, ComprehensiveRelease, FloorCause, ManifestEdit, MissingPackageError, ModCompWithPackage, NewChangeset, NewChangesetWithCommit, PackageJSON, ParsedChangeset, PendingChangeset, PendingChangesets, PlannedRelease, PreState, RangeEdit, ReleaseContext, ReleaseEdits, ReleasePlan, ReleaseType, SnapshotPreModeError, SnapshotTemplateError, UnknownPackageError, VersionType };
|
package/internal/versions.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effected/changesets",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Changeset files, `.changeset/config.json` and the release plan as Effect schemas and pure functions.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@effected/glob": "^0.21.0",
|
|
46
46
|
"@effected/semver": "^0.24.0",
|
|
47
|
-
"@effected/workspaces": "^0.
|
|
47
|
+
"@effected/workspaces": "^0.47.0",
|
|
48
48
|
"@effected/yaml": "^0.30.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|