Skip to main content

Plugin SDK reference

Page summary:

The Plugin SDK is a set of commands from @strapi/sdk-plugin for creating, building, linking, and publishing Strapi plugins locally or to NPM and the Marketplace.

The Plugin SDK is set of commands provided by the package @strapi/sdk-plugin orientated around developing plugins to use them as local plugins or to publish them on NPM and/or submit them to the Marketplace.

The present documentation lists the available Plugin SDK commands. The associated guide illustrates how to use these commands to create a plugin from scratch, link it to an existing project, and publish it.

npx @strapi/sdk-plugin init​

Create a new plugin at a given path.

terminal
npx @strapi/sdk-plugin init <path>
ArgumentsTypeDescriptionDefault
pathstringPath to the plugin (required). When the command runs from the root of a Strapi project and path contains no /, the plugin is created in ./src/plugins/<path>.-
OptionTypeDescriptionDefault
-d, --debug-Enable debugging mode with verbose logsfalse
--silent-Do not log anythingfalse
--use-npm-Use npm as the plugin package manager-
--use-yarn-Use yarn as the plugin package manager-
--use-pnpm-Use pnpm as the plugin package manager-
--no-install-Do not install the plugin dependencies nor build the plugin-

When the command runs from the root of a Strapi project that has a lock file, the plugin uses the package manager of the project. In this case, the --use-npm, --use-yarn, and --use-pnpm options are ignored. Otherwise, without these options, the package manager running the command is used, or npm by default.

strapi-plugin build​

Bundle the Strapi plugin for publishing.

terminal
strapi-plugin build
OptionTypeDescriptionDefault
-d, --debug-Enable debugging mode with verbose logsfalse
--silent-Do not log anythingfalse
--minify-Minify the outputfalse
--sourcemap-Produce sourcemapsfalse
Note

As of v6, the build configuration is automatically derived from your package.json exports field. No configuration file (such as vite.config.ts or rollup.config.ts) is needed.

Using SDK Plugin v5 (legacy)

If you need to continue using the previous build system with @strapi/pack-up, you can pin to version 5.x:

terminal
yarn add @strapi/sdk-plugin@5

Version 5.x of the SDK plugin supports packup.config.ts for custom build configuration. However, v6 is recommended for security updates and simplified configuration.

strapi-plugin watch:link​

Recompiles the plugin automatically on changes and runs yalc push --publish.

For testing purposes, it is very convenient to link your plugin to an existing application to experiment with it in real condition. This command is made to help you streamline this process.

terminal
strapi-plugin watch:link
OptionTypeDescriptionDefault
-d, --debug-Enable debugging mode with verbose logsfalse
--silent-Do not log anythingfalse

strapi-plugin watch​

Watch the plugin source code for any change and rebuild it everytime. Useful when implementing your plugin and testing it in an application.

terminal
strapi-plugin watch
OptionTypeDescriptionDefault
-d, --debug-Enable debugging mode with verbose logsfalse
--silent-Do not log anythingfalse

strapi-plugin verify​

Verify the output of the plugin before publishing it.

terminal
strapi-plugin verify
OptionTypeDescriptionDefault
-d, --debug-Enable debugging mode with verbose logsfalse
--silent-Do not log anythingfalse
Was this page helpful?