Skip to main content

Configuration File

Your project's configuration lives in a purplet.config.ts file. All values are optional. The complete list of options, with defaults, is shown here:

purplet.config.ts
import { Config } from 'purplet';

const config: Config = {
alias: {
$features: 'src/features',
$lib: 'src/lib',
},
allowedMentions: {
repliedUser: true,
parse: ['users'],
},
lang: 'en-US',
paths: {
build: 'dist',
features: 'src/features',
translations: 'locales',
},
vite: () => ({}),
};

export default config;

alias

An object containing zero or more aliases used to replace values in import statements. These aliases are automatically passed to Vite and TypeScript. Built-in, $lib and $features aliases are provided.

For example, you can add aliases to a components and utils folder:

svelte.config.ts
const config = {
alias: {
$utils: 'src/utils',
},
};

allowedMentions

This sets a bot-wide default for the allowed_mentions field, passed to functions that send a message. By default, it is an object that only allows user mentions and replies to cause pings.

lang

The primary language that your project is written in. This is only needed if you plan to translate your bot.

paths

Defines various paths related to your application that Purplet uses:

  • build: Path to where built JavaScript files are saved. The bot entry is always index.js inside of this folder.
  • features: The directory to search and watch for exported Feature objects.
  • translations: The directory that translation files are stored.

vite

A Vite config object, or a function that returns one. You can pass Vite and Rollup plugins via the plugins option to customize your build in advanced ways.