Using the CLI
Plugma comes with a Command Line Interface that supports the following commands.
Commands
dev
Start a server to develop your plugin. This command builds the ui.html
and points it to the dev server making it easier to develop and debug your plugin.
Usage
plugma dev [options]
Options
-p
,--port
: Specify a port number for the plugin preview.-o
,--output
: Specify an output dir, default isdist
.-m
,--mode
: Specify a mode.-ws
,--websockets
: Enable WebSockets to preview in browser.
Example
# Start development server on port 3000
plugma dev -p 3000
# Start development server with websockets enabled
plugma dev -ws
When using the commands withnpm run
you need to pass the arguments with a double dash--
, for examplenpm run dev -- -p 3000
.
preview
Preview your plugin in any browser to see how it looks and works. Make sure the plugin is open in the Figma desktop app for this to work.
Usage
plugma preview [options]
Options
-p
,--port
: Specify a port number for the plugin preview.-o
,--output
: Specify an output dir, default isdist
.-m
,--mode
: Specify a mode.
Example
# Preview the plugin on port 8080
plugma preview -p 8080
build
Create a build before publishing. This command compiles and bundles your plugin, preparing it for distribution.
Usage
plugma build [options]
Options
-w
,--watch
: Watch for changes and rebuild automatically.-o
,--output
: Specify an output dir, default isdist
.-m
,--mode
: Specify a mode.
Example
# Build the plugin
plugma build
# Build and watch for changes
plugma build -w
release
Build the plugin and release to GitHub. This command automates creating a new GitHub release with your latest changes. If no version is specified, it will automatically update the plugma.pluginVersion
field in package.json
.
plugma build [version] [options]
Version
alpha
,beta
,stable
or an integer (optional)
Options
-t
,--title
: Custom title for the release.-n
,--notes
: Add release notes.-o
,--output
: Specify an output dir, default isdist
.
Example
# Increment the next stable version
plugma release
# Release a beta version with custom title and notes
plugma release beta -t "New feature" -n "This release includes new features X and Y"
Installing globally
If you'd prefer to use the CLI globally you can install it using the following.
npm install plugma -g