@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.
- 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 +113 -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/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/.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
|
@@ -17,24 +17,24 @@
|
|
|
17
17
|
"wordpress"
|
|
18
18
|
],
|
|
19
19
|
"[php]": {
|
|
20
|
-
"editor.defaultFormatter": "
|
|
21
|
-
"editor.formatOnSave":
|
|
20
|
+
"editor.defaultFormatter": "carthage-software.mago",
|
|
21
|
+
"editor.formatOnSave": false,
|
|
22
22
|
"editor.insertSpaces": true,
|
|
23
23
|
"editor.tabSize": 4
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"extensions": {
|
|
27
27
|
"recommendations": [
|
|
28
|
-
"
|
|
28
|
+
"carthage-software.mago"
|
|
29
29
|
]
|
|
30
30
|
},
|
|
31
31
|
"tasks": {
|
|
32
32
|
"tasks": [
|
|
33
33
|
{
|
|
34
|
-
"label": "đ§ PHP:
|
|
34
|
+
"label": "đ§ PHP: Format (Mago)",
|
|
35
35
|
"type": "shell",
|
|
36
36
|
"command": "lando",
|
|
37
|
-
"args": ["
|
|
37
|
+
"args": ["mago"],
|
|
38
38
|
"group": "build",
|
|
39
39
|
"presentation": {
|
|
40
40
|
"echo": true,
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"problemMatcher": []
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
|
-
"label": "đ PHP: Check
|
|
48
|
+
"label": "đ PHP: Check Format (Mago)",
|
|
49
49
|
"type": "shell",
|
|
50
50
|
"command": "lando",
|
|
51
|
-
"args": ["
|
|
51
|
+
"args": ["mago-check"],
|
|
52
52
|
"group": "test",
|
|
53
53
|
"presentation": {
|
|
54
54
|
"echo": true,
|
|
@@ -56,18 +56,21 @@
|
|
|
56
56
|
"focus": false,
|
|
57
57
|
"panel": "shared"
|
|
58
58
|
},
|
|
59
|
-
"problemMatcher":
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
59
|
+
"problemMatcher": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "đŦ PHP: Lint (Mago)",
|
|
63
|
+
"type": "shell",
|
|
64
|
+
"command": "lando",
|
|
65
|
+
"args": ["mago-lint"],
|
|
66
|
+
"group": "test",
|
|
67
|
+
"presentation": {
|
|
68
|
+
"echo": true,
|
|
69
|
+
"reveal": "always",
|
|
70
|
+
"focus": false,
|
|
71
|
+
"panel": "shared"
|
|
72
|
+
},
|
|
73
|
+
"problemMatcher": []
|
|
71
74
|
}
|
|
72
75
|
]
|
|
73
76
|
}
|
package/modules/plugin/index.js
CHANGED
|
@@ -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
|
export async function setupModule(context, generator) {
|
|
8
8
|
const pluginName = context.plugin_name || `${context.projectName}-plugin`;
|
|
@@ -16,30 +16,22 @@ export async function setupModule(context, generator) {
|
|
|
16
16
|
|
|
17
17
|
// 2. Generate main plugin entry file
|
|
18
18
|
await generator.generateFile(
|
|
19
|
-
|
|
19
|
+
"plugin.php",
|
|
20
20
|
{ ...context, plugin_name: pluginName },
|
|
21
|
-
|
|
22
|
-
`${pluginDir}/${pluginName}.php
|
|
21
|
+
"plugin",
|
|
22
|
+
`${pluginDir}/${pluginName}.php`,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
25
|
// 3. Generate composer.json
|
|
26
26
|
await generator.generateFile(
|
|
27
|
-
|
|
27
|
+
"composer.json",
|
|
28
28
|
{ ...context, plugin_name: pluginName },
|
|
29
|
-
|
|
30
|
-
`${pluginDir}/composer.json
|
|
29
|
+
"plugin",
|
|
30
|
+
`${pluginDir}/composer.json`,
|
|
31
31
|
);
|
|
32
32
|
|
|
33
33
|
// 4. Create src/ scaffold
|
|
34
|
-
await fs.ensureFile(path.join(absolutePluginDir,
|
|
35
|
-
|
|
36
|
-
// 5. Lint configs co-located in plugin â always installed (IDE/editor support)
|
|
37
|
-
log(color.blue, '[plugin] đ§ Installing lint configurations...');
|
|
38
|
-
await generator.copyFile('lint/.prettierrc.json', 'plugin', `${pluginDir}/.prettierrc.json`);
|
|
39
|
-
await generator.copyFile('lint/pint.json', 'plugin', `${pluginDir}/pint.json`);
|
|
40
|
-
if (context.plugin_lint_eslint === true) {
|
|
41
|
-
await generator.copyFile('lint/eslint.config.mjs', 'plugin', `${pluginDir}/eslint.config.mjs`);
|
|
42
|
-
}
|
|
34
|
+
await fs.ensureFile(path.join(absolutePluginDir, "src", ".gitkeep"));
|
|
43
35
|
|
|
44
36
|
log(color.green, `[plugin] â
Plugin scaffolded: ${pluginDir}`);
|
|
45
37
|
}
|
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
export default [
|
|
2
2
|
{
|
|
3
|
-
type:
|
|
4
|
-
name:
|
|
5
|
-
message:
|
|
6
|
-
default: (answers) => `${answers.projectName ||
|
|
7
|
-
when: (answers) => answers.selectedContentModules?.includes(
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
type: 'confirm',
|
|
11
|
-
name: 'plugin_lint_pint',
|
|
12
|
-
message: 'Plugin: enable Pint for PHP?',
|
|
13
|
-
default: true,
|
|
14
|
-
when: (answers) => answers.selectedContentModules?.includes('plugin') && answers.enable_lint,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'confirm',
|
|
18
|
-
name: 'plugin_lint_eslint',
|
|
19
|
-
message: 'Plugin: enable ESLint for JS/TS?',
|
|
20
|
-
default: false,
|
|
21
|
-
when: (answers) => answers.selectedContentModules?.includes('plugin') && answers.enable_lint,
|
|
3
|
+
type: "input",
|
|
4
|
+
name: "plugin_name",
|
|
5
|
+
message: "Plugin slug (used as directory name):",
|
|
6
|
+
default: (answers) => `${answers.projectName || "wordpress"}-plugin`,
|
|
7
|
+
when: (answers) => answers.selectedContentModules?.includes("plugin"),
|
|
22
8
|
},
|
|
23
9
|
];
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
tooling:
|
|
2
2
|
{{#if enable_lint}}
|
|
3
|
-
plugin-
|
|
3
|
+
plugin-mago:
|
|
4
|
+
service: appserver
|
|
5
|
+
description: Format PHP in the plugin
|
|
6
|
+
dir: /app
|
|
7
|
+
cmd: vendor/bin/mago format content/plugins/{{plugin_name}}/
|
|
8
|
+
plugin-mago-lint:
|
|
4
9
|
service: appserver
|
|
5
10
|
description: Lint PHP in the plugin
|
|
6
|
-
dir: /app
|
|
7
|
-
cmd:
|
|
8
|
-
{{#if plugin_lint_eslint}}
|
|
9
|
-
plugin-eslint:
|
|
10
|
-
service: build
|
|
11
|
-
description: Lint JS/TS in the plugin
|
|
12
|
-
dir: /app/content/plugins/{{plugin_name}}
|
|
13
|
-
cmd: npx eslint --fix resources/
|
|
14
|
-
{{/if}}
|
|
11
|
+
dir: /app
|
|
12
|
+
cmd: vendor/bin/mago lint content/plugins/{{plugin_name}}/
|
|
15
13
|
{{/if}}
|
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
}
|
|
7
7
|
},
|
|
8
8
|
"require-dev": {
|
|
9
|
-
"
|
|
9
|
+
"carthage-software/mago": "^1.0"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"
|
|
12
|
+
"format": ["vendor/bin/mago format"],
|
|
13
|
+
"format:check": ["vendor/bin/mago format --check"],
|
|
14
|
+
"lint": ["vendor/bin/mago lint"]
|
|
13
15
|
}
|
|
14
16
|
}
|
package/modules/sage/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import path from
|
|
2
|
-
import { execSync } from
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
3
|
|
|
4
|
-
import fs from
|
|
4
|
+
import fs from "fs-extra";
|
|
5
5
|
|
|
6
|
-
import { log, color } from
|
|
7
|
-
import { VERSION_REGISTRY, validateVersionCompatibility } from
|
|
6
|
+
import { log, color } from "../../lib/utils/logger.js";
|
|
7
|
+
import { VERSION_REGISTRY, validateVersionCompatibility } from "../../lib/config/versions.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Install Sage theme with enhanced error handling and validation
|
|
@@ -14,9 +14,9 @@ import { VERSION_REGISTRY, validateVersionCompatibility } from '../../lib/config
|
|
|
14
14
|
* - Better logging and progress tracking
|
|
15
15
|
*/
|
|
16
16
|
export async function setupModule(context, generator) {
|
|
17
|
-
const themeDir = path.join(context.cwd,
|
|
17
|
+
const themeDir = path.join(context.cwd, "content", "themes", context.projectName);
|
|
18
18
|
const relativeThemeDir = `content/themes/${context.projectName}`;
|
|
19
|
-
const relativeDevcontainerDir =
|
|
19
|
+
const relativeDevcontainerDir = ".devcontainer";
|
|
20
20
|
|
|
21
21
|
try {
|
|
22
22
|
// 1. Validate version compatibility
|
|
@@ -24,17 +24,17 @@ export async function setupModule(context, generator) {
|
|
|
24
24
|
context.sageVersion,
|
|
25
25
|
context.phpVersion,
|
|
26
26
|
context.nodeVersion,
|
|
27
|
-
context.wpCoreVersion
|
|
27
|
+
context.wpCoreVersion,
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
if (validation.errors.length > 0) {
|
|
31
|
-
log(color.red,
|
|
31
|
+
log(color.red, "â Version compatibility errors:");
|
|
32
32
|
validation.errors.forEach((err) => log(color.red, ` - ${err}`));
|
|
33
|
-
throw new Error(
|
|
33
|
+
throw new Error("Version compatibility check failed");
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
if (validation.warnings.length > 0) {
|
|
37
|
-
log(color.orange,
|
|
37
|
+
log(color.orange, "â ī¸ Version compatibility warnings:");
|
|
38
38
|
validation.warnings.forEach((warn) => log(color.orange, ` - ${warn}`));
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -53,7 +53,7 @@ export async function setupModule(context, generator) {
|
|
|
53
53
|
const alreadyInstalled = await isSageThemeInstalled(themeDir);
|
|
54
54
|
if (alreadyInstalled) {
|
|
55
55
|
shouldInstallSage = false;
|
|
56
|
-
log(color.blue,
|
|
56
|
+
log(color.blue, "[sage] âģī¸ Existing Sage theme detected. Reusing installation.");
|
|
57
57
|
} else {
|
|
58
58
|
log(color.orange, `â ī¸ ${themeDir} has stale files. Cleaning before installation.`);
|
|
59
59
|
await fs.emptyDir(themeDir);
|
|
@@ -62,18 +62,18 @@ export async function setupModule(context, generator) {
|
|
|
62
62
|
|
|
63
63
|
// 4. Build composer command with proper error handling
|
|
64
64
|
const cmd = [
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
"composer create-project",
|
|
66
|
+
"roots/sage",
|
|
67
67
|
`"${themeDir}"`,
|
|
68
68
|
sageConfig.tag,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
].join(
|
|
69
|
+
"--no-interaction",
|
|
70
|
+
"--ignore-platform-reqs",
|
|
71
|
+
].join(" ");
|
|
72
72
|
|
|
73
73
|
if (shouldInstallSage) {
|
|
74
74
|
log(color.blue, `[sage] đĻ Installing Sage ${context.sageVersion} (${sageConfig.tag})...`);
|
|
75
75
|
log(color.blue, `[sage] đ Location: ${relativeThemeDir}`);
|
|
76
|
-
execSync(cmd, { stdio:
|
|
76
|
+
execSync(cmd, { stdio: "inherit", cwd: context.cwd });
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// 6. Validate theme installation
|
|
@@ -81,128 +81,118 @@ export async function setupModule(context, generator) {
|
|
|
81
81
|
log(color.green, `[sage] â
Theme installation verified`);
|
|
82
82
|
|
|
83
83
|
// 7. Generate customizations
|
|
84
|
-
log(color.blue,
|
|
85
|
-
if (context.sageVersion ===
|
|
84
|
+
log(color.blue, "[sage] đ ī¸ Applying advanced Sage DX customizations...");
|
|
85
|
+
if (context.sageVersion === "11") {
|
|
86
86
|
await generator.generateFile(
|
|
87
|
-
|
|
87
|
+
"theme/vite.config.js",
|
|
88
88
|
context,
|
|
89
|
-
|
|
90
|
-
`${relativeThemeDir}/vite.config.js
|
|
89
|
+
"sage",
|
|
90
|
+
`${relativeThemeDir}/vite.config.js`,
|
|
91
91
|
);
|
|
92
92
|
} else {
|
|
93
|
-
log(color.blue,
|
|
93
|
+
log(color.blue, "[sage] âšī¸ Keeping default Vite config for Sage 10 compatibility.");
|
|
94
94
|
}
|
|
95
95
|
await generator.generateFile(
|
|
96
|
-
|
|
96
|
+
"theme/style.css",
|
|
97
97
|
context,
|
|
98
|
-
|
|
99
|
-
`${relativeThemeDir}/style.css
|
|
98
|
+
"sage",
|
|
99
|
+
`${relativeThemeDir}/style.css`,
|
|
100
100
|
);
|
|
101
101
|
|
|
102
102
|
await generator.generateFile(
|
|
103
|
-
|
|
103
|
+
"theme/app/Blocks/.gitkeep",
|
|
104
104
|
context,
|
|
105
|
-
|
|
106
|
-
`${relativeThemeDir}/app/Blocks/.gitkeep
|
|
105
|
+
"sage",
|
|
106
|
+
`${relativeThemeDir}/app/Blocks/.gitkeep`,
|
|
107
107
|
);
|
|
108
108
|
await generator.generateFile(
|
|
109
|
-
|
|
109
|
+
"theme/app/Fields/.gitkeep",
|
|
110
110
|
context,
|
|
111
|
-
|
|
112
|
-
`${relativeThemeDir}/app/Fields/.gitkeep
|
|
111
|
+
"sage",
|
|
112
|
+
`${relativeThemeDir}/app/Fields/.gitkeep`,
|
|
113
113
|
);
|
|
114
114
|
await generator.generateFile(
|
|
115
|
-
|
|
115
|
+
"theme/resources/views/blocks/.gitkeep",
|
|
116
116
|
context,
|
|
117
|
-
|
|
118
|
-
`${relativeThemeDir}/resources/views/blocks/.gitkeep
|
|
117
|
+
"sage",
|
|
118
|
+
`${relativeThemeDir}/resources/views/blocks/.gitkeep`,
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
await generator.mergeWithExistingFile({
|
|
122
122
|
existingFile: `${relativeThemeDir}/package.json`,
|
|
123
|
-
moduleTemplatePath:
|
|
123
|
+
moduleTemplatePath: "theme/package.json",
|
|
124
124
|
context,
|
|
125
|
-
format:
|
|
126
|
-
moduleName:
|
|
127
|
-
mergeStrategy:
|
|
125
|
+
format: "json",
|
|
126
|
+
moduleName: "sage",
|
|
127
|
+
mergeStrategy: "replace",
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
await generator.mergeWithExistingFile({
|
|
131
131
|
existingFile: `${relativeThemeDir}/composer.json`,
|
|
132
|
-
moduleTemplatePath:
|
|
132
|
+
moduleTemplatePath: "theme/composer.json",
|
|
133
133
|
context,
|
|
134
|
-
format:
|
|
135
|
-
moduleName:
|
|
136
|
-
mergeStrategy:
|
|
134
|
+
format: "json",
|
|
135
|
+
moduleName: "sage",
|
|
136
|
+
mergeStrategy: "replace",
|
|
137
137
|
});
|
|
138
138
|
|
|
139
139
|
await generator.generateFile(
|
|
140
|
-
|
|
140
|
+
".devcontainer/docker-compose.override.yml",
|
|
141
141
|
context,
|
|
142
|
-
|
|
143
|
-
`${relativeDevcontainerDir}/docker-compose.override.yml
|
|
142
|
+
"sage",
|
|
143
|
+
`${relativeDevcontainerDir}/docker-compose.override.yml`,
|
|
144
144
|
);
|
|
145
145
|
await generator.generateFile(
|
|
146
|
-
|
|
146
|
+
".devcontainer/post-create.sh",
|
|
147
147
|
context,
|
|
148
|
-
|
|
149
|
-
`${relativeDevcontainerDir}/post-create.sh
|
|
148
|
+
"sage",
|
|
149
|
+
`${relativeDevcontainerDir}/post-create.sh`,
|
|
150
150
|
);
|
|
151
|
-
await fs.chmod(path.join(context.cwd, relativeDevcontainerDir,
|
|
151
|
+
await fs.chmod(path.join(context.cwd, relativeDevcontainerDir, "post-create.sh"), 0o755);
|
|
152
152
|
|
|
153
153
|
// Unified setup scripts for Sage â shared between Lando, devcontainer and CI/CD
|
|
154
154
|
await generator.generateFile(
|
|
155
|
-
|
|
155
|
+
"server/cmd/setup-sage-php.sh",
|
|
156
156
|
context,
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
"sage",
|
|
158
|
+
"server/cmd/setup-sage-php.sh",
|
|
159
159
|
);
|
|
160
160
|
await generator.generateFile(
|
|
161
|
-
|
|
161
|
+
"server/cmd/setup-sage-node.sh",
|
|
162
162
|
context,
|
|
163
|
-
|
|
164
|
-
|
|
163
|
+
"sage",
|
|
164
|
+
"server/cmd/setup-sage-node.sh",
|
|
165
165
|
);
|
|
166
|
-
await fs.chmod(path.join(context.cwd,
|
|
167
|
-
await fs.chmod(path.join(context.cwd,
|
|
166
|
+
await fs.chmod(path.join(context.cwd, "server/cmd/setup-sage-php.sh"), 0o755);
|
|
167
|
+
await fs.chmod(path.join(context.cwd, "server/cmd/setup-sage-node.sh"), 0o755);
|
|
168
168
|
|
|
169
169
|
await generator.mergeWithExistingFile({
|
|
170
170
|
existingFile: `${relativeDevcontainerDir}/devcontainer.json`,
|
|
171
|
-
moduleTemplatePath:
|
|
171
|
+
moduleTemplatePath: ".devcontainer/devcontainer.json",
|
|
172
172
|
context,
|
|
173
|
-
format:
|
|
174
|
-
moduleName:
|
|
175
|
-
mergeStrategy:
|
|
173
|
+
format: "json",
|
|
174
|
+
moduleName: "sage",
|
|
175
|
+
mergeStrategy: "replace",
|
|
176
176
|
});
|
|
177
177
|
|
|
178
178
|
// 8. Lint configs co-located in theme â always installed (IDE/editor support)
|
|
179
|
-
log(color.blue,
|
|
179
|
+
log(color.blue, "[sage] đ§ Installing lint configurations...");
|
|
180
180
|
await generator.copyFile(
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
`${relativeThemeDir}/.prettierrc.json
|
|
181
|
+
"lint/.prettierrc.json",
|
|
182
|
+
"sage",
|
|
183
|
+
`${relativeThemeDir}/.prettierrc.json`,
|
|
184
184
|
);
|
|
185
|
-
if (context.sage_lint_eslint !== false) {
|
|
186
|
-
await generator.copyFile(
|
|
187
|
-
'lint/eslint.config.mjs',
|
|
188
|
-
'sage',
|
|
189
|
-
`${relativeThemeDir}/eslint.config.mjs`
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
if (context.sage_lint_pint !== false) {
|
|
193
|
-
await generator.copyFile('lint/pint.json', 'sage', `${relativeThemeDir}/pint.json`);
|
|
194
|
-
}
|
|
195
185
|
if (context.sage_lint_stylelint !== false) {
|
|
196
186
|
await generator.copyFile(
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
`${relativeThemeDir}/.stylelintrc.json
|
|
187
|
+
"lint/.stylelintrc.json",
|
|
188
|
+
"sage",
|
|
189
|
+
`${relativeThemeDir}/.stylelintrc.json`,
|
|
200
190
|
);
|
|
201
191
|
}
|
|
202
192
|
|
|
203
|
-
log(color.green,
|
|
193
|
+
log(color.green, "[sage] â
Advanced Sage setup completed successfully");
|
|
204
194
|
log(color.green, `[sage] â
Theme directory: ${relativeThemeDir}`);
|
|
205
|
-
log(color.green,
|
|
195
|
+
log(color.green, "[sage] â
Lando + Devcontainer command parity enabled");
|
|
206
196
|
} catch (error) {
|
|
207
197
|
log(color.red, `[sage] â Installation failed: ${error.message}`);
|
|
208
198
|
throw error;
|
|
@@ -213,7 +203,7 @@ export async function setupModule(context, generator) {
|
|
|
213
203
|
* Validate that Sage theme installation was successful
|
|
214
204
|
*/
|
|
215
205
|
async function validateThemeInstallation(themeDir, sageConfig) {
|
|
216
|
-
const requiredFiles = [
|
|
206
|
+
const requiredFiles = ["package.json", "composer.json", "theme.json"];
|
|
217
207
|
const missingFiles = [];
|
|
218
208
|
|
|
219
209
|
for (const file of requiredFiles) {
|
|
@@ -224,25 +214,25 @@ async function validateThemeInstallation(themeDir, sageConfig) {
|
|
|
224
214
|
}
|
|
225
215
|
|
|
226
216
|
if (missingFiles.length > 0) {
|
|
227
|
-
throw new Error(`Theme installation incomplete. Missing files: ${missingFiles.join(
|
|
217
|
+
throw new Error(`Theme installation incomplete. Missing files: ${missingFiles.join(", ")}`);
|
|
228
218
|
}
|
|
229
219
|
|
|
230
220
|
// Additional validation: check if package.json has correct structure
|
|
231
|
-
const packageJsonPath = path.join(themeDir,
|
|
221
|
+
const packageJsonPath = path.join(themeDir, "package.json");
|
|
232
222
|
const packageJson = await fs.readJson(packageJsonPath);
|
|
233
223
|
|
|
234
224
|
// Sage packages typically have devDependencies (which is valid)
|
|
235
225
|
const hasDeps = packageJson.dependencies || packageJson.devDependencies;
|
|
236
226
|
|
|
237
227
|
if (!hasDeps) {
|
|
238
|
-
throw new Error(
|
|
228
|
+
throw new Error("Theme package.json is missing dependency sections");
|
|
239
229
|
}
|
|
240
230
|
|
|
241
|
-
log(color.blue, `[sage] âšī¸ Theme info: ${packageJson.name} v${packageJson.version ||
|
|
231
|
+
log(color.blue, `[sage] âšī¸ Theme info: ${packageJson.name} v${packageJson.version || "1.0.0"}`);
|
|
242
232
|
}
|
|
243
233
|
|
|
244
234
|
async function isSageThemeInstalled(themeDir) {
|
|
245
|
-
const requiredFiles = [
|
|
235
|
+
const requiredFiles = ["package.json", "composer.json", "theme.json"];
|
|
246
236
|
for (const file of requiredFiles) {
|
|
247
237
|
if (!(await fs.pathExists(path.join(themeDir, file)))) {
|
|
248
238
|
return false;
|
package/modules/sage/prompts.js
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
export default [
|
|
2
2
|
{
|
|
3
|
-
type:
|
|
4
|
-
name:
|
|
5
|
-
message:
|
|
6
|
-
choices: [
|
|
7
|
-
default:
|
|
8
|
-
when: (answers) => answers.selectedContentModules?.includes(
|
|
3
|
+
type: "list",
|
|
4
|
+
name: "sageVersion",
|
|
5
|
+
message: "Sage version:",
|
|
6
|
+
choices: ["11", "10"],
|
|
7
|
+
default: "11",
|
|
8
|
+
when: (answers) => answers.selectedContentModules?.includes("sage"),
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
type:
|
|
12
|
-
name:
|
|
13
|
-
message:
|
|
11
|
+
type: "confirm",
|
|
12
|
+
name: "sage_lint_stylelint",
|
|
13
|
+
message: "Sage: enable Stylelint for CSS/SCSS?",
|
|
14
14
|
default: true,
|
|
15
|
-
when: (answers) => answers.selectedContentModules?.includes(
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: 'confirm',
|
|
19
|
-
name: 'sage_lint_stylelint',
|
|
20
|
-
message: 'Sage: enable Stylelint for CSS/SCSS?',
|
|
21
|
-
default: true,
|
|
22
|
-
when: (answers) => answers.selectedContentModules?.includes('sage') && answers.enable_lint,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'confirm',
|
|
26
|
-
name: 'sage_lint_pint',
|
|
27
|
-
message: 'Sage: enable Pint for PHP?',
|
|
28
|
-
default: true,
|
|
29
|
-
when: (answers) => answers.selectedContentModules?.includes('sage') && answers.enable_lint,
|
|
15
|
+
when: (answers) => answers.selectedContentModules?.includes("sage") && answers.enable_lint,
|
|
30
16
|
},
|
|
31
17
|
];
|
|
@@ -42,15 +42,25 @@ tooling:
|
|
|
42
42
|
description: Build the Sage theme
|
|
43
43
|
cmd: npm run build --prefix /app/content/themes/{{projectName}}
|
|
44
44
|
{{#if enable_lint}}
|
|
45
|
+
mago:
|
|
46
|
+
service: appserver
|
|
47
|
+
description: Format PHP (theme + tests)
|
|
48
|
+
dir: /app
|
|
49
|
+
cmd: vendor/bin/mago format
|
|
50
|
+
mago-check:
|
|
51
|
+
service: appserver
|
|
52
|
+
description: Check PHP formatting without modifying files
|
|
53
|
+
dir: /app
|
|
54
|
+
cmd: vendor/bin/mago format --check
|
|
55
|
+
mago-lint:
|
|
56
|
+
service: appserver
|
|
57
|
+
description: Lint PHP (theme + tests)
|
|
58
|
+
dir: /app
|
|
59
|
+
cmd: vendor/bin/mago lint
|
|
45
60
|
theme-lint:
|
|
46
61
|
service: build
|
|
47
|
-
description: Lint the Sage theme (
|
|
48
|
-
cmd:
|
|
49
|
-
pint:
|
|
50
|
-
service: appserver
|
|
51
|
-
description: Lint PHP in the Sage theme
|
|
52
|
-
dir: /app/content/themes/{{projectName}}
|
|
53
|
-
cmd: ./vendor/bin/pint
|
|
62
|
+
description: Lint JS/TS/Vue in the Sage theme (oxlint)
|
|
63
|
+
cmd: npx oxlint --fix content/themes/{{projectName}}/resources/
|
|
54
64
|
stylelint:
|
|
55
65
|
service: build
|
|
56
66
|
description: Lint CSS/SCSS in the Sage theme
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
"description": "{{projectDescription}}",
|
|
3
|
+
"authors": [
|
|
4
|
+
{
|
|
5
|
+
"name": "{{author}}",
|
|
6
|
+
"email": "{{authorEmail}}"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"require": {
|
|
10
|
+
"php": ">={{phpVersion}}",
|
|
11
|
+
"blade-ui-kit/blade-icons": "^1.10",
|
|
12
|
+
"log1x/acf-composer": "3.4.6",
|
|
13
|
+
"log1x/sage-directives": "2.0.6",
|
|
14
|
+
"roots/acorn": "6.1.0",
|
|
15
|
+
"roots/acorn-ai": "0.1.2"
|
|
16
|
+
},
|
|
17
|
+
"require-dev": {
|
|
18
|
+
"laravel/pint": "1.29.1"
|
|
19
|
+
},
|
|
20
|
+
"config": {
|
|
21
|
+
"optimize-autoloader": true,
|
|
22
|
+
"preferred-install": "dist",
|
|
23
|
+
"sort-packages": true
|
|
24
|
+
},
|
|
25
|
+
"minimum-stability": "dev",
|
|
26
|
+
"prefer-stable": true,
|
|
27
|
+
"scripts": {
|
|
28
|
+
"post-autoload-dump": [
|
|
29
|
+
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
|
|
30
|
+
],
|
|
31
|
+
"lint": [
|
|
32
|
+
"./vendor/bin/pint --test"
|
|
33
|
+
],
|
|
34
|
+
"acorn:optimize": [
|
|
35
|
+
"wp acorn optimize"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
25
38
|
}
|