Skip to content
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
2 changes: 1 addition & 1 deletion docs/components/Footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export const Footer: React.FC<FooterProps> = () => {
<Group justify="right">
<Text fz={12} inline>
Made with ❤️ by{' '}
<Anchor fz={13} href="https://undolog.com/">
<Anchor fz={13} href="https://gfazioli.github.io/">
Undolog
</Anchor>
</Text>
Expand Down
2 changes: 1 addition & 1 deletion docs/components/Shell/Shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function Shell({ children }: ShellProps) {
size={36}
radius={0}
component="a"
href="https://undolog.com/"
href="https://gfazioli.github.io/"
target="_blank"
rel="noreferrer"
aria-label="Undolog"
Expand Down
6 changes: 1 addition & 5 deletions docs/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import createMDX from '@next/mdx';
import fs from 'fs-extra';
import remarkSlug from 'remark-slug';
import signale from 'signale';

const withMDX = createMDX({
options: {
remarkPlugins: [remarkSlug],
remarkPlugins: ['remark-slug'],
},
});

Expand All @@ -25,9 +24,6 @@ const nextConfig = {
output: 'export',
basePath: process.env.NODE_ENV === 'production' ? `/${repository}` : undefined,
pageExtensions: ['ts', 'tsx', 'mdx'],
eslint: {
ignoreDuringBuilds: true,
},
};

export default withMDX(nextConfig);
18 changes: 9 additions & 9 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
},
"dependencies": {
"@gfazioli/mantine-window": "workspace:*",
"@mantine/code-highlight": "9.0.2",
"@mantine/core": "9.0.2",
"@mantine/hooks": "9.0.2",
"@mantine/code-highlight": "9.2.0",
"@mantine/core": "9.2.0",
"@mantine/hooks": "9.2.0",
"@mantinex/demo": "^2.0.0",
"@mantinex/dev-icons": "^2.0.0",
"@mantinex/mantine-header": "^2.0.0",
Expand All @@ -21,18 +21,18 @@
"@mantinex/shiki": "^1.1.0",
"@mdx-js/loader": "^3.1.1",
"@mdx-js/react": "^3.1.1",
"@next/mdx": "^15.5.15",
"@tabler/icons-react": "^3.41.1",
"@next/mdx": "^16.2.6",
"@tabler/icons-react": "^3.44.0",
"@types/mdx": "^2.0.13",
"next": "15.5.15",
"react": "19.2.5",
"react-dom": "19.2.5",
"next": "16.2.6",
"react": "19.2.6",
"react-dom": "19.2.6",
"remark-slug": "^7.0.1",
"shiki": "^3.23.0",
"type-fest": "^4.41.0"
},
"devDependencies": {
"@types/node": "^22.19.17",
"@types/node": "^22.19.19",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"typescript": "6.0.3"
Expand Down
2 changes: 1 addition & 1 deletion docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"moduleResolution": "bundler",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"jsx": "react-jsx",
"incremental": true
},
"include": [
Expand Down
32 changes: 15 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,51 @@
},
"devDependencies": {
"@mantine-tests/core": "^2.1.0",
"@mantine/core": "9.0.2",
"@mantine/hooks": "9.0.2",
"@mantine/core": "9.2.0",
"@mantine/hooks": "9.2.0",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-replace": "^6.0.3",
"@storybook/addon-themes": "^10.3.5",
"@storybook/react": "^10.3.5",
"@storybook/react-vite": "^10.3.5",
"@storybook/addon-themes": "^10.3.6",
"@storybook/react": "^10.3.6",
"@storybook/react-vite": "^10.3.6",
"@testing-library/dom": "^10.4.1",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/fs-extra": "^11.0.4",
"@types/identity-obj-proxy": "^3.0.2",
"@types/jest": "^29.5.14",
"@types/node": "^22.19.17",
"@types/node": "^22.19.19",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@types/signale": "^1.4.7",
"@types/yargs": "^17.0.35",
"@vitejs/plugin-react": "^4.7.0",
"esbuild": "^0.27.7",
"esbuild": "^0.28.0",
"esbuild-jest": "^0.5.0",
"fs-extra": "^11.3.4",
"fs-extra": "^11.3.5",
"gh-pages": "^6.3.0",
"hash-css-selector": "^1.1.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-axe": "^9.0.0",
"jest-environment-jsdom": "^29.7.0",
"mantine-docgen-script": "^1.6.0",
"new-github-release-url": "^2.0.0",
"open": "^10.2.0",
"oxfmt": "^0.42.0",
"oxlint": "^1.61.0",
"postcss": "^8.5.10",
"oxfmt": "^0.49.0",
"oxlint": "^1.64.0",
"postcss": "^8.5.14",
"postcss-preset-mantine": "1.18.0",
"react": "19.2.5",
"react-dom": "19.2.5",
"react": "19.2.6",
"react-dom": "19.2.6",
"rimraf": "^6.1.3",
"rollup": "^4.60.2",
"rollup": "^4.60.3",
"rollup-plugin-banner2": "^1.3.1",
"rollup-plugin-esbuild": "^6.2.1",
"rollup-plugin-node-externals": "^8.1.2",
"rollup-plugin-postcss": "^4.0.2",
"signale": "^1.4.0",
"simple-git": "^3.36.0",
"storybook": "^10.3.5",
"storybook": "^10.3.6",
"stylelint": "^16.26.1",
"stylelint-config-standard-scss": "^14.0.0",
"syncpack": "^13.0.4",
Expand Down
78 changes: 70 additions & 8 deletions scripts/release.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import path from 'node:path';
import chalk from 'chalk';
import fs from 'fs-extra';
import githubRelease from 'new-github-release-url';
import open from 'open';
import signale from 'signale';
import SimpleGit from 'simple-git';
import { getNextVersion, VersionIncrement, VersionStage } from 'version-next';
Expand All @@ -12,6 +10,58 @@ import { $ } from 'zx';
import { run } from './run';
import { updateVersion } from './update-version';

function extractChangelogBody(changelogPath: string): string {
if (!fs.existsSync(changelogPath)) {
signale.error(
`${chalk.cyan('CHANGELOG.md')} not found. Generate it before running the release script.`
);
process.exit(1);
}

const raw = fs.readFileSync(changelogPath, 'utf8');
const cutIdx = raw.search(/^##.*?\bDiscord\s+Summary\b/m);
const upToCut = cutIdx >= 0 ? raw.slice(0, cutIdx) : raw;

const lines = upToCut.split('\n');
const firstSectionIdx = lines.findIndex((line) => /^##\s+/.test(line));

if (firstSectionIdx < 0) {
signale.error(
`${chalk.cyan('CHANGELOG.md')} has no content sections (\`## …\`) before \`## Discord Summary\`. Regenerate it.`
);
process.exit(1);
}

let endIdx = lines.length;
while (endIdx > firstSectionIdx && /^(\s*|-{3,}\s*)$/.test(lines[endIdx - 1])) {
endIdx--;
}

return lines.slice(firstSectionIdx, endIdx).join('\n').trim();
}

async function generateGitHubAutoNotes(
repoSlug: string,
tag: string,
previousTag: string | undefined
): Promise<{ name: string; body: string }> {
const args = ['-X', 'POST', `repos/${repoSlug}/releases/generate-notes`, '-f', `tag_name=${tag}`];

if (previousTag) {
args.push('-f', `previous_tag_name=${previousTag}`);
}

const result = await $`gh api ${args}`.quiet();
return JSON.parse(result.stdout);
Comment on lines +54 to +55
}

function parseRepoSlug(repositoryField: string): string {
return repositoryField
.replace(/^.*github\.com[/:]/, '')
.replace(/\.git$/, '')
.replace(/\/$/, '');
}

const packageJsonPath = path.join(process.cwd(), 'package/package.json');
const packageJson = fs.readJsonSync(packageJsonPath);
const { argv } = yargs(hideBin(process.argv)) as any;
Expand Down Expand Up @@ -104,12 +154,24 @@ async function release() {
await git.commit(`Release ${nextVersion}`);
await git.push();

open(
githubRelease({
repoUrl: (packageJson.repository.url || packageJson.repository).replace('.git', ''),
tag: nextVersion,
title: nextVersion,
})
const changelogBody = extractChangelogBody(path.join(process.cwd(), 'CHANGELOG.md'));
const repoSlug = parseRepoSlug(packageJson.repository.url || packageJson.repository);

const tags = await git.tags();
const previousTag = tags.all.includes(nextVersion)
? tags.all[tags.all.indexOf(nextVersion) - 1]
: tags.latest;
Comment on lines +160 to +163

const autoNotes = await generateGitHubAutoNotes(repoSlug, nextVersion, previousTag);
const releaseBody = `${changelogBody}\n\n---\n\n${autoNotes.body}`.trim();

await run(
$`gh release create ${nextVersion} --repo ${repoSlug} --target master --title ${autoNotes.name} --notes ${releaseBody}`,
{
info: `Creating GitHub release ${chalk.cyan(nextVersion)}`,
success: `GitHub release ${chalk.cyan(nextVersion)} created`,
error: `Failed to create GitHub release ${chalk.cyan(nextVersion)}`,
}
);
}

Expand Down
Loading
Loading