Skip to content

A test-driven template for building reliable Strapi plugins

License

Notifications You must be signed in to change notification settings

pluginpal/strapi-plugin-boilerplate

Repository files navigation

Strapi Plugin Boilerplate

A test-driven template for building reliable Strapi Plugins
CI build status

✨ Features

  • Setup using @strapi/sdk-plugin with commands for build and watch.
  • An isolated Strapi instance for testing and development, the Playground.
  • Github Actions workflow for linting and testing.
  • Clear community files like CONTRIBUTING.md and CODE-OF-CONDUCT.md.
  • Jest & Supertest for testing your plugin API's.
  • Cypress for GUI e2e tests

⏳ How to use

This repository is meant to be a template for new plugins. It can be used as a starting point, giving you the resources to built a test-driven Strapi plugin.

After creating your copy of the template, do a find-replace through the code and change the following:

  1. Change boilerplate (lowercase) to be the identifier of your plugin.
  2. Change Boilerplate (uppercase) to be the human readable name of your plugin.

You're all set! Go make your plugin and write some tests!

📓 Tutorials

This repository has been made alongside an article series called "Automated Testing for Strapi Plugins". To better understand how and why this repository has been setup, please read the following articles:

  1. Using a Playground Instance
  2. Integration tests (In Progress)
  3. E2E tests (In Progress)

🔌 Commands

Strapi Plugin SDK commands

  1. yarn build
  1. yarn watch
  1. yarn watch:link
  1. yarn verify

Testing commands

  1. yarn test:ts:front
  • A check for Typescript errors on the front-end side.
  • Used in the linting step of the pipeline.
  1. yarn test:ts:back
  • A check for Typescript errors on the back-end side.
  • Used in the linting step of the pipeline.

Playground commands

  1. yarn playground:install
  • Installs the plugin into the playground using yalc-add-link.
  • Installs all other dependencies of the playground.
  1. yarn playground:yalc-add
  • Installs a production-like version of the plugin, into the playground.
  1. yarn playground:yalc-add-link
  • Installs a development build of the plugin, into the playground.
  1. yarn playground:build
  1. yarn playground:develop
  1. yarn playground:start

About

A test-driven template for building reliable Strapi plugins

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project