@codigodoleo/wp-kit 5.0.2 → 5.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.
Files changed (59) hide show
  1. package/lib/commands/init.js +87 -78
  2. package/lib/config/versions.js +45 -45
  3. package/lib/core/infer-ci-capabilities.js +39 -26
  4. package/lib/prompts/index.js +113 -92
  5. package/modules/blank-theme/index.js +23 -34
  6. package/modules/blank-theme/prompts.js +9 -25
  7. package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
  8. package/modules/blank-theme/templates/package.json.hbs +1 -1
  9. package/modules/deploy/index.js +51 -61
  10. package/modules/deploy/prompts.js +36 -12
  11. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
  12. package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
  13. package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
  14. package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
  15. package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
  16. package/modules/git/.lintstagedrc.json +2 -5
  17. package/modules/lint/.oxlintrc.json +19 -0
  18. package/modules/lint/.prettierignore +16 -1
  19. package/modules/lint/index.js +32 -40
  20. package/modules/lint/templates/mago.toml.hbs +83 -0
  21. package/modules/lint/templates/package.json.hbs +6 -10
  22. package/modules/lint/templates/workspace.json.hbs +2 -36
  23. package/modules/mu-plugin/index.js +39 -51
  24. package/modules/mu-plugin/prompts.js +10 -28
  25. package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
  26. package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
  27. package/modules/mu-plugin/templates/composer.json.hbs +4 -2
  28. package/modules/php/templates/.lando.yml.hbs +13 -8
  29. package/modules/php/templates/composer.json.hbs +15 -7
  30. package/modules/php/templates/workspace.json.hbs +22 -19
  31. package/modules/plugin/index.js +10 -18
  32. package/modules/plugin/prompts.js +5 -19
  33. package/modules/plugin/templates/.lando.yml.hbs +8 -10
  34. package/modules/plugin/templates/composer.json.hbs +4 -2
  35. package/modules/sage/index.js +78 -88
  36. package/modules/sage/prompts.js +10 -24
  37. package/modules/sage/templates/.lando.yml.hbs +17 -7
  38. package/modules/sage/templates/theme/composer.json.hbs +36 -23
  39. package/modules/sage/templates/theme/package.json.hbs +24 -13
  40. package/modules/test/templates/composer.json.hbs +1 -1
  41. package/package.json +30 -35
  42. package/templates/.devcontainer/devcontainer.json.hbs +2 -2
  43. package/templates/.gitignore.hbs +1 -0
  44. package/templates/auth.json.hbs +8 -0
  45. package/templates/composer.json.hbs +13 -5
  46. package/templates/package.json.hbs +2 -4
  47. package/templates/workspace.json.hbs +3 -4
  48. package/wp-config.php +5 -0
  49. package/modules/blank-theme/lint/eslint.config.mjs +0 -30
  50. package/modules/blank-theme/lint/pint.json +0 -11
  51. package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
  52. package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
  53. package/modules/deploy/.github/workflows/release.yml +0 -57
  54. package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
  55. package/modules/mu-plugin/lint/pint.json +0 -11
  56. package/modules/plugin/lint/eslint.config.mjs +0 -30
  57. package/modules/plugin/lint/pint.json +0 -11
  58. package/modules/sage/lint/eslint.config.mjs +0 -30
  59. package/modules/sage/lint/pint.json +0 -11
@@ -1,6 +1,6 @@
1
- import path from 'path';
1
+ import path from "path";
2
2
 
3
- import fs from 'fs-extra';
3
+ import fs from "fs-extra";
4
4
 
