@artemsemkin/wp-headers 1.2.2 → 1.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -3
- package/dist/core.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,6 +58,16 @@ Running `processMapping({ type: 'theme', slug: 'flavor', entityDir: '/path/to/th
|
|
|
58
58
|
* Text Domain: flavor
|
|
59
59
|
* Tags: blog, one-column
|
|
60
60
|
*/
|
|
61
|
+
|
|
62
|
+
html {
|
|
63
|
+
margin-top: 0 !important;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
img,
|
|
67
|
+
video {
|
|
68
|
+
max-width: 100%;
|
|
69
|
+
height: auto;
|
|
70
|
+
}
|
|
61
71
|
```
|
|
62
72
|
|
|
63
73
|
### Plugin: `package.json` → PHP header
|
|
@@ -88,6 +98,7 @@ Given this in your plugin's `package.json`:
|
|
|
88
98
|
Running `processMapping({ type: 'plugin', slug: 'flavor-core', entityDir: '/path/to/plugin' })` generates or updates the header at the top of `flavor-core.php`:
|
|
89
99
|
|
|
90
100
|
```php
|
|
101
|
+
<?php
|
|
91
102
|
/**
|
|
92
103
|
* Plugin Name: Flavor Core
|
|
93
104
|
* Plugin URI: https://example.com/flavor-core
|
|
@@ -101,6 +112,15 @@ Running `processMapping({ type: 'plugin', slug: 'flavor-core', entityDir: '/path
|
|
|
101
112
|
* License: GPL-2.0-or-later
|
|
102
113
|
* Text Domain: flavor-core
|
|
103
114
|
*/
|
|
115
|
+
|
|
116
|
+
defined( 'ABSPATH' ) || exit;
|
|
117
|
+
|
|
118
|
+
define( 'FLAVOR_CORE_VERSION', '1.0.0' );
|
|
119
|
+
define( 'FLAVOR_CORE_PATH', plugin_dir_path( __FILE__ ) );
|
|
120
|
+
|
|
121
|
+
require_once FLAVOR_CORE_PATH . 'inc/class-flavor-core.php';
|
|
122
|
+
|
|
123
|
+
load_plugin_textdomain( 'flavor-core', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
|
|
104
124
|
```
|
|
105
125
|
|
|
106
126
|
### TGM version patching
|
|
@@ -115,6 +135,7 @@ Given this TGM registration file in your theme:
|
|
|
115
135
|
add_action( 'tgmpa_register', 'flavor_tgm_register_required_plugins' );
|
|
116
136
|
function flavor_tgm_register_required_plugins() {
|
|
117
137
|
$plugins = array(
|
|
138
|
+
// Bundled plugins — have a version constraint
|
|
118
139
|
array(
|
|
119
140
|
'name' => 'Flavor Core',
|
|
120
141
|
'slug' => 'flavor-core',
|
|
@@ -123,19 +144,30 @@ function flavor_tgm_register_required_plugins() {
|
|
|
123
144
|
'version' => '1.0.0',
|
|
124
145
|
),
|
|
125
146
|
array(
|
|
126
|
-
'name' => 'Flavor Elementor',
|
|
127
|
-
'slug' => 'flavor-elementor',
|
|
147
|
+
'name' => 'Flavor Elementor Extension',
|
|
148
|
+
'slug' => 'flavor-elementor-extension',
|
|
128
149
|
'source' => esc_url( $elementor_plugin_url ),
|
|
129
150
|
'required' => true,
|
|
130
151
|
'version' => '1.0.0',
|
|
131
152
|
),
|
|
153
|
+
// Third-party plugins — no version field, pulled from wp.org
|
|
154
|
+
array(
|
|
155
|
+
'name' => 'Elementor',
|
|
156
|
+
'slug' => 'elementor',
|
|
157
|
+
'required' => true,
|
|
158
|
+
),
|
|
159
|
+
array(
|
|
160
|
+
'name' => 'Contact Form 7',
|
|
161
|
+
'slug' => 'contact-form-7',
|
|
162
|
+
'required' => false,
|
|
163
|
+
),
|
|
132
164
|
);
|
|
133
165
|
|
|
134
166
|
tgmpa( $plugins, $config );
|
|
135
167
|
}
|
|
136
168
|
```
|
|
137
169
|
|
|
138
|
-
When `flavor-core`'s `package.json` has `"version": "2.0.0"`, processing updates only the matching entry:
|
|
170
|
+
When `flavor-core`'s `package.json` has `"version": "2.0.0"`, processing updates only the matching entry — the Elementor and Contact Form 7 entries are left untouched because they don't have a `version` field and their slugs don't match:
|
|
139
171
|
|
|
140
172
|
```diff
|
|
141
173
|
- 'version' => '1.0.0',
|
package/dist/core.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
export function buildComment(fields) {
|
|
3
3
|
const lines = ['/*'];
|
|
4
4
|
for (const [key, value] of Object.entries(fields)) {
|
|
5
|
-
lines.push(
|
|
5
|
+
lines.push(` * ${key}: ${value}`);
|
|
6
6
|
}
|
|
7
|
-
lines.push('*/');
|
|
7
|
+
lines.push(' */');
|
|
8
8
|
return lines.join('\n') + '\n';
|
|
9
9
|
}
|
|
10
10
|
/** Serialize a titled readme header block: `=== Title ===\n\nKey: Value\n\n` */
|