@codigodoleo/wp-kit 3.2.0 → 3.3.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/core/infer-ci-capabilities.js +17 -0
- package/lib/prompts/index.js +3 -3
- package/modules/blank-theme/index.js +71 -0
- package/modules/blank-theme/lint/.prettierrc.json +12 -0
- package/modules/blank-theme/lint/.stylelintrc.json +7 -0
- package/modules/{lint → blank-theme/lint}/eslint.config.mjs +2 -8
- package/modules/blank-theme/lint/pint.json +11 -0
- package/modules/blank-theme/prompts.js +36 -0
- package/modules/blank-theme/templates/.lando.yml.hbs +26 -0
- package/modules/blank-theme/templates/functions.php.hbs +46 -0
- package/modules/blank-theme/templates/package.json.hbs +16 -0
- package/modules/blank-theme/templates/style.css.hbs +7 -0
- package/modules/blank-theme/templates/vite.config.js.hbs +23 -0
- package/modules/deploy/.github/workflows/deploy-docker.yml +2 -0
- package/modules/deploy/.github/workflows/deploy-ssh.yml +2 -0
- package/modules/deploy/.github/workflows/release.yml +2 -0
- package/modules/deploy/index.js +38 -0
- package/modules/deploy/templates/.github/workflows/ci.yml.hbs +29 -1
- package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +35 -0
- package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +19 -0
- package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +19 -0
- package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +47 -0
- package/modules/git/templates/workspace.json.hbs +1 -1
- package/modules/lint/.commitlintrc.json +21 -0
- package/modules/lint/.prettierignore +15 -25
- package/modules/lint/.prettierrc.json +5 -16
- package/modules/lint/index.js +75 -8
- package/modules/lint/prompts.js +1 -8
- package/modules/lint/templates/.lando.yml.hbs +3 -8
- package/modules/lint/templates/workspace.json.hbs +3 -3
- package/modules/mu-plugin/index.js +49 -0
- package/modules/mu-plugin/lint/.prettierrc.json +7 -0
- package/modules/mu-plugin/lint/eslint.config.mjs +30 -0
- package/modules/mu-plugin/lint/pint.json +11 -0
- package/modules/mu-plugin/prompts.js +29 -0
- package/modules/mu-plugin/templates/.lando.yml.hbs +15 -0
- package/modules/mu-plugin/templates/composer.json.hbs +14 -0
- package/modules/mu-plugin/templates/plugin.php.hbs +15 -0
- package/modules/php/templates/composer.json.hbs +15 -1
- package/modules/plugin/index.js +45 -0
- package/modules/plugin/lint/.prettierrc.json +7 -0
- package/modules/plugin/lint/eslint.config.mjs +30 -0
- package/modules/plugin/lint/pint.json +11 -0
- package/modules/plugin/prompts.js +29 -0
- package/modules/plugin/templates/.lando.yml.hbs +15 -0
- package/modules/plugin/templates/composer.json.hbs +14 -0
- package/modules/plugin/templates/plugin.php.hbs +15 -0
- package/modules/sage/index.js +25 -0
- package/modules/sage/lint/.prettierrc.json +12 -0
- package/modules/sage/lint/.stylelintrc.json +7 -0
- package/modules/sage/lint/eslint.config.mjs +30 -0
- package/modules/sage/lint/pint.json +11 -0
- package/modules/sage/prompts.js +21 -0
- package/modules/sage/templates/.lando.yml.hbs +13 -1
- package/modules/sage/templates/theme/vite.config.js.hbs +4 -4
- package/package.json +1 -1
- package/templates/.gitignore.hbs +84 -13
- package/templates/composer.json.hbs +60 -13
- package/templates/workspace.json.hbs +1 -1
- package/modules/lint/.eslintignore +0 -36
- package/modules/lint/.eslintrc.json +0 -8
- package/modules/lint/.stylelintignore +0 -19
- package/modules/lint/.stylelintrc.json +0 -9
- package/modules/lint/pint.json +0 -26
|
@@ -84,6 +84,23 @@ export function inferCiCapabilities(context) {
|
|
|
84
84
|
node: hasNode,
|
|
85
85
|
sage: hasSage,
|
|
86
86
|
},
|
|
87
|
+
lint: {
|
|
88
|
+
sage:
|
|
89
|
+
hasSage &&
|
|
90
|
+
Boolean(context.enable_lint) &&
|
|
91
|
+
(context.sage_lint_eslint !== false ||
|
|
92
|
+
context.sage_lint_pint !== false ||
|
|
93
|
+
context.sage_lint_stylelint !== false),
|
|
94
|
+
mu_plugin: Boolean(context.enable_mu_plugin && context.enable_lint),
|
|
95
|
+
plugin: Boolean(context.enable_plugin && context.enable_lint),
|
|
96
|
+
blank_theme: Boolean(context.enable_blank_theme && context.enable_lint),
|
|
97
|
+
any:
|
|
98
|
+
Boolean(context.enable_lint) &&
|
|
99
|
+
(hasSage ||
|
|
100
|
+
Boolean(context.enable_mu_plugin) ||
|
|
101
|
+
Boolean(context.enable_plugin) ||
|
|
102
|
+
Boolean(context.enable_blank_theme)),
|
|
103
|
+
},
|
|
87
104
|
deploy: {
|
|
88
105
|
docker: context.deploy_strategy === 'docker',
|
|
89
106
|
},
|
package/lib/prompts/index.js
CHANGED
|
@@ -85,7 +85,7 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
85
85
|
for (const prompt of allPrompts) {
|
|
86
86
|
if (prompt.when && !prompt.when(defaultAnswers)) continue;
|
|
87
87
|
const def = prompt.default;
|
|
88
|
-
defaultAnswers[prompt.name] = typeof def === 'function' ? def() : def;
|
|
88
|
+
defaultAnswers[prompt.name] = typeof def === 'function' ? def(defaultAnswers) : def;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
const envEnableSage = parseBooleanEnv(process.env.WP_KIT_ENABLE_SAGE);
|
|
@@ -99,7 +99,7 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
const enabledModules = Object.keys(modulePromptDefs).filter(
|
|
102
|
-
(mod) => defaultAnswers[`enable_${mod}`] === true
|
|
102
|
+
(mod) => defaultAnswers[`enable_${mod.replace(/-/g, '_')}`] === true
|
|
103
103
|
);
|
|
104
104
|
return {
|
|
105
105
|
...defaultAnswers,
|
|
@@ -114,7 +114,7 @@ export async function runPrompts({ defaults = false } = {}) {
|
|
|
114
114
|
const answers = await inquirer.prompt(allPrompts);
|
|
115
115
|
|
|
116
116
|
const enabledModules = Object.keys(modulePromptDefs).filter(
|
|
117
|
-
(mod) => answers[`enable_${mod}`] === true
|
|
117
|
+
(mod) => answers[`enable_${mod.replace(/-/g, '_')}`] === true
|
|
118
118
|
);
|
|
119
119
|
return {
|
|
120
120
|
...answers,
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
|
|
5
|
+
import { log, color } from '../../lib/utils/logger.js';
|
|
6
|
+
|
|
7
|
+
export async function setupModule(context, generator) {
|
|
8
|
+
const themeName = context.blank_theme_name || `${context.projectName}-theme`;
|
|
9
|
+
const themeDir = `content/themes/${themeName}`;
|
|
10
|
+
const absoluteThemeDir = path.join(generator.cwd, themeDir);
|
|
11
|
+
|
|
12
|
+
log(color.blue, `[blank-theme] 📂 Scaffolding blank theme: ${themeDir}`);
|
|
13
|
+
|
|
14
|
+
// 1. Ensure directories exist
|
|
15
|
+
await fs.ensureDir(path.join(absoluteThemeDir, 'src', 'js'));
|
|
16
|
+
await fs.ensureDir(path.join(absoluteThemeDir, 'src', 'scss'));
|
|
17
|
+
await fs.ensureDir(path.join(absoluteThemeDir, 'php'));
|
|
18
|
+
|
|
19
|
+
// 2. Generate static files
|
|
20
|
+
await generator.generateFile(
|
|
21
|
+
'style.css',
|
|
22
|
+
{ ...context, blank_theme_name: themeName },
|
|
23
|
+
'blank-theme',
|
|
24
|
+
`${themeDir}/style.css`
|
|
25
|
+
);
|
|
26
|
+
await generator.generateFile(
|
|
27
|
+
'functions.php',
|
|
28
|
+
{ ...context, blank_theme_name: themeName },
|
|
29
|
+
'blank-theme',
|
|
30
|
+
`${themeDir}/functions.php`
|
|
31
|
+
);
|
|
32
|
+
await generator.generateFile(
|
|
33
|
+
'vite.config.js',
|
|
34
|
+
{ ...context, blank_theme_name: themeName },
|
|
35
|
+
'blank-theme',
|
|
36
|
+
`${themeDir}/vite.config.js`
|
|
37
|
+
);
|
|
38
|
+
await generator.generateFile(
|
|
39
|
+
'package.json',
|
|
40
|
+
{ ...context, blank_theme_name: themeName },
|
|
41
|
+
'blank-theme',
|
|
42
|
+
`${themeDir}/package.json`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// 3. src/ scaffolds
|
|
46
|
+
await fs.ensureFile(path.join(absoluteThemeDir, 'src', 'js', 'app.js'));
|
|
47
|
+
await fs.ensureFile(path.join(absoluteThemeDir, 'src', 'scss', 'app.scss'));
|
|
48
|
+
|
|
49
|
+
// 4. Lint configs co-located in theme — always installed (IDE/editor support)
|
|
50
|
+
log(color.blue, '[blank-theme] 🔧 Installing lint configurations...');
|
|
51
|
+
await generator.copyFile('lint/.prettierrc.json', 'blank-theme', `${themeDir}/.prettierrc.json`);
|
|
52
|
+
if (context.blank_theme_lint_eslint !== false) {
|
|
53
|
+
await generator.copyFile(
|
|
54
|
+
'lint/eslint.config.mjs',
|
|
55
|
+
'blank-theme',
|
|
56
|
+
`${themeDir}/eslint.config.mjs`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (context.blank_theme_lint_pint !== false) {
|
|
60
|
+
await generator.copyFile('lint/pint.json', 'blank-theme', `${themeDir}/pint.json`);
|
|
61
|
+
}
|
|
62
|
+
if (context.blank_theme_lint_stylelint !== false) {
|
|
63
|
+
await generator.copyFile(
|
|
64
|
+
'lint/.stylelintrc.json',
|
|
65
|
+
'blank-theme',
|
|
66
|
+
`${themeDir}/.stylelintrc.json`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
log(color.green, `[blank-theme] ✅ Blank theme scaffolded: ${themeDir}`);
|
|
71
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"semi": true,
|
|
3
|
+
"singleQuote": true,
|
|
4
|
+
"trailingComma": "es5",
|
|
5
|
+
"printWidth": 100,
|
|
6
|
+
"tabWidth": 2,
|
|
7
|
+
"overrides": [
|
|
8
|
+
{ "files": "*.blade.php", "options": { "parser": "html" } },
|
|
9
|
+
{ "files": "*.vue", "options": { "parser": "vue" } },
|
|
10
|
+
{ "files": "*.scss", "options": { "singleQuote": false } }
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -5,17 +5,11 @@ import globals from 'globals';
|
|
|
5
5
|
|
|
6
6
|
export default [
|
|
7
7
|
{
|
|
8
|
-
ignores: [
|
|
9
|
-
'**/node_modules/**',
|
|
10
|
-
'**/vendor/**',
|
|
11
|
-
'**/wp/**',
|
|
12
|
-
'**/public/build/**',
|
|
13
|
-
'**/dist/**',
|
|
14
|
-
'eslint.config.mjs',
|
|
15
|
-
],
|
|
8
|
+
ignores: ['node_modules/**', 'vendor/**', 'dist/**'],
|
|
16
9
|
},
|
|
17
10
|
js.configs.recommended,
|
|
18
11
|
{
|
|
12
|
+
files: ['src/js/**/*.{js,mjs,ts}'],
|
|
19
13
|
languageOptions: {
|
|
20
14
|
ecmaVersion: 2022,
|
|
21
15
|
sourceType: 'module',
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export default [
|
|
2
|
+
{
|
|
3
|
+
type: 'confirm',
|
|
4
|
+
name: 'enable_blank_theme',
|
|
5
|
+
message: 'Enable Blank Theme scaffold (Vite + SCSS, no Sage)?',
|
|
6
|
+
default: false,
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
type: 'input',
|
|
10
|
+
name: 'blank_theme_name',
|
|
11
|
+
message: 'Blank theme slug (used as directory name):',
|
|
12
|
+
default: (answers) => `${answers.projectName || 'wordpress'}-theme`,
|
|
13
|
+
when: (answers) => answers.enable_blank_theme,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: 'confirm',
|
|
17
|
+
name: 'blank_theme_lint_eslint',
|
|
18
|
+
message: 'Blank Theme: enable ESLint for JS/TS?',
|
|
19
|
+
default: true,
|
|
20
|
+
when: (answers) => answers.enable_blank_theme && answers.enable_lint,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'confirm',
|
|
24
|
+
name: 'blank_theme_lint_stylelint',
|
|
25
|
+
message: 'Blank Theme: enable Stylelint for CSS/SCSS?',
|
|
26
|
+
default: true,
|
|
27
|
+
when: (answers) => answers.enable_blank_theme && answers.enable_lint,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'confirm',
|
|
31
|
+
name: 'blank_theme_lint_pint',
|
|
32
|
+
message: 'Blank Theme: enable Pint for PHP?',
|
|
33
|
+
default: true,
|
|
34
|
+
when: (answers) => answers.enable_blank_theme && answers.enable_lint,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
tooling:
|
|
2
|
+
bt-dev:
|
|
3
|
+
service: build
|
|
4
|
+
description: Run Vite dev server for blank theme
|
|
5
|
+
cmd: npm run dev --prefix /app/content/themes/{{blank_theme_name}}
|
|
6
|
+
bt-build:
|
|
7
|
+
service: build
|
|
8
|
+
description: Build blank theme assets
|
|
9
|
+
cmd: npm run build --prefix /app/content/themes/{{blank_theme_name}}
|
|
10
|
+
{{#if enable_lint}}
|
|
11
|
+
bt-eslint:
|
|
12
|
+
service: build
|
|
13
|
+
description: Lint JS/TS in blank theme
|
|
14
|
+
cmd: npx eslint --fix src/js/ --config /app/content/themes/{{blank_theme_name}}/eslint.config.mjs
|
|
15
|
+
dir: /app/content/themes/{{blank_theme_name}}
|
|
16
|
+
bt-stylelint:
|
|
17
|
+
service: build
|
|
18
|
+
description: Lint CSS/SCSS in blank theme
|
|
19
|
+
cmd: npx stylelint --fix "src/scss/**/*.scss" --config /app/content/themes/{{blank_theme_name}}/.stylelintrc.json
|
|
20
|
+
dir: /app/content/themes/{{blank_theme_name}}
|
|
21
|
+
bt-pint:
|
|
22
|
+
service: appserver
|
|
23
|
+
description: Lint PHP in blank theme
|
|
24
|
+
dir: /app/content/themes/{{blank_theme_name}}
|
|
25
|
+
cmd: ./vendor/bin/pint
|
|
26
|
+
{{/if}}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Theme functions and definitions.
|
|
4
|
+
*
|
|
5
|
+
* @package {{blank_theme_name}}
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
if (!defined('ABSPATH')) {
|
|
9
|
+
exit;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
define('{{blank_theme_name}}_VERSION', '{{projectVersion}}');
|
|
13
|
+
define('{{blank_theme_name}}_DIR', get_template_directory());
|
|
14
|
+
define('{{blank_theme_name}}_URI', get_template_directory_uri());
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Enqueue Vite-compiled assets.
|
|
18
|
+
*/
|
|
19
|
+
add_action('wp_enqueue_scripts', function () {
|
|
20
|
+
$manifest = {{blank_theme_name}}_DIR . '/dist/.vite/manifest.json';
|
|
21
|
+
|
|
22
|
+
if (!file_exists($manifest)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
$data = json_decode(file_get_contents($manifest), true);
|
|
27
|
+
|
|
28
|
+
if (isset($data['src/js/app.js']['file'])) {
|
|
29
|
+
wp_enqueue_script(
|
|
30
|
+
'{{blank_theme_name}}-app',
|
|
31
|
+
{{blank_theme_name}}_URI . '/dist/' . $data['src/js/app.js']['file'],
|
|
32
|
+
[],
|
|
33
|
+
null,
|
|
34
|
+
true
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isset($data['src/scss/app.scss']['file'])) {
|
|
39
|
+
wp_enqueue_style(
|
|
40
|
+
'{{blank_theme_name}}-app',
|
|
41
|
+
{{blank_theme_name}}_URI . '/dist/' . $data['src/scss/app.scss']['file'],
|
|
42
|
+
[],
|
|
43
|
+
null
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{blank_theme_name}}",
|
|
3
|
+
"version": "{{projectVersion}}",
|
|
4
|
+
"description": "{{projectDescription}}",
|
|
5
|
+
"private": true,
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"lint": "eslint src/js --ext .js,.ts",
|
|
10
|
+
"lint:css": "stylelint \"src/scss/**/*.scss\""
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"vite": "^6.0.0",
|
|
14
|
+
"sass-embedded": "^1.77.0"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
base: '/app/content/themes/{{blank_theme_name}}/dist/',
|
|
5
|
+
build: {
|
|
6
|
+
outDir: 'dist',
|
|
7
|
+
rollupOptions: {
|
|
8
|
+
input: {
|
|
9
|
+
app: 'src/js/app.js',
|
|
10
|
+
styles: 'src/scss/app.scss',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
manifest: true,
|
|
14
|
+
emptyOutDir: true,
|
|
15
|
+
},
|
|
16
|
+
css: {
|
|
17
|
+
preprocessorOptions: {
|
|
18
|
+
scss: {
|
|
19
|
+
api: 'modern-compiler',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
});
|
package/modules/deploy/index.js
CHANGED
|
@@ -33,6 +33,44 @@ export async function setupModule(context, generator) {
|
|
|
33
33
|
'.gitlab/ci/deploy-ssh.yml'
|
|
34
34
|
);
|
|
35
35
|
log(color.green, '[deploy] Jobs reutilizáveis GitLab gerados em .gitlab/ci/');
|
|
36
|
+
|
|
37
|
+
// Lint jobs condicionais por módulo
|
|
38
|
+
if (context.ci?.lint?.sage) {
|
|
39
|
+
await generator.generateFile(
|
|
40
|
+
'.gitlab/ci/lint-sage.yml',
|
|
41
|
+
context,
|
|
42
|
+
'deploy',
|
|
43
|
+
'.gitlab/ci/lint-sage.yml'
|
|
44
|
+
);
|
|
45
|
+
log(color.green, '[deploy] GitLab lint job para Sage gerado.');
|
|
46
|
+
}
|
|
47
|
+
if (context.ci?.lint?.mu_plugin) {
|
|
48
|
+
await generator.generateFile(
|
|
49
|
+
'.gitlab/ci/lint-mu-plugin.yml',
|
|
50
|
+
context,
|
|
51
|
+
'deploy',
|
|
52
|
+
'.gitlab/ci/lint-mu-plugin.yml'
|
|
53
|
+
);
|
|
54
|
+
log(color.green, '[deploy] GitLab lint job para MU Plugin gerado.');
|
|
55
|
+
}
|
|
56
|
+
if (context.ci?.lint?.plugin) {
|
|
57
|
+
await generator.generateFile(
|
|
58
|
+
'.gitlab/ci/lint-plugin.yml',
|
|
59
|
+
context,
|
|
60
|
+
'deploy',
|
|
61
|
+
'.gitlab/ci/lint-plugin.yml'
|
|
62
|
+
);
|
|
63
|
+
log(color.green, '[deploy] GitLab lint job para Plugin gerado.');
|
|
64
|
+
}
|
|
65
|
+
if (context.ci?.lint?.blank_theme) {
|
|
66
|
+
await generator.generateFile(
|
|
67
|
+
'.gitlab/ci/lint-blank-theme.yml',
|
|
68
|
+
context,
|
|
69
|
+
'deploy',
|
|
70
|
+
'.gitlab/ci/lint-blank-theme.yml'
|
|
71
|
+
);
|
|
72
|
+
log(color.green, '[deploy] GitLab lint job para Blank Theme gerado.');
|
|
73
|
+
}
|
|
36
74
|
}
|
|
37
75
|
if (context.gitProvider === 'github') {
|
|
38
76
|
await generator.generateFile(
|
|
@@ -26,6 +26,34 @@ env.NODE_VERSION
|
|
|
26
26
|
não encontrado em $THEME — pulando build do tema" fi
|
|
27
27
|
{{/if}}
|
|
28
28
|
|
|
29
|
+
{{#if ci.lint.sage}}
|
|
30
|
+
lint-sage: name: Lint Sage Theme runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
|
|
31
|
+
env.NODE_VERSION
|
|
32
|
+
{{'}}'}}
|
|
33
|
+
- name: Lint Sage run: | cd {{ci.theme.paths.themeRoot}} && npm ci && npx eslint resources/ --config eslint.config.mjs --fix-dry-run && npx stylelint "resources/**/*.{css,scss}"
|
|
34
|
+
{{/if}}
|
|
35
|
+
|
|
36
|
+
{{#if ci.lint.mu_plugin}}
|
|
37
|
+
lint-mu-plugin: name: Lint MU Plugin runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
|
|
38
|
+
env.PHP_VERSION
|
|
39
|
+
{{'}}'}}
|
|
40
|
+
- name: Lint MU Plugin PHP run: | cd content/mu-plugins/{{mu_plugin_name}} && composer install --no-dev && ./vendor/bin/pint --test
|
|
41
|
+
{{/if}}
|
|
42
|
+
|
|
43
|
+
{{#if ci.lint.plugin}}
|
|
44
|
+
lint-plugin: name: Lint Plugin runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
|
|
45
|
+
env.PHP_VERSION
|
|
46
|
+
{{'}}'}}
|
|
47
|
+
- name: Lint Plugin PHP run: | cd content/plugins/{{plugin_name}} && composer install --no-dev && ./vendor/bin/pint --test
|
|
48
|
+
{{/if}}
|
|
49
|
+
|
|
50
|
+
{{#if ci.lint.blank_theme}}
|
|
51
|
+
lint-blank-theme: name: Lint Blank Theme runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
|
|
52
|
+
env.NODE_VERSION
|
|
53
|
+
{{'}}'}}
|
|
54
|
+
- name: Lint Blank Theme run: | cd content/themes/{{blank_theme_name}} && npm ci && npx eslint src/js/ --config eslint.config.mjs --fix-dry-run && npx stylelint "src/scss/**/*.scss"
|
|
55
|
+
{{/if}}
|
|
56
|
+
|
|
29
57
|
test-basic: name: Tests runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 -
|
|
30
58
|
name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
|
|
31
59
|
env.NODE_VERSION
|
|
@@ -46,4 +74,4 @@ env.NODE_VERSION
|
|
|
46
74
|
{{/if}}
|
|
47
75
|
|
|
48
76
|
env: PHP_VERSION: "{{phpVersion}}" NODE_VERSION: "{{ci.nodeVersion}}" WORDPRESS_VERSION: "{{wpCoreVersion}}"
|
|
49
|
-
PROJECT_NAME: "{{projectName}}"
|
|
77
|
+
PROJECT_NAME: "{{projectName}}"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{{#if ci.lint.blank_theme}}
|
|
2
|
+
lint:blank-theme:eslint:
|
|
3
|
+
stage: lint
|
|
4
|
+
image: node:${NODE_VERSION}-alpine
|
|
5
|
+
variables:
|
|
6
|
+
THEME_DIR: content/themes/{{blank_theme_name}}
|
|
7
|
+
before_script:
|
|
8
|
+
- apk add --no-cache git
|
|
9
|
+
script:
|
|
10
|
+
- cd $THEME_DIR
|
|
11
|
+
- npm ci --cache .npm --prefer-offline
|
|
12
|
+
- npx eslint src/js/ --config eslint.config.mjs --fix-dry-run
|
|
13
|
+
rules:
|
|
14
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
15
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
16
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
17
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
18
|
+
|
|
19
|
+
lint:blank-theme:stylelint:
|
|
20
|
+
stage: lint
|
|
21
|
+
image: node:${NODE_VERSION}-alpine
|
|
22
|
+
variables:
|
|
23
|
+
THEME_DIR: content/themes/{{blank_theme_name}}
|
|
24
|
+
before_script:
|
|
25
|
+
- apk add --no-cache git
|
|
26
|
+
script:
|
|
27
|
+
- cd $THEME_DIR
|
|
28
|
+
- npm ci --cache .npm --prefer-offline
|
|
29
|
+
- npx stylelint "src/scss/**/*.scss"
|
|
30
|
+
rules:
|
|
31
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
32
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
33
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
34
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
35
|
+
{{/if}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{#if ci.lint.mu_plugin}}
|
|
2
|
+
lint:mu-plugin:pint:
|
|
3
|
+
stage: lint
|
|
4
|
+
image: php:${PHP_VERSION}-cli
|
|
5
|
+
variables:
|
|
6
|
+
PLUGIN_DIR: content/mu-plugins/{{mu_plugin_name}}
|
|
7
|
+
before_script:
|
|
8
|
+
- apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
|
|
9
|
+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
10
|
+
script:
|
|
11
|
+
- cd $PLUGIN_DIR
|
|
12
|
+
- composer install --no-dev
|
|
13
|
+
- ./vendor/bin/pint --test
|
|
14
|
+
rules:
|
|
15
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
16
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
17
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
18
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
19
|
+
{{/if}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{#if ci.lint.plugin}}
|
|
2
|
+
lint:plugin:pint:
|
|
3
|
+
stage: lint
|
|
4
|
+
image: php:${PHP_VERSION}-cli
|
|
5
|
+
variables:
|
|
6
|
+
PLUGIN_DIR: content/plugins/{{plugin_name}}
|
|
7
|
+
before_script:
|
|
8
|
+
- apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
|
|
9
|
+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
10
|
+
script:
|
|
11
|
+
- cd $PLUGIN_DIR
|
|
12
|
+
- composer install --no-dev
|
|
13
|
+
- ./vendor/bin/pint --test
|
|
14
|
+
rules:
|
|
15
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
16
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
17
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
18
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
19
|
+
{{/if}}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{{#if ci.lint.sage}}
|
|
2
|
+
lint:sage:eslint:
|
|
3
|
+
stage: lint
|
|
4
|
+
image: node:${NODE_VERSION}-alpine
|
|
5
|
+
before_script:
|
|
6
|
+
- apk add --no-cache git
|
|
7
|
+
script:
|
|
8
|
+
- cd {{ci.theme.paths.themeRoot}}
|
|
9
|
+
- npm ci --cache .npm --prefer-offline
|
|
10
|
+
- npx eslint resources/ --config eslint.config.mjs --fix-dry-run
|
|
11
|
+
rules:
|
|
12
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
13
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
14
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
15
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
16
|
+
|
|
17
|
+
lint:sage:stylelint:
|
|
18
|
+
stage: lint
|
|
19
|
+
image: node:${NODE_VERSION}-alpine
|
|
20
|
+
before_script:
|
|
21
|
+
- apk add --no-cache git
|
|
22
|
+
script:
|
|
23
|
+
- cd {{ci.theme.paths.themeRoot}}
|
|
24
|
+
- npm ci --cache .npm --prefer-offline
|
|
25
|
+
- npx stylelint "resources/**/*.{css,scss}"
|
|
26
|
+
rules:
|
|
27
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
28
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
29
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
30
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
31
|
+
|
|
32
|
+
lint:sage:pint:
|
|
33
|
+
stage: lint
|
|
34
|
+
image: php:${PHP_VERSION}-cli
|
|
35
|
+
before_script:
|
|
36
|
+
- apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
|
|
37
|
+
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
|
|
38
|
+
script:
|
|
39
|
+
- cd {{ci.theme.paths.themeRoot}}
|
|
40
|
+
- composer install --no-dev --optimize-autoloader
|
|
41
|
+
- ./vendor/bin/pint --test
|
|
42
|
+
rules:
|
|
43
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
44
|
+
- if: $CI_COMMIT_BRANCH == "main"
|
|
45
|
+
- if: $CI_COMMIT_BRANCH == "staging"
|
|
46
|
+
- if: $CI_COMMIT_BRANCH == "develop"
|
|
47
|
+
{{/if}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@commitlint/config-conventional"],
|
|
3
|
+
"rules": {
|
|
4
|
+
"type-enum": [
|
|
5
|
+
2,
|
|
6
|
+
"always",
|
|
7
|
+
["feat", "fix", "docs", "style", "refactor", "perf", "test", "chore", "ci", "build", "revert"]
|
|
8
|
+
],
|
|
9
|
+
"type-case": [2, "always", "lower-case"],
|
|
10
|
+
"type-empty": [2, "never"],
|
|
11
|
+
"scope-case": [2, "always", "lower-case"],
|
|
12
|
+
"subject-case": [2, "never", ["sentence-case", "start-case", "pascal-case", "upper-case"]],
|
|
13
|
+
"subject-empty": [2, "never"],
|
|
14
|
+
"subject-full-stop": [2, "never", "."],
|
|
15
|
+
"header-max-length": [2, "always", 72],
|
|
16
|
+
"body-leading-blank": [1, "always"],
|
|
17
|
+
"body-max-line-length": [2, "always", 100],
|
|
18
|
+
"footer-leading-blank": [1, "always"],
|
|
19
|
+
"footer-max-line-length": [2, "always", 100]
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Node & Composer
|
|
2
2
|
node_modules/
|
|
3
|
-
|
|
4
|
-
build/
|
|
5
|
-
|
|
6
|
-
# Ignore WordPress core
|
|
7
|
-
wp/
|
|
8
|
-
wp-content/plugins/
|
|
9
|
-
wp-content/mu-plugins/
|
|
10
|
-
wp-content/uploads/
|
|
11
|
-
wp-content/upgrade/
|
|
3
|
+
vendor/
|
|
12
4
|
|
|
13
|
-
|
|
5
|
+
# Development module folders — each has its own lint config
|
|
6
|
+
content/themes/
|
|
14
7
|
content/mu-plugins/
|
|
8
|
+
content/plugins/
|
|
9
|
+
|
|
10
|
+
# WordPress core and uploads
|
|
11
|
+
wp/
|
|
15
12
|
content/uploads/
|
|
16
13
|
content/upgrade/
|
|
14
|
+
content/cache/
|
|
17
15
|
|
|
18
|
-
#
|
|
19
|
-
|
|
16
|
+
# Build outputs
|
|
17
|
+
public/build/
|
|
18
|
+
dist/
|
|
19
|
+
.lando/
|
|
20
20
|
|
|
21
|
-
#
|
|
22
|
-
*.log
|
|
21
|
+
# Env and logs
|
|
23
22
|
.env
|
|
24
23
|
.env.*
|
|
25
|
-
|
|
26
|
-
# Ignore IDE and system files
|
|
27
|
-
.DS_Store
|
|
28
|
-
Thumbs.db
|
|
29
|
-
|
|
30
|
-
# Ignore Lando config cache
|
|
31
|
-
.lando/
|
|
32
|
-
|
|
33
|
-
# Ignore anything temporary
|
|
24
|
+
*.log
|
|
34
25
|
*.tmp
|
|
35
|
-
*.temp
|
|
36
26
|
*.bak
|