mirror of
https://github.com/sern-handler/website
synced 2026-06-09 09:22:20 +00:00
Compare commits
12 Commits
jacoobes-p
...
jacoobes-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15f624c41f | ||
|
|
e540d6a241 | ||
|
|
fa5fc42fba | ||
|
|
f6ac97695e | ||
|
|
2a7a57236c | ||
|
|
5cc194b008 | ||
|
|
92c97b605f | ||
|
|
a773a1d658 | ||
|
|
b446871ec7 | ||
|
|
b94e34aad5 | ||
|
|
67154cedd5 | ||
|
|
aeda731f97 |
BIN
src/assets/docs/watch-example2.mp4
Normal file
BIN
src/assets/docs/watch-example2.mp4
Normal file
Binary file not shown.
@@ -11,9 +11,15 @@ Build your bot
|
||||
Options:
|
||||
-f --format [fmt] The module system of your application. `cjs` or `esm` (default: "esm")
|
||||
-m --mode [mode] the mode for sern to build in. `production` or `development` (default: "development")
|
||||
-w --watch
|
||||
--watch-command [cmd] the command for sern to watch. if watch is not enabled, an error is thrown (default: "")
|
||||
-W --suppress-warnings suppress experimental warning
|
||||
-p --project [filePath] build with this sern.build file
|
||||
-p --project [filePath] build with the provided sern.build file
|
||||
-e --env path to .env file
|
||||
--source-maps Whether to add source-maps to configuration (default: false)
|
||||
--tsconfig [filePath] Use this tsconfig
|
||||
-h, --help display help for command
|
||||
|
||||
```
|
||||
|
||||
## Guiding Principles
|
||||
@@ -44,8 +50,6 @@ The `sern build` command comes equipped with a range of features designed to enh
|
||||
|
||||
- **Zero Configuration**: Building your bot application without additional configuration. The CLI handles most of the setup for you.
|
||||
|
||||
- **Experimental Image Support**: We've introduced experimental support for top-level imports of PNG and JPG files, making it easier to include images in your bot application.
|
||||
|
||||
- **Compile Time Constants**: Customize your build with constants such as `__DEV__`, `__PROD__`, allowing you to tailor your application to different production stages.
|
||||
|
||||
- **Development and Production Modes**: The CLI supports both development and production modes, enabling you to tailor your bot application for different stages of development.
|
||||
@@ -103,6 +107,16 @@ type BuildOptions = {
|
||||
* default to .env.
|
||||
*/
|
||||
env?: string;
|
||||
|
||||
// options for watch
|
||||
watch?: {
|
||||
/**
|
||||
* command to run.
|
||||
* defaults to your package
|
||||
* manager's start command.
|
||||
*/
|
||||
command?: string;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
@@ -114,6 +128,43 @@ sern build
|
||||
|
||||
(that was easy)
|
||||
|
||||
## sern build --watch
|
||||
|
||||
the watch flag needs a `start` command. Depending on the **lock file** in your project, sern will run this command to reload your project. the build command checks in this order:
|
||||
|
||||
```js
|
||||
// custom defined watchCommand
|
||||
if(watchCommand) return watchCommand
|
||||
// npm
|
||||
if (pathExistsSync('package-lock.json')) return 'npm start';
|
||||
// yarn
|
||||
if (pathExistsSync('yarn.lock')) return 'yarn start';
|
||||
// pnpm
|
||||
if (pathExistsSync('pnpm-lock.yaml')) return 'pnpm start';
|
||||
// bun 1.1
|
||||
if (pathExistsSync('bun.lockb')) return 'bun start';
|
||||
// bun 1.2
|
||||
if (pathExistsSync('bun.lock')) return 'bun start';
|
||||
```
|
||||
|
||||
|
||||
:::tip
|
||||
supply a custom watch command with the watch.command option. If you want sern build to only watch the build process, and not rerunning your bot,
|
||||
watchCommand should be set **exactly** to `''` (an empty string)
|
||||
:::
|
||||
|
||||
:::tip
|
||||
The supplied watch command is [debounced](https://www.geeksforgeeks.org/debouncing-in-javascript/) to 1.5 seconds.
|
||||
:::
|
||||
|
||||
|
||||
import VideoUrl from "~/assets/docs/watch-example2.mp4"
|
||||
|
||||
<video width="640" height="360" controls type="video/mp4">
|
||||
<source src={VideoUrl} webkit-playsinline="" type="video/mp4"> </source>
|
||||
</video>
|
||||
|
||||
|
||||
## Adapting Older Projects
|
||||
|
||||
Change your `tsconfig.json` to extend our generated one, `./.sern/tsconfig.json`.
|
||||
|
||||
27
src/content/docs/v4/reference/goal.mdx
Normal file
27
src/content/docs/v4/reference/goal.mdx
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Goal
|
||||
description: sern's goal is to make bot development easier and more efficient
|
||||
sidebar:
|
||||
order: 10
|
||||
---
|
||||
|
||||
This reference will have JavaScript but many snippets are easily transferrable to Typescript.
|
||||
|
||||
# why?
|
||||
There's a **lack of sane ways** to build Discord bots.
|
||||
Some advocate to *build your own abstractions*, use clunky archaic codebases that are rarely maintained, or install frameworks that don't satisfy your needs.
|
||||
|
||||
**Keep it simple!**
|
||||
|
||||
|
||||
# sern is built for these things in mind
|
||||
|
||||
- **Modularity**: sern is built with modularity in mind. You can swap pieces and parts easily.
|
||||
- **Familiarity**: Commands and structures are similar to classic v12 handlers and the official Discord.js command handler guide, while packing many features!
|
||||
- **Concise**: Too much code is a liability. With sern, write less for more. 🤯
|
||||
|
||||
# Our community
|
||||
|
||||
As of 01/23/2025, our [discord](https://sern.dev/discord) is considered small, but it is no excuse for helping those who want to build bots with us. Feel free to join us!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user