Skip to content

Command Options

Neodymium edited this page Dec 10, 2024 · 5 revisions

The bundlebd command takes a few possible arguments, but none are required. All options besides input must be prefixed in the format --option value and can be in any order. For options that are booleans, instead use the format --option without a value, or --option true|false.

input

The first argument is a path to the plugin's folder. Unlike all other command options, it must be the first argument, and does not require any prefix.

Defaults to src.

Usage

npx bundlebd MyAmazingPlugin/src

output

The output option is a path to the folder that the bundled plugin will be placed into.

Defaults to dist.

Usage

npx bundlebd --output MyAmazingPlugin/dist

bd-path

The bd-path option is an absolute path to BetterDiscord's main folder. This is used to copy the bundled plugin to the plugins folder with the dev option. If you want to disable copying the bundled plugin, set this value to none.

By default, will attempt to find the BetterDiscord folder using the current platform.

Usage

npx bundlebd --dev --bd-path C:/Users/Neodymium/AppData/Roaming/BetterDiscord

Or if you want to disable copying the bundled plugin:

npx bundlebd --dev --bd-path none

dev

When passed the dev option, the bundler will watch for changes and bundle the plugin when they occur. It will also attempt to copy the bundled plugin to BetterDiscord's plugins folder using the bd-path option.

Defaults to false.

Usage

npx bundlebd --dev

plugin

The plugin option is passed to the Bundler Configuration if it exports a function. It's purpose is to dynamically configure the bundler based on which plugin is being bundled. It is usually the plugin's name, but can be any value. See Bundler Configuration for more information.

By default, no value will be passed.

Usage

npx bundlebd --plugin MyAmazingPlugin

version

You can also do npx bundlebd --version to get the current version of the bundler.

npm Scripts

For an easy shortcut to the command, you can create scripts in your package.json file to run instead. For example you can add:

// package.json

{
	// ... Rest of your package.json file ...

	"scripts": {
		"build": "bundlebd MyAmazingPlugin/src --output MyAmazingPlugin/dist",
		"dev": "bundlebd MyAmazingPlugin/src --output MyAmazingPlugin/dist --dev"
	}
}

And now you can use npm run build and npm run dev instead.