@carmopereira/wp-plugin-addons
v1.1.4
Published
Addons to speed up WordPress plugin development for PHP and Gutenberg block plugins
Maintainers
Readme
@carmopereira/wp-plugin-addons
Addons to speed up WordPress plugin development for both traditional PHP plugins and Gutenberg block plugins.
Installation
Or run directly with npx avoiding local cache:
npx @carmopereira/wp-plugin-addons@latestUsage
1. Scaffold your plugin
You can start from a Gutenberg block plugin or a traditional PHP plugin:
Gutenberg block plugin (create-block)
npx @wordpress/create-block@latest my-plugin --variant=dynamic
cd my-pluginPHP plugin scaffold
npx @carmopereira/wp-php-template
cd my-plugin2. Apply the custom setup
Open a terminal at the plugin folder
npx @carmopereira/wp-plugin-addons@latestWhat gets added
The create-block-carmo-addon setup adds:
Scripts to package.json
prebuild: Automatically updates the version before build (patch version)updateGIT: Interactive script to run git add, commit, and pushsymlink: Script to create a plugin symlink in the WordPress directoryplugin-zip: Builds a distributable plugin.zipviawp-scripts plugin-zip— only added if the project doesn't already define it
Scripts in the scripts/ folder
sync-version.js: Syncs the version betweenpackage.json, the main PHP file, andblock.jsoncreate-symlink.js: Creates the plugin symlink inwp-content/pluginsupdate-git.js: Simplifies the commit and push process
.gitignore updates
Adds standard entries for build artifacts, logs, etc.
Available scripts
After applying the setup, you can run:
# Create plugin symlink
npm run symlink
# Commit and push
npm run updateGIT
# Build (automatically updates version)
npm run build
# Build a distributable plugin zip
npm run plugin-zipRepository structure
carmo-wp-plugin-addons/
├── setups/
│ └── create-block-carmo-addon/
│ ├── setup/
│ │ ├── create-symlink.js
│ │ ├── sync-version.js
│ │ └── update-git.js
│ ├── .gitignore
│ └── package-scripts.json
├── setup.js
├── package.json
├── .npmignore
└── README.mdLicense
GPL-2.0-or-later
