Skip to content

Commit 27a5a82

Browse files
Andaristemmatown
andauthored
Add support for fixed packages (#690)
* Add support for `fixed` packages * Add changesets * Delete config.js * Tweak `getHighestReleaseType` implementation * Add a test showcasing how CHANGELOGs are generated for fixed packages that dont have any changeset associated with them Co-authored-by: Mitchell Hamilton <mitchell@hamil.town>
1 parent 0d1debd commit 27a5a82

File tree

25 files changed

+1203
-579
lines changed

25 files changed

+1203
-579
lines changed

.changeset/hotpink-walls-suffer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/types": minor
3+
---
4+
5+
Add the new `fixed` property to the `Config` type.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@changesets/cli": minor
3+
---
4+
5+
Added a new `.changeset/config.json` option: `fixed`. It can be used to group packages that should always be released together. If any package from a group is going to be released then all packages from that group will be released together (with the same version).
6+
7+
This is similar to what people often know from Lerna as this is how their fixed/locked mode works.

.changeset/pink-walls-suffer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/config": minor
3+
---
4+
5+
Added parsing and validating of the new `fixed` option. The description for this option has also been added to the JSON schema.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/assemble-release-plan": minor
3+
---
4+
5+
Added handling of the `fixed` config option. This adds all the packages from the `fixed` group to the assembled release and added releases end up having the same version.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# We just want a file in here so git collects it
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"private": true,
3+
"name": "simple-project",
4+
"description": "two fixed projects",
5+
"version": "1.0.0",
6+
"bolt": {
7+
"workspaces": [
8+
"packages/*"
9+
]
10+
}
11+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "pkg-a",
3+
"version": "1.0.0",
4+
"dependencies": {
5+
"pkg-b": "1.0.0"
6+
}
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "pkg-b",
3+
"version": "1.0.0"
4+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"jest-junit": "^6.4.0",
6565
"jest-watch-typeahead": "^0.4.2",
6666
"prettier": "^1.19.1",
67-
"typescript": "^3.9.6"
67+
"typescript": "^4.5.2"
6868
},
6969
"preconstruct": {
7070
"packages": [

packages/apply-release-plan/src/index.test.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class FakeReleasePlan {
4343
this.config = {
4444
changelog: false,
4545
commit: false,
46+
fixed: [],
4647
linked: [],
4748
access: "restricted",
4849
baseBranch: "main",
@@ -79,6 +80,7 @@ async function testSetup(
7980
config = {
8081
changelog: false,
8182
commit: false,
83+
fixed: [],
8284
linked: [],
8385
access: "restricted",
8486
baseBranch: "main",
@@ -478,6 +480,7 @@ describe("apply release plan", () => {
478480
{
479481
changelog: false,
480482
commit: false,
483+
fixed: [],
481484
linked: [],
482485
access: "restricted",
483486
baseBranch: "main",
@@ -540,6 +543,7 @@ describe("apply release plan", () => {
540543
{
541544
changelog: false,
542545
commit: false,
546+
fixed: [],
543547
linked: [],
544548
access: "restricted",
545549
baseBranch: "main",
@@ -688,6 +692,7 @@ describe("apply release plan", () => {
688692
{
689693
changelog: false,
690694
commit: false,
695+
fixed: [],
691696
linked: [],
692697
access: "restricted",
693698
baseBranch: "main",
@@ -772,6 +777,7 @@ describe("apply release plan", () => {
772777
{
773778
changelog: false,
774779
commit: false,
780+
fixed: [],
775781
linked: [],
776782
access: "restricted",
777783
baseBranch: "main",
@@ -848,6 +854,7 @@ describe("apply release plan", () => {
848854
{
849855
changelog: false,
850856
commit: false,
857+
fixed: [],
851858
linked: [],
852859
access: "restricted",
853860
baseBranch: "main",
@@ -924,6 +931,7 @@ describe("apply release plan", () => {
924931
{
925932
changelog: false,
926933
commit: false,
934+
fixed: [],
927935
linked: [],
928936
access: "restricted",
929937
baseBranch: "main",
@@ -1003,6 +1011,7 @@ describe("apply release plan", () => {
10031011
{
10041012
changelog: false,
10051013
commit: false,
1014+
fixed: [],
10061015
linked: [],
10071016
access: "restricted",
10081017
baseBranch: "main",
@@ -1087,6 +1096,7 @@ describe("apply release plan", () => {
10871096
{
10881097
changelog: false,
10891098
commit: false,
1099+
fixed: [],
10901100
linked: [],
10911101
access: "restricted",
10921102
baseBranch: "main",
@@ -1163,6 +1173,7 @@ describe("apply release plan", () => {
11631173
{
11641174
changelog: false,
11651175
commit: false,
1176+
fixed: [],
11661177
linked: [],
11671178
access: "restricted",
11681179
baseBranch: "main",
@@ -1239,6 +1250,7 @@ describe("apply release plan", () => {
12391250
{
12401251
changelog: false,
12411252
commit: false,
1253+
fixed: [],
12421254
linked: [],
12431255
access: "restricted",
12441256
baseBranch: "main",
@@ -1319,6 +1331,7 @@ describe("apply release plan", () => {
13191331
{
13201332
changelog: false,
13211333
commit: false,
1334+
fixed: [],
13221335
linked: [],
13231336
access: "restricted",
13241337
baseBranch: "main",
@@ -1476,6 +1489,7 @@ describe("apply release plan", () => {
14761489
},
14771490
{
14781491
commit: false,
1492+
fixed: [],
14791493
linked: [],
14801494
access: "restricted",
14811495
baseBranch: "main",
@@ -1584,6 +1598,7 @@ describe("apply release plan", () => {
15841598
null
15851599
],
15861600
commit: false,
1601+
fixed: [],
15871602
linked: [],
15881603
access: "restricted",
15891604
baseBranch: "main",
@@ -1668,6 +1683,7 @@ describe("apply release plan", () => {
16681683
null
16691684
],
16701685
commit: false,
1686+
fixed: [],
16711687
linked: [],
16721688
access: "restricted",
16731689
baseBranch: "main",
@@ -1756,6 +1772,7 @@ describe("apply release plan", () => {
17561772
null
17571773
],
17581774
commit: false,
1775+
fixed: [],
17591776
linked: [],
17601777
access: "restricted",
17611778
baseBranch: "main",
@@ -1858,6 +1875,7 @@ describe("apply release plan", () => {
18581875
null
18591876
],
18601877
commit: false,
1878+
fixed: [],
18611879
linked: [],
18621880
access: "restricted",
18631881
baseBranch: "main",
@@ -1948,7 +1966,7 @@ describe("apply release plan", () => {
19481966
});
19491967
changedFiles = testResults.changedFiles;
19501968
} catch (e) {
1951-
expect(e.message).toEqual("some string probably");
1969+
expect((e as Error).message).toEqual("some string probably");
19521970

19531971
return;
19541972
}
@@ -1987,7 +2005,7 @@ describe("apply release plan", () => {
19872005
releasePlan.config
19882006
);
19892007
} catch (e) {
1990-
expect(e.message).toEqual(
2008+
expect((e as Error).message).toEqual(
19912009
"Could not find matching package for release of: impossible-package"
19922010
);
19932011

@@ -2026,7 +2044,7 @@ describe("apply release plan", () => {
20262044
}
20272045
);
20282046
} catch (e) {
2029-
expect(e.message).toEqual("no chance");
2047+
expect((e as Error).message).toEqual("no chance");
20302048

20312049
let gitCmd = await spawn("git", ["status"], { cwd: tempDir });
20322050

@@ -2275,6 +2293,7 @@ describe("apply release plan", () => {
22752293
{
22762294
changelog: false,
22772295
commit: true,
2296+
fixed: [],
22782297
linked: [],
22792298
access: "restricted",
22802299
baseBranch: "main",

0 commit comments

Comments
 (0)