Update cli build.mdx

This commit is contained in:
Jacob Nguyen
2025-02-04 16:49:27 -06:00
committed by GitHub
parent b94e34aad5
commit b446871ec7

View File

@@ -11,8 +11,12 @@ 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
-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
```
@@ -44,8 +48,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.
@@ -112,6 +114,23 @@ type BuildOptions = {
sern build
```
## 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
// 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';
```
(that was easy)
## Adapting Older Projects