Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(create-discord-bot): support bun in create-discord-bot #9798

Merged
merged 1 commit into from
Aug 28, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ yarn init
pnpm init; pnpm pkg set type="module"
```

```sh bun
bun init
```

</CH.Code>

This is the next command you'll be running. This command creates a _`package.json`_ file for you, which will keep track of the dependencies your project uses, as well as other info.
Expand All @@ -93,6 +97,10 @@ yarn add discord.js
pnpm add discord.js
```

```sh bun
bun add discord.js
```

</CH.Code>

And that's it! With all the necessities installed, you're almost ready to start coding your bot.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ yarn add dotenv
pnpm add dotenv
```

```sh bun
# Bun automatically reads .env files
```

</CH.Code>

<CH.Code lineNumbers={false} rows={7}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ yarn remove @discordjs/builders @discordjs/formatters @discordjs/rest discord-ap
pnpm remove @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types
```

```sh bun
bun remove @discordjs/builders @discordjs/formatters @discordjs/rest discord-api-types
```

</CH.Code>

## Breaking Changes
Expand Down
9 changes: 8 additions & 1 deletion packages/create-discord-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@

## About

`npx create-discord-bot ./your/chosen/directory/`. It's as easy as that to create a simple Discord bot to begin your journey with the Discord API.
It's easy to create a simple Discord bot to begin your journey with the Discord API.

```sh
npm create discord-bot ./your/chosen/directory
yarn create discord-bot ./your/chosen/directory
pnpm create discord-bot ./your/chosen/directory
bunx create-discord-bot ./your/chosen/directory
```

## Links

Expand Down
4 changes: 4 additions & 0 deletions packages/create-discord-bot/src/helpers/packageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export function resolvePackageManager(): PackageManager {
return 'pnpm';
}

if (npmConfigUserAgent.startsWith('bun')) {
return 'bun';
}

console.error(
yellow(
`Detected an unsupported package manager (${npmConfigUserAgent}). Falling back to ${DEFAULT_PACKAGE_MANAGER}.`,
Expand Down
2 changes: 2 additions & 0 deletions packages/discord.js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to
npm install discord.js
yarn add discord.js
pnpm add discord.js
bun add discord.js
```

### Optional packages
Expand All @@ -52,6 +53,7 @@ Install discord.js:
npm install discord.js
yarn add discord.js
pnpm add discord.js
bun add discord.js
```

Register a slash command against the Discord API:
Expand Down
1 change: 1 addition & 0 deletions packages/formatters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
npm install @discordjs/formatters
yarn add @discordjs/formatters
pnpm add @discordjs/formatters
bun add @discordjs/formatters
```

## Example usage
Expand Down
1 change: 1 addition & 0 deletions packages/next/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
npm install @discordjs/next
yarn add @discordjs/next
pnpm add @discordjs/next
bun add @discordjs/next
```

## Links
Expand Down
1 change: 1 addition & 0 deletions packages/proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
npm install @discordjs/proxy
yarn add @discordjs/proxy
pnpm add @discordjs/proxy
bun add @discordjs/proxy
```

## Links
Expand Down
2 changes: 2 additions & 0 deletions packages/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Note: native fetch (not recommended) is unavailable in this node version, either
npm install @discordjs/rest
yarn add @discordjs/rest
pnpm add @discordjs/rest
bun add @discordjs/rest
```

## Examples
Expand All @@ -41,6 +42,7 @@ Install all required dependencies:
npm install @discordjs/rest discord-api-types
yarn add @discordjs/rest discord-api-types
pnpm add @discordjs/rest discord-api-types
bun add @discordjs/rest discord-api-types
```

Send a basic message:
Expand Down
1 change: 1 addition & 0 deletions packages/util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
npm install @discordjs/util
yarn add @discordjs/util
pnpm add @discordjs/util
bun add @discordjs/util
```

## Links
Expand Down
1 change: 1 addition & 0 deletions packages/voice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
npm install @discordjs/voice
yarn add @discordjs/voice
pnpm add @discordjs/voice
bun add @discordjs/voice
```

## Dependencies
Expand Down
1 change: 1 addition & 0 deletions packages/ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
npm install @discordjs/ws
yarn add @discordjs/ws
pnpm add @discordjs/ws
bun add @discordjs/ws
```

### Optional packages
Expand Down