5
5
  /**
6
6
  * Builds the lint-staged entries object from active development modules.
@@ -9,73 +9,65 @@ import fs from 'fs-extra';
9
9
  function buildLintStagedEntries(context) {
10
10
  const entries = {};
11
11
 
12
- // Infra: YAML, JSON, Markdown at root (never touching module folders)
13
- entries['*.{yml,yaml}'] = ['prettier --write'];
14
- entries['*.{json,md}'] = ['prettier --write'];
12
+ // Infra: YAML, JSON, Markdown at root
13
+ entries["*.{js,mjs,ts,vue,jsx,tsx}"] = ["oxfmt --write", "oxlint --fix"];
14
+ entries["*.{json,jsonc,html,yml,yaml,md,mdx}"] = ["oxfmt --write"];
15
15
 
16
- // Sage
16
+ // Sage — PHP via mago (format only on pre-commit, lint runs in CI)
17
17
  if (context.enable_sage) {
18
18
  const dir = `content/themes/${context.projectName}`;
19
- if (context.sage_lint_eslint !== false) {
20
- entries[`${dir}/resources/**/*.{js,ts,vue,mjs}`] = ['eslint --fix'];
21
- }
19
+ entries[`${dir}/{app,routes,config}/**/*.php`] = [
20
+ "lando ssh -c 'cd /app && vendor/bin/mago format --no-progress'",
21
+ ];
22
22
  if (context.sage_lint_stylelint !== false) {
23
- entries[`${dir}/resources/**/*.{css,scss}`] = ['stylelint --fix'];
24
- }
25
- if (context.sage_lint_pint !== false) {
26
- entries[`${dir}/app/**/*.php`] = ['pint'];
23
+ entries[`${dir}/resources/**/*.{css,scss}`] = ["stylelint --fix"];
27
24
  }
28
25
  }
29
26
 
30
- // MU-Plugin
27
+ // MU-Plugin — PHP via mago
31
28
  if (context.enable_mu_plugin) {
32
29
  const dir = `content/mu-plugins/${context.mu_plugin_name || `${context.projectName}-core`}`;
33
- if (context.mu_plugin_lint_eslint !== false) {
34
- entries[`${dir}/resources/**/*.{js,ts}`] = ['eslint --fix'];
35
- }
36
- if (context.mu_plugin_lint_pint !== false) {
37
- entries[`${dir}/src/**/*.php`] = ['pint'];
38
- }
30
+ entries[`${dir}/app/**/*.php`] = [
31
+ "lando ssh -c 'cd /app && vendor/bin/mago format --no-progress'",
32
+ ];
39
33
  }
40
34
 
41
- // Plugin
35
+ // Plugin — PHP via mago
42
36
  if (context.enable_plugin) {
43
37
  const dir = `content/plugins/${context.plugin_name || `${context.projectName}-plugin`}`;
44
- if (context.plugin_lint_eslint !== false) {
45
- entries[`${dir}/resources/**/*.{js,ts}`] = ['eslint --fix'];
46
- }
47
- if (context.plugin_lint_pint !== false) {
48
- entries[`${dir}/src/**/*.php`] = ['pint'];
49
- }
38
+ entries[`${dir}/src/**/*.php`] = [
39
+ "lando ssh -c 'cd /app && vendor/bin/mago format --no-progress'",
40
+ ];
50
41
  }
51
42
 
52
43
  // Blank Theme
53
44
  if (context.enable_blank_theme) {
54
45
  const dir = `content/themes/${context.blank_theme_name || `${context.projectName}-theme`}`;
55
- if (context.blank_theme_lint_eslint !== false) {
56
- entries[`${dir}/src/**/*.{js,ts}`] = ['eslint --fix'];
57
- }
46
+ entries[`${dir}/src/**/*.{js,ts}`] = ["oxfmt --write", "oxlint --fix"];
58
47
  if (context.blank_theme_lint_stylelint !== false) {
59
- entries[`${dir}/src/**/*.{css,scss}`] = ['stylelint --fix'];
60
- }
61
- if (context.blank_theme_lint_pint !== false) {
62
- entries[`${dir}/src/**/*.php`] = ['pint'];
48
+ entries[`${dir}/src/**/*.{css,scss}`] = ["stylelint --fix"];
63
49
  }
64
50
  }
65
51
 
52
+ // Tests PHP
53
+ entries["tests/**/*.php"] = ["lando ssh -c 'cd /app && vendor/bin/mago format --no-progress'"];
54
+
66
55
  return entries;
67
56
  }
68
57
 
69
58
  export async function setupModule(context, generator) {
70
59
  if (!context.enable_lint) return;
71
60
 
72
- // Root developer tooling (always present when lint is enabled)
73
- await generator.copyFile('.commitlintrc.json', 'lint');
74
- await generator.copyFile('.prettierrc.json', 'lint');
75
- await generator.copyFile('.prettierignore', 'lint');
61
+ // Root developer tooling
62
+ await generator.copyFile(".commitlintrc.json", "lint");
63
+ await generator.copyFile(".prettierignore", "lint");
64
+ await generator.copyFile(".oxlintrc.json", "lint");
65
+
66
+ // mago.toml — generated (paths depend on active modules)
67
+ await generator.generateFile("mago.toml", context, "lint", "mago.toml");
76
68
 
77
69
  // Compose .lintstagedrc.json from active modules
78
70
  const entries = buildLintStagedEntries(context);
79
- const lintStagedPath = path.join(generator.cwd, '.lintstagedrc.json');
80
- await fs.outputFile(lintStagedPath, JSON.stringify(entries, null, 2) + '\n');
71
+ const lintStagedPath = path.join(generator.cwd, ".lintstagedrc.json");
72
+ await fs.outputFile(lintStagedPath, JSON.stringify(entries, null, 2) + "\n");
81
73
  }
@@ -0,0 +1,83 @@
1
+ # Mago — PHP format + lint configuration
2
+ # https://carthage.software/mago
3
+ #
4
+ # Replaces Laravel Pint and adds a linter we never had.
5
+ #
6
+ # WordPress-aware rule overrides: a number of "best practices" lints fire on
7
+ # idioms that are unavoidable inside WordPress / ACF / Acorn — they are
8
+ # disabled explicitly with a comment so a future reader knows why.
9
+
10
+ [source]
11
+ paths = [
12
+ {{#if enable_sage}} "content/themes/{{projectName}}/app/",
13
+ "content/themes/{{projectName}}/routes/",
14
+ "content/themes/{{projectName}}/config/",
15
+ {{/if}}{{#if enable_mu_plugin}} "content/mu-plugins/{{mu_plugin_name}}/app/",
16
+ {{/if}}{{#if enable_plugin}} "content/plugins/{{plugin_name}}/src/",
17
+ {{/if}} "tests/",
18
+ ]
19
+ excludes = [
20
+ {{#if enable_sage}} "content/themes/{{projectName}}/public/**",
21
+ "content/themes/{{projectName}}/vendor/**",
22
+ "content/themes/{{projectName}}/node_modules/**",
23
+ {{/if}} "vendor/**",
24
+ "wp/**",
25
+ "content/plugins/**",
26
+ "content/mu-plugins/**",
27
+ ]
28
+
29
+ [formatter]
30
+ print-width = 120
31
+ null-type-hint = "question"
32
+ space-before-arrow-function-parameter-list-parenthesis = true
33
+ space-after-logical-not-unary-prefix-operator = true
34
+ sort-uses = true
35
+
36
+ [linter]
37
+ integrations = ["laravel"]
38
+
39
+ [linter.rules]
40
+ # Too noisy with WordPress i18n functions (__(), _e(), _x(), etc.)
41
+ literal-named-argument = { enabled = false }
42
+
43
+ no-else-clause = { enabled = true }
44
+
45
+ # Common WordPress pattern: if ($x = get_option(...)) { ... }
46
+ no-assign-in-condition = { enabled = false }
47
+
48
+ no-empty = { enabled = false }
49
+
50
+ # Unavoidable in WordPress: $GLOBALS['wpdb'], global $wp_rest_server, etc.
51
+ no-global = { enabled = false }
52
+
53
+ # False positive on Laravel cast definitions
54
+ no-literal-password = { enabled = false }
55
+
56
+ # We use empty comments to keep callback bodies expanded for readability
57
+ no-empty-comment = { enabled = false }
58
+
59
+ no-eval = { enabled = true }
60
+
61
+ # Common WordPress REST API test pattern
62
+ no-multi-assignments = { enabled = false }
63
+
64
+ # WordPress functions often return false instead of null
65
+ no-redundant-nullsafe = { enabled = false }
66
+
67
+ no-redundant-parentheses = { enabled = true }
68
+ no-redundant-use = { enabled = true }
69
+ no-shorthand-ternary = { enabled = false }
70
+
71
+ # Arrow functions should be a stylistic choice
72
+ prefer-arrow-function = { enabled = false }
73
+
74
+ # False positive — doesn't recognize `return new class extends Migration`
75
+ prefer-anonymous-migration = { enabled = false }
76
+
77
+ # False positive with spread operator: fn ($params) => func(...$params)
78
+ prefer-first-class-callable = { enabled = false }
79
+
80
+ prefer-static-closure = { enabled = false }
81
+ strict-types = { enabled = false }
82
+
83
+ too-many-methods = { threshold = 20 }
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "scripts": {
3
- "format": "prettier --write .",
4
- "lint": "lando eslint .",
5
- "lint:fix": "lando eslint . --fix"
3
+ "format": "oxfmt && lando ssh -c 'cd /app && vendor/bin/mago format'",
4
+ "format:check": "oxfmt --check && lando ssh -c 'cd /app && vendor/bin/mago format --check'",
5
+ "lint": "oxlint && lando ssh -c 'cd /app && vendor/bin/mago lint'",
6
+ "lint:fix": "oxlint --fix"
6
7
  },
7
8
  "devDependencies": {
8
- "globals": "^16.3.0",
9
- "@eslint/eslintrc": "^3.3.1",
10
- "@eslint/js": "^9.30.1",
11
- "eslint": "^9.30.1",
12
- "eslint-config-prettier": "^10.1.5",
13
- "eslint-plugin-prettier": "^5.3.1",
14
- "prettier": "^3.6.2"
9
+ "oxfmt": "^0.52.0",
10
+ "oxlint": "^1.67.0"
15
11
  }
16
12
  }
@@ -1,52 +1,18 @@
1
1
  {
2
2
  "settings": {
3
- "editor.defaultFormatter": "esbenp.prettier-vscode",
4
3
  "editor.formatOnSave": false,
5
4
  "editor.codeActionsOnSave": {
6
5
  "source.fixAll": "explicit",
7
- "source.fixAll.eslint": "explicit",
8
6
  "source.organizeImports": "explicit"
9
7
  },
10
- "prettier.requireConfig": true,
11
- "prettier.useEditorConfig": true,
12
- "[blade]": {
13
- "editor.defaultFormatter": "esbenp.prettier-vscode",
14
- "editor.formatOnSave": false,
15
- "editor.insertSpaces": true,
16
- "editor.tabSize": 2
17
- },
18
- "[javascript]": {
19
- "editor.defaultFormatter": "esbenp.prettier-vscode",
20
- "editor.formatOnSave": false,
21
- "editor.insertSpaces": true,
22
- "editor.tabSize": 2
23
- },
24
- "[typescript]": {
25
- "editor.defaultFormatter": "esbenp.prettier-vscode",
26
- "editor.formatOnSave": false,
27
- "editor.insertSpaces": true,
28
- "editor.tabSize": 2
29
- },
30
- "[css]": {
31
- "editor.defaultFormatter": "esbenp.prettier-vscode",
32
- "editor.formatOnSave": false,
33
- "editor.insertSpaces": true,
34
- "editor.tabSize": 2
35
- },
36
- "[scss]": {
37
- "editor.defaultFormatter": "esbenp.prettier-vscode",
38
- "editor.formatOnSave": false,
39
- "editor.insertSpaces": true,
40
- "editor.tabSize": 2
41
- },
42
8
  "files.eol": "\n",
43
9
  "files.trimTrailingWhitespace": true,
44
10
  "files.insertFinalNewline": true
45
11
  },
46
12
  "extensions": {
47
13
  "recommendations": [
48
- "esbenp.prettier-vscode",
49
- "dbaeumer.vscode-eslint",
14
+ "carthage-software.mago",
15
+ "oxc.oxc-vscode",
50
16
  "editorconfig.editorconfig",
51
17
  "stylelint.vscode-stylelint",
52
18
  "bmewburn.vscode-intelephense-client",
@@ -1,8 +1,8 @@
1
- import path from 'path';
1
+ import path from "path";
2
2
 
3
- import fs from 'fs-extra';
3
+ import fs from "fs-extra";
4
4
 
5
- import { log, color } from '../../lib/utils/logger.js';
5
+ import { log, color } from "../../lib/utils/logger.js";
6
6
 
7
7
  /**
8
8
  * Derive a StudlyCase PSR-4 namespace fragment from a kebab/snake plugin slug.
@@ -16,7 +16,7 @@ function toStudlyCase(slug) {
16
16
  .split(/[-_]/)
17
17
  .filter(Boolean)
18
18
  .map((segment) => segment[0].toUpperCase() + segment.slice(1).toLowerCase())
19
- .join('');
19
+ .join("");
20
20
  }
21
21
 
22
22
  /**
@@ -30,7 +30,7 @@ function toConstantPrefix(slug) {
30
30
  .split(/[-_]/)
31
31
  .filter(Boolean)
32
32
  .map((segment) => segment.toUpperCase())
33
- .join('_');
33
+ .join("_");
34
34
  }
35
35
 
36
36
  export async function setupModule(context, generator) {
@@ -43,11 +43,11 @@ export async function setupModule(context, generator) {
43
43
  // Sage is selected, but we also defend at scaffold time so non-
44
44
  // interactive paths (env-var driven, --defaults) cannot drift into
45
45
  // the broken state.
46
- const hasSage = (context.selectedContentModules || []).includes('sage');
46
+ const hasSage = (context.selectedContentModules || []).includes("sage");
47
47
  if (hasSage && context.mu_plugin_acorn === true) {
48
48
  log(
49
49
  color.orange,
50
- '[mu-plugin] ⚠️ Sage is also selected — forcing the minimal (non-Acorn) flavor to avoid a competing Application singleton. If you want the MU plugin to own Acorn, regenerate the project with the `blank-theme` module instead of `sage`.'
50
+ "[mu-plugin] ⚠️ Sage is also selected — forcing the minimal (non-Acorn) flavor to avoid a competing Application singleton. If you want the MU plugin to own Acorn, regenerate the project with the `blank-theme` module instead of `sage`.",
51
51
  );
52
52
  }
53
53
  const useAcorn = !hasSage && context.mu_plugin_acorn !== false;
@@ -65,7 +65,7 @@ export async function setupModule(context, generator) {
65
65
 
66
66
  log(
67
67
  color.blue,
68
- `[mu-plugin] 📂 Scaffolding ${useAcorn ? 'Acorn-flavored' : 'minimal'} MU plugin: ${pluginDir}`
68
+ `[mu-plugin] 📂 Scaffolding ${useAcorn ? "Acorn-flavored" : "minimal"} MU plugin: ${pluginDir}`,
69
69
  );
70
70
 
71
71
  // 1. Ensure directory exists
@@ -77,18 +77,6 @@ export async function setupModule(context, generator) {
77
77
  await scaffoldMinimal(pluginContext, generator, pluginDir, absolutePluginDir);
78
78
  }
79
79
 
80
- // Lint configs co-located in plugin — always installed (IDE/editor support)
81
- log(color.blue, '[mu-plugin] 🔧 Installing lint configurations...');
82
- await generator.copyFile('lint/.prettierrc.json', 'mu-plugin', `${pluginDir}/.prettierrc.json`);
83
- await generator.copyFile('lint/pint.json', 'mu-plugin', `${pluginDir}/pint.json`);
84
- if (context.mu_plugin_lint_eslint === true) {
85
- await generator.copyFile(
86
- 'lint/eslint.config.mjs',
87
- 'mu-plugin',
88
- `${pluginDir}/eslint.config.mjs`
89
- );
90
- }
91
-
92
80
  log(color.green, `[mu-plugin] ✅ MU plugin scaffolded: ${pluginDir}`);
93
81
  }
94
82
 
@@ -105,53 +93,53 @@ async function scaffoldAcorn(context, generator, pluginDir, absolutePluginDir) {
105
93
  // the plugin directory). Required because native WP does not recurse into
106
94
  // subdirectory mu-plugins.
107
95
  await generator.copyFile(
108
- 'templates/bedrock-autoloader.php',
109
- 'mu-plugin',
110
- 'content/mu-plugins/bedrock-autoloader.php'
96
+ "templates/bedrock-autoloader.php",
97
+ "mu-plugin",
98
+ "content/mu-plugins/bedrock-autoloader.php",
111
99
  );
112
100
 
113
101
  // Plugin entry file (Acorn boot, WP-CLI guard, APP_DEBUG=false, Filesystem provider)
114
102
  await generator.generateFile(
115
- 'acorn/plugin.php',
103
+ "acorn/plugin.php",
116
104
  context,
117
- 'mu-plugin',
118
- `${pluginDir}/${pluginName}.php`
105
+ "mu-plugin",
106
+ `${pluginDir}/${pluginName}.php`,
119
107
  );
120
108
 
121
109
  // composer.json with type=wordpress-muplugin, Acorn + acf-composer, allow-plugins
122
110
  await generator.generateFile(
123
- 'acorn/composer.json',
111
+ "acorn/composer.json",
124
112
  context,
125
- 'mu-plugin',
126
- `${pluginDir}/composer.json`
113
+ "mu-plugin",
114
+ `${pluginDir}/composer.json`,
127
115
  );
128
116
 
129
117
  // .gitignore for vendor/, composer.lock, storage runtime
130
- await generator.generateFile('acorn/.gitignore', context, 'mu-plugin', `${pluginDir}/.gitignore`);
118
+ await generator.generateFile("acorn/.gitignore", context, "mu-plugin", `${pluginDir}/.gitignore`);
131
119
 
132
120
  // README.md (purpose + structure + install + documented traps)
133
- await generator.generateFile('acorn/README.md', context, 'mu-plugin', `${pluginDir}/README.md`);
121
+ await generator.generateFile("acorn/README.md", context, "mu-plugin", `${pluginDir}/README.md`);
134
122
 
135
123
  // config/ files
136
124
  await generator.generateFile(
137
- 'acorn/config/app.php',
125
+ "acorn/config/app.php",
138
126
  context,
139
- 'mu-plugin',
140
- `${pluginDir}/config/app.php`
127
+ "mu-plugin",
128
+ `${pluginDir}/config/app.php`,
141
129
  );
142
130
  await generator.generateFile(
143
- 'acorn/config/logging.php',
131
+ "acorn/config/logging.php",
144
132
  context,
145
- 'mu-plugin',
146
- `${pluginDir}/config/logging.php`
133
+ "mu-plugin",
134
+ `${pluginDir}/config/logging.php`,
147
135
  );
148
136
 
149
137
  // app/Providers/CoreServiceProvider.php stub
150
138
  await generator.generateFile(
151
- 'acorn/app/Providers/CoreServiceProvider.php',
139
+ "acorn/app/Providers/CoreServiceProvider.php",
152
140
  context,
153
- 'mu-plugin',
154
- `${pluginDir}/app/Providers/CoreServiceProvider.php`
141
+ "mu-plugin",
142
+ `${pluginDir}/app/Providers/CoreServiceProvider.php`,
155
143
  );
156
144
 
157
145
  // Storage and resources scaffolding (.gitkeep markers committed; runtime
@@ -165,13 +153,13 @@ async function scaffoldAcorn(context, generator, pluginDir, absolutePluginDir) {
165
153
  // marker on the consumer side bypasses both this repo's .gitignore
166
154
  // and any future similar trap.
167
155
  for (const subdir of [
168
- 'storage/framework/cache',
169
- 'storage/framework/views',
170
- 'storage/framework/sessions',
171
- 'storage/logs',
172
- 'resources',
156
+ "storage/framework/cache",
157
+ "storage/framework/views",
158
+ "storage/framework/sessions",
159
+ "storage/logs",
160
+ "resources",
173
161
  ]) {
174
- await fs.ensureFile(path.join(absolutePluginDir, subdir, '.gitkeep'));
162
+ await fs.ensureFile(path.join(absolutePluginDir, subdir, ".gitkeep"));
175
163
  }
176
164
  }
177
165
 
@@ -183,13 +171,13 @@ async function scaffoldMinimal(context, generator, pluginDir, absolutePluginDir)
183
171
  const { mu_plugin_name: pluginName } = context;
184
172
 
185
173
  await generator.generateFile(
186
- 'plugin.php',
174
+ "plugin.php",
187
175
  context,
188
- 'mu-plugin',
189
- `${pluginDir}/${pluginName}.php`
176
+ "mu-plugin",
177
+ `${pluginDir}/${pluginName}.php`,
190
178
  );
191
179
 
192
- await generator.generateFile('composer.json', context, 'mu-plugin', `${pluginDir}/composer.json`);
180
+ await generator.generateFile("composer.json", context, "mu-plugin", `${pluginDir}/composer.json`);
193
181
 
194
- await fs.ensureFile(path.join(absolutePluginDir, 'src', '.gitkeep'));
182
+ await fs.ensureFile(path.join(absolutePluginDir, "src", ".gitkeep"));
195
183
  }
@@ -1,10 +1,10 @@
1
1
  export default [
2
2
  {
3
- type: 'input',
4
- name: 'mu_plugin_name',
5
- message: 'MU Plugin slug (used as directory name):',
6
- default: (answers) => `${answers.projectName || 'wordpress'}-core`,
7
- when: (answers) => answers.selectedContentModules?.includes('mu-plugin'),
3
+ type: "input",
4
+ name: "mu_plugin_name",
5
+ message: "MU Plugin slug (used as directory name):",
6
+ default: (answers) => `${answers.projectName || "wordpress"}-core`,
7
+ when: (answers) => answers.selectedContentModules?.includes("mu-plugin"),
8
8
  },
9
9
  {
10
10
  // Acorn-flavored MU plugin and Sage cannot both boot Acorn in the same
@@ -17,30 +17,12 @@ export default [
17
17
  // - Sage NOT selected: MU plugin can opt into the Acorn flavor and
18
18
  // become the project's Acorn Application host. The recommended
19
19
  // theme companion is then the `blank-theme` module.
20
- //
21
- // We suppress the prompt entirely when Sage is also selected. The
22
- // generator (`modules/mu-plugin/index.js`) also defends against this
23
- // case at scaffold time.
24
- type: 'confirm',
25
- name: 'mu_plugin_acorn',
26
- message: 'MU Plugin: bootstrap with Roots Acorn (project becomes the Acorn host)?',
20
+ type: "confirm",
21
+ name: "mu_plugin_acorn",
22
+ message: "MU Plugin: bootstrap with Roots Acorn (project becomes the Acorn host)?",
27
23
  default: true,
28
24
  when: (answers) =>
29
- answers.selectedContentModules?.includes('mu-plugin') &&
30
- !answers.selectedContentModules?.includes('sage'),
31
- },
32
- {
33
- type: 'confirm',
34
- name: 'mu_plugin_lint_pint',
35
- message: 'MU Plugin: enable Pint for PHP?',
36
- default: true,
37
- when: (answers) => answers.selectedContentModules?.includes('mu-plugin') && answers.enable_lint,
38
- },
39
- {
40
- type: 'confirm',
41
- name: 'mu_plugin_lint_eslint',
42
- message: 'MU Plugin: enable ESLint for JS/TS?',
43
- default: false,
44
- when: (answers) => answers.selectedContentModules?.includes('mu-plugin') && answers.enable_lint,
25
+ answers.selectedContentModules?.includes("mu-plugin") &&
26
+ !answers.selectedContentModules?.includes("sage"),
45
27
  },
46
28
  ];
@@ -1,15 +1,13 @@
1
1
  tooling:
2
2
  {{#if enable_lint}}
3
- mu-pint:
3
+ mu-mago:
4
+ service: appserver
5
+ description: Format PHP in the MU plugin
6
+ dir: /app
7
+ cmd: vendor/bin/mago format content/mu-plugins/{{mu_plugin_name}}/
8
+ mu-mago-lint:
4
9
  service: appserver
5
10
  description: Lint PHP in the MU plugin
6
- dir: /app/content/mu-plugins/{{mu_plugin_name}}
7
- cmd: ./vendor/bin/pint
8
- {{#if mu_plugin_lint_eslint}}
9
- mu-eslint:
10
- service: build
11
- description: Lint JS/TS in the MU plugin
12
- dir: /app/content/mu-plugins/{{mu_plugin_name}}
13
- cmd: npx eslint --fix resources/
14
- {{/if}}
11
+ dir: /app
12
+ cmd: vendor/bin/mago lint content/mu-plugins/{{mu_plugin_name}}/
15
13
  {{/if}}
@@ -5,11 +5,11 @@
5
5
  "license": "proprietary",
6
6
  "require": {
7
7
  "php": ">={{phpVersion}}",
8
- "roots/acorn": "^6.1",
9
- "log1x/acf-composer": "^3.4"
8
+ "roots/acorn": "6.1.0",
9
+ "log1x/acf-composer": "3.4.6"
10
10
  },
11
11
  "require-dev": {
12
- "laravel/pint": "^1.21"
12
+ "carthage-software/mago": "^1.0"
13
13
  },
14
14
  "autoload": {
15
15
  "psr-4": {
@@ -23,8 +23,9 @@
23
23
  "sort-packages": true
24
24
  },
25
25
  "scripts": {
26
- "lint": ["./vendor/bin/pint --test"],
27
- "lint:fix": ["./vendor/bin/pint"]
26
+ "format": ["vendor/bin/mago format"],
27
+ "format:check": ["vendor/bin/mago format --check"],
28
+ "lint": ["vendor/bin/mago lint"]
28
29
  },
29
30
  "minimum-stability": "stable",
30
31
  "prefer-stable": true
@@ -6,9 +6,11 @@
6
6
  }
7
7
  },
8
8
  "require-dev": {
9
- "laravel/pint": "^1.21"
9
+ "carthage-software/mago": "^1.0"
10
10
  },
11
11
  "scripts": {
12
- "lint": ["./vendor/bin/pint --test"]
12
+ "format": ["vendor/bin/mago format"],
13
+ "format:check": ["vendor/bin/mago format --check"],
14
+ "lint": ["vendor/bin/mago lint"]
13
15
  }
14
16
  }
@@ -1,11 +1,16 @@
1
1
  tooling:
2
- pint:
2
+ mago:
3
3
  service: appserver
4
- description: PHP Code Style (modern PSR-12)
5
- cmd:
6
- - pint
7
- pint-check:
4
+ description: Format PHP files
5
+ dir: /app
6
+ cmd: vendor/bin/mago format
7
+ mago-check:
8
8
  service: appserver
9
- description: Check code style without fixing
10
- cmd:
11
- - pint --test
9
+ description: Check PHP formatting without modifying files
10
+ dir: /app
11
+ cmd: vendor/bin/mago format --check
12
+ mago-lint:
13
+ service: appserver
14
+ description: Lint PHP files
15
+ dir: /app
16
+ cmd: vendor/bin/mago lint
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "require-dev": {
3
- "laravel/pint": "^1.29",
4
- "phpunit/phpunit": "^12.5",
5
- "phpstan/phpstan": "^2.1",
6
- "phpstan/extension-installer": "^1.4",
7
- "szepeviktor/phpstan-wordpress": "^2.0",
8
- "php-stubs/wordpress-stubs": "^6.8"
3
+ "carthage-software/mago": "^1.0",
4
+ "phpstan/phpstan": "2.1",
5
+ "phpstan/extension-installer": "1.4.3",
6
+ "szepeviktor/phpstan-wordpress": "^2.1",
7
+ "php-stubs/wordpress-stubs": "7.0.0",
8
+ "pestphp/pest": "4.7"
9
9
  },
10
10
  "config": {
11
11
  "allow-plugins": {
12
- "phpstan/extension-installer": true
12
+ "phpstan/extension-installer": true,
13
+ "pestphp/pest-plugin": true
13
14
  }
15
+ },
16
+ "scripts": {
17
+ "format": "vendor/bin/mago format",
18
+ "format:check": "vendor/bin/mago format --check",
19
+ "lint": "vendor/bin/mago lint",
20
+ "test": "pest",
21
+ "test:coverage": "pest --coverage"
14
22
  }
15
23
  }