npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stacker-plugin-cli

v1.0.8

Published

A zero configuration dev-toolkit for WordPress Plugin Developers. Supports: Gutenberg Blocks, PHPUnit, WPCS, LocalWP, Docker Compose and more.

Downloads

7

Readme

STACKER-plugin-CLI : WordPress Plugin Developer Toolkit

WordPress Scaffolding Plugin Generator

A Zero-Configuration WordPress plugin development toolkit that kickstarts your next WordPress plugin development project with modern tools and workflows.

Out-Of-The-Box Support For: Classes & Functions Autoloading, Gutenberg Blocks, Xdebug, PHPUnit tests, Docker-Compose, LocalWP, WordPress Coding Standards, JavaScript & SCSS lints, Husky hooks to make sure that you always commit error-free code, and VSCode configs to configure your IDE to setup perfectly for your plugin development experience.

Version: v1.0.0 License npm Maintainer

Stacker Plugin Boilerplate Supports

  • Classes & Functions auto-loading for 'inc' folder
  • Optional GutenBerg Blocks development
  • Docker Compose or wpLocal development envrionment
  • Xdebug for VScode
  • PHPUnit test
  • Composer dependencies
  • NPM dependencies
  • WordPress Coding Standards, WooCommerce Coding Standards & Fixes via PHPCS/PHPCBF
  • Gulp, SASS, Babel, Webpack, AutoPrefixer, BrowserSync (Reloads your browser while development), assets minification and image optimizations.

🚀 How the CLI works?

Stacker-plugin-cli asks a set of questions required to scaffolds your WordPress plugin.

:arrow_right: Quick Installation

In your terminal window; cd to your plugin development folder 'wp-content/plugins' and run the below given npx command:

$ npx stacker-plugin-cli

You will be asked a few questions to generate & configure your plugin files, answer them correctly and a fresh WordPress plugin boilerplate will be generated inside your current working directory (which usually, should be your wp-content/plugins) folder.

Stacker Pluigin CLI Questions Stacker Plugin Generated

Once the files are generated successfully, cd to your generated plugin's directory and install npm and composer dependencies.

$ cd Your-Plugin-Folder

$ npm install

$ composer install

Now, you can start building your plugin using the npm command below:

$ npm run start

:open_file_folder: Generated Plugin's Folder Structure with docker compose, xdebug, and phpunit configured

./plugin-name                           
├── Dockerfile                          '(Dockerfile to build images in docker compose)'
├── blocks.webpack.config.js            '(webpack config for wpscript)'
├── composer.json                       '(composer json)'
├── docker-compose.yaml                 '(docker compose yaml file)'
├── docker-configs                      '(config files for docker compose env)'
│   ├── php-file-size.ini
│   └── xdebug.ini
├── inc                                 '(inc folder of our plugin)'
│   ├── admin                           
│   │   ├── class-admin.php             '(contains the admin class of our plugin)'
│   │   ├── class-hooks.php             '(contains admin hooks of our plugin)'
│   │   └── index.php
│   ├── class-autoloader.php            '(Our plugin classes autoloader. Works for files inside 'inc' folder only)'
│   ├── class-loader.php                '(Our plugin loader class to bootstrap the plugin)'
│   ├── helpers                         '(Helper functions of our plugin. Any file with *-functions.php name will be autoloaded)'
│   │   ├── helper-functions.php
│   │   └── index.php
│   ├── index.php
│   ├── public                          '(Frontend functionality classes of our plugin goes here.)'
│   │   ├── class-frontend.php
│   │   └── index.php
│   ├── repositories                    '(Any class deals with creating repositories lies here.)'
│   │   ├── class-user.php
│   │   └── index.php
│   └── services                        '(Any class for different services lies here. e.g. api or db queries)'
│       ├── class-api.php
│       ├── class-db.php
│       └── index.php
├── index.php
├── package.json                        '(npm packages definition file)'
├── phpunit.xml.dist                    '(file to configure options for PHPUnit)'
├── plugin-name.php                     '(Our main plugin file)'
└── src                                 '(contains source files for blocks and plugin assets)'
    ├── assets                          '(plugin common frontend and backend assets)'
    └── blocks                          '(gutenberg blocks files)'

⚡️ Begin Installation

⚡️ Create a fresh plugin in your plugin's folder

In your terminal window; cd to your plugin development folder 'wp-content/plugins/' and run the below given npx command:

$ npx stacker-plugin-cli

You will be asked a few questions to generate & configure your plugin files, answer them correctly and a fresh WordPress plugin boilerplate will be generated inside your current working directory (which usually, should be your wp-content/plugins) folder.

$ npm run start

Start your development environment to watch changes in your PHP, Js, and SCSS files.

$ composer run phpcs

To sniff your plugin's php files for WordPress coding standards.

$ composer run phpcbf

To fix WordPress coding standards errors within your plugin's directory.

⚡️ Installation Configuration Options Available

In the CLI questions you will be asked to pick these options to generate the plugin files depending on your development:

  1. Installation with Docker Compose : Choose Docker Compose as your development environment.
  2. Installation to be used with WP Local (https://localwp.com) : Choose WPLocal as your development environment.
  3. Installation with xdebug configured : From the options select 'Yes' for configuring xdebug.
  4. Installation with PHPUnit configured : From the options select 'Yes' for configuring PHPunit.

⚡️ How to run php tests?

$ npx stacker-plugin-cli

Run PHP tests by running below command in your generated plugin's folder:

$ composer run test

⚡️ NPM Commands available

  • npm run build : To build your plugin files with blocks and other assets.
  • npm run start : To start watching your development changes in JS, IMG, and SCSS files in src/blocks and src/assets folder. Kicks hot-reloading as well.
  • npm run dist : To create a distributable version of plugin and zip file.
  • npm run devdist : To create a distributable version of plugin for other fellow developers who don't have access to your private git repo.
  • npm run format : To format your plugin's SCSS and Js files.

⚡️ Composer Commands available

  • composer run test : To run php tests defined in ./tests/ directory of your plugin.
  • composer run phpcs : To execute PHP Code Sniffer with WordPress coding standards on your plugin files.
  • composer run phpcbf : To execute PHP Code Beautifier with WordPress coding standards on your plugin files to fix PHPWPCS errors in your plugin files.