Skip to content

Commit ba391d9

Browse files
committed
chore: custom changesets plugin
1 parent 81f087f commit ba391d9

File tree

7 files changed

+50
-45
lines changed

7 files changed

+50
-45
lines changed

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
33
"changelog": [
4-
"@changesets/changelog-github",
4+
"@spectrum-tools/changesets-changelog-github",
55
{
66
"repo": "adobe/spectrum-css"
77
}

.github/workflows/development.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ jobs:
183183
## --- Run plugins test suites --- ##
184184
- name: Run plugin tests
185185
run: yarn test:plugins
186+
env:
187+
GITHUB_TOKEN: ${{ secrets.GH_ACCESS_FOR_CHANGESETS }}
186188

187189
# -------------------------------------------------------------
188190
# RUN VISUAL REGRESSION TESTS --- #

plugins/changesets-changelog-github/index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@ const changelogFunctions = {
8282
pull: prFromSummary,
8383
});
8484
if (commitFromSummary) {
85-
const shortCommitId = commitFromSummary.slice(0, 7);
86-
links = {
87-
...links,
88-
commit: `[\`${shortCommitId}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`,
89-
};
85+
links.commit = `[\`${commitFromSummary.slice(0, 7)}\`](https://github.com/${options.repo}/commit/${commitFromSummary})`;
9086
}
9187
return links;
9288
}
@@ -116,7 +112,7 @@ const changelogFunctions = {
116112
users === null ? "" : ` Thanks ${users}!`,
117113
].join("");
118114

119-
return `\n\n📝 ${prefix ? `${prefix}` : ""}\n\n${changelogLines.join("\n")}`;
115+
return `${prefix ? `\n\n📝 ${prefix}` : ""}\n\n${changelogLines.join("\n")}\n`;
120116
},
121117
};
122118

plugins/changesets-changelog-github/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@changesets/get-github-info": "^0.6.0",
2020
"@changesets/types": "^6.1.0",
21-
"dotenv": "^16.4.7"
21+
"dotenv": "^16.5.0"
2222
},
2323
"devDependencies": {
2424
"@changesets/parse": "^0.4.1",

plugins/changesets-changelog-github/test.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,38 @@ import sinon from "sinon";
44
import changelogFunctions from "./index.js";
55

66
/** @type {sinon.SinonSandbox} */
7-
let sandbox;
7+
let sandbox = sinon.createSandbox();
88

99
const data = {
10-
commit: "a085003",
10+
commit: "a085003d4c8ca284c116668d7217fb747802ed85",
1111
user: "Andarist",
1212
pull: 1613,
1313
repo: "emotion-js/emotion",
1414
};
1515

1616
test.beforeEach((t) => {
17-
sandbox = sinon.createSandbox();
18-
const stub = sandbox.stub("@changesets/get-github-info");
19-
stub.getInfo.returns({
20-
pull: data.pull,
21-
user: data.user,
22-
links: {
23-
user: `[@${data.user}](https://github.com/${data.user})`,
24-
pull: `[#${data.pull}](https://github.com/${data.repo}/pull/${data.pull})`,
25-
commit: `[\`${data.commit}\`](https://github.com/${data.repo}/commit/${data.commit})`,
26-
},
27-
});
28-
29-
stub.getInfoFromPullRequest.returns({
30-
commit: data.commit,
31-
user: data.user,
32-
links: {
33-
user: `[@${data.user}](https://github.com/${data.user})`,
34-
pull: `[#${data.pull}](https://github.com/${data.repo}/pull/${data.pull})`,
35-
commit: `[\`${data.commit}\`](https://github.com/${data.repo}/commit/${data.commit})`,
36-
},
37-
});
17+
sandbox.stub({
18+
getInfo: () => ({
19+
pull: data.pull,
20+
user: data.user,
21+
links: {
22+
user: `[@${data.user}](https://github.com/${data.user})`,
23+
pull: `[#${data.pull}](https://github.com/${data.repo}/pull/${data.pull})`,
24+
commit: `[\`${data.commit.slice(0, 7)}\`](https://github.com/${data.repo}/commit/${data.commit})`,
25+
},
26+
})
27+
}, "getInfo");
28+
sandbox.stub({
29+
getInfoFromPullRequest: () => ({
30+
commit: data.commit,
31+
user: data.user,
32+
links: {
33+
user: `[@${data.user}](https://github.com/${data.user})`,
34+
pull: `[#${data.pull}](https://github.com/${data.repo}/pull/${data.pull})`,
35+
commit: `[\`${data.commit.slice(0, 7)}\`](https://github.com/${data.repo}/commit/${data.commit})`,
36+
},
37+
}),
38+
}, "getInfoFromPullRequest");
3839
});
3940

4041
test.afterEach.always(() => {
@@ -77,7 +78,7 @@ const getChangeset = (content, commit) => {
7778
commitFromChangeset
7879
)
7980
),
80-
"\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@Andarist](https://github.com/Andarist)! - something\n"
81+
"\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@Andarist](https://github.com/Andarist)!\n\nsomething\n"
8182
);
8283
});
8384

