Skip to content

V2 Command Arguments

Neodymium edited this page Apr 29, 2023 · 1 revision

The bundlebd command takes two possible arguments, but neither is usually required. The arguments can be given in any order.

Development Mode

Development Mode will be enabled if the command is passed the argument --development or -D. When Development Mode is enabled, the bundler will:

  • Watch for changes and bundle the plugin when they occur
  • Copy the bundled plugin to BetterDiscord's plugins folder using the Bundler Configuration's bdPath property (If you don't want the plugin to be copied to BetterDiscord's plugins folder, you can set bdPath to none)
  • Place bundled plugins into the Bundler Configuration's devOutput instead of the default output if specified

Usage

npx bundlebd --development

OR

npx bundlebd -D

Plugin

The second argument is a plugin you want to bundle, which is usually the same as the name of the plugin. Its purpose is to parse the strings given in the Bundler Configuration's properties, not to configure the plugin's name. It is required if any Bundler Configuration options use [plugin]. If the plugin argument contains any whitespace, it will be removed.

This argument, as well as using [plugin] in paths within the Bundler Configuration, are only useful if your repo/project/folder has multiple plugins. If you only have one plugin, you will likely not need them.

Usage

npx bundlebd MyAmazingPlugin

Usage With Development Mode

npx bundlebd MyAmazingPlugin --development

OR

npx bundlebd MyAmazingPlugin -D

What's the difference between the Plugin Configuration meta's name property and the Plugin command argument?

The meta's name is for resolving the name of the plugin inside of the plugin itself, such as its meta, config, and filename. On the other hand, the Plugin argument is used for resolving paths given in the Bundler Configuration. If a Plugin argument is given, it will usually be the same as the plugin's name, but it does not alter or configure the bundled plugin's name in any way.

npm Scripts

If you don't want to type out the command every time, 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",
		"dev": "bundlebd --development"
	}
}

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