Skip to content

Commit

Permalink
feat: custom changelog (#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
o-az authored May 14, 2024
1 parent a40bc0a commit 80a671a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 73 deletions.
22 changes: 22 additions & 0 deletions .changeset/changelog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import type { ChangelogFunctions } from '@changesets/types';

export const getDependencyReleaseLine: ChangelogFunctions['getDependencyReleaseLine'] =
async (_, dependenciesUpdated) => {
if (dependenciesUpdated.length === 0) return '';
const updatedDepenenciesList = dependenciesUpdated.map(
(dependency) => `\`${dependency.name}@${dependency.newVersion}\``,
);
return `- Update dependencies: ${updatedDepenenciesList.join(', ')}`;
};

export const getReleaseLine: ChangelogFunctions['getReleaseLine'] = async (
changeset,
) => {
const [firstLine, ...nextLines] = changeset.summary
.split('\n')
.map((l) => l.trimEnd());

if (!nextLines.length) return `- ${firstLine}`;

return `- ${firstLine}\n${nextLines.join('\n')}`;
};
5 changes: 1 addition & 4 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": [
"@changesets/changelog-github",
{ "repo": "rehype-pretty/rehype-pretty-code" }
],
"changelog": "./changelog.ts",
"commit": false,
"fixed": [],
"linked": [["rehype-pretty-code", "@rehype-pretty/transformers"]],
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
},
"devDependencies": {
"@biomejs/biome": "^1.7.3",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@types/bun": "^1.1.2",
"@types/node": "^20.12.11",
Expand Down
66 changes: 0 additions & 66 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion scripts/changeset-update-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ run().catch((error) => {
async function run() {
const versionCommand = bun.$`pnpm exec changeset version`.text();
const installCommand = bun.$`pnpm install --lockfile-only`.text();
const formatCommand = bun.$`biome format . --write`.text();

const results = await Promise.all([versionCommand, installCommand]);
const results = await Promise.all([
versionCommand,
installCommand,
formatCommand,
]);

console.info(JSON.stringify(results, undefined, 2));
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"downlevelIteration": true
},
"include": ["scripts"],
"files": ["biome.json"],
"files": ["biome.json", ".changeset/changelog.ts"],
"exclude": ["node_modules"]
}

0 comments on commit 80a671a

Please sign in to comment.