@@ -89,7 +90,7 @@ const getChangeset = (content, commit) => {
8990
commitFromChangeset
9091
)
9192
),
92-
"\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@Andarist](https://github.com/Andarist)! - something\n"
93+
"\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@Andarist](https://github.com/Andarist)!\n\nsomething\n"
9394
);
9495
});
9596
});
@@ -99,7 +100,7 @@ const getChangeset = (content, commit) => {
99100
await changelogFunctions.getReleaseLine(
100101
...getChangeset(`commit: ${data.commit}`, commitFromChangeset)
101102
),
102-
"\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@Andarist](https://github.com/Andarist)! - something\n"
103+
"\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@Andarist](https://github.com/Andarist)!\n\nsomething\n"
103104
);
104105
});
105106
});
@@ -113,7 +114,7 @@ const getChangeset = (content, commit) => {
113114
data.commit
114115
)
115116
),
116-
"\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@other](https://github.com/other)!\n\nsomething\n"
117+
"\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@other](https://github.com/other)!\n\nsomething\n"
117118
);
118119
});
119120

@@ -125,7 +126,7 @@ const getChangeset = (content, commit) => {
125126
data.commit
126127
)
127128
),
128-
"\n\n- [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@other](https://github.com/other)!\n\nsomething\n"
129+
"\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [`a085003`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@other](https://github.com/other)!\n\nsomething\n"
129130
);
130131
});
131132
});
@@ -138,6 +139,6 @@ test("with multiple authors", async (t) => {
138139
data.commit
139140
)
140141
),
141-
`
142-
- [#1613](https://github.com/emotion-js/emotion/pull/1613) [\`a085003\`](https://github.com/emotion-js/emotion/commit/a085003) Thanks [@Andarist](https://github.com/Andarist), [@mitchellhamilton](https://github.com/mitchellhamilton)!\n\nsomething`);
142+
`\n\n📝 [#1613](https://github.com/emotion-js/emotion/pull/1613) [\`a085003\`](https://github.com/emotion-js/emotion/commit/a085003d4c8ca284c116668d7217fb747802ed85) Thanks [@Andarist](https://github.com/Andarist), [@mitchellhamilton](https://github.com/mitchellhamilton)!\n\nsomething\n`
143+
);
143144
});

tokens/project.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,8 @@
4646
"inputs": [{ "externalDependencies": ["@adobe/token-diff-generator"] }],
4747
"options": {
4848
"commands": [
49-
"tdiff report --old-token-version @adobe/spectrum-tokens@{args.v1} --new-token-version @adobe/spectrum-tokens@{args.v2} --format markdown --output {projectRoot}/dist/tokens-diff.md"
49+
"tdiff report --old-token-version @adobe/spectrum-tokens@{args.v1} --new-token-version @adobe/spectrum-tokens@{args.v2} --format markdown --output dist/tokens-diff.md"
5050
],
51-
"cwd": "{projectRoot}",
5251
"forwardAllArgs": true,
5352
"v1": "0.0.0-s2-foundations-20241121221506"
5453
},

yarn.lock

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5787,7 +5787,7 @@ __metadata:
57875787
"@changesets/parse": "npm:^0.4.1"
57885788
"@changesets/types": "npm:^6.1.0"
57895789
ava: "npm:^6.4.0"
5790-
dotenv: "npm:^16.4.7"
5790+
dotenv: "npm:^16.5.0"
57915791
sinon: "npm:^20.0.0"
57925792
languageName: unknown
57935793
linkType: soft
@@ -9950,10 +9950,10 @@ __metadata:
99509950
languageName: node
99519951
linkType: hard
99529952

9953-
"dotenv@npm:^16.4.7, dotenv@npm:~16.4.5":
9954-
version: 16.4.7
9955-
resolution: "dotenv@npm:16.4.7"
9956-
checksum: 10c0/be9f597e36a8daf834452daa1f4cc30e5375a5968f98f46d89b16b983c567398a330580c88395069a77473943c06b877d1ca25b4afafcdd6d4adb549e8293462
9953+
"dotenv@npm:^16.5.0":
9954+
version: 16.5.0
9955+
resolution: "dotenv@npm:16.5.0"
9956+
checksum: 10c0/5bc94c919fbd955bf0ba44d33922a1e93d1078e64a1db5c30faeded1d996e7a83c55332cb8ea4fae5a9ca4d0be44cbceb95c5811e70f9f095298df09d1997dd9
99579957
languageName: node
99589958
linkType: hard
99599959

@@ -9964,6 +9964,13 @@ __metadata:
99649964
languageName: node
99659965
linkType: hard
99669966

9967+
"dotenv@npm:~16.4.5":
9968+
version: 16.4.7
9969+
resolution: "dotenv@npm:16.4.7"
9970+
checksum: 10c0/be9f597e36a8daf834452daa1f4cc30e5375a5968f98f46d89b16b983c567398a330580c88395069a77473943c06b877d1ca25b4afafcdd6d4adb549e8293462
9971+
languageName: node
9972+
linkType: hard
9973+
99679974
"dunder-proto@npm:^1.0.0, dunder-proto@npm:^1.0.1":
99689975
version: 1.0.1
99699976
resolution: "dunder-proto@npm:1.0.1"

0 commit comments

Comments
 (0)