Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a custom changelog line generator function to avoid adding meaningless changelog entries #1409

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .changeset/changelog.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

/**
* Modified version of
* https://github.com/changesets/changesets/blob/main/packages/changelog-git/src/index.ts
*
* This is because we do not add changelog entries per-PR (upon merge), and we instead add them
* later, (per changeset-recover, https://github.com/nullvoxpopuli/changeset-recover)
*
* All of the built-in changelog line generators provided by changesets assume a
* "add changeset before merge" workflow, and add git/github references accordingly.
*
* Here, we ignore the commit, and just use the changeset summary.
*
* See docs here: https://github.com/changesets/changesets/blob/main/docs/modifying-changelog-format.md
*/
async function getReleaseLine(changeset, _type) {
let [firstLine, ...futureLines] = changeset.summary.split('\n').map(l => l.trimRight());

let returnVal = firstLine;

if (futureLines.length > 0) {
returnVal += `\n${futureLines.map(l => ` ${l}`).join('\n')}`;
}

return returnVal;
}

async function getDependencyReleaseLine(changesets, dependenciesUpdated) {
if (dependenciesUpdated.length === 0) return '';

let changesetLinks = [`- Updated dependencies`];
let updatedDependenciesList = dependenciesUpdated.map(
dependency => ` - ${dependency.name}@${dependency.newVersion}`
);

return [...changesetLinks, ...updatedDependenciesList].join('\n');
}

module.exports = {
getReleaseLine,
getDependencyReleaseLine,
};
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
"changelog": "@changesets/changelog-git",
"changelog": "./changelog.cjs",
"commit": false,
"fixed": [["@embroider/compat", "@embroider/core", "@embroider/test-setup", "@embroider/webpack"]],
"access": "public",
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,19 @@
"**/graceful-fs": "^4.0.0"
},
"devDependencies": {
"@changesets/changelog-github": "^0.4.7",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

"@changesets/cli": "^2.25.0",
"@types/jest": "^29.2.0",
"@typescript-eslint/eslint-plugin": "^4.1.1",
"@typescript-eslint/parser": "^4.1.1",
"changeset-recover": "0.1.0-beta.10",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the yarn CLI sorted this file

"concurrently": "^7.2.1",
"cross-env": "^7.0.3",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"changeset-recover": "0.1.0-beta.10",
"patch-package": "^6.5.1",
"jest": "^29.2.1",
"patch-package": "^6.5.1",
"prettier": "^2.3.1",
"typescript": "4.4.2"
},
Expand Down
29 changes: 1 addition & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1113,15 +1113,6 @@
dependencies:
"@changesets/types" "^5.2.1"

"@changesets/changelog-github@^0.4.7":
version "0.4.8"
resolved "https://registry.yarnpkg.com/@changesets/changelog-github/-/changelog-github-0.4.8.tgz#b7f8ae85d0c0ff08028d924c5e59a1cbd3742634"
integrity sha512-jR1DHibkMAb5v/8ym77E4AMNWZKB5NPzw5a5Wtqm1JepAuIF+hrKp2u04NKM14oBZhHglkCfrla9uq8ORnK/dw==
dependencies:
"@changesets/get-github-info" "^0.5.2"
"@changesets/types" "^5.2.1"
dotenv "^8.1.0"

"@changesets/cli@^2.25.0":
version "2.26.1"
resolved "https://registry.yarnpkg.com/@changesets/cli/-/cli-2.26.1.tgz#2d10858d7d32314a524e383111c96d831eb0402f"
Expand Down Expand Up @@ -1192,14 +1183,6 @@
fs-extra "^7.0.1"
semver "^5.4.1"

"@changesets/get-github-info@^0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@changesets/get-github-info/-/get-github-info-0.5.2.tgz#0cde2cadba57db85c714dc303c077da919a574e5"
integrity sha512-JppheLu7S114aEs157fOZDjFqUDpm7eHdq5E8SSR0gUBTEK0cNSHsrSR5a66xs0z3RWuo46QvA3vawp8BxDHvg==
dependencies:
dataloader "^1.4.0"
node-fetch "^2.5.0"

"@changesets/get-release-plan@^3.0.16":
version "3.0.16"
resolved "https://registry.yarnpkg.com/@changesets/get-release-plan/-/get-release-plan-3.0.16.tgz#5d9cfc4ffda02c496ef0fde407210de8e3a0fb19"
Expand Down Expand Up @@ -6772,11 +6755,6 @@ data-urls@^3.0.1:
whatwg-mimetype "^3.0.0"
whatwg-url "^11.0.0"

dataloader@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-1.4.0.tgz#bca11d867f5d3f1b9ed9f737bd15970c65dff5c8"
integrity sha512-68s5jYdlvasItOJnCuI2Q9s4q98g0pCyL3HrcKJu8KNugUl8ahgmZYg38ysLTgQjjXX3H8CJLkAvWrclWfcalw==

date-fns@^2.28.0, date-fns@^2.29.1, date-fns@^2.29.2:
version "2.29.3"
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz#27402d2fc67eb442b511b70bbdf98e6411cd68a8"
Expand Down Expand Up @@ -7134,11 +7112,6 @@ dot-prop@^5.2.0:
dependencies:
is-obj "^2.0.0"

dotenv@^8.1.0:
version "8.6.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b"
integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==

duplexer3@^0.1.4:
version "0.1.5"
resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.5.tgz#0b5e4d7bad5de8901ea4440624c8e1d20099217e"
Expand Down Expand Up @@ -13890,7 +13863,7 @@ node-dir@^0.1.17:
dependencies:
minimatch "^3.0.2"

node-fetch@^2.5.0, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7:
node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7:
version "2.6.9"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.9.tgz#7c7f744b5cc6eb5fd404e0c7a9fec630a55657e6"
integrity sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==
Expand Down