Skip to content

Commit 1831996

Browse files
committed
refactor: clean-up stuff
1 parent bf528b5 commit 1831996

File tree

5 files changed

+119
-82
lines changed

5 files changed

+119
-82
lines changed

apps/docs/pages/guide/_meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"installation": "Installation",
33
"commandkit-setup": "CommandKit Setup",
4-
"commandkit.config.js-options": "commandkit.config.js Options",
54
"command-file-setup": "Commands Setup",
65
"event-file-setup": "Events Setup",
76
"validation-file-setup": "Validations Setup",
87
"buttonkit": "Using ButtonKit",
98
"using-cli": "Using CommandKit CLI",
9+
"commandkit-config": "CommandKit Config",
1010
"using-signals": "Using Signals",
1111
"migrating-from-djs-commander": "Migrating from DJS-Commander"
1212
}

apps/docs/pages/guide/buttonkit.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,19 @@ myButton.onClick(
149149

150150
- Type: [`Message`](https://old.discordjs.dev/#/docs/discord.js/main/class/Message)
151151

152-
This is the message that ButtonKit uses to listen button clicks.
152+
The message object that ButtonKit uses to listen for button clicks (interactions).
153153

154154
### `time` (optional)
155155

156156
- Type: `number`
157157

158-
This is the time you want the collector to run and listen for button clicks.
158+
The duration (in ms) the collector should run for and listen for button clicks.
159159

160160
### `autoReset` (optional)
161161

162162
- Type: `boolean`
163163

164-
This determines if the collector should automatically reset the timer when a button is clicked.
164+
Whether or not the collector should automatically reset the timer when a button is clicked.
165165

166166
### Additional optional options
167167

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
import { Callout } from 'nextra/components';
2+
3+
# CommandKit Configuration
4+
5+
CommandKit CLI can be configured using `commandkit.config` file in the root of your project directory (for example, by `package.json`). You can use either of the following files:
6+
7+
- `commandkit.js`
8+
- `commandkit.config.js`
9+
- `commandkit.mjs`
10+
- `commandkit.config.mjs`
11+
- `commandkit.cjs`
12+
- `commandkit.config.cjs`
13+
- `commandkit.json`
14+
- `commandkit.config.json`
15+
16+
Throughout this guide, we'll be using `commandkit.config.mjs` as an example.
17+
18+
The following is the sample configuration required to run your bot:
19+
20+
```js filename="commandkit.config.mjs" copy
21+
import { defineConfig } from 'commandkit';
22+
23+
export default defineConfig({
24+
src: 'src', // The source directory of your project.
25+
main: 'index.mjs', // The JavaScript entry point of your project.
26+
});
27+
```
28+
29+
## Options
30+
31+
### `src`
32+
33+
- Type: `string`
34+
35+
The source directory of the project where your source code lives.
36+
37+
### `main`
38+
39+
- Type: `string`
40+
41+
The entry point to your project.
42+
43+
Example: If your source is structured as `src/index.ts`, this option must be set to `index.mjs`. This is because CommandKit always compiles your source code to esm format.
44+
45+
<Callout type="warning">
46+
The "src" part in this option isn't required because it's already defined in the `src` option.
47+
</Callout>
48+
49+
### `watch` (optional)
50+
51+
- Type: `boolean`
52+
- Default: `true`
53+
54+
Whether to watch for file changes or not.
55+
56+
### `outDir` (optional)
57+
58+
- Type: `string`
59+
- Default: `"dist"`
60+
61+
The output directory to emit the production build to.
62+
63+
### `envExtra` (optional)
64+
65+
- Type: `boolean`
66+
- Default: `true`
67+
68+
Extra env utilities to load. This allows you to load environment variables in different formats, like `Date`, `JSON`, `Boolean`, etc.
69+
70+
### `nodeOptions` (optional)
71+
72+
- Type: `string[]`
73+
- Default: `[]`
74+
75+
Options to pass to Node.js.
76+
77+
### `clearRestartLogs` (optional)
78+
79+
- Type: `boolean`
80+
- Default: `true`
81+
82+
Whether or not to clear default restart logs.
83+
84+
### `minify` (optional)
85+
86+
- Type: `boolean`
87+
- Default: `false`
88+
89+
Whether or not to minify the production build.
90+
91+
### `sourcemap` (optional)
92+
93+
- Type: `boolean` | `"inline"`
94+
- Default: `false`
95+
96+
Whether or not to include sourcemaps in the production build.
97+
98+
### `antiCrash` (optional)
99+
100+
- Type: `boolean`
101+
- Default: `true`
102+
103+
Whether or not to inject anti-crash script in the production build.
104+
105+
### `requirePolyfill` (optional)
106+
107+
- Type: `boolean`
108+
- Default: `true`
109+
110+
Whether or not to polyfill `require` function.

apps/docs/pages/guide/commandkit.config.js-options.mdx

Lines changed: 0 additions & 73 deletions
This file was deleted.

apps/docs/pages/guide/using-cli.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Callout } from 'nextra/components';
22

33
# Using CommandKit CLI
44

5-
CommandKit CLI allows you to start and build your bot application.
5+
CommandKit CLI allows you to start, build, and manage your bot application. It also includes features such as anti-crash so you can be rest assured your bot won't crash and go offline during production.
66

77
To get a list of the available CLI commands, run the following command inside your project directory:
88

@@ -30,18 +30,18 @@ Commands:
3030
<code>tsc --noEmit</code> command or any other tool of your choice.
3131
</Callout>
3232

33-
# Available commands
33+
## Available commands
3434

35-
## Build
35+
### Build
3636

3737
`commandkit build` creates an optimized production build of your bot application. By default, commandkit emits the build to `dist/` directory in your project. It supports typescript out of the box.
3838

3939
CommandKit also injects anti-crash script in your production build to prevent your bot from crashing due to cases like unhandled promise rejections. Although, it's recommended to handle these cases yourself. You can disable this behavior by setting `antiCrash: false` in your `commandkit.config.js` file.
4040

41-
## Development
41+
### Development
4242

4343
`commandkit dev` starts your bot in development mode. It supports hot reloading out of the box to automatically restart your bot when you make changes to your code. CommandKit automatically loads your environment variables from `.env` file in your project directory, without you having to worry about it. It also supports typescript out of the box.
4444

45-
## Production
45+
### Production
4646

4747
`commandkit start` starts your bot in production mode. You need to run `commandkit build` before running this command. This command also loads the environment variables from `.env` file in your project directory.

0 commit comments

Comments
 (0)