Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Force LF line endings for all text files regardless of the committing
# machine's core.autocrlf setting. This repo is published to npm verbatim
# (index.js + templates/**) — CRLF sneaking into a commit corrupts generated
# scaffolds (mixed CRLF/LF within a single file breaks PHP_CodeSniffer's
# tokenizer) and diverges from what's checked into GitHub.
* text=auto eol=lf
122 changes: 61 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,61 @@
# create-wp-plugin
Interactive scaffold generator for modern, production-ready WordPress plugins — built with PSR-4 autoloading, WPCS/VIP coding standards, PHPUnit unit tests, WP-CLI command integration, and optional React asset build pipeline (`@wordpress/scripts`).
## Usage
### Quick Start via NPX
Run directly without installing:
```bash
npx create-wp-plugin-cli
```
> Published on npm as [`create-wp-plugin-cli`](https://www.npmjs.com/package/create-wp-plugin-cli) (the `create-wp-plugin` name was already taken). You can still run the latest `main` branch directly from GitHub with `npx github:akshat009/create-wp-plugin-cli`.
### Local Usage
```bash
node index.js
```
### CLI Flags (Non-Interactive Mode)
```bash
node index.js --yes --name "My Plugin" --prefix myp --namespace MyPlugin --out ./my-plugin
```
Available flags: `--help`, `--version`, `--yes`, `--name`, `--slug`, `--namespace`, `--prefix`, `--author`, `--email`, `--author-uri`, `--description`, `--min-php`, `--out`, `--modules`, `--react`, `--no-react`.
`--modules` accepts a comma-separated list of: `admin_settings`, `shortcode`, `rest_api`, `ajax_handler`, `cpt_taxonomy`, `cron`, `elementor_widget`, `woocommerce_hooks`, `interactivity`.
## After Generating
After running the generator, perform the following steps to initialize your project:
```bash
cd <slug>
composer install # installs PHPCS/WPCS/VIP rulesets, PHPUnit (required
# before composer lint / composer test will work)
composer lint
composer test
git init && git add -A && git commit -m "scaffold"
```
> **Note:** `composer install` may prompt to allow the `dealerdirect/phpcodesniffer-composer-installer` plugin — answer **yes**, as it registers the WPCS/VIP rulesets with PHPCS. You may also see a message *"No composer.lock file present"* on the first run; this is completely normal and Composer will automatically create the lock file.
## Features
- ⚡ **PSR-4 Autoloading**: Clean `src/` directory layout with automatic fallback.
- 🎨 **WordPress Coding Standards**: Full WPCS, Docs, VIP Go, and PHPCompatibilityWP integration (`composer lint`).
- 🧪 **PHPUnit & Brain Monkey**: Zero-WordPress-install unit testing suite (`composer test`).
- 💻 **WP-CLI Commands**: Built-in `wp <prefix> status` and `wp <prefix> cache clear` handlers.
- ⚛️ **React Admin App Build Pipeline**: Built-in `@wordpress/scripts` workflow that mounts a real interactive React app into your plugin's own wp-admin screen (not shipped to frontend visitors).
- ⚡ **Frontend Interactivity Module**: WordPress's native Interactivity API (directive-based, WP 6.5+) for lightweight, actually-interactive frontend markup without shipping a React runtime to visitors.
- 📦 **Modular Architecture**: Toggleable scaffolding for Admin Settings Page, Shortcodes, REST API, AJAX, CPT + Taxonomies, Cron Jobs, Elementor Widgets, WooCommerce, and Frontend Interactivity.
- 🛒 **Full WooCommerce Integration**: Payment gateway (classic checkout **and** WooCommerce Blocks / block-based checkout), shipping method, custom order email (with its own template files), custom product type, HPOS compatibility — all real, working, PHPCS-clean skeletons, not stubs you have to wire up yourself.
- 🔌 **Service Composition**: Extensible `{{PREFIX}}_services` filter to inject third-party `Registrable` services.
- 🎨 **Elementor Auto-Discovery**: Automatic discovery of concrete widgets in `src/Widgets/` with convention-based CSS/JS registration (`{{PREFIX}}-widget-slug`).
- 🛠️ **VS Code Tooling**: Code snippets (`wpelwidget`), PHPCS integration (`valeryanm.vscode-phpsab`), EditorConfig support, and WordPress stubs via Intelephense.
- ⚙️ **GitHub Actions CI**: Preconfigured workflow for automated PHPCS linting and PHP version matrix testing.
> **Note:** To scaffold Gutenberg blocks, use `npx @wordpress/create-block`.
## License
GPL-2.0-or-later
# create-wp-plugin

Interactive scaffold generator for modern, production-ready WordPress plugins — built with PSR-4 autoloading, WPCS/VIP coding standards, PHPUnit unit tests, WP-CLI command integration, and optional React asset build pipeline (`@wordpress/scripts`).

## Usage

### Quick Start via NPX
Run directly without installing:
```bash
npx create-wp-plugin-cli
```

> Published on npm as [`create-wp-plugin-cli`](https://www.npmjs.com/package/create-wp-plugin-cli) (the `create-wp-plugin` name was already taken). You can still run the latest `main` branch directly from GitHub with `npx github:akshat009/create-wp-plugin-cli`.

### Local Usage
```bash
node index.js
```

### CLI Flags (Non-Interactive Mode)
```bash
node index.js --yes --name "My Plugin" --prefix myp --namespace MyPlugin --out ./my-plugin
```

Available flags: `--help`, `--version`, `--yes`, `--name`, `--slug`, `--namespace`, `--prefix`, `--author`, `--email`, `--author-uri`, `--description`, `--min-php`, `--out`, `--modules`, `--react`, `--no-react`.

`--modules` accepts a comma-separated list of: `admin_settings`, `shortcode`, `rest_api`, `ajax_handler`, `cpt_taxonomy`, `cron`, `elementor_widget`, `woocommerce_hooks`, `interactivity`.

## After Generating

After running the generator, perform the following steps to initialize your project:

```bash
cd <slug>
composer install # installs PHPCS/WPCS/VIP rulesets, PHPUnit (required
# before composer lint / composer test will work)
composer lint
composer test
git init && git add -A && git commit -m "scaffold"
```

> **Note:** `composer install` may prompt to allow the `dealerdirect/phpcodesniffer-composer-installer` plugin — answer **yes**, as it registers the WPCS/VIP rulesets with PHPCS. You may also see a message *"No composer.lock file present"* on the first run; this is completely normal and Composer will automatically create the lock file.

## Features
- ⚡ **PSR-4 Autoloading**: Clean `src/` directory layout with automatic fallback.
- 🎨 **WordPress Coding Standards**: Full WPCS, Docs, VIP Go, and PHPCompatibilityWP integration (`composer lint`).
- 🧪 **PHPUnit & Brain Monkey**: Zero-WordPress-install unit testing suite (`composer test`).
- 💻 **WP-CLI Commands**: Built-in `wp <prefix> status` and `wp <prefix> cache clear` handlers.
- ⚛️ **React Admin App Build Pipeline**: Built-in `@wordpress/scripts` workflow that mounts a real interactive React app into your plugin's own wp-admin screen (not shipped to frontend visitors).
- ⚡ **Frontend Interactivity Module**: WordPress's native Interactivity API (directive-based, WP 6.5+) for lightweight, actually-interactive frontend markup without shipping a React runtime to visitors.
- 📦 **Modular Architecture**: Toggleable scaffolding for Admin Settings Page, Shortcodes, REST API, AJAX, CPT + Taxonomies, Cron Jobs, Elementor Widgets, WooCommerce, and Frontend Interactivity.
- 🛒 **Full WooCommerce Integration**: Payment gateway (classic checkout **and** WooCommerce Blocks / block-based checkout), shipping method, custom order email (with its own template files), custom product type, HPOS compatibility — all real, working, PHPCS-clean skeletons, not stubs you have to wire up yourself.
- 🔌 **Service Composition**: Extensible `{{PREFIX}}_services` filter to inject third-party `Registrable` services.
- 🎨 **Elementor Auto-Discovery**: Automatic discovery of concrete widgets in `src/Widgets/` with convention-based CSS/JS registration (`{{PREFIX}}-widget-slug`).
- 🛠️ **VS Code Tooling**: Code snippets (`wpelwidget`), PHPCS integration (`valeryanm.vscode-phpsab`), EditorConfig support, and WordPress stubs via Intelephense.
- ⚙️ **GitHub Actions CI**: Preconfigured workflow for automated PHPCS linting and PHP version matrix testing.

> **Note:** To scaffold Gutenberg blocks, use `npx @wordpress/create-block`.

## License
GPL-2.0-or-later
Loading
Loading