12 Commits

Author SHA1 Message Date
Jacob Nguyen
15f624c41f Update build.mdx 2025-02-06 22:09:47 -06:00
Jacob Nguyen
e540d6a241 Update build.mdx 2025-02-05 09:57:21 -06:00
Jacob Nguyen
fa5fc42fba sdfasd 2025-02-04 22:22:49 -06:00
Jacob Nguyen
f6ac97695e mayhaps 2025-02-04 22:17:16 -06:00
Jacob Nguyen
2a7a57236c s 2025-02-04 21:52:57 -06:00
Jacob Nguyen
5cc194b008 tasdf 2025-02-04 21:37:06 -06:00
Jacob Nguyen
92c97b605f shudwurl 2025-02-04 21:30:27 -06:00
Jacob Nguyen
a773a1d658 watchexample 2025-02-04 20:22:51 -06:00
Jacob Nguyen
b446871ec7 Update cli build.mdx 2025-02-04 16:49:27 -06:00
Jacob Nguyen
b94e34aad5 Merge pull request #84 from sern-handler/feat/quickstart-guide
Some checks failed
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
replace current getting started page with a quickstart guide
2025-01-29 12:53:48 -06:00
Jacob Nguyen
67154cedd5 Merge pull request #87 from sern-handler/jacoobes-patch-5
Update package.json
2025-01-29 12:37:25 -06:00
Jacob Nguyen
aeda731f97 Create goal.mdx (#86)
Some checks failed
Deploy to GitHub Pages / Deploy to GitHub Pages (push) Has been cancelled
2025-01-27 18:53:09 +01:00
3 changed files with 81 additions and 3 deletions

Binary file not shown.

View File

@@ -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`.

View 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!