generator-chisel 2.3.3 → 2.4.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 +9 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.editorconfig +16 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.husky/pre-commit +92 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/.nvmrc +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/README.md +67 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/assets/icons-source/search.svg +3 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/composer.json +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP/AjaxEndpoints.php → core/Ajax/LoadMoreEndpoint.php} +8 -51
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Controllers/AjaxController.php +225 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AcfHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AjaxHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/AssetsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/BlocksHelpers.php +5 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CacheHelpers.php +5 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/CommentsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/DataHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/GravityFormsHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ImageHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/ThemeHelpers.php +10 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/WoocommerceHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Helpers/YoastHelpers.php +4 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Interfaces/AjaxEndpointInterface.php +15 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/GravityForms}/GravityForms.php +12 -24
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/Plugins → core/Plugins/Woocommerce}/Woocommerce.php +23 -14
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Plugins/Yoast/Yoast.php +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Cache.php +5 -17
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselImage.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselPost.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProduct.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselProductCategory.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/ChiselTerm.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc/WP → core/Timber}/Components.php +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Hooks.php +29 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/HooksSingleton.php +54 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/core/Traits/Rest.php +51 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/Singleton.php +10 -8
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Acf.php +22 -55
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/AcfBlocks.php +7 -20
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Assets.php +3 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Blocks.php +7 -19
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Comments.php +44 -49
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomPostTypes.php +8 -35
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/CustomTaxonomies.php +12 -36
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Sidebars.php +3 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Site.php +52 -18
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Theme.php +4 -15
- package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/WP/Twig.php +12 -31
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/Timber/ChiselPost.php +14 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Acf.php +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Ajax.php +45 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Assets.php +37 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/CustomPostTypes.php +76 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Site.php +42 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/app/WP/Twig.php +52 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/functions.php +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/custom/views/README.md +7 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/functions.php +27 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +9 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/phpcs.xml +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/blocks/accordion/block.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/settings/_index.scss +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_breakpoints.scss +1 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/editor/mods/core.js +11 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/main-nav.js +14 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/scripts/modules/slider.js +45 -4
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_buttons.scss +11 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_search-form.scss +17 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_slider.scss +3 -3
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-base.scss +117 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-collapse.scss.disabled +66 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-elastic.scss.disabled +56 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-emphatic.scss.disabled +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-settings.scss +22 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-slider.scss +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spin.scss.disabled +60 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-spring.scss.disabled +98 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-squeeze.scss.disabled +47 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-stand.scss.disabled +59 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-three-d.scss.disabled +139 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/main-nav-toggle/_mnt-vortex.scss.disabled +61 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/gravity-forms.scss +17 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/theme.json +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/twig_cs.php +4 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/base.twig +1 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/footer.twig +19 -11
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/header.twig +6 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/logo.twig +6 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/main-nav.twig +1 -1
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/post-item.twig +38 -20
- package/lib/commands/create/creators/app/chisel-starter-theme/views/components/search-form.twig +8 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/views/index.twig +19 -10
- package/lib/commands/create/creators/app/chisel-starter-theme/views/search.twig +5 -6
- package/lib/commands/create/creators/app/chisel-starter-theme/views/single.twig +43 -31
- package/lib/commands/create/creators/app/chisel-starter-theme/views/woocommerce/content-product.twig +1 -1
- package/lib/commands/create/creators/app/index.js +87 -9
- package/lib/commands/create/creators/wp/index.js +10 -2
- package/lib/commands/create/packages-versions.js +2 -2
- package/lib/commands/create/priorities.js +3 -0
- package/package.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php +0 -156
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php +0 -26
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/InstanceInterface.php +0 -16
- package/lib/commands/create/creators/app/chisel-starter-theme/inc/Plugins/Yoast.php +0 -46
- package/lib/commands/create/creators/app/chisel-starter-theme/src/styles/components/_main-nav-toggle.scss +0 -804
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/AcfOptionsPageType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Enums/BlocksType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterAcfOptionsPage.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterBlocks.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomPostType.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Factories/RegisterCustomTaxonomy.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{inc → core}/Traits/PageBlocks.php +0 -0
- /package/lib/commands/create/creators/app/chisel-starter-theme/{src/scripts/blog.js → custom/app/Ajax/.gitkeep} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% extends "base.twig" %}
|
|
2
2
|
|
|
3
3
|
{% block content %}
|
|
4
|
-
<article id="post-{{ post.ID }}" class="
|
|
4
|
+
<article id="post-{{ post.ID }}" class="{{ post_classes(post.class) }}">
|
|
5
5
|
<section class="o-wrapper__inner c-post__inner {{ wrapper_class }}">
|
|
6
6
|
|
|
7
7
|
<div class="o-layout c-content{% if sidebar.content %} has-sidebar{% endif %}">
|
|
@@ -13,45 +13,57 @@
|
|
|
13
13
|
|
|
14
14
|
{% block inner_content %}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{% if post.get_thumbnail('large') %}
|
|
22
|
-
<div class="c-post__image">
|
|
23
|
-
{{ post.get_thumbnail() }}
|
|
16
|
+
{% block post_meta %}
|
|
17
|
+
<div class="c-post__meta">
|
|
18
|
+
<span class="c-post__author"><a href="{{ post.author.link }}">{{ __('By', 'chisel') }} {{ post.author.name }}</a></span> •
|
|
19
|
+
<time datetime="{{ post.date }}">{{ post.date }}</time></span>
|
|
24
20
|
</div>
|
|
25
|
-
{%
|
|
26
|
-
|
|
27
|
-
<div class="c-post__terms">
|
|
28
|
-
{% if post.categories %}
|
|
29
|
-
<p class="c-post__categories">
|
|
30
|
-
{{ __('Categories', 'chisel') }}:
|
|
31
|
-
{% for category in post.categories %}
|
|
32
|
-
<span class="c-post__categories"><a href="{{ category.link }}">{{ category }}</a>{% if not loop.last %}, {% endif %}</span>
|
|
33
|
-
{% endfor %}
|
|
34
|
-
</p>
|
|
35
|
-
{% endif %}
|
|
21
|
+
{% endblock %}
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
{
|
|
41
|
-
|
|
42
|
-
{% endfor %}
|
|
43
|
-
</p>
|
|
23
|
+
{% block post_image %}
|
|
24
|
+
{% if post.get_thumbnail('large') %}
|
|
25
|
+
<div class="c-post__image">
|
|
26
|
+
{{ post.get_thumbnail() }}
|
|
27
|
+
</div>
|
|
44
28
|
{% endif %}
|
|
45
|
-
|
|
29
|
+
{% endblock %}
|
|
30
|
+
|
|
31
|
+
{% block post_terms %}
|
|
32
|
+
<div class="c-post__terms">
|
|
33
|
+
{% if post.categories %}
|
|
34
|
+
<p class="c-post__categories">
|
|
35
|
+
{{ __('Categories', 'chisel') }}:
|
|
36
|
+
{% for category in post.categories %}
|
|
37
|
+
<span class="c-post__categories"><a href="{{ category.link }}">{{ category }}</a>{% if not loop.last %}, {% endif %}</span>
|
|
38
|
+
{% endfor %}
|
|
39
|
+
</p>
|
|
40
|
+
{% endif %}
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
{% if post.tags %}
|
|
43
|
+
<p class="c-post__tags">
|
|
44
|
+
{{ __('Tags', 'chisel') }}:
|
|
45
|
+
{% for tag in post.tags %}
|
|
46
|
+
<span class="c-post__tags"><a href="{{ tag.link }}">#{{ tag }}</a>{% if not loop.last %}, {% endif %}</span>
|
|
47
|
+
{% endfor %}
|
|
48
|
+
</p>
|
|
49
|
+
{% endif %}
|
|
50
|
+
</div>
|
|
51
|
+
{% endblock %}
|
|
52
|
+
|
|
53
|
+
{% block post_content %}
|
|
54
|
+
{{ post.content }}
|
|
55
|
+
{% endblock %}
|
|
48
56
|
|
|
49
|
-
{
|
|
57
|
+
{% block post_comments %}
|
|
58
|
+
{{ comments_template() }}
|
|
59
|
+
{% endblock %}
|
|
50
60
|
{% endblock %}
|
|
51
61
|
</div>
|
|
52
62
|
|
|
53
63
|
{% if sidebar.content %}
|
|
54
|
-
{%
|
|
64
|
+
{% block post_sidebar %}
|
|
65
|
+
{% include 'sidebar-blog.twig' %}
|
|
66
|
+
{% endblock %}
|
|
55
67
|
{% endif %}
|
|
56
68
|
</div>
|
|
57
69
|
</section>
|
|
@@ -14,7 +14,10 @@ module.exports = async (api) => {
|
|
|
14
14
|
let app;
|
|
15
15
|
|
|
16
16
|
const runLocalCurrent = (args, opts) =>
|
|
17
|
-
runLocal(args, {
|
|
17
|
+
runLocal(args, {
|
|
18
|
+
...opts,
|
|
19
|
+
cwd: api.resolve(app.themePath),
|
|
20
|
+
});
|
|
18
21
|
|
|
19
22
|
api.schedule(api.PRIORITIES.PROMPT, async () => {
|
|
20
23
|
const userName = execa('git', ['config', 'user.name'], {
|
|
@@ -65,7 +68,10 @@ module.exports = async (api) => {
|
|
|
65
68
|
let installedPackages;
|
|
66
69
|
api.schedule(api.PRIORITIES.COPY, async () => {
|
|
67
70
|
await api.copy();
|
|
68
|
-
await api.copy({
|
|
71
|
+
await api.copy({
|
|
72
|
+
from: 'chisel-starter-theme',
|
|
73
|
+
to: app.themePath,
|
|
74
|
+
});
|
|
69
75
|
|
|
70
76
|
const modifyDependencies = (deps) => {
|
|
71
77
|
Object.keys(deps).forEach((dep) => {
|
|
@@ -89,7 +95,9 @@ module.exports = async (api) => {
|
|
|
89
95
|
api.schedule(api.PRIORITIES.INSTALL_DEPENDENCIES, async () => {
|
|
90
96
|
if (api.creator.cmd.skipDependenciesInstall) return;
|
|
91
97
|
|
|
92
|
-
await installDependencies({
|
|
98
|
+
await installDependencies({
|
|
99
|
+
cwd: api.resolve(app.themePath),
|
|
100
|
+
});
|
|
93
101
|
|
|
94
102
|
// await run(['xfive-coding-standards', '--skip-checks'], {
|
|
95
103
|
// cwd: api.resolve(app.themePath),
|
|
@@ -128,15 +136,23 @@ module.exports = async (api) => {
|
|
|
128
136
|
.catch(() => false)
|
|
129
137
|
) {
|
|
130
138
|
await api.modifyFile(preCommitPath, (body) => {
|
|
131
|
-
const
|
|
139
|
+
const devcontainerSnippet = [
|
|
132
140
|
'',
|
|
141
|
+
'# Set up devcontainer alias if needed (for all npx commands)',
|
|
133
142
|
'if [ -f .use-devcontainer ]; then',
|
|
134
143
|
' alias npx="/usr/bin/env bash ../../../.devcontainer/exec npx"',
|
|
135
144
|
'fi',
|
|
136
145
|
'',
|
|
137
146
|
].join('\n');
|
|
138
147
|
|
|
139
|
-
|
|
148
|
+
// Insert after shebang line
|
|
149
|
+
const shebangPattern = /^(#!\/bin\/sh)\n/;
|
|
150
|
+
if (shebangPattern.test(body)) {
|
|
151
|
+
return body.replace(shebangPattern, `$1\n${devcontainerSnippet}\n`);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Fallback: prepend to file
|
|
155
|
+
return devcontainerSnippet + '\n' + body;
|
|
140
156
|
});
|
|
141
157
|
}
|
|
142
158
|
|
|
@@ -148,7 +164,9 @@ module.exports = async (api) => {
|
|
|
148
164
|
|
|
149
165
|
for (const pkg of installedAndAvailable) {
|
|
150
166
|
console.log(`Running npm link ${pkg}...`);
|
|
151
|
-
await run(['npm', 'link', pkg], {
|
|
167
|
+
await run(['npm', 'link', pkg], {
|
|
168
|
+
cwd: api.resolve(app.themePath),
|
|
169
|
+
});
|
|
152
170
|
}
|
|
153
171
|
}
|
|
154
172
|
});
|
|
@@ -171,7 +189,67 @@ module.exports = async (api) => {
|
|
|
171
189
|
});
|
|
172
190
|
});
|
|
173
191
|
|
|
174
|
-
//
|
|
175
|
-
|
|
176
|
-
|
|
192
|
+
// Set up git hooks after build
|
|
193
|
+
api.schedule(api.PRIORITIES.HUSKY, async () => {
|
|
194
|
+
const themePath = api.resolve(app.themePath);
|
|
195
|
+
|
|
196
|
+
// Check if git is initialized (in theme folder or project root)
|
|
197
|
+
const gitInTheme = await fs
|
|
198
|
+
.access(path.join(themePath, '.git'))
|
|
199
|
+
.then(() => true)
|
|
200
|
+
.catch(() => false);
|
|
201
|
+
const gitInRoot = await fs
|
|
202
|
+
.access(api.resolve('.git'))
|
|
203
|
+
.then(() => true)
|
|
204
|
+
.catch(() => false);
|
|
205
|
+
|
|
206
|
+
if (gitInTheme || gitInRoot) {
|
|
207
|
+
console.log('');
|
|
208
|
+
console.log('Setting up git hooks...');
|
|
209
|
+
try {
|
|
210
|
+
await runLocalCurrent(['chisel-scripts', 'husky-init'], {
|
|
211
|
+
execaOpts: { stdio: 'inherit' },
|
|
212
|
+
});
|
|
213
|
+
console.log('✔ Git hooks installed successfully');
|
|
214
|
+
} catch (error) {
|
|
215
|
+
console.log(
|
|
216
|
+
'⚠️ Failed to set up git hooks. Run "npm run prepare" manually.',
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
console.log('');
|
|
221
|
+
console.log(
|
|
222
|
+
'╔══════════════════════════════════════════════════════════════════════════════╗',
|
|
223
|
+
);
|
|
224
|
+
console.log(
|
|
225
|
+
'║ ⚠️ Git not initialized - pre-commit hooks not set up ║',
|
|
226
|
+
);
|
|
227
|
+
console.log(
|
|
228
|
+
'╠══════════════════════════════════════════════════════════════════════════════╣',
|
|
229
|
+
);
|
|
230
|
+
console.log(
|
|
231
|
+
'║ ║',
|
|
232
|
+
);
|
|
233
|
+
console.log(
|
|
234
|
+
'║ To enable core folder protection, run: ║',
|
|
235
|
+
);
|
|
236
|
+
console.log(
|
|
237
|
+
'║ ║',
|
|
238
|
+
);
|
|
239
|
+
console.log(
|
|
240
|
+
'║ git init ║',
|
|
241
|
+
);
|
|
242
|
+
console.log(`║ cd ${app.themePath.padEnd(71)}║`);
|
|
243
|
+
console.log(
|
|
244
|
+
'║ npm run prepare ║',
|
|
245
|
+
);
|
|
246
|
+
console.log(
|
|
247
|
+
'║ ║',
|
|
248
|
+
);
|
|
249
|
+
console.log(
|
|
250
|
+
'╚══════════════════════════════════════════════════════════════════════════════╝',
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
console.log('');
|
|
254
|
+
});
|
|
177
255
|
};
|
|
@@ -176,7 +176,15 @@ module.exports = (api) => {
|
|
|
176
176
|
await wp(['theme', 'activate', themeName]);
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
-
|
|
179
|
+
api.schedule(api.PRIORITIES.WP_UPDATE_OPTIONS, async () => {
|
|
180
|
+
if (api.creator.cmd.skipWpCommands) return;
|
|
180
181
|
|
|
181
|
-
|
|
182
|
+
await wp(['option', 'update', 'permalink_structure', '/%postname%/']);
|
|
183
|
+
await wp(['option', 'update', 'blog_public', '0']);
|
|
184
|
+
await wp(['option', 'update', 'default_comment_status', 'closed']);
|
|
185
|
+
await wp(['option', 'update', 'default_pingback_flag', '0']);
|
|
186
|
+
await wp(['option', 'update', 'default_ping_status', 'closed']);
|
|
187
|
+
await wp(['option', 'update', 'comment_moderation', '1']);
|
|
188
|
+
await wp(['option', 'update', 'comment_registration', '1']);
|
|
189
|
+
});
|
|
182
190
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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": "259173a22a8cb7a7380936bfc01baf4b87f6afa3"
|
|
41
41
|
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Controllers/AjaxController.php
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel\Controllers;
|
|
4
|
-
|
|
5
|
-
use Chisel\WP\AjaxEndpoints;
|
|
6
|
-
use Chisel\Interfaces\InstanceInterface;
|
|
7
|
-
use Chisel\Interfaces\HooksInterface;
|
|
8
|
-
use Chisel\Traits\Singleton;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Custom Ajax class based on REST API.
|
|
12
|
-
*
|
|
13
|
-
* @package Chisel
|
|
14
|
-
*/
|
|
15
|
-
final class AjaxController extends \WP_REST_Controller implements InstanceInterface, HooksInterface {
|
|
16
|
-
|
|
17
|
-
use Singleton;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Ajax custom route namespace.
|
|
21
|
-
*
|
|
22
|
-
* @var string
|
|
23
|
-
*/
|
|
24
|
-
public const ROUTE_NAMESPACE = 'chisel/v2';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Ajax custom route base.
|
|
28
|
-
*
|
|
29
|
-
* @var string
|
|
30
|
-
*/
|
|
31
|
-
public const ROUTE_BASE = 'ajax';
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Ajax custom routes.
|
|
35
|
-
*
|
|
36
|
-
* @var array
|
|
37
|
-
*/
|
|
38
|
-
private array $routes = array();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Class constructor.
|
|
42
|
-
*/
|
|
43
|
-
private function __construct() {
|
|
44
|
-
add_action( 'after_setup_theme', array( $this, 'set_properties' ), 7 );
|
|
45
|
-
|
|
46
|
-
$this->action_hooks();
|
|
47
|
-
$this->filter_hooks();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Set properties.
|
|
52
|
-
*/
|
|
53
|
-
public function set_properties(): void {
|
|
54
|
-
$this->routes = array(
|
|
55
|
-
'load-more' => array(),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Register action hooks.
|
|
61
|
-
*/
|
|
62
|
-
public function action_hooks(): void {
|
|
63
|
-
add_action( 'rest_api_init', array( $this, 'register_endpoints' ) );
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Register filter hooks.
|
|
68
|
-
*/
|
|
69
|
-
public function filter_hooks(): void {}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Register endpoints
|
|
73
|
-
*
|
|
74
|
-
* @return void
|
|
75
|
-
*/
|
|
76
|
-
public function register_endpoints(): void {
|
|
77
|
-
$this->routes = apply_filters( 'chisel_ajax_routes', $this->routes );
|
|
78
|
-
|
|
79
|
-
if ( $this->routes ) {
|
|
80
|
-
foreach ( $this->routes as $route_name => $route_params ) {
|
|
81
|
-
$route = sprintf( '%s/%s/', self::ROUTE_BASE, $route_name );
|
|
82
|
-
$methods = isset( $route_params['methods'] ) ? $route_params['methods'] : array( 'POST' );
|
|
83
|
-
|
|
84
|
-
register_rest_route(
|
|
85
|
-
self::ROUTE_NAMESPACE,
|
|
86
|
-
$route,
|
|
87
|
-
array(
|
|
88
|
-
'methods' => $methods,
|
|
89
|
-
'callback' => array( $this, 'callback' ),
|
|
90
|
-
'permission_callback' => array( $this, 'permissions_check' ),
|
|
91
|
-
'args' => $this->get_endpoint_args_for_item_schema( true ),
|
|
92
|
-
)
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Create dynamic route callback
|
|
100
|
-
*
|
|
101
|
-
* @param \WP_REST_Request $request WP_REST_Request.
|
|
102
|
-
*
|
|
103
|
-
* @return \WP_REST_Response|\WP_Error|array
|
|
104
|
-
*/
|
|
105
|
-
public function callback( \WP_REST_Request $request ): \WP_REST_Response|\WP_Error|array {
|
|
106
|
-
$callback = $this->get_callback_name( $request );
|
|
107
|
-
$ajax_endpoints = new AjaxEndpoints();
|
|
108
|
-
|
|
109
|
-
if ( method_exists( $ajax_endpoints, $callback ) ) {
|
|
110
|
-
if ( ! defined( 'DOING_AJAX' ) ) {
|
|
111
|
-
define( 'DOING_AJAX', true );
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if ( ! defined( 'DOING_CHISEL_AJAX' ) ) {
|
|
115
|
-
define( 'DOING_CHISEL_AJAX', true );
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
$callable = array( $ajax_endpoints, $callback );
|
|
119
|
-
|
|
120
|
-
return $callable( $request );
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
return new \WP_Error( 'chisel_ajax_callback_missing', sprintf( 'Callback %s not found', $callback ), array( 'status' => 404 ) );
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Check ajax request permissions.
|
|
128
|
-
*
|
|
129
|
-
* @param \WP_REST_Request $request WP_REST_Request.
|
|
130
|
-
*
|
|
131
|
-
* @return boolean
|
|
132
|
-
*/
|
|
133
|
-
public function permissions_check( \WP_REST_Request $request ): bool|\WP_Error {
|
|
134
|
-
$verify_nonce = wp_verify_nonce( $request->get_header( 'x_wp_nonce' ), 'wp_rest' );
|
|
135
|
-
$allowed = (bool) $verify_nonce;
|
|
136
|
-
|
|
137
|
-
$permission = apply_filters( 'chisel_ajax_permissions_check', $allowed, $this->get_callback_name( $request ), $request );
|
|
138
|
-
|
|
139
|
-
return $permission;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Get callback name from ajax request.
|
|
144
|
-
*
|
|
145
|
-
* @param \WP_REST_Request $request
|
|
146
|
-
*
|
|
147
|
-
* @return string
|
|
148
|
-
*/
|
|
149
|
-
private function get_callback_name( \WP_REST_Request $request ): string {
|
|
150
|
-
$route = $request->get_route();
|
|
151
|
-
$route_parts = explode( '/', $route );
|
|
152
|
-
$callback = str_replace( '-', '_', end( $route_parts ) );
|
|
153
|
-
|
|
154
|
-
return $callback;
|
|
155
|
-
}
|
|
156
|
-
}
|
package/lib/commands/create/creators/app/chisel-starter-theme/inc/Interfaces/HooksInterface.php
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel\Interfaces;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Hooks Interface
|
|
7
|
-
*
|
|
8
|
-
* @package Chisel
|
|
9
|
-
*/
|
|
10
|
-
interface HooksInterface {
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Set class properties.
|
|
14
|
-
*/
|
|
15
|
-
public function set_properties(): void;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Register action hooks.
|
|
19
|
-
*/
|
|
20
|
-
public function action_hooks(): void;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Register filter hooks.
|
|
24
|
-
*/
|
|
25
|
-
public function filter_hooks(): void;
|
|
26
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
<?php
|
|
2
|
-
|
|
3
|
-
namespace Chisel\Plugins;
|
|
4
|
-
|
|
5
|
-
use Chisel\Interfaces\InstanceInterface;
|
|
6
|
-
use Chisel\Interfaces\HooksInterface;
|
|
7
|
-
use Chisel\Traits\Singleton;
|
|
8
|
-
use Chisel\Helpers\YoastHelpers;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Yoast SEO plugin related functionalities.
|
|
12
|
-
*
|
|
13
|
-
* @package Chisel
|
|
14
|
-
*/
|
|
15
|
-
final class Yoast implements InstanceInterface, HooksInterface {
|
|
16
|
-
|
|
17
|
-
use Singleton;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Class constructor.
|
|
21
|
-
*/
|
|
22
|
-
private function __construct() {
|
|
23
|
-
if ( ! YoastHelpers::is_yoast_active() ) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
$this->set_properties();
|
|
28
|
-
$this->action_hooks();
|
|
29
|
-
$this->filter_hooks();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Set properties.
|
|
34
|
-
*/
|
|
35
|
-
public function set_properties(): void {}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Register action hooks.
|
|
39
|
-
*/
|
|
40
|
-
public function action_hooks(): void {}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Register filter hooks.
|
|
44
|
-
*/
|
|
45
|
-
public function filter_hooks(): void {}
|
|
46
|
-
}
|