feat: release notes (#283)

* feat: add release.ts

* feat: add utils

* chore: add scripts to tsconfig.json include

* feat: add changelog logic, component, storybook file, scripts, and update to Node v20.9.0 (LTS)

* chore: update packages

* feat: use conventionalcommits for changelog preset

* feat: update padding, width, and change font to mono

* feat: refactor to use DialogProvider

* chore: remove extra args

* feat: update CHANGELOG.md, add title, and add button

* refactor: use hook

* chore: fix typo
This commit is contained in:
doprz
2024-10-12 17:05:37 -05:00
committed by GitHub
parent aede681d4b
commit bd17e33537
12 changed files with 4133 additions and 1675 deletions

27
utils/git/getSourceRef.ts Normal file
View File

@@ -0,0 +1,27 @@
import type { SimpleGit } from 'simple-git';
import { simpleGit } from 'simple-git';
/**
* Determines the source reference based on the destination branch.
* @param destinationBranch - The destination branch for the release.
* @returns A Promise that resolves to the source reference.
* @throws Error if an invalid destination branch is provided.
*/
export async function getSourceRef(destinationBranch: string): Promise<string> {
const git: SimpleGit = simpleGit();
switch (destinationBranch) {
case 'preview':
return 'develop';
case 'production':
// Get the latest tag from the repository
const tags = await git.tags();
const latestTag = tags.latest;
if (!latestTag) {
throw new Error('No tags found in the repository');
}
return latestTag;
default:
throw new Error(`Invalid destination branch: ${destinationBranch}`);
}
}