diff --git a/.changeset/changelog.cjs b/.changeset/changelog.cjs new file mode 100644 index 0000000..c3663d9 --- /dev/null +++ b/.changeset/changelog.cjs @@ -0,0 +1,24 @@ +/** @type {import('@changesets/types').ChangelogFunctions['getDependencyReleaseLine']} */ +const getDependencyReleaseLine = async (_, dependenciesUpdated) => { + if (dependenciesUpdated.length === 0) return ''; + const updatedDepenenciesList = dependenciesUpdated.map( + (dependency) => `\`${dependency.name}@${dependency.newVersion}\``, + ); + return `- Update dependencies: ${updatedDepenenciesList.join(', ')}`; +}; + +/** @type {import('@changesets/types').ChangelogFunctions['getReleaseLine']} */ +const 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')}`; +}; + +module.exports = { + getDependencyReleaseLine, + getReleaseLine, +}; diff --git a/.changeset/changelog.ts b/.changeset/changelog.ts deleted file mode 100644 index 1604397..0000000 --- a/.changeset/changelog.ts +++ /dev/null @@ -1,22 +0,0 @@ -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')}`; -}; diff --git a/.changeset/config.json b/.changeset/config.json index 7408f27..a67cf12 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,6 +1,6 @@ { "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": "./changelog.ts", + "changelog": "./changelog.cjs", "commit": false, "fixed": [], "linked": [["rehype-pretty-code", "@rehype-pretty/transformers"]], diff --git a/tsconfig.json b/tsconfig.json index 60aab28..fe4d3fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,6 +19,6 @@ "downlevelIteration": true }, "include": ["scripts"], - "files": ["biome.json", ".changeset/changelog.ts"], + "files": ["biome.json", ".changeset/changelog.cjs"], "exclude": ["node_modules"] }