@codigodoleo/wp-kit 5.0.2 → 5.2.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/lib/commands/init.js +87 -78
- package/lib/config/versions.js +45 -45
- package/lib/core/infer-ci-capabilities.js +39 -26
- package/lib/prompts/index.js +118 -92
- package/modules/blank-theme/index.js +23 -34
- package/modules/blank-theme/prompts.js +9 -25
- package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
- package/modules/blank-theme/templates/package.json.hbs +1 -1
- package/modules/deploy/index.js +51 -61
- package/modules/deploy/prompts.js +36 -12
- package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
- package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
- package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
- package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
- package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
- package/modules/docs/templates/docs/Infraestrutura.md.hbs +24 -0
- package/modules/docs/templates/docs/Troubleshooting.md.hbs +17 -0
- package/modules/git/.lintstagedrc.json +2 -5
- package/modules/lint/.oxlintrc.json +19 -0
- package/modules/lint/.prettierignore +16 -1
- package/modules/lint/index.js +32 -40
- package/modules/lint/templates/mago.toml.hbs +83 -0
- package/modules/lint/templates/package.json.hbs +6 -10
- package/modules/lint/templates/workspace.json.hbs +2 -36
- package/modules/mu-plugin/index.js +39 -51
- package/modules/mu-plugin/prompts.js +10 -28
- package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
- package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
- package/modules/mu-plugin/templates/composer.json.hbs +4 -2
- package/modules/php/templates/.lando.yml.hbs +13 -8
- package/modules/php/templates/composer.json.hbs +15 -7
- package/modules/php/templates/workspace.json.hbs +22 -19
- package/modules/plugin/index.js +10 -18
- package/modules/plugin/prompts.js +5 -19
- package/modules/plugin/templates/.lando.yml.hbs +8 -10
- package/modules/plugin/templates/composer.json.hbs +4 -2
- package/modules/sage/index.js +78 -88
- package/modules/sage/prompts.js +10 -24
- package/modules/sage/templates/.lando.yml.hbs +17 -7
- package/modules/sage/templates/theme/composer.json.hbs +36 -23
- package/modules/sage/templates/theme/package.json.hbs +24 -13
- package/modules/test/templates/composer.json.hbs +1 -1
- package/package.json +30 -35
- package/templates/.devcontainer/devcontainer.json.hbs +2 -2
- package/templates/.env.hbs +5 -0
- package/templates/.gitignore.hbs +1 -0
- package/templates/auth.json.hbs +8 -0
- package/templates/composer.json.hbs +13 -5
- package/templates/package.json.hbs +2 -4
- package/templates/workspace.json.hbs +3 -4
- package/wp-config.php +5 -0
- package/modules/blank-theme/lint/eslint.config.mjs +0 -30
- package/modules/blank-theme/lint/pint.json +0 -11
- package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
- package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
- package/modules/deploy/.github/workflows/release.yml +0 -57
- package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
- package/modules/mu-plugin/lint/pint.json +0 -11
- package/modules/plugin/lint/eslint.config.mjs +0 -30
- package/modules/plugin/lint/pint.json +0 -11
- package/modules/sage/lint/eslint.config.mjs +0 -30
- package/modules/sage/lint/pint.json +0 -11
package/lib/prompts/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
// lib/prompts/index.js
|
|
2
|
-
import inquirer from
|
|
2
|
+
import inquirer from "inquirer";
|
|
3
3
|
|
|
4
|
-
import { getGitUserDefaults } from
|
|
5
|
-
import { Generator } from
|
|
4
|
+
import { getGitUserDefaults } from "../utils/git.js";
|
|
5
|
+
import { Generator } from "../core/generator.js";
|
|
6
6
|
|
|
7
|
-
import { loadModulePrompts } from
|
|
7
|
+
import { loadModulePrompts } from "./loadModulePrompts.js";
|
|
8
8
|
|
|
9
9
|
function parseBooleanEnv(value) {
|
|
10
|
-
if (typeof value !==
|
|
10
|
+
if (typeof value !== "string") return null;
|
|
11
11
|
const normalized = value.trim().toLowerCase();
|
|
12
|
-
if ([
|
|
13
|
-
if ([
|
|
12
|
+
if (["1", "true", "yes", "on"].includes(normalized)) return true;
|
|
13
|
+
if (["0", "false", "no", "off"].includes(normalized)) return false;
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
function capitalizeToken(token) {
|
|
18
|
-
if (!token) return
|
|
18
|
+
if (!token) return "";
|
|
19
19
|
|
|
20
20
|
const normalized = token.toLowerCase();
|
|
21
21
|
const dictionary = {
|
|
22
|
-
wordpress:
|
|
23
|
-
wp:
|
|
24
|
-
api:
|
|
25
|
-
ui:
|
|
26
|
-
ux:
|
|
27
|
-
cms:
|
|
28
|
-
seo:
|
|
29
|
-
php:
|
|
30
|
-
js:
|
|
31
|
-
ci:
|
|
32
|
-
cd:
|
|
33
|
-
qa:
|
|
34
|
-
devops:
|
|
22
|
+
wordpress: "WordPress",
|
|
23
|
+
wp: "WP",
|
|
24
|
+
api: "API",
|
|
25
|
+
ui: "UI",
|
|
26
|
+
ux: "UX",
|
|
27
|
+
cms: "CMS",
|
|
28
|
+
seo: "SEO",
|
|
29
|
+
php: "PHP",
|
|
30
|
+
js: "JS",
|
|
31
|
+
ci: "CI",
|
|
32
|
+
cd: "CD",
|
|
33
|
+
qa: "QA",
|
|
34
|
+
devops: "DevOps",
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
if (dictionary[normalized]) {
|
|
@@ -43,9 +43,9 @@ function capitalizeToken(token) {
|
|
|
43
43
|
|
|
44
44
|
function parseRepositoryInfo(gitRepository, projectName) {
|
|
45
45
|
const fallbackPath = `your-group/${projectName}`;
|
|
46
|
-
const fallbackHost =
|
|
46
|
+
const fallbackHost = "gitlab.com";
|
|
47
47
|
|
|
48
|
-
if (!gitRepository || typeof gitRepository !==
|
|
48
|
+
if (!gitRepository || typeof gitRepository !== "string") {
|
|
49
49
|
return {
|
|
50
50
|
repositoryHost: fallbackHost,
|
|
51
51
|
repositoryPath: fallbackPath,
|
|
@@ -80,10 +80,10 @@ function parseRepositoryInfo(gitRepository, projectName) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
function deriveProjectMetadata({ projectName, gitRepository }) {
|
|
83
|
-
const tokens = projectName.split(
|
|
84
|
-
const projectTitle = tokens.map(capitalizeToken).join(
|
|
85
|
-
const projectPascal = tokens.map(capitalizeToken).join(
|
|
86
|
-
const projectSnake = projectName.replace(/-/g,
|
|
83
|
+
const tokens = projectName.split("-").filter(Boolean);
|
|
84
|
+
const projectTitle = tokens.map(capitalizeToken).join(" ");
|
|
85
|
+
const projectPascal = tokens.map(capitalizeToken).join("");
|
|
86
|
+
const projectSnake = projectName.replace(/-/g, "_");
|
|
87
87
|
const projectConstant = projectSnake.toUpperCase();
|
|
88
88
|
const projectThemeSlug = `${projectName}-theme`;
|
|
89
89
|
const repository = parseRepositoryInfo(gitRepository, projectName);
|
|
@@ -106,80 +106,101 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
106
106
|
|
|
107
107
|
const corePrompts = [
|
|
108
108
|
{
|
|
109
|
-
type:
|
|
110
|
-
name:
|
|
111
|
-
message:
|
|
112
|
-
default:
|
|
109
|
+
type: "input",
|
|
110
|
+
name: "projectName",
|
|
111
|
+
message: "Project name (lowercase, hyphens only):",
|
|
112
|
+
default: "wordpress-dev",
|
|
113
113
|
filter: (val) =>
|
|
114
114
|
val
|
|
115
115
|
.trim()
|
|
116
116
|
.toLowerCase()
|
|
117
|
-
.replace(/\s+/g,
|
|
118
|
-
.replace(/[^a-z0-9-]/g,
|
|
117
|
+
.replace(/\s+/g, "-")
|
|
118
|
+
.replace(/[^a-z0-9-]/g, ""),
|
|
119
119
|
validate: (val) =>
|
|
120
|
-
/^[a-z0-9][a-z0-9-]*$/.test(val) ||
|
|
120
|
+
/^[a-z0-9][a-z0-9-]*$/.test(val) || "Use only lowercase letters, numbers and hyphens.",
|
|
121
121
|
},
|
|
122
122
|
{
|
|
123
|
-
type:
|
|
124
|
-
name:
|
|
125
|
-
message:
|
|
126
|
-
default:
|
|
123
|
+
type: "input",
|
|
124
|
+
name: "projectDescription",
|
|
125
|
+
message: "Project description:",
|
|
126
|
+
default: "Generated with wp-kit",
|
|
127
127
|
},
|
|
128
128
|
{
|
|
129
|
-
type:
|
|
130
|
-
name:
|
|
131
|
-
message:
|
|
132
|
-
default:
|
|
129
|
+
type: "input",
|
|
130
|
+
name: "projectVersion",
|
|
131
|
+
message: "Project version:",
|
|
132
|
+
default: "1.0.0",
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
|
-
type:
|
|
136
|
-
name:
|
|
137
|
-
message:
|
|
135
|
+
type: "input",
|
|
136
|
+
name: "author",
|
|
137
|
+
message: "Author:",
|
|
138
138
|
default: defaultsGit.author,
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
type:
|
|
142
|
-
name:
|
|
143
|
-
message:
|
|
141
|
+
type: "input",
|
|
142
|
+
name: "authorEmail",
|
|
143
|
+
message: "Author email:",
|
|
144
144
|
default: defaultsGit.authorEmail,
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
|
-
type:
|
|
148
|
-
name:
|
|
149
|
-
message:
|
|
147
|
+
type: "input",
|
|
148
|
+
name: "gitRepository",
|
|
149
|
+
message: "Repository URL:",
|
|
150
150
|
default: defaultsGit.gitRepository,
|
|
151
151
|
},
|
|
152
152
|
// phpVersion and nodeVersion are locked to '8.4' / '24' — injected into context, not prompted
|
|
153
153
|
{
|
|
154
|
-
type:
|
|
155
|
-
name:
|
|
156
|
-
message:
|
|
157
|
-
choices: [
|
|
158
|
-
default:
|
|
154
|
+
type: "list",
|
|
155
|
+
name: "wpCoreVersion",
|
|
156
|
+
message: "WordPress core version:",
|
|
157
|
+
choices: ["7.0", "6.9.4", "6.8.1", "6.7"],
|
|
158
|
+
default: "7.0",
|
|
159
159
|
},
|
|
160
160
|
{
|
|
161
|
-
type:
|
|
162
|
-
name:
|
|
163
|
-
message:
|
|
161
|
+
type: "confirm",
|
|
162
|
+
name: "useRocket",
|
|
163
|
+
message: "Use WP Rocket?",
|
|
164
164
|
default: true,
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
|
-
type:
|
|
168
|
-
name:
|
|
169
|
-
message:
|
|
167
|
+
type: "confirm",
|
|
168
|
+
name: "enableDebug",
|
|
169
|
+
message: "Enable debug mode?",
|
|
170
170
|
default: false,
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
type:
|
|
174
|
-
name:
|
|
175
|
-
message:
|
|
173
|
+
type: "checkbox",
|
|
174
|
+
name: "selectedContentModules",
|
|
175
|
+
message: "Selecione os módulos de conteúdo do projeto:",
|
|
176
176
|
choices: [
|
|
177
|
-
{ name:
|
|
178
|
-
{ name:
|
|
179
|
-
{ name:
|
|
180
|
-
{ name:
|
|
177
|
+
{ name: "Sage theme (Roots + Acorn + Vite)", value: "sage" },
|
|
178
|
+
{ name: "Blank theme (Vite + SCSS, sem Sage)", value: "blank-theme" },
|
|
179
|
+
{ name: "MU Plugin scaffold", value: "mu-plugin" },
|
|
180
|
+
{ name: "Plugin scaffold", value: "plugin" },
|
|
181
181
|
],
|
|
182
|
-
default: [
|
|
182
|
+
default: ["sage"],
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
type: "confirm",
|
|
186
|
+
name: "enable_acf_pro",
|
|
187
|
+
message: "Install ACF Pro via Composer? (requires license key)",
|
|
188
|
+
default: true,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: "input",
|
|
192
|
+
name: "acf_license_key",
|
|
193
|
+
message:
|
|
194
|
+
"ACF Pro license key (from connect.advancedcustomfields.com — leave blank to configure later):",
|
|
195
|
+
default: "",
|
|
196
|
+
when: (answers) => answers.enable_acf_pro,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: "input",
|
|
200
|
+
name: "acf_site_url",
|
|
201
|
+
message: "Licensed site URL (must match ACF account):",
|
|
202
|
+
when: (answers) => answers.enable_acf_pro,
|
|
203
|
+
default: (answers) => `https://${answers.projectName || "mysite"}.com`,
|
|
183
204
|
},
|
|
184
205
|
];
|
|
185
206
|
|
|
@@ -192,14 +213,14 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
192
213
|
for (const prompt of allPrompts) {
|
|
193
214
|
if (prompt.when && !prompt.when(defaultAnswers)) continue;
|
|
194
215
|
const def = prompt.default;
|
|
195
|
-
defaultAnswers[prompt.name] = typeof def ===
|
|
216
|
+
defaultAnswers[prompt.name] = typeof def === "function" ? def(defaultAnswers) : def;
|
|
196
217
|
}
|
|
197
218
|
|
|
198
219
|
const sel = defaultAnswers.selectedContentModules || [];
|
|
199
|
-
defaultAnswers.enable_sage = sel.includes(
|
|
200
|
-
defaultAnswers.enable_blank_theme = sel.includes(
|
|
201
|
-
defaultAnswers.enable_mu_plugin = sel.includes(
|
|
202
|
-
defaultAnswers.enable_plugin = sel.includes(
|
|
220
|
+
defaultAnswers.enable_sage = sel.includes("sage");
|
|
221
|
+
defaultAnswers.enable_blank_theme = sel.includes("blank-theme");
|
|
222
|
+
defaultAnswers.enable_mu_plugin = sel.includes("mu-plugin");
|
|
223
|
+
defaultAnswers.enable_plugin = sel.includes("plugin");
|
|
203
224
|
|
|
204
225
|
// WP_KIT_ENABLE_SAGE: legacy single-module override. Use WP_KIT_CONTENT_MODULES for full control.
|
|
205
226
|
const envEnableSage = parseBooleanEnv(process.env.WP_KIT_ENABLE_SAGE);
|
|
@@ -208,12 +229,12 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
208
229
|
// Sync selectedContentModules with env override
|
|
209
230
|
if (envEnableSage) {
|
|
210
231
|
defaultAnswers.selectedContentModules = [
|
|
211
|
-
...new Set([...(defaultAnswers.selectedContentModules || []),
|
|
232
|
+
...new Set([...(defaultAnswers.selectedContentModules || []), "sage"]),
|
|
212
233
|
];
|
|
213
234
|
} else {
|
|
214
235
|
defaultAnswers.selectedContentModules = (
|
|
215
236
|
defaultAnswers.selectedContentModules || []
|
|
216
|
-
).filter((m) => m !==
|
|
237
|
+
).filter((m) => m !== "sage");
|
|
217
238
|
}
|
|
218
239
|
}
|
|
219
240
|
|
|
@@ -224,15 +245,15 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
224
245
|
if (envContentModules !== undefined) {
|
|
225
246
|
const modules = envContentModules
|
|
226
247
|
? envContentModules
|
|
227
|
-
.split(
|
|
248
|
+
.split(",")
|
|
228
249
|
.map((m) => m.trim())
|
|
229
250
|
.filter(Boolean)
|
|
230
251
|
: [];
|
|
231
252
|
defaultAnswers.selectedContentModules = modules;
|
|
232
|
-
defaultAnswers.enable_sage = modules.includes(
|
|
233
|
-
defaultAnswers.enable_blank_theme = modules.includes(
|
|
234
|
-
defaultAnswers.enable_mu_plugin = modules.includes(
|
|
235
|
-
defaultAnswers.enable_plugin = modules.includes(
|
|
253
|
+
defaultAnswers.enable_sage = modules.includes("sage");
|
|
254
|
+
defaultAnswers.enable_blank_theme = modules.includes("blank-theme");
|
|
255
|
+
defaultAnswers.enable_mu_plugin = modules.includes("mu-plugin");
|
|
256
|
+
defaultAnswers.enable_plugin = modules.includes("plugin");
|
|
236
257
|
}
|
|
237
258
|
|
|
238
259
|
// WP_KIT_PROJECT_NAME: overrides the default project name (used for E2E tests).
|
|
@@ -246,8 +267,13 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
246
267
|
defaultAnswers.gitProvider = envGitProvider;
|
|
247
268
|
}
|
|
248
269
|
|
|
270
|
+
// WP_KIT_SSH_TRANSPORT: overrides ssh_transport (used for non-interactive E2E generation).
|
|
271
|
+
if (process.env.WP_KIT_SSH_TRANSPORT) {
|
|
272
|
+
defaultAnswers.ssh_transport = process.env.WP_KIT_SSH_TRANSPORT;
|
|
273
|
+
}
|
|
274
|
+
|
|
249
275
|
const enabledModules = Object.keys(modulePromptDefs).filter(
|
|
250
|
-
(mod) => defaultAnswers[`enable_${mod.replace(/-/g,
|
|
276
|
+
(mod) => defaultAnswers[`enable_${mod.replace(/-/g, "_")}`] === true,
|
|
251
277
|
);
|
|
252
278
|
const derived = deriveProjectMetadata({
|
|
253
279
|
projectName: defaultAnswers.projectName,
|
|
@@ -257,8 +283,8 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
257
283
|
return {
|
|
258
284
|
...defaultAnswers,
|
|
259
285
|
...derived,
|
|
260
|
-
phpVersion:
|
|
261
|
-
nodeVersion:
|
|
286
|
+
phpVersion: "8.4",
|
|
287
|
+
nodeVersion: "24",
|
|
262
288
|
enabledModules,
|
|
263
289
|
projectDomain: `${defaultAnswers.projectName}.lndo.site`,
|
|
264
290
|
salts: Generator.generateSalts(),
|
|
@@ -269,13 +295,13 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
269
295
|
|
|
270
296
|
// Derive enable_* flags from the checkbox selection
|
|
271
297
|
const sel = answers.selectedContentModules || [];
|
|
272
|
-
answers.enable_sage = sel.includes(
|
|
273
|
-
answers.enable_blank_theme = sel.includes(
|
|
274
|
-
answers.enable_mu_plugin = sel.includes(
|
|
275
|
-
answers.enable_plugin = sel.includes(
|
|
298
|
+
answers.enable_sage = sel.includes("sage");
|
|
299
|
+
answers.enable_blank_theme = sel.includes("blank-theme");
|
|
300
|
+
answers.enable_mu_plugin = sel.includes("mu-plugin");
|
|
301
|
+
answers.enable_plugin = sel.includes("plugin");
|
|
276
302
|
|
|
277
303
|
const enabledModules = Object.keys(modulePromptDefs).filter(
|
|
278
|
-
(mod) => answers[`enable_${mod.replace(/-/g,
|
|
304
|
+
(mod) => answers[`enable_${mod.replace(/-/g, "_")}`] === true,
|
|
279
305
|
);
|
|
280
306
|
const derived = deriveProjectMetadata({
|
|
281
307
|
projectName: answers.projectName,
|
|
@@ -285,8 +311,8 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
285
311
|
return {
|
|
286
312
|
...answers,
|
|
287
313
|
...derived,
|
|
288
|
-
phpVersion:
|
|
289
|
-
nodeVersion:
|
|
314
|
+
phpVersion: "8.4",
|
|
315
|
+
nodeVersion: "24",
|
|
290
316
|
enabledModules,
|
|
291
317
|
projectDomain: `${answers.projectName}.lndo.site`,
|
|
292
318
|
salts: Generator.generateSalts(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import path from
|
|
1
|
+
import path from "path";
|
|
2
2
|
|
|
3
|
-
import fs from
|
|
3
|
+
import fs from "fs-extra";
|
|
4
4
|
|
|
5
|
-
import { log, color } from
|
|
5
|
+
import { log, color } from "../../lib/utils/logger.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Derive an UPPER_SNAKE constant prefix from a kebab/snake theme slug
|
|
@@ -19,7 +19,7 @@ function toConstantPrefix(slug) {
|
|
|
19
19
|
.split(/[-_]/)
|
|
20
20
|
.filter(Boolean)
|
|
21
21
|
.map((segment) => segment.toUpperCase())
|
|
22
|
-
.join(
|
|
22
|
+
.join("_");
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export async function setupModule(context, generator) {
|
|
@@ -36,53 +36,42 @@ export async function setupModule(context, generator) {
|
|
|
36
36
|
log(color.blue, `[blank-theme] 📂 Scaffolding blank theme: ${themeDir}`);
|
|
37
37
|
|
|
38
38
|
// 1. Ensure directories exist
|
|
39
|
-
await fs.ensureDir(path.join(absoluteThemeDir,
|
|
40
|
-
await fs.ensureDir(path.join(absoluteThemeDir,
|
|
41
|
-
await fs.ensureDir(path.join(absoluteThemeDir,
|
|
39
|
+
await fs.ensureDir(path.join(absoluteThemeDir, "src", "js"));
|
|
40
|
+
await fs.ensureDir(path.join(absoluteThemeDir, "src", "scss"));
|
|
41
|
+
await fs.ensureDir(path.join(absoluteThemeDir, "php"));
|
|
42
42
|
|
|
43
43
|
// 2. Generate static files
|
|
44
|
-
await generator.generateFile(
|
|
44
|
+
await generator.generateFile("style.css", themeContext, "blank-theme", `${themeDir}/style.css`);
|
|
45
45
|
await generator.generateFile(
|
|
46
|
-
|
|
46
|
+
"functions.php",
|
|
47
47
|
themeContext,
|
|
48
|
-
|
|
49
|
-
`${themeDir}/functions.php
|
|
48
|
+
"blank-theme",
|
|
49
|
+
`${themeDir}/functions.php`,
|
|
50
50
|
);
|
|
51
51
|
await generator.generateFile(
|
|
52
|
-
|
|
52
|
+
"vite.config.js",
|
|
53
53
|
themeContext,
|
|
54
|
-
|
|
55
|
-
`${themeDir}/vite.config.js
|
|
54
|
+
"blank-theme",
|
|
55
|
+
`${themeDir}/vite.config.js`,
|
|
56
56
|
);
|
|
57
57
|
await generator.generateFile(
|
|
58
|
-
|
|
58
|
+
"package.json",
|
|
59
59
|
themeContext,
|
|
60
|
-
|
|
61
|
-
`${themeDir}/package.json
|
|
60
|
+
"blank-theme",
|
|
61
|
+
`${themeDir}/package.json`,
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
// 3. src/ scaffolds
|
|
65
|
-
await fs.ensureFile(path.join(absoluteThemeDir,
|
|
66
|
-
await fs.ensureFile(path.join(absoluteThemeDir,
|
|
65
|
+
await fs.ensureFile(path.join(absoluteThemeDir, "src", "js", "app.js"));
|
|
66
|
+
await fs.ensureFile(path.join(absoluteThemeDir, "src", "scss", "app.scss"));
|
|
67
67
|
|
|
68
68
|
// 4. Lint configs co-located in theme — always installed (IDE/editor support)
|
|
69
|
-
log(color.blue,
|
|
70
|
-
await generator.copyFile('lint/.prettierrc.json', 'blank-theme', `${themeDir}/.prettierrc.json`);
|
|
71
|
-
if (context.blank_theme_lint_eslint !== false) {
|
|
72
|
-
await generator.copyFile(
|
|
73
|
-
'lint/eslint.config.mjs',
|
|
74
|
-
'blank-theme',
|
|
75
|
-
`${themeDir}/eslint.config.mjs`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
if (context.blank_theme_lint_pint !== false) {
|
|
79
|
-
await generator.copyFile('lint/pint.json', 'blank-theme', `${themeDir}/pint.json`);
|
|
80
|
-
}
|
|
69
|
+
log(color.blue, "[blank-theme] 🔧 Installing lint configurations...");
|
|
81
70
|
if (context.blank_theme_lint_stylelint !== false) {
|
|
82
71
|
await generator.copyFile(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
`${themeDir}/.stylelintrc.json
|
|
72
|
+
"lint/.stylelintrc.json",
|
|
73
|
+
"blank-theme",
|
|
74
|
+
`${themeDir}/.stylelintrc.json`,
|
|
86
75
|
);
|
|
87
76
|
}
|
|
88
77
|
|
|
@@ -1,33 +1,17 @@
|
|
|
1
1
|
export default [
|
|
2
2
|
{
|
|
3
|
-
type:
|
|
4
|
-
name:
|
|
5
|
-
message:
|
|
6
|
-
default: (answers) => `${answers.projectName ||
|
|
7
|
-
when: (answers) => answers.selectedContentModules?.includes(
|
|
3
|
+
type: "input",
|
|
4
|
+
name: "blank_theme_name",
|
|
5
|
+
message: "Blank theme slug (used as directory name):",
|
|
6
|
+
default: (answers) => `${answers.projectName || "wordpress"}-theme`,
|
|
7
|
+
when: (answers) => answers.selectedContentModules?.includes("blank-theme"),
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
|
-
type:
|
|
11
|
-
name:
|
|
12
|
-
message:
|
|
10
|
+
type: "confirm",
|
|
11
|
+
name: "blank_theme_lint_stylelint",
|
|
12
|
+
message: "Blank Theme: enable Stylelint for CSS/SCSS?",
|
|
13
13
|
default: true,
|
|
14
14
|
when: (answers) =>
|
|
15
|
-
answers.selectedContentModules?.includes(
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: 'confirm',
|
|
19
|
-
name: 'blank_theme_lint_stylelint',
|
|
20
|
-
message: 'Blank Theme: enable Stylelint for CSS/SCSS?',
|
|
21
|
-
default: true,
|
|
22
|
-
when: (answers) =>
|
|
23
|
-
answers.selectedContentModules?.includes('blank-theme') && answers.enable_lint,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'confirm',
|
|
27
|
-
name: 'blank_theme_lint_pint',
|
|
28
|
-
message: 'Blank Theme: enable Pint for PHP?',
|
|
29
|
-
default: true,
|
|
30
|
-
when: (answers) =>
|
|
31
|
-
answers.selectedContentModules?.includes('blank-theme') && answers.enable_lint,
|
|
15
|
+
answers.selectedContentModules?.includes("blank-theme") && answers.enable_lint,
|
|
32
16
|
},
|
|
33
17
|
];
|
|
@@ -8,19 +8,16 @@ tooling:
|
|
|
8
8
|
description: Build blank theme assets
|
|
9
9
|
cmd: npm run build --prefix /app/content/themes/{{blank_theme_name}}
|
|
10
10
|
{{#if enable_lint}}
|
|
11
|
-
bt-
|
|
11
|
+
bt-lint:
|
|
12
12
|
service: build
|
|
13
|
-
description: Lint JS/TS in blank theme
|
|
14
|
-
cmd: npx
|
|
13
|
+
description: Lint JS/TS in blank theme (oxlint)
|
|
14
|
+
cmd: npx oxlint --fix src/js/
|
|
15
15
|
dir: /app/content/themes/{{blank_theme_name}}
|
|
16
|
+
{{#if blank_theme_lint_stylelint}}
|
|
16
17
|
bt-stylelint:
|
|
17
18
|
service: build
|
|
18
19
|
description: Lint CSS/SCSS in blank theme
|
|
19
20
|
cmd: npx stylelint --fix "src/scss/**/*.scss" --config /app/content/themes/{{blank_theme_name}}/.stylelintrc.json
|
|
20
21
|
dir: /app/content/themes/{{blank_theme_name}}
|
|
21
|
-
|
|
22
|
-
service: appserver
|
|
23
|
-
description: Lint PHP in blank theme
|
|
24
|
-
dir: /app/content/themes/{{blank_theme_name}}
|
|
25
|
-
cmd: ./vendor/bin/pint
|
|
22
|
+
{{/if}}
|
|
26
23
|
{{/if}}
|