feat: add Bun templates for create-discord-bot (#11348)

* feat: add Bun templates for create-discord-bot

- Add TypeScript Bun template with complete src structure
- Add JavaScript Bun template with complete src structure
- Both templates mirror the Node.js versions with Bun-specific configuration

Closes #11346

* fix: update template and bun template loading

---------

Co-authored-by: almeidx <github@almeidx.dev>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
ManHam
2026-01-16 21:02:20 +05:30
committed by GitHub
parent 52a69d77d0
commit be78e26729
34 changed files with 558 additions and 30 deletions

View File

@@ -44,27 +44,17 @@ export async function createDiscordBot({ directory, installPackages, typescript,
}
console.log(`Creating ${directoryName} in ${styleText('green', root)}.`);
const deno = packageManager === 'deno';
await cp(new URL(`../template/${deno ? 'Deno' : typescript ? 'TypeScript' : 'JavaScript'}`, import.meta.url), root, {
const bun = packageManager === 'bun';
const lang = typescript ? 'TypeScript' : 'JavaScript';
const templateBasePath = deno ? 'Deno' : bun ? `Bun/${lang}` : lang;
await cp(new URL(`../template/${templateBasePath}`, import.meta.url), root, {
recursive: true,
});
const bun = packageManager === 'bun';
if (bun) {
await cp(
new URL(`../template/Bun/${typescript ? 'TypeScript' : 'JavaScript'}/package.json`, import.meta.url),
`${root}/package.json`,
);
if (typescript) {
await cp(
new URL('../template/Bun/TypeScript/tsconfig.eslint.json', import.meta.url),
`${root}/tsconfig.eslint.json`,
);
await cp(new URL('../template/Bun/TypeScript/tsconfig.json', import.meta.url), `${root}/tsconfig.json`);
}
}
process.chdir(root);
const newVSCodeSettings = await readFile('./.vscode/settings.json', { encoding: 'utf8' });

View File

@@ -19,6 +19,10 @@ export function resolvePackageManager(): PackageManager {
return 'deno';
}
if (process.versions.bun) {
return 'bun';
}
// If this is not present, return the default package manager.
if (!npmConfigUserAgent) {
return DEFAULT_PACKAGE_MANAGER;