import { join } from 'path' import { REPO_ROOT, writeJsonFile } from './file' type Label = { // this is what the label is 'called' on github name: string // this is how we describe the label in our pull request template description: string // this is the section title for the label in our changelogs changelogTitle: string } const SCOPE_LABELS = [ { name: `sdk`, description: `Changes the tldraw SDK`, changelogTitle: '๐Ÿ“š SDK Changes', }, { name: `dotcom`, description: `Changes the tldraw.com web app`, changelogTitle: '๐Ÿ–ฅ๏ธ tldraw.com Changes', }, { name: `docs`, description: `Changes to the documentation, examples, or templates.`, changelogTitle: '๐Ÿ“– Documentation changes', }, { name: `vs code`, description: `Changes to the vscode plugin`, changelogTitle: '๐Ÿ‘ฉโ€๐Ÿ’ป VS Code Plugin Changes', }, { name: `internal`, description: `Does not affect user-facing stuff`, changelogTitle: '๐Ÿ•ต๏ธโ€โ™€๏ธ Internal Changes', }, ] as const satisfies Label[] const TYPE_LABELS = [ { name: `bugfix`, description: `Bug fix`, changelogTitle: '๐Ÿ› Bug Fixes' }, { name: `feature`, description: `New feature`, changelogTitle: '๐Ÿš€ Features' }, { name: `improvement`, description: `Improving existing features`, changelogTitle: '๐Ÿ’„ Improvements', }, { name: `chore`, description: `Updating dependencies, other boring stuff`, changelogTitle: '๐Ÿงน Chores', }, { name: `galaxy brain`, description: `Architectural changes`, changelogTitle: '๐Ÿคฏ Architectural changes', }, { name: `tests`, description: `Changes to any test code`, changelogTitle: '๐Ÿงช Tests' }, { name: `tools`, description: `Changes to infrastructure, CI, internal scripts, debugging tools, etc.`, changelogTitle: '๐Ÿ› ๏ธ Tools', }, { name: `dunno`, description: `I don't know`, changelogTitle: '๐Ÿคท Dunno' }, ] as const satisfies Label[] export function getLabelNames() { return [...SCOPE_LABELS, ...TYPE_LABELS].map((label) => label.name) } function formatTemplateOption(label: Label) { return `- [ ] \`${label.name}\` โ€” ${label.description}` } export function formatLabelOptionsForPRTemplate() { let result = `\n\n` for (const label of SCOPE_LABELS) { result += formatTemplateOption(label) + '\n' } result += `\n\n\n` for (const label of TYPE_LABELS) { result += formatTemplateOption(label) + '\n' } return result } export async function generateAutoRcFile() { const autoRcPath = join(REPO_ROOT, '.autorc') await writeJsonFile(autoRcPath, { plugins: ['npm'], labels: [...SCOPE_LABELS, ...TYPE_LABELS].map(({ name, changelogTitle }) => ({ name, changelogTitle, releaseType: 'none', })), }) }