generator-chisel 2.2.2 → 2.3.1
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 +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factories/RegisterBlocks.php +16 -7
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugins/Woocommerce.php +18 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Blocks.php +51 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/WP/Site.php +0 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +6 -5
- package/lib/commands/create/creators/app/chisel-starter-theme/webpack.config.js +0 -11
- package/lib/commands/create/packages-versions.js +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## <small>2.3.1 (2025-12-16)</small>
|
|
6
|
+
|
|
7
|
+
- add wp interactivity api support, optimize css build, refactor webpack config ([319d822](https://github.com/xfiveco/generator-chisel/commit/319d822))
|
|
8
|
+
|
|
9
|
+
## 2.3.0 (2025-12-15)
|
|
10
|
+
|
|
11
|
+
- add wp exp-modules support, update wp scripts, build file size limits, auto clear patterns cache, no ([728f566](https://github.com/xfiveco/generator-chisel/commit/728f566))
|
|
12
|
+
- Publish ([0fc6fce](https://github.com/xfiveco/generator-chisel/commit/0fc6fce))
|
|
13
|
+
|
|
5
14
|
## <small>2.2.2 (2025-11-07)</small>
|
|
6
15
|
|
|
7
16
|
- blocks adjustments, new patterns, fixes, block mods ([19f038f](https://github.com/xfiveco/generator-chisel/commit/19f038f))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
20.12.2
|
|
1
|
+
>=20.12.2
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Factories/RegisterBlocks.php
CHANGED
|
@@ -187,13 +187,22 @@ final class RegisterBlocks {
|
|
|
187
187
|
|
|
188
188
|
// Register ignored scripts in dev mode in order to watch changes.
|
|
189
189
|
if ( ThemeHelpers::is_fast_refresh() || ( ! ThemeHelpers::is_fast_refresh() && ! in_array( $script, $ignore_scripts, true ) ) ) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
if ( 'viewscriptmodule' === $script_handle ) {
|
|
191
|
+
wp_register_script_module(
|
|
192
|
+
$block_handle,
|
|
193
|
+
$file_url,
|
|
194
|
+
$script_asset['dependencies'],
|
|
195
|
+
$script_asset['version']
|
|
196
|
+
);
|
|
197
|
+
} else {
|
|
198
|
+
wp_register_script(
|
|
199
|
+
$block_handle,
|
|
200
|
+
$file_url,
|
|
201
|
+
$script_asset['dependencies'],
|
|
202
|
+
$script_asset['version'],
|
|
203
|
+
$register_script_args
|
|
204
|
+
);
|
|
205
|
+
}
|
|
197
206
|
}
|
|
198
207
|
}
|
|
199
208
|
}
|
|
@@ -55,6 +55,8 @@ final class Woocommerce implements InstanceInterface, HooksInterface {
|
|
|
55
55
|
public function action_hooks(): void {
|
|
56
56
|
$this->remove_actions();
|
|
57
57
|
|
|
58
|
+
add_action( 'rest_api_init', array( $this, 'register_cart' ) );
|
|
59
|
+
|
|
58
60
|
add_action( 'after_setup_theme', array( $this, 'add_woocommerce_support' ) );
|
|
59
61
|
|
|
60
62
|
add_action( 'woocommerce_before_shop_loop', array( $this, 'before_shop_loop_div_open' ), 19 );
|
|
@@ -101,6 +103,22 @@ final class Woocommerce implements InstanceInterface, HooksInterface {
|
|
|
101
103
|
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 );
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Get access to cart in REST API endpoints.
|
|
108
|
+
*
|
|
109
|
+
* @return void
|
|
110
|
+
*/
|
|
111
|
+
public function register_cart(): void {
|
|
112
|
+
include_once WC_ABSPATH . 'includes/wc-cart-functions.php';
|
|
113
|
+
include_once WC_ABSPATH . 'includes/wc-notice-functions.php';
|
|
114
|
+
|
|
115
|
+
WC()->initialize_session();
|
|
116
|
+
WC()->initialize_cart();
|
|
117
|
+
WC()->session->set_customer_session_cookie( true );
|
|
118
|
+
|
|
119
|
+
WC()->cart->get_cart();
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
/**
|
|
105
123
|
* Add WooCommerce support.
|
|
106
124
|
*/
|
|
@@ -29,6 +29,13 @@ final class Blocks implements InstanceInterface, HooksInterface {
|
|
|
29
29
|
*/
|
|
30
30
|
private RegisterBlocks $register_blocks_factory;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Theme.
|
|
34
|
+
*
|
|
35
|
+
* @var \WP_Theme
|
|
36
|
+
*/
|
|
37
|
+
private ?\WP_Theme $theme = null;
|
|
38
|
+
|
|
32
39
|
/**
|
|
33
40
|
* Blocks.
|
|
34
41
|
*
|
|
@@ -51,6 +58,14 @@ final class Blocks implements InstanceInterface, HooksInterface {
|
|
|
51
58
|
*/
|
|
52
59
|
private array $block_patterns_categories = array();
|
|
53
60
|
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Blocks patterns categories namespace.
|
|
64
|
+
*
|
|
65
|
+
* @var string
|
|
66
|
+
*/
|
|
67
|
+
private string $block_patterns_categories_namespace = '';
|
|
68
|
+
|
|
54
69
|
/**
|
|
55
70
|
* Blocks twig file base path.
|
|
56
71
|
*
|
|
@@ -75,8 +90,10 @@ final class Blocks implements InstanceInterface, HooksInterface {
|
|
|
75
90
|
* Set properties.
|
|
76
91
|
*/
|
|
77
92
|
public function set_properties(): void {
|
|
78
|
-
$this->
|
|
79
|
-
$this->
|
|
93
|
+
$this->theme = wp_get_theme();
|
|
94
|
+
$this->blocks_category = 'chisel-blocks';
|
|
95
|
+
$this->block_patterns_categories_namespace = 'chisel-patterns';
|
|
96
|
+
$this->block_patterns_categories = array(
|
|
80
97
|
'cta' => array(
|
|
81
98
|
'label' => __( 'Call to Action', 'chisel' ),
|
|
82
99
|
'description' => __( 'Call to Action Sections.', 'chisel' ),
|
|
@@ -173,9 +190,11 @@ final class Blocks implements InstanceInterface, HooksInterface {
|
|
|
173
190
|
return;
|
|
174
191
|
}
|
|
175
192
|
|
|
193
|
+
$this->maybe_clear_patterns_cache();
|
|
194
|
+
|
|
176
195
|
foreach ( $this->block_patterns_categories as $slug => $category ) {
|
|
177
196
|
$category['label'] = sprintf( '[%s] %s', ThemeHelpers::get_theme_name(), esc_attr( $category['label'] ) );
|
|
178
|
-
register_block_pattern_category( '
|
|
197
|
+
register_block_pattern_category( $this->block_patterns_categories_namespace . '/' . $slug, $category );
|
|
179
198
|
}
|
|
180
199
|
}
|
|
181
200
|
|
|
@@ -313,4 +332,33 @@ final class Blocks implements InstanceInterface, HooksInterface {
|
|
|
313
332
|
}
|
|
314
333
|
}
|
|
315
334
|
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Maybe clear patterns cache. Clear patterns cache if block patterns categories are changed / added.
|
|
338
|
+
*
|
|
339
|
+
* @return void
|
|
340
|
+
*/
|
|
341
|
+
protected function maybe_clear_patterns_cache() {
|
|
342
|
+
if ( ! $this->block_patterns_categories ) {
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
$theme_patterns = $this->block_patterns_categories;
|
|
347
|
+
$cached_patterns = $this->theme->get_block_patterns();
|
|
348
|
+
$patterns_categories = array();
|
|
349
|
+
|
|
350
|
+
foreach ( $cached_patterns as $pattern ) {
|
|
351
|
+
foreach ( $pattern['categories'] ?? array() as $category ) {
|
|
352
|
+
$category = str_replace( $this->block_patterns_categories_namespace . '/', '', $category );
|
|
353
|
+
|
|
354
|
+
if ( isset( $theme_patterns[ $category ] ) ) {
|
|
355
|
+
unset( $theme_patterns[ $category ] );
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
if ( ! empty( $theme_patterns ) ) {
|
|
361
|
+
$this->theme->delete_pattern_cache();
|
|
362
|
+
}
|
|
363
|
+
}
|
|
316
364
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%= app.nameSlug %>",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "<%= app.author %>",
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"devcontainer:up": "npm run --silent devcontainer -- up --workspace-folder ../../..",
|
|
11
11
|
"devcontainer:enter": "/usr/bin/env bash ../../../.devcontainer/exec bash",
|
|
12
12
|
"devcontainer:start": "/usr/bin/env bash ../../../.devcontainer/exec npm run --silent start",
|
|
13
|
-
"start": "chisel-scripts start",
|
|
13
|
+
"start": "chisel-scripts start --experimental-modules",
|
|
14
14
|
"dev": "npm run --silent start",
|
|
15
|
-
"build": "chisel-scripts build
|
|
16
|
-
"build
|
|
15
|
+
"build-scripts": "chisel-scripts build --experimental-modules",
|
|
16
|
+
"build": "npm run build-scripts && npm run lint && npm run phpcs && npm run twigcs",
|
|
17
17
|
"add-page": "chisel-scripts add-page",
|
|
18
18
|
"create-block": "chisel-scripts create-block --category=chisel-blocks --namespace=chisel",
|
|
19
19
|
"create-dynamic-block": "npm run create-block --variant=dynamic",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"swiper": "^11.1.10"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@wordpress/scripts": "^
|
|
30
|
+
"@wordpress/scripts": "^31.1.0",
|
|
31
|
+
"@wordpress/interactivity": "^6.36.0",
|
|
31
32
|
"chisel-scripts": "*",
|
|
32
33
|
"cross-env": "^7.0.3"
|
|
33
34
|
},
|
|
@@ -3,15 +3,4 @@ const { adjustWebpackConfig } = require('chisel-scripts');
|
|
|
3
3
|
|
|
4
4
|
const updatedConfig = adjustWebpackConfig(defaultConfig, __dirname);
|
|
5
5
|
|
|
6
|
-
updatedConfig.devServer = {
|
|
7
|
-
...updatedConfig.devServer,
|
|
8
|
-
client: {
|
|
9
|
-
overlay: {
|
|
10
|
-
errors: true,
|
|
11
|
-
warnings: false,
|
|
12
|
-
runtimeErrors: false,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
|
|
17
6
|
module.exports = updatedConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "A generator for scaffolding front-end and WordPress projects",
|
|
5
5
|
"bin": {
|
|
6
6
|
"chisel": "bin/chisel.js"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"tinyqueue": "^2.0.3",
|
|
38
38
|
"update-notifier": "^4.1.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "eeef8803f7213be257ef9a48b02a1dc1790d2409"
|
|
41
41
|
}
|