Skip to content

Commit 11820d7

Browse files
committed
Improve plugin template: archive, prerequisites, activation logic
1 parent 1f4adad commit 11820d7

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Install dependencies
1616
run: bun install
1717
- name: Create archive
18-
run: bunx roll archive -y
18+
run: bun run archive
1919
- name: Install pipeline
2020
run: mkdir -p publish && cd publish && git clone https://github.com/tangibleinc/pipeline
2121
- name: Add latest tag as needed

example-plugin.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ function example_plugin($instance = false) {
2626

2727
add_action('plugins_loaded', function() {
2828

29+
/**
30+
* Don't load during plugin activation: the newest version of Framework is
31+
* not guaranteed due to how WordPress runs the `plugins_loaded` action *before*
32+
* loading plugins and modules, short-circuiting the version comparison logic.
33+
* @see https://developer.wordpress.org/reference/functions/register_activation_hook/#more-information
34+
* @see https://github.com/WordPress/wordpress-develop/blob/8a52d746e9bb85604f6a309a87d22296ce1c4280/src/wp-admin/includes/plugin.php#L2381C10-L2381C31
35+
*/
36+
if (defined('WP_SANDBOX_SCRAPING')) return;
37+
2938
$plugin = framework\register_plugin([
3039
'name' => 'example-plugin',
3140
'title' => 'Example Plugin',

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description of example plugin
44

55
## Develop
66

7-
Prerequisites: [Git](https://git-scm.com/), [Node](https://nodejs.org/en/) (version 18 and above)
7+
Prerequisites: Linux, macOS, or Windows ([WSL](https://learn.microsoft.com/en-us/windows/wsl/about)); [Git](https://git-scm.com/), [Node](https://nodejs.org/en/) (version 20 and above)
88

99
Clone the repository and install dependencies.
1010

tangible.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default {
2929
src: [
3030
'*.php',
3131
'assets/**',
32-
'includes',
32+
'includes/**',
3333
'vendor/tangible/**',
3434
'readme.txt'
3535
],

0 commit comments

Comments
 (0)