Update to version 0.1.5 with testing setup, multisite compatibility, and npm scripts
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
All notable changes to this project should be documented both here and in the main Readme files.
|
All notable changes to this project should be documented both here and in the main Readme files.
|
||||||
|
|
||||||
|
#### [0.1.5] - 2025-04-19
|
||||||
|
#### Fixed
|
||||||
|
- Release workflow to use correct plugin directory name
|
||||||
|
|
||||||
|
#### Added
|
||||||
|
- Testing setup with wp-env and Cypress
|
||||||
|
- Multisite compatibility
|
||||||
|
- npm scripts for development and testing
|
||||||
|
|
||||||
#### [0.1.3] - 2025-04-19
|
#### [0.1.3] - 2025-04-19
|
||||||
#### Added
|
#### Added
|
||||||
- Improved AI IDE context recommendations in documentation
|
- Improved AI IDE context recommendations in documentation
|
||||||
|
|||||||
112
README.md
112
README.md
@@ -15,11 +15,12 @@ This template is based on the experience gained from developing the "Fix 'Plugin
|
|||||||
* **Object-Oriented Architecture**: Well-structured, maintainable code using OOP principles
|
* **Object-Oriented Architecture**: Well-structured, maintainable code using OOP principles
|
||||||
* **Namespace Support**: Modern PHP namespacing for better organization and avoiding conflicts
|
* **Namespace Support**: Modern PHP namespacing for better organization and avoiding conflicts
|
||||||
* **Comprehensive Documentation**: Detailed documentation for both users and developers
|
* **Comprehensive Documentation**: Detailed documentation for both users and developers
|
||||||
* **Testing Framework**: PHPUnit setup for unit testing
|
* **Testing Framework**: PHPUnit setup for unit testing and Cypress for e2e testing
|
||||||
* **Internationalization Ready**: Full support for translation and localization
|
* **Internationalization Ready**: Full support for translation and localization
|
||||||
* **Update Source Selection**: Choose between WordPress.org, GitHub, or Gitea for plugin updates
|
* **Update Source Selection**: Choose between WordPress.org, GitHub, or Gitea for plugin updates
|
||||||
* **AI Workflow Documentation**: Detailed guides for AI-assisted development
|
* **AI Workflow Documentation**: Detailed guides for AI-assisted development
|
||||||
* **Wiki Documentation**: Ready-to-use wiki structure for comprehensive documentation
|
* **Wiki Documentation**: Ready-to-use wiki structure for comprehensive documentation
|
||||||
|
* **Multisite Compatible**: Fully tested and compatible with WordPress multisite installations
|
||||||
|
|
||||||
### How to Use This Template
|
### How to Use This Template
|
||||||
|
|
||||||
@@ -70,6 +71,86 @@ To get started with this template, follow these steps:
|
|||||||
|
|
||||||
4. Use an AI assistant like GitHub Copilot, Claude, or ChatGPT to help you customize the template by providing the prompt from the Starter Prompt file.
|
4. Use an AI assistant like GitHub Copilot, Claude, or ChatGPT to help you customize the template by providing the prompt from the Starter Prompt file.
|
||||||
|
|
||||||
|
### Development Environment
|
||||||
|
|
||||||
|
This template includes configuration for WordPress Environment (wp-env) to make local development easier:
|
||||||
|
|
||||||
|
1. Install Node.js dependencies:
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Start the WordPress environment:
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
3. For multisite testing:
|
||||||
|
```bash
|
||||||
|
npm run multisite
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Access your local WordPress site at http://localhost:8888 (admin credentials: admin/password)
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
The template includes both PHP unit tests and end-to-end tests:
|
||||||
|
|
||||||
|
#### PHP Unit Tests
|
||||||
|
|
||||||
|
1. Install Composer dependencies:
|
||||||
|
```bash
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run PHP unit tests:
|
||||||
|
```bash
|
||||||
|
npm run test:php
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Check PHP coding standards:
|
||||||
|
```bash
|
||||||
|
npm run lint:php
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Fix PHP coding standards issues:
|
||||||
|
```bash
|
||||||
|
npm run fix:php
|
||||||
|
```
|
||||||
|
|
||||||
|
#### End-to-End Tests
|
||||||
|
|
||||||
|
1. Start the WordPress environment:
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run Cypress tests in interactive mode:
|
||||||
|
```bash
|
||||||
|
npm run test:e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run Cypress tests in headless mode:
|
||||||
|
```bash
|
||||||
|
npm run test:e2e:headless
|
||||||
|
```
|
||||||
|
|
||||||
|
### Building for Production
|
||||||
|
|
||||||
|
Use the included build script to create a deployable version of your plugin:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run build
|
||||||
|
```
|
||||||
|
|
||||||
|
Or directly:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build.sh {VERSION}
|
||||||
|
```
|
||||||
|
|
||||||
|
This will create a ZIP file that you can install in WordPress.
|
||||||
|
|
||||||
### Using with Git Updater
|
### Using with Git Updater
|
||||||
|
|
||||||
If you've installed this plugin from GitHub or Gitea, you'll need Git Updater to receive updates:
|
If you've installed this plugin from GitHub or Gitea, you'll need Git Updater to receive updates:
|
||||||
@@ -105,13 +186,14 @@ The main files you need to update include:
|
|||||||
3. readme.txt
|
3. readme.txt
|
||||||
4. CHANGELOG.md
|
4. CHANGELOG.md
|
||||||
5. composer.json
|
5. composer.json
|
||||||
6. languages/pot file
|
6. package.json
|
||||||
7. .github/workflows/
|
7. languages/pot file
|
||||||
8. .wiki/
|
8. .github/workflows/
|
||||||
9. .ai-assistant.md
|
9. .wiki/
|
||||||
10. includes/plugin.php
|
10. .ai-assistant.md
|
||||||
11. includes/core.php
|
11. includes/plugin.php
|
||||||
12. admin/lib/admin.php
|
12. includes/core.php
|
||||||
|
13. admin/lib/admin.php
|
||||||
|
|
||||||
### How do I build and test my plugin?
|
### How do I build and test my plugin?
|
||||||
|
|
||||||
@@ -127,6 +209,14 @@ This will create a ZIP file that you can install in WordPress.
|
|||||||
|
|
||||||
Customize the includes/core.php file to implement your core functionality and the admin/lib/admin.php file for admin-specific functionality.
|
Customize the includes/core.php file to implement your core functionality and the admin/lib/admin.php file for admin-specific functionality.
|
||||||
|
|
||||||
|
### Is this template compatible with WordPress multisite?
|
||||||
|
|
||||||
|
Yes, this template is fully compatible with WordPress multisite installations. You can test multisite compatibility by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run multisite
|
||||||
|
```
|
||||||
|
|
||||||
## Support & Feedback
|
## Support & Feedback
|
||||||
|
|
||||||
If you need help with this template, there are several ways to get support:
|
If you need help with this template, there are several ways to get support:
|
||||||
@@ -188,6 +278,12 @@ For more information on Git Updater integration, see the [Git Updater Required H
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
|
### 0.1.5
|
||||||
|
* Fixed: Release workflow to use correct plugin directory name
|
||||||
|
* Added: Testing setup with wp-env and Cypress
|
||||||
|
* Added: Multisite compatibility
|
||||||
|
* Added: npm scripts for development and testing
|
||||||
|
|
||||||
### 0.1.3
|
### 0.1.3
|
||||||
* Added: Improved AI IDE context recommendations in documentation
|
* Added: Improved AI IDE context recommendations in documentation
|
||||||
* Enhanced: Starter Prompt with guidance on pinning .ai-assistant.md and .ai-workflows/
|
* Enhanced: Starter Prompt with guidance on pinning .ai-assistant.md and .ai-workflows/
|
||||||
|
|||||||
101
readme.txt
101
readme.txt
@@ -5,7 +5,7 @@ Tags: starter, template, boilerplate, plugin development, ai coding
|
|||||||
Requires at least: 5.0
|
Requires at least: 5.0
|
||||||
Tested up to: 6.4
|
Tested up to: 6.4
|
||||||
Requires PHP: 7.0
|
Requires PHP: 7.0
|
||||||
Stable tag: 0.1.3
|
Stable tag: 0.1.5
|
||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
|
||||||
@@ -22,11 +22,12 @@ This template is based on the experience gained from developing the "Fix 'Plugin
|
|||||||
* **Object-Oriented Architecture**: Well-structured, maintainable code using OOP principles
|
* **Object-Oriented Architecture**: Well-structured, maintainable code using OOP principles
|
||||||
* **Namespace Support**: Modern PHP namespacing for better organization and avoiding conflicts
|
* **Namespace Support**: Modern PHP namespacing for better organization and avoiding conflicts
|
||||||
* **Comprehensive Documentation**: Detailed documentation for both users and developers
|
* **Comprehensive Documentation**: Detailed documentation for both users and developers
|
||||||
* **Testing Framework**: PHPUnit setup for unit testing
|
* **Testing Framework**: PHPUnit setup for unit testing and Cypress for e2e testing
|
||||||
* **Internationalization Ready**: Full support for translation and localization
|
* **Internationalization Ready**: Full support for translation and localization
|
||||||
* **Update Source Selection**: Choose between WordPress.org, GitHub, or Gitea for plugin updates
|
* **Update Source Selection**: Choose between WordPress.org, GitHub, or Gitea for plugin updates
|
||||||
* **AI Workflow Documentation**: Detailed guides for AI-assisted development
|
* **AI Workflow Documentation**: Detailed guides for AI-assisted development
|
||||||
* **Wiki Documentation**: Ready-to-use wiki structure for comprehensive documentation
|
* **Wiki Documentation**: Ready-to-use wiki structure for comprehensive documentation
|
||||||
|
* **Multisite Compatible**: Fully tested and compatible with WordPress multisite installations
|
||||||
|
|
||||||
= How to Use This Template =
|
= How to Use This Template =
|
||||||
|
|
||||||
@@ -51,6 +52,70 @@ This template includes comprehensive documentation for AI-assisted development:
|
|||||||
|
|
||||||
**Important**: For the best AI assistance, add the .ai-assistant.md file and .ai-workflows/ directory to your AI IDE chat context. In most AI IDEs, you can pin these files to ensure they're considered in each message.
|
**Important**: For the best AI assistance, add the .ai-assistant.md file and .ai-workflows/ directory to your AI IDE chat context. In most AI IDEs, you can pin these files to ensure they're considered in each message.
|
||||||
|
|
||||||
|
= Development Environment =
|
||||||
|
|
||||||
|
This template includes configuration for WordPress Environment (wp-env) to make local development easier:
|
||||||
|
|
||||||
|
1. Install Node.js dependencies:
|
||||||
|
```bash
|
||||||
|
npm install
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Start the WordPress environment:
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
3. For multisite testing:
|
||||||
|
```bash
|
||||||
|
npm run multisite
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Access your local WordPress site at http://localhost:8888 (admin credentials: admin/password)
|
||||||
|
|
||||||
|
= Testing =
|
||||||
|
|
||||||
|
The template includes both PHP unit tests and end-to-end tests:
|
||||||
|
|
||||||
|
**PHP Unit Tests**
|
||||||
|
|
||||||
|
1. Install Composer dependencies:
|
||||||
|
```bash
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run PHP unit tests:
|
||||||
|
```bash
|
||||||
|
npm run test:php
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Check PHP coding standards:
|
||||||
|
```bash
|
||||||
|
npm run lint:php
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Fix PHP coding standards issues:
|
||||||
|
```bash
|
||||||
|
npm run fix:php
|
||||||
|
```
|
||||||
|
|
||||||
|
**End-to-End Tests**
|
||||||
|
|
||||||
|
1. Start the WordPress environment:
|
||||||
|
```bash
|
||||||
|
npm run start
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Run Cypress tests in interactive mode:
|
||||||
|
```bash
|
||||||
|
npm run test:e2e
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Run Cypress tests in headless mode:
|
||||||
|
```bash
|
||||||
|
npm run test:e2e:headless
|
||||||
|
```
|
||||||
|
|
||||||
= Support & Feedback =
|
= Support & Feedback =
|
||||||
|
|
||||||
If you need help with this template, there are several ways to get support:
|
If you need help with this template, there are several ways to get support:
|
||||||
@@ -95,13 +160,14 @@ The main files you need to update include:
|
|||||||
3. readme.txt
|
3. readme.txt
|
||||||
4. CHANGELOG.md
|
4. CHANGELOG.md
|
||||||
5. composer.json
|
5. composer.json
|
||||||
6. languages/pot file
|
6. package.json
|
||||||
7. .github/workflows/
|
7. languages/pot file
|
||||||
8. .wiki/
|
8. .github/workflows/
|
||||||
9. .ai-assistant.md
|
9. .wiki/
|
||||||
10. includes/plugin.php
|
10. .ai-assistant.md
|
||||||
11. includes/core.php
|
11. includes/plugin.php
|
||||||
12. admin/lib/admin.php
|
12. includes/core.php
|
||||||
|
13. admin/lib/admin.php
|
||||||
|
|
||||||
= How do I build and test my plugin? =
|
= How do I build and test my plugin? =
|
||||||
|
|
||||||
@@ -125,12 +191,26 @@ You'll need to update all namespace references from WPALLSTARS\PluginStarterTemp
|
|||||||
|
|
||||||
You'll need to update all text domain references from 'wp-plugin-starter-template' to your own text domain throughout the codebase.
|
You'll need to update all text domain references from 'wp-plugin-starter-template' to your own text domain throughout the codebase.
|
||||||
|
|
||||||
|
= Is this template compatible with WordPress multisite? =
|
||||||
|
|
||||||
|
Yes, this template is fully compatible with WordPress multisite installations. You can test multisite compatibility by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run multisite
|
||||||
|
```
|
||||||
|
|
||||||
== Screenshots ==
|
== Screenshots ==
|
||||||
|
|
||||||
1. This is a placeholder for your plugin's screenshots. Replace with actual screenshots of your plugin in action.
|
1. This is a placeholder for your plugin's screenshots. Replace with actual screenshots of your plugin in action.
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 0.1.5 =
|
||||||
|
* Fixed: Release workflow to use correct plugin directory name
|
||||||
|
* Added: Testing setup with wp-env and Cypress
|
||||||
|
* Added: Multisite compatibility
|
||||||
|
* Added: npm scripts for development and testing
|
||||||
|
|
||||||
= 0.1.3 =
|
= 0.1.3 =
|
||||||
* Added: Improved AI IDE context recommendations in documentation
|
* Added: Improved AI IDE context recommendations in documentation
|
||||||
* Enhanced: Starter Prompt with guidance on pinning .ai-assistant.md and .ai-workflows/
|
* Enhanced: Starter Prompt with guidance on pinning .ai-assistant.md and .ai-workflows/
|
||||||
@@ -158,6 +238,9 @@ You'll need to update all text domain references from 'wp-plugin-starter-templat
|
|||||||
|
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
|
|
||||||
|
= 0.1.5 =
|
||||||
|
Fixed release workflow and added testing setup with wp-env and Cypress, multisite compatibility, and npm scripts for development and testing.
|
||||||
|
|
||||||
= 0.1.3 =
|
= 0.1.3 =
|
||||||
Added improved AI IDE context recommendations and moved Starter Prompt to the wiki with guidance on pinning .ai-assistant.md and .ai-workflows/ files.
|
Added improved AI IDE context recommendations and moved Starter Prompt to the wiki with guidance on pinning .ai-assistant.md and .ai-workflows/ files.
|
||||||
|
|
||||||
|
|||||||
9
tests/e2e/cypress.json
Normal file
9
tests/e2e/cypress.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"baseUrl": "http://localhost:8889",
|
||||||
|
"integrationFolder": "tests/e2e/cypress/integration",
|
||||||
|
"pluginsFile": "tests/e2e/cypress/plugins/index.js",
|
||||||
|
"supportFile": "tests/e2e/cypress/support/index.js",
|
||||||
|
"videosFolder": "tests/e2e/cypress/videos",
|
||||||
|
"screenshotsFolder": "tests/e2e/cypress/screenshots",
|
||||||
|
"fixturesFolder": "tests/e2e/cypress/fixtures"
|
||||||
|
}
|
||||||
27
tests/e2e/cypress/integration/basic.spec.js
Normal file
27
tests/e2e/cypress/integration/basic.spec.js
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
/**
|
||||||
|
* Basic e2e test for the plugin.
|
||||||
|
*/
|
||||||
|
describe('Plugin Basic Tests', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.login();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should activate the plugin', () => {
|
||||||
|
cy.visit('/wp-admin/plugins.php');
|
||||||
|
cy.contains('WP Plugin Starter Template').should('exist');
|
||||||
|
|
||||||
|
// Check if plugin is not active, then activate it
|
||||||
|
cy.get('tr[data-slug="wp-plugin-starter-template-for-ai-coding"]')
|
||||||
|
.then(($tr) => {
|
||||||
|
if ($tr.hasClass('inactive')) {
|
||||||
|
cy.wrap($tr).find('.activate a').click();
|
||||||
|
cy.contains('Plugin activated.').should('exist');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should have the plugin settings page', () => {
|
||||||
|
cy.visit('/wp-admin/options-general.php?page=wp-plugin-starter-template');
|
||||||
|
cy.contains('WP Plugin Starter Template Settings').should('exist');
|
||||||
|
});
|
||||||
|
});
|
||||||
10
tests/e2e/cypress/plugins/index.js
Normal file
10
tests/e2e/cypress/plugins/index.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* Cypress plugins file.
|
||||||
|
*
|
||||||
|
* @param {Object} on - Cypress events
|
||||||
|
* @param {Object} config - Cypress config
|
||||||
|
* @return {Object} - Modified config
|
||||||
|
*/
|
||||||
|
module.exports = (on, config) => {
|
||||||
|
return config;
|
||||||
|
};
|
||||||
12
tests/e2e/cypress/support/commands.js
Normal file
12
tests/e2e/cypress/support/commands.js
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/**
|
||||||
|
* Custom Cypress commands.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Login command
|
||||||
|
Cypress.Commands.add('login', (username = 'admin', password = 'password') => {
|
||||||
|
cy.visit('/wp-login.php');
|
||||||
|
cy.get('#user_login').type(username);
|
||||||
|
cy.get('#user_pass').type(password);
|
||||||
|
cy.get('#wp-submit').click();
|
||||||
|
cy.get('body.wp-admin').should('exist');
|
||||||
|
});
|
||||||
4
tests/e2e/cypress/support/index.js
Normal file
4
tests/e2e/cypress/support/index.js
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* Import commands.js
|
||||||
|
*/
|
||||||
|
import './commands';
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
* Plugin Name: WordPress Plugin Starter Template
|
* Plugin Name: WordPress Plugin Starter Template
|
||||||
* Plugin URI: https://www.wpallstars.com
|
* Plugin URI: https://www.wpallstars.com
|
||||||
* Description: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development.
|
* Description: A comprehensive starter template for WordPress plugins with best practices for AI-assisted development.
|
||||||
* Version: 0.1.3
|
* Version: 0.1.5
|
||||||
* Author: Your Name & The WPALLSTARS Team
|
* Author: Your Name & The WPALLSTARS Team
|
||||||
* Author URI: https://www.wpallstars.com
|
* Author URI: https://www.wpallstars.com
|
||||||
* License: GPL-2.0+
|
* License: GPL-2.0+
|
||||||
@@ -35,4 +35,4 @@ if (!defined('WPINC')) {
|
|||||||
require_once plugin_dir_path(__FILE__) . 'includes/plugin.php';
|
require_once plugin_dir_path(__FILE__) . 'includes/plugin.php';
|
||||||
|
|
||||||
// Initialize the plugin
|
// Initialize the plugin
|
||||||
new WPALLSTARS\PluginStarterTemplate\Plugin(__FILE__, '0.1.3');
|
new WPALLSTARS\PluginStarterTemplate\Plugin(__FILE__, '0.1.5');
|
||||||
|
|||||||
Reference in New Issue
Block a user