Plugin
The plugin folder structure is separated from the root folder structure to avoid flooding the documentation. Additionally folders/files marked with a prefixed π‘ are important for getting started (that means, learn more about them).
All files and folders written in italics are not saved in Git, but automatically arranged when you develop or deploy your plugin.
Folder structure
π
plugins/your-pluginFolder you created withcreate-wp-react-app create-pluginπ
coverageCoverage reports, see thisπ
devopsFiles related to CI/CD, Docker and so on for this specific pluginπ
.gitlabπ π‘
.gitlab-ci.ymlCI/CD similar root file, included in root.gitlab-ci.ymlπ
stage-build-production.ymlPredefined job to build production plugin when merged tomasterπ
stage-build.ymlPredefined job to build pluginπ
stage-deploy.ymlPredefined job for wordpress.org deploymentπ
stage-test.ymlPredefined test jobsπ
stage-validate.ymlJobs for Docker garbage collection, semantic versioning and license scanner
π
docker-composeCompose files are consumed automaticallyπ
docker-compose.e2e.ymlUsed in Cypress E2E testsπ
docker-compose.local.ymlUsed locally with port exposeπ
docker-compose.traefik.ymlUsed for Review applicationsπ
docker-compose.ymlThis file is automatically merged withdevops/docker-compose/docker-compose.yml, see here
π
scriptsAdditional scripts used in Docker containers (mounted) for this specific pluginπ π‘
wordpress-startup.shSimilar todevops/scripts/wordpress-startup.sh
π
buildRunyarn buildto create an installable plugin into this folderπ
docsRunyarn docsto create all technical docs into this folderπ
node_modulesNode dependenciesπ
scriptsScripts related to developmentπ π‘
Gruntfile.tsGruntfile for this plugin, extendscommon/Gruntfile.base.tsπ π‘
webpack.config.tsWebpack configuration file for this plugin, consumescommon/webpack.factory.ts, see here
π
srcYour plugin coding, here we go!π
incServer-side coding in PHPπ
baseBase classes and functionsπ
othersπ
cachebuster-lib.phpCachebuster file for library filesπ
cachebuster.phpCachebuster file for entrypoint filesπ
fallback-php-version.phpShow admin notice when PHP version not reachedπ
fallback-rest-api.phpShow admin notice when WP REST API is not availableπ
fallback-wp-version.phpShow admin notice when WP version is not reachableπ
index.phpEmpty index.php file to prevent directory browsingπ
start.phpInitializes the plugins Core class and shows notices if requirements are not met (e. g. WP version)
π π‘
Core.phpAbstract core class for main initialization of namespacing and so on, similar to the well-knownfunctions.phpπ
index.phpEmpty index.php file to prevent directory browsingπ π‘
UtilsProvider.phpMake plugin relevant data available to composer packages, used in all your classes!
π π‘
restExample WP REST API endpoint implementationπ
index.phpEmpty index.php file to prevent directory browsingπ
HelloWorld.phpExamplewp-json/your-plugin/hello-worldendpoint
π π‘
viewView relevant coding like initialization of Widgets and admin pagesπ
menuExample admin page implementationπ
index.phpEmpty index.php file to prevent directory browsingπ
Page.phpExample "Your plugin" admin page
π
widgetExample widget implementationπ
index.phpEmpty index.php file to prevent directory browsingπ
Widget.phpReact example widget implementation
π
index.phpEmpty index.php file to prevent directory browsing
π π‘
Activator.phpClass for activate, deactivate and install actions, extends./base/Activator.phpπ π‘
Assets.phpClass for assets management, extends./base/Assets.phpπ π‘
Core.phpCore class, put your hook and filter registrations here; extends./base/Core.phpπ
index.phpEmpty index.php file to prevent directory browsingπ π‘
Localization.phpAllows to override used language, extends./base/Localization.php
π
languagesServer-side language filesπ
wp-reactjs-starter.potLanguage file can be translated with Poedit
π
publicClient-side coding in React (TypeScript)π
devRunyarn build:js:developmentto compile TypeScript to consumable JS filesπ
distRunyarn build:js:productionto compile TypeScript to minified consumable JS filesπ
libRunyarn grunt libs:copyto copy external library files to this folderπ
languagesClient-side language filesπ
wp-reactjs-starter.potLanguage file can be translated with Poedit
π π‘
tsYour frontend TypeScript entrypoints and codingπ
componentsReact componentsπ
index.tsxExport all members from this folderπ
page.tsxPage component used insrc/inc/view/menu/Page.phpπ
todo.tsxExample todo component consuming the store from../store/todo.tsx, used in./page.tsxπ
todoItem.tsxExample todo item component, used in./todo.tsx
π
modelsModel definitions for your storesπ
index.tsxExport all members from this folderπ
todoModel.tsxExample todo item implementation, see../store/todo.ts
π
styleCSS styles as SCSS filesπ
admin.scssConsumed in../admin.tsx, enqueued inAssets.phpπ
widget.scssConsumed in../widget.tsx, enqueued inAssets.php
π
typesAdditional declaration filesπ
global.d.tsAvoid errors of plain JS packages (see this)
π
utilsUtils and helpersπ
index.tsxCreate utils frompackages/utils/lib/factorylike i18n and AJAX handler
π
widgetExample widget implementation, seesrc/inc/view/widget/Widget.phpπ
index.tsxReact component for the widget container
π
wp-apiWP REST API typesπ
hello.get.tsxTypes forwp-json/your-plugin/hello-world, seesrc/inc/rest/HelloWorld.phpπ
index.tsxExport all members from this folder
π
admin.tsxAdmin frontend coding (entrypoint), enqueued inAssets.phpπ
widget.tsxWidget frontend coding (entrypoint), enqueued inAssets.php
π π‘
index.phpMain plugin file making your plugin to a real WordPress pluginπ
uninstall.phpUninstall file
π
testTest files and specsπ π‘
cypressPut your E2E test files hereπ
jestPut all your Jest tests hereπ
phpunitPut all your PHPUnit tests hereπ
jest.config.jsJest configuration fileπ
jest.setup.jsJest setup fileπ
patchwork.jsonPatchwork configuration fileπ
phpunit.bootstrap.phpPHPUnit bootstrap fileπ
phpunit.xdebug.phpPHPUnit + [XDebug filtering]((https://xdebug.org/docs/code_coverage)) for faster code coverage analysisπ
phpunit.xmlPHPUnit configuration file
π
vendorComposer vendor-dirπ
wordpress.orgwordpress.org related files for release in the plugin directory, see hereπ
assetsAssets like banner and icons (see this)π π‘
README.wporg.txtPlugin readme
π
CHANGELOG.mdConventional changelog outputπ
composer.jsonComposer configuration fileπ
composer.lockComposer lock fileπ
cypress.jsonCypress configuration fileπ
LICENSEPlugin license fileπ
LICENSE_3RD_PARTY_JS.mdYarn dependencies disclaimer, see License checkerπ
LICENSE_3RD_PARTY_PHP.mdComposer dependencies disclaimer, see License checkerπ
package.jsonPackage definition fileπ
tsconfig.jsonTypeScript configuration file, extendscommon/tsconfig.json
Last updated