@webikon/webentor-codemods 0.1.0
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/CHANGELOG.md +24 -0
- package/LICENCE.md +7 -0
- package/README.md +85 -0
- package/bin/webentor-codemods.mjs +215 -0
- package/migrations/0.13.0/README.md +99 -0
- package/migrations/0.13.0/rules/deps.yml +311 -0
- package/migrations/0.13.0/rules/editor-enqueue-iframe.yml +62 -0
- package/migrations/__fixtures__/0.13.0/after/app/setup.php +226 -0
- package/migrations/__fixtures__/0.13.0/after/composer.json +63 -0
- package/migrations/__fixtures__/0.13.0/after/package.json +86 -0
- package/migrations/__fixtures__/0.13.0/before/app/setup.php +211 -0
- package/migrations/__fixtures__/0.13.0/before/composer.json +63 -0
- package/migrations/__fixtures__/0.13.0/before/package.json +86 -0
- package/migrations/__fixtures__/0.13.0/customized/app/setup.php +24 -0
- package/migrations/__fixtures__/0.13.0/customized/composer.json +63 -0
- package/migrations/__fixtures__/0.13.0/customized/package.json +86 -0
- package/migrations/index.json +17 -0
- package/package.json +52 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
# Dependency bumps for the webentor-core 0.13.0 upgrade.
|
|
2
|
+
#
|
|
3
|
+
# One rule per dependency, matched by its exact key (anchored regex, so e.g.
|
|
4
|
+
# "eslint" never matches "eslint-plugin-prettier") with a value-is-string guard
|
|
5
|
+
# (so a config object that shares a key — e.g. "lint-staged"/"prettier"/"stylelint"
|
|
6
|
+
# — is never clobbered), rewritten to the 0.13.0 starter baseline range regardless
|
|
7
|
+
# of the consumer's current value. The set is the complete
|
|
8
|
+
# `git diff <0.12 baseline> -- <theme>/{package,composer}.json`.
|
|
9
|
+
#
|
|
10
|
+
# `files:` scopes npm rules to package.json and the composer rule to composer.json.
|
|
11
|
+
# Held majors (react 18, eslint 9, vite 7, typescript 5, lint-staged 16) are
|
|
12
|
+
# intentionally absent. `name`/`version` are never touched.
|
|
13
|
+
id: deps-10up-block-components
|
|
14
|
+
language: json
|
|
15
|
+
files: ['**/package.json']
|
|
16
|
+
rule:
|
|
17
|
+
kind: pair
|
|
18
|
+
all:
|
|
19
|
+
- has: { field: key, regex: '^"@10up/block-components"$' }
|
|
20
|
+
- has: { field: value, kind: string }
|
|
21
|
+
fix: '"@10up/block-components": "^1.22.2"'
|
|
22
|
+
---
|
|
23
|
+
id: deps-eslint-js
|
|
24
|
+
language: json
|
|
25
|
+
files: ['**/package.json']
|
|
26
|
+
rule:
|
|
27
|
+
kind: pair
|
|
28
|
+
all:
|
|
29
|
+
- has: { field: key, regex: '^"@eslint/js"$' }
|
|
30
|
+
- has: { field: value, kind: string }
|
|
31
|
+
fix: '"@eslint/js": "^9.39.2"'
|
|
32
|
+
---
|
|
33
|
+
id: deps-ianvs-sort-imports
|
|
34
|
+
language: json
|
|
35
|
+
files: ['**/package.json']
|
|
36
|
+
rule:
|
|
37
|
+
kind: pair
|
|
38
|
+
all:
|
|
39
|
+
- has: { field: key, regex: '^"@ianvs/prettier-plugin-sort-imports"$' }
|
|
40
|
+
- has: { field: value, kind: string }
|
|
41
|
+
fix: '"@ianvs/prettier-plugin-sort-imports": "^4.7.1"'
|
|
42
|
+
---
|
|
43
|
+
id: deps-roots-vite-plugin
|
|
44
|
+
language: json
|
|
45
|
+
files: ['**/package.json']
|
|
46
|
+
rule:
|
|
47
|
+
kind: pair
|
|
48
|
+
all:
|
|
49
|
+
- has: { field: key, regex: '^"@roots/vite-plugin"$' }
|
|
50
|
+
- has: { field: value, kind: string }
|
|
51
|
+
fix: '"@roots/vite-plugin": "^1.3.1"'
|
|
52
|
+
---
|
|
53
|
+
id: deps-shufo-blade
|
|
54
|
+
language: json
|
|
55
|
+
files: ['**/package.json']
|
|
56
|
+
rule:
|
|
57
|
+
kind: pair
|
|
58
|
+
all:
|
|
59
|
+
- has: { field: key, regex: '^"@shufo/prettier-plugin-blade"$' }
|
|
60
|
+
- has: { field: value, kind: string }
|
|
61
|
+
fix: '"@shufo/prettier-plugin-blade": "^1.16.2"'
|
|
62
|
+
---
|
|
63
|
+
id: deps-tailwindcss-postcss
|
|
64
|
+
language: json
|
|
65
|
+
files: ['**/package.json']
|
|
66
|
+
rule:
|
|
67
|
+
kind: pair
|
|
68
|
+
all:
|
|
69
|
+
- has: { field: key, regex: '^"@tailwindcss/postcss"$' }
|
|
70
|
+
- has: { field: value, kind: string }
|
|
71
|
+
fix: '"@tailwindcss/postcss": "^4.3.1"'
|
|
72
|
+
---
|
|
73
|
+
id: deps-tailwindcss-vite
|
|
74
|
+
language: json
|
|
75
|
+
files: ['**/package.json']
|
|
76
|
+
rule:
|
|
77
|
+
kind: pair
|
|
78
|
+
all:
|
|
79
|
+
- has: { field: key, regex: '^"@tailwindcss/vite"$' }
|
|
80
|
+
- has: { field: value, kind: string }
|
|
81
|
+
fix: '"@tailwindcss/vite": "^4.3.1"'
|
|
82
|
+
---
|
|
83
|
+
id: deps-types-wordpress-block-editor
|
|
84
|
+
language: json
|
|
85
|
+
files: ['**/package.json']
|
|
86
|
+
rule:
|
|
87
|
+
kind: pair
|
|
88
|
+
all:
|
|
89
|
+
- has: { field: key, regex: '^"@types/wordpress__block-editor"$' }
|
|
90
|
+
- has: { field: value, kind: string }
|
|
91
|
+
fix: '"@types/wordpress__block-editor": "^15.0.6"'
|
|
92
|
+
---
|
|
93
|
+
id: deps-vitejs-plugin-react
|
|
94
|
+
language: json
|
|
95
|
+
files: ['**/package.json']
|
|
96
|
+
rule:
|
|
97
|
+
kind: pair
|
|
98
|
+
all:
|
|
99
|
+
- has: { field: key, regex: '^"@vitejs/plugin-react"$' }
|
|
100
|
+
- has: { field: value, kind: string }
|
|
101
|
+
fix: '"@vitejs/plugin-react": "^5.2.0"'
|
|
102
|
+
---
|
|
103
|
+
id: deps-webentor-core-npm
|
|
104
|
+
language: json
|
|
105
|
+
files: ['**/package.json']
|
|
106
|
+
rule:
|
|
107
|
+
kind: pair
|
|
108
|
+
all:
|
|
109
|
+
- has: { field: key, regex: '^"@webikon/webentor-core"$' }
|
|
110
|
+
- has: { field: value, kind: string }
|
|
111
|
+
fix: '"@webikon/webentor-core": "^0.13.0"'
|
|
112
|
+
---
|
|
113
|
+
id: deps-wp-block-editor
|
|
114
|
+
language: json
|
|
115
|
+
files: ['**/package.json']
|
|
116
|
+
rule:
|
|
117
|
+
kind: pair
|
|
118
|
+
all:
|
|
119
|
+
- has: { field: key, regex: '^"@wordpress/block-editor"$' }
|
|
120
|
+
- has: { field: value, kind: string }
|
|
121
|
+
fix: '"@wordpress/block-editor": "^15.21.1"'
|
|
122
|
+
---
|
|
123
|
+
id: deps-wp-block-library
|
|
124
|
+
language: json
|
|
125
|
+
files: ['**/package.json']
|
|
126
|
+
rule:
|
|
127
|
+
kind: pair
|
|
128
|
+
all:
|
|
129
|
+
- has: { field: key, regex: '^"@wordpress/block-library"$' }
|
|
130
|
+
- has: { field: value, kind: string }
|
|
131
|
+
fix: '"@wordpress/block-library": "^9.48.1"'
|
|
132
|
+
---
|
|
133
|
+
id: deps-wp-blocks
|
|
134
|
+
language: json
|
|
135
|
+
files: ['**/package.json']
|
|
136
|
+
rule:
|
|
137
|
+
kind: pair
|
|
138
|
+
all:
|
|
139
|
+
- has: { field: key, regex: '^"@wordpress/blocks"$' }
|
|
140
|
+
- has: { field: value, kind: string }
|
|
141
|
+
fix: '"@wordpress/blocks": "^15.21.1"'
|
|
142
|
+
---
|
|
143
|
+
id: deps-wp-components
|
|
144
|
+
language: json
|
|
145
|
+
files: ['**/package.json']
|
|
146
|
+
rule:
|
|
147
|
+
kind: pair
|
|
148
|
+
all:
|
|
149
|
+
- has: { field: key, regex: '^"@wordpress/components"$' }
|
|
150
|
+
- has: { field: value, kind: string }
|
|
151
|
+
fix: '"@wordpress/components": "^35.0.1"'
|
|
152
|
+
---
|
|
153
|
+
id: deps-wp-dependency-extraction
|
|
154
|
+
language: json
|
|
155
|
+
files: ['**/package.json']
|
|
156
|
+
rule:
|
|
157
|
+
kind: pair
|
|
158
|
+
all:
|
|
159
|
+
- has: { field: key, regex: '^"@wordpress/dependency-extraction-webpack-plugin"$' }
|
|
160
|
+
- has: { field: value, kind: string }
|
|
161
|
+
fix: '"@wordpress/dependency-extraction-webpack-plugin": "^6.48.1"'
|
|
162
|
+
---
|
|
163
|
+
id: deps-wp-i18n
|
|
164
|
+
language: json
|
|
165
|
+
files: ['**/package.json']
|
|
166
|
+
rule:
|
|
167
|
+
kind: pair
|
|
168
|
+
all:
|
|
169
|
+
- has: { field: key, regex: '^"@wordpress/i18n"$' }
|
|
170
|
+
- has: { field: value, kind: string }
|
|
171
|
+
fix: '"@wordpress/i18n": "^6.21.1"'
|
|
172
|
+
---
|
|
173
|
+
id: deps-wp-icons
|
|
174
|
+
language: json
|
|
175
|
+
files: ['**/package.json']
|
|
176
|
+
rule:
|
|
177
|
+
kind: pair
|
|
178
|
+
all:
|
|
179
|
+
- has: { field: key, regex: '^"@wordpress/icons"$' }
|
|
180
|
+
- has: { field: value, kind: string }
|
|
181
|
+
fix: '"@wordpress/icons": "^14.0.1"'
|
|
182
|
+
---
|
|
183
|
+
id: deps-eslint
|
|
184
|
+
language: json
|
|
185
|
+
files: ['**/package.json']
|
|
186
|
+
rule:
|
|
187
|
+
kind: pair
|
|
188
|
+
all:
|
|
189
|
+
- has: { field: key, regex: '^"eslint"$' }
|
|
190
|
+
- has: { field: value, kind: string }
|
|
191
|
+
fix: '"eslint": "^9.39.2"'
|
|
192
|
+
---
|
|
193
|
+
id: deps-eslint-plugin-prettier
|
|
194
|
+
language: json
|
|
195
|
+
files: ['**/package.json']
|
|
196
|
+
rule:
|
|
197
|
+
kind: pair
|
|
198
|
+
all:
|
|
199
|
+
- has: { field: key, regex: '^"eslint-plugin-prettier"$' }
|
|
200
|
+
- has: { field: value, kind: string }
|
|
201
|
+
fix: '"eslint-plugin-prettier": "^5.5.6"'
|
|
202
|
+
---
|
|
203
|
+
id: deps-lint-staged
|
|
204
|
+
language: json
|
|
205
|
+
files: ['**/package.json']
|
|
206
|
+
rule:
|
|
207
|
+
kind: pair
|
|
208
|
+
all:
|
|
209
|
+
- has: { field: key, regex: '^"lint-staged"$' }
|
|
210
|
+
- has: { field: value, kind: string }
|
|
211
|
+
fix: '"lint-staged": "^16.4.0"'
|
|
212
|
+
---
|
|
213
|
+
id: deps-postcss
|
|
214
|
+
language: json
|
|
215
|
+
files: ['**/package.json']
|
|
216
|
+
rule:
|
|
217
|
+
kind: pair
|
|
218
|
+
all:
|
|
219
|
+
- has: { field: key, regex: '^"postcss"$' }
|
|
220
|
+
- has: { field: value, kind: string }
|
|
221
|
+
fix: '"postcss": "^8.5.15"'
|
|
222
|
+
---
|
|
223
|
+
id: deps-prettier
|
|
224
|
+
language: json
|
|
225
|
+
files: ['**/package.json']
|
|
226
|
+
rule:
|
|
227
|
+
kind: pair
|
|
228
|
+
all:
|
|
229
|
+
- has: { field: key, regex: '^"prettier"$' }
|
|
230
|
+
- has: { field: value, kind: string }
|
|
231
|
+
fix: '"prettier": "^3.8.4"'
|
|
232
|
+
---
|
|
233
|
+
id: deps-prettier-plugin-tailwindcss
|
|
234
|
+
language: json
|
|
235
|
+
files: ['**/package.json']
|
|
236
|
+
rule:
|
|
237
|
+
kind: pair
|
|
238
|
+
all:
|
|
239
|
+
- has: { field: key, regex: '^"prettier-plugin-tailwindcss"$' }
|
|
240
|
+
- has: { field: value, kind: string }
|
|
241
|
+
fix: '"prettier-plugin-tailwindcss": "^0.8.0"'
|
|
242
|
+
---
|
|
243
|
+
id: deps-stylelint
|
|
244
|
+
language: json
|
|
245
|
+
files: ['**/package.json']
|
|
246
|
+
rule:
|
|
247
|
+
kind: pair
|
|
248
|
+
all:
|
|
249
|
+
- has: { field: key, regex: '^"stylelint"$' }
|
|
250
|
+
- has: { field: value, kind: string }
|
|
251
|
+
fix: '"stylelint": "^17.13.0"'
|
|
252
|
+
---
|
|
253
|
+
id: deps-stylelint-config-recommended
|
|
254
|
+
language: json
|
|
255
|
+
files: ['**/package.json']
|
|
256
|
+
rule:
|
|
257
|
+
kind: pair
|
|
258
|
+
all:
|
|
259
|
+
- has: { field: key, regex: '^"stylelint-config-recommended"$' }
|
|
260
|
+
- has: { field: value, kind: string }
|
|
261
|
+
fix: '"stylelint-config-recommended": "^18.0.0"'
|
|
262
|
+
---
|
|
263
|
+
id: deps-tailwindcss
|
|
264
|
+
language: json
|
|
265
|
+
files: ['**/package.json']
|
|
266
|
+
rule:
|
|
267
|
+
kind: pair
|
|
268
|
+
all:
|
|
269
|
+
- has: { field: key, regex: '^"tailwindcss"$' }
|
|
270
|
+
- has: { field: value, kind: string }
|
|
271
|
+
fix: '"tailwindcss": "^4.3.1"'
|
|
272
|
+
---
|
|
273
|
+
id: deps-typescript-eslint
|
|
274
|
+
language: json
|
|
275
|
+
files: ['**/package.json']
|
|
276
|
+
rule:
|
|
277
|
+
kind: pair
|
|
278
|
+
all:
|
|
279
|
+
- has: { field: key, regex: '^"typescript-eslint"$' }
|
|
280
|
+
- has: { field: value, kind: string }
|
|
281
|
+
fix: '"typescript-eslint": "^8.61.1"'
|
|
282
|
+
---
|
|
283
|
+
id: deps-vite
|
|
284
|
+
language: json
|
|
285
|
+
files: ['**/package.json']
|
|
286
|
+
rule:
|
|
287
|
+
kind: pair
|
|
288
|
+
all:
|
|
289
|
+
- has: { field: key, regex: '^"vite"$' }
|
|
290
|
+
- has: { field: value, kind: string }
|
|
291
|
+
fix: '"vite": "^7.3.5"'
|
|
292
|
+
---
|
|
293
|
+
id: deps-alpinejs-intersect
|
|
294
|
+
language: json
|
|
295
|
+
files: ['**/package.json']
|
|
296
|
+
rule:
|
|
297
|
+
kind: pair
|
|
298
|
+
all:
|
|
299
|
+
- has: { field: key, regex: '^"@alpinejs/intersect"$' }
|
|
300
|
+
- has: { field: value, kind: string }
|
|
301
|
+
fix: '"@alpinejs/intersect": "^3.15.12"'
|
|
302
|
+
---
|
|
303
|
+
id: deps-webentor-core-composer
|
|
304
|
+
language: json
|
|
305
|
+
files: ['**/composer.json']
|
|
306
|
+
rule:
|
|
307
|
+
kind: pair
|
|
308
|
+
all:
|
|
309
|
+
- has: { field: key, regex: '^"webikon/webentor-core"$' }
|
|
310
|
+
- has: { field: value, kind: string }
|
|
311
|
+
fix: '"webikon/webentor-core": "^0.13"'
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
id: theme-editor-enqueue-iframe
|
|
2
|
+
language: php
|
|
3
|
+
severity: hint
|
|
4
|
+
message: >-
|
|
5
|
+
Move editor canvas styles to `enqueue_block_assets` (is_admin) so WP 7.0's
|
|
6
|
+
iframed editor styles them correctly.
|
|
7
|
+
note: >-
|
|
8
|
+
Matches the canonical theme `app/setup.php` that enqueues the editor JS plus
|
|
9
|
+
the `editor.css` and `button.style.css` styles all on
|
|
10
|
+
`enqueue_block_editor_assets`. Rewrites it so the JS stays on
|
|
11
|
+
`enqueue_block_editor_assets` while the two styles move to a new
|
|
12
|
+
`enqueue_block_assets` hook guarded by `is_admin()` (WP 7.0 iframe editor).
|
|
13
|
+
Already-migrated files (no styles left on that hook) do not match — idempotent.
|
|
14
|
+
rule:
|
|
15
|
+
all:
|
|
16
|
+
- pattern: "add_action('enqueue_block_editor_assets', function (): void { $$$BODY }, 10);"
|
|
17
|
+
- has:
|
|
18
|
+
pattern: "\\Kucrut\\Vite\\enqueue_asset($JSDIR, 'resources/scripts/editor.ts', $JSOPTS)"
|
|
19
|
+
stopBy: end
|
|
20
|
+
- has:
|
|
21
|
+
pattern: "\\Kucrut\\Vite\\enqueue_asset($SDIR, 'resources/styles/editor.css', $SOPTS)"
|
|
22
|
+
stopBy: end
|
|
23
|
+
- has:
|
|
24
|
+
pattern: "\\Kucrut\\Vite\\enqueue_asset($BDIR, 'resources/core-components/button/button.style.css', $BOPTS)"
|
|
25
|
+
stopBy: end
|
|
26
|
+
fix: |-
|
|
27
|
+
add_action('enqueue_block_editor_assets', function (): void {
|
|
28
|
+
$dependencies = File::exists(get_template_directory() . '/public/build/editor.deps.json') ? File::json(get_template_directory() . '/public/build/editor.deps.json') : [];
|
|
29
|
+
|
|
30
|
+
\Kucrut\Vite\enqueue_asset(
|
|
31
|
+
$JSDIR,
|
|
32
|
+
'resources/scripts/editor.ts',
|
|
33
|
+
$JSOPTS
|
|
34
|
+
);
|
|
35
|
+
}, 10);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Enqueue global block-editor styles into the editor canvas.
|
|
39
|
+
*
|
|
40
|
+
* Since WP 6.9/7.0 the editor runs in an iframe. Global canvas styles must be
|
|
41
|
+
* registered on `enqueue_block_assets` (not `enqueue_block_editor_assets`) so
|
|
42
|
+
* WordPress routes them into the iframe; otherwise it warns that the style was
|
|
43
|
+
* "added to the iframe incorrectly". The `is_admin()` guard keeps them off the
|
|
44
|
+
* public frontend, where this hook also fires.
|
|
45
|
+
*/
|
|
46
|
+
add_action('enqueue_block_assets', function (): void {
|
|
47
|
+
if (!is_admin()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
\Kucrut\Vite\enqueue_asset(
|
|
52
|
+
$SDIR,
|
|
53
|
+
'resources/styles/editor.css',
|
|
54
|
+
$SOPTS
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
\Kucrut\Vite\enqueue_asset(
|
|
58
|
+
$BDIR,
|
|
59
|
+
'resources/core-components/button/button.style.css',
|
|
60
|
+
$BOPTS
|
|
61
|
+
);
|
|
62
|
+
}, 10);
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
namespace App;
|
|
4
|
+
|
|
5
|
+
use Illuminate\Support\Facades\File;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Register the theme assets.
|
|
9
|
+
*
|
|
10
|
+
* @return void
|
|
11
|
+
*/
|
|
12
|
+
add_action('enqueue_block_editor_assets', function (): void {
|
|
13
|
+
$dependencies = File::exists(get_template_directory() . '/public/build/editor.deps.json') ? File::json(get_template_directory() . '/public/build/editor.deps.json') : [];
|
|
14
|
+
|
|
15
|
+
\Kucrut\Vite\enqueue_asset(
|
|
16
|
+
get_template_directory() . '/public/build',
|
|
17
|
+
'resources/scripts/editor.ts',
|
|
18
|
+
[
|
|
19
|
+
'handle' => 'theme-blocks-editor',
|
|
20
|
+
'dependencies' => $dependencies,
|
|
21
|
+
'in-footer' => true, // Optional. Defaults to false.
|
|
22
|
+
]
|
|
23
|
+
);
|
|
24
|
+
}, 10);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Enqueue global block-editor styles into the editor canvas.
|
|
28
|
+
*
|
|
29
|
+
* Since WP 6.9/7.0 the editor runs in an iframe. Global canvas styles must be
|
|
30
|
+
* registered on `enqueue_block_assets` (not `enqueue_block_editor_assets`) so
|
|
31
|
+
* WordPress routes them into the iframe; otherwise it warns that the style was
|
|
32
|
+
* "added to the iframe incorrectly". The `is_admin()` guard keeps them off the
|
|
33
|
+
* public frontend, where this hook also fires.
|
|
34
|
+
*/
|
|
35
|
+
add_action('enqueue_block_assets', function (): void {
|
|
36
|
+
if (!is_admin()) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
\Kucrut\Vite\enqueue_asset(
|
|
41
|
+
get_template_directory() . '/public/build',
|
|
42
|
+
'resources/styles/editor.css',
|
|
43
|
+
[
|
|
44
|
+
'handle' => 'theme-blocks-editor-styles',
|
|
45
|
+
'css-only' => true,
|
|
46
|
+
]
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
\Kucrut\Vite\enqueue_asset(
|
|
50
|
+
get_template_directory() . '/public/build',
|
|
51
|
+
'resources/core-components/button/button.style.css',
|
|
52
|
+
[
|
|
53
|
+
'handle' => 'theme-button-styles',
|
|
54
|
+
'css-only' => true,
|
|
55
|
+
]
|
|
56
|
+
);
|
|
57
|
+
}, 10);
|
|
58
|
+
|
|
59
|
+
add_action('wp_enqueue_scripts', function () {
|
|
60
|
+
\Kucrut\Vite\enqueue_asset(
|
|
61
|
+
get_template_directory() . '/public/build',
|
|
62
|
+
'resources/scripts/app.ts',
|
|
63
|
+
[
|
|
64
|
+
'handle' => 'theme-app-scripts',
|
|
65
|
+
'in-footer' => true
|
|
66
|
+
]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
\Kucrut\Vite\enqueue_asset(
|
|
70
|
+
get_template_directory() . '/public/build',
|
|
71
|
+
'resources/styles/app.css',
|
|
72
|
+
[
|
|
73
|
+
'handle' => 'theme-app-styles',
|
|
74
|
+
'css-only' => true,
|
|
75
|
+
]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
\Kucrut\Vite\enqueue_asset(
|
|
79
|
+
get_template_directory() . '/public/build',
|
|
80
|
+
'resources/styles/lightgallery.css',
|
|
81
|
+
[
|
|
82
|
+
'handle' => 'theme-lightgallery-styles',
|
|
83
|
+
'css-only' => true,
|
|
84
|
+
]
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
// Core components
|
|
88
|
+
\Kucrut\Vite\enqueue_asset(
|
|
89
|
+
get_template_directory() . '/public/build',
|
|
90
|
+
'resources/core-components/button/button.style.css',
|
|
91
|
+
[
|
|
92
|
+
'handle' => 'theme-button-styles',
|
|
93
|
+
'css-only' => true,
|
|
94
|
+
]
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// $manifest = \Kucrut\Vite\get_manifest(get_template_directory() . '/public/build');
|
|
98
|
+
|
|
99
|
+
// $components = glob(get_template_directory() . '/resources/core-components/*/');
|
|
100
|
+
// foreach ($components as $component) {
|
|
101
|
+
// $componentName = basename($component);
|
|
102
|
+
// if (!empty($manifest->data->{"resources/core-components/{$componentName}/{$componentName}.script.ts"})) {
|
|
103
|
+
// \Kucrut\Vite\enqueue_asset(
|
|
104
|
+
// get_template_directory() . '/public/build',
|
|
105
|
+
// "resources/core-components/{$componentName}/{$componentName}.script.ts",
|
|
106
|
+
// [
|
|
107
|
+
// 'handle' => "theme-{$componentName}-scripts",
|
|
108
|
+
// ]
|
|
109
|
+
// );
|
|
110
|
+
// }
|
|
111
|
+
|
|
112
|
+
// if (!empty($manifest->data->{"resources/core-components/{$componentName}/{$componentName}.style.css"})) {
|
|
113
|
+
// \Kucrut\Vite\enqueue_asset(
|
|
114
|
+
// get_template_directory() . '/public/build',
|
|
115
|
+
// "resources/core-components/{$componentName}/{$componentName}.style.css",
|
|
116
|
+
// [
|
|
117
|
+
// 'handle' => "theme-{$componentName}-styles",
|
|
118
|
+
// 'css-only' => true,
|
|
119
|
+
// ]
|
|
120
|
+
// );
|
|
121
|
+
// }
|
|
122
|
+
// }
|
|
123
|
+
}, 10);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Use the generated theme.json file.
|
|
127
|
+
*
|
|
128
|
+
* @return string
|
|
129
|
+
*/
|
|
130
|
+
add_filter('theme_file_path', function ($path, $file) {
|
|
131
|
+
return $file === 'theme.json'
|
|
132
|
+
? public_path('build/assets/theme.json')
|
|
133
|
+
: $path;
|
|
134
|
+
}, 10, 2);
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Add custom classes to body.
|
|
138
|
+
*
|
|
139
|
+
* @param array $classes Array of body classes.
|
|
140
|
+
* @return array Modified array of body classes.
|
|
141
|
+
*/
|
|
142
|
+
add_filter('body_class', function (array $classes): array {
|
|
143
|
+
$classes[] = 'webentor-theme';
|
|
144
|
+
|
|
145
|
+
return $classes;
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Add custom classes to Gutenberg editor wrapper, but only on edit pages.
|
|
150
|
+
*
|
|
151
|
+
* @param string $classes String of editor wrapper classes.
|
|
152
|
+
* @return string Modified string of editor wrapper classes.
|
|
153
|
+
*/
|
|
154
|
+
add_filter('admin_body_class', function (string $classes): string {
|
|
155
|
+
$screen = get_current_screen();
|
|
156
|
+
|
|
157
|
+
if ($screen && $screen->is_block_editor()) {
|
|
158
|
+
$classes .= ' webentor-theme';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return $classes;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Register the initial theme setup.
|
|
166
|
+
*
|
|
167
|
+
* @return void
|
|
168
|
+
*/
|
|
169
|
+
add_action('after_setup_theme', function () {
|
|
170
|
+
/**
|
|
171
|
+
* Load languages.
|
|
172
|
+
*/
|
|
173
|
+
load_theme_textdomain('webentor', get_stylesheet_directory() . '/resources/languages');
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Register the navigation menus.
|
|
177
|
+
*
|
|
178
|
+
* @link https://developer.wordpress.org/reference/functions/register_nav_menus/
|
|
179
|
+
*/
|
|
180
|
+
register_nav_menus([
|
|
181
|
+
'primary_nav' => __('Primary Nav', 'webentor'),
|
|
182
|
+
]);
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Enable plugins to manage the document title.
|
|
186
|
+
*
|
|
187
|
+
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#title-tag
|
|
188
|
+
*/
|
|
189
|
+
add_theme_support('title-tag');
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Enable post thumbnail support.
|
|
193
|
+
*
|
|
194
|
+
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
|
|
195
|
+
*/
|
|
196
|
+
add_theme_support('post-thumbnails');
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Enable responsive embed support.
|
|
200
|
+
*
|
|
201
|
+
* @link https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#responsive-embedded-content
|
|
202
|
+
*/
|
|
203
|
+
add_theme_support('responsive-embeds');
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Enable HTML5 markup support.
|
|
207
|
+
*
|
|
208
|
+
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
|
|
209
|
+
*/
|
|
210
|
+
add_theme_support('html5', [
|
|
211
|
+
'caption',
|
|
212
|
+
'comment-form',
|
|
213
|
+
'comment-list',
|
|
214
|
+
'gallery',
|
|
215
|
+
'search-form',
|
|
216
|
+
'script',
|
|
217
|
+
'style',
|
|
218
|
+
]);
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Enable selective refresh for widgets in customizer.
|
|
222
|
+
*
|
|
223
|
+
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#customize-selective-refresh-widgets
|
|
224
|
+
*/
|
|
225
|
+
add_theme_support('customize-selective-refresh-widgets');
|
|
226
|
+
}, 20);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webikon/webentor-theme",
|
|
3
|
+
"type": "wordpress-theme",
|
|
4
|
+
"version": "2.0.6",
|
|
5
|
+
"description": "Webentor starter theme",
|
|
6
|
+
"homepage": "https://webikon.sk",
|
|
7
|
+
"authors": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Roots",
|
|
10
|
+
"homepage": "https://github.com/roots/sage"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "Webikon s.r.o.",
|
|
14
|
+
"email": "support@webikon.sk",
|
|
15
|
+
"homepage": "https://webikon.sk"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Pavol Caban",
|
|
19
|
+
"email": "pavol.caban@webikon.sk",
|
|
20
|
+
"homepage": "https://webikon.sk"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
"repositories": [
|
|
24
|
+
{
|
|
25
|
+
"type": "github",
|
|
26
|
+
"url": "https://github.com/webikon/webentor-core.git"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"autoload": {
|
|
30
|
+
"psr-4": {
|
|
31
|
+
"App\\": "app/"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"php": ">=8.3",
|
|
36
|
+
"johnbillion/extended-cpts": "^5.0",
|
|
37
|
+
"log1x/acf-composer": "^3.0",
|
|
38
|
+
"log1x/sage-directives": "^2.0",
|
|
39
|
+
"log1x/sage-svg": "^2.0",
|
|
40
|
+
"roots/acorn": "^5.0",
|
|
41
|
+
"roots/acorn-prettify": "^1.0",
|
|
42
|
+
"stoutlogic/acf-builder": "^1.12",
|
|
43
|
+
"webikon/webentor-core": "^0.13"
|
|
44
|
+
},
|
|
45
|
+
"require-dev": {
|
|
46
|
+
"squizlabs/php_codesniffer": "^3.8.0"
|
|
47
|
+
},
|
|
48
|
+
"config": {
|
|
49
|
+
"optimize-autoloader": true,
|
|
50
|
+
"preferred-install": "dist",
|
|
51
|
+
"sort-packages": true
|
|
52
|
+
},
|
|
53
|
+
"minimum-stability": "dev",
|
|
54
|
+
"prefer-stable": true,
|
|
55
|
+
"scripts": {
|
|
56
|
+
"post-autoload-dump": [
|
|
57
|
+
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
|
|
58
|
+
],
|
|
59
|
+
"lint": [
|
|
60
|
+
"phpcs --extensions=php --standard=PSR12 app"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|