@codigodoleo/wp-kit 3.1.1 → 3.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 +19 -10
- package/lib/config/versions.js +5 -5
- package/lib/prompts/index.js +24 -14
- package/lib/utils/git.js +50 -13
- package/modules/deploy/.github/workflows/deploy-docker.yml +102 -0
- package/modules/deploy/.github/workflows/deploy-ssh.yml +126 -0
- package/modules/deploy/.github/workflows/release.yml +55 -0
- package/modules/deploy/index.js +39 -0
- package/modules/deploy/prompts.js +1 -3
- package/modules/deploy/templates/.gitlab/ci/deploy-docker.yml.hbs +35 -0
- package/modules/deploy/templates/.gitlab/ci/deploy-ssh.yml.hbs +83 -0
- package/modules/deploy/templates/.gitlab/ci/release.yml.hbs +26 -0
- package/modules/git/.husky/commit-msg +8 -4
- package/modules/git/.husky/pre-commit +0 -3
- package/modules/git/templates/package.json.hbs +4 -4
- package/modules/lint/templates/package.json.hbs +4 -4
- package/modules/php/templates/composer.json.hbs +1 -1
- package/modules/sage/index.js +114 -15
- package/modules/sage/prompts.js +1 -1
- package/modules/sage/templates/.devcontainer/devcontainer.json.hbs +7 -0
- package/modules/sage/templates/.devcontainer/docker-compose.override.yml.hbs +6 -0
- package/modules/sage/templates/.devcontainer/post-create.sh.hbs +11 -0
- package/modules/sage/templates/.lando.yml.hbs +34 -48
- package/modules/sage/templates/server/cmd/setup-sage-node.sh.hbs +23 -0
- package/modules/sage/templates/server/cmd/setup-sage-php.sh.hbs +24 -0
- package/modules/sage/templates/theme/app/Blocks/.gitkeep.hbs +0 -0
- package/modules/sage/templates/theme/app/Fields/.gitkeep.hbs +0 -0
- package/modules/sage/templates/theme/composer.json.hbs +25 -3
- package/modules/sage/templates/theme/package.json.hbs +15 -3
- package/modules/sage/templates/theme/resources/views/blocks/.gitkeep.hbs +0 -0
- package/modules/sage/templates/theme/vite.config.js.hbs +55 -13
- package/modules/sage/templates/workspace.json.hbs +94 -6
- package/modules/skills/index.js +18 -0
- package/modules/skills/prompts.js +21 -0
- package/modules/test/index.js +19 -0
- package/modules/test/prompts.js +8 -0
- package/modules/test/templates/composer.json.hbs +16 -0
- package/modules/test/templates/package.json.hbs +11 -0
- package/modules/test/templates/playwright.config.js.hbs +29 -0
- package/modules/test/tests/Pest.php +39 -0
- package/modules/test/tests/SmokeTest.php +15 -0
- package/modules/test/tests/e2e/example.spec.js +11 -0
- package/modules/test/tests/e2e/helpers/loginHelper.js +40 -0
- package/package.json +1 -1
- package/templates/.devcontainer/Dockerfile.hbs +24 -0
- package/templates/.devcontainer/config/nginx.conf +23 -0
- package/templates/.devcontainer/config/nginx.conf.hbs +23 -0
- package/templates/.devcontainer/devcontainer.json.hbs +29 -0
- package/templates/.devcontainer/docker-compose.yml.hbs +73 -0
- package/templates/.devcontainer/setup.sh.hbs +17 -0
- package/templates/.env.hbs +38 -15
- package/templates/.gitignore.hbs +2 -2
- package/templates/.lando.yml.hbs +61 -17
- package/templates/README.md.hbs +23 -7
- package/templates/composer.json.hbs +4 -3
- package/templates/package.json.hbs +0 -2
- package/templates/server/cmd/install-wp.sh.hbs +54 -43
- package/templates/server/cmd/setup-node.sh.hbs +11 -0
- package/templates/server/cmd/setup-php.sh.hbs +14 -0
- package/templates/server/www/vhosts.conf.hbs +54 -17
- package/templates/workspace.json.hbs +56 -0
- package/templates/wp-cli.yml.hbs +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Job reutilizável — SSH Deploy via rsync
|
|
2
|
+
#
|
|
3
|
+
# Como usar no .gitlab-ci.yml principal:
|
|
4
|
+
#
|
|
5
|
+
# include:
|
|
6
|
+
# - local: '.gitlab/ci/deploy-ssh.yml'
|
|
7
|
+
#
|
|
8
|
+
# stages:
|
|
9
|
+
# - build
|
|
10
|
+
# - deploy
|
|
11
|
+
#
|
|
12
|
+
# Variáveis necessárias (Settings → CI/CD → Variables):
|
|
13
|
+
# SSH_PRIVATE_KEY — chave SSH privada (sem passphrase para CI)
|
|
14
|
+
# SSH_KNOWN_HOSTS — saída de: ssh-keyscan -H <host>
|
|
15
|
+
# DEPLOY_HOST — endereço do servidor (ex: meu-servidor.example.com)
|
|
16
|
+
# DEPLOY_USER — usuário SSH (ex: deploy)
|
|
17
|
+
# DEPLOY_PATH — caminho absoluto no servidor (ex: /var/www/html)
|
|
18
|
+
#
|
|
19
|
+
# O rsync usa --no-perms --no-owner --no-group, portanto não altera
|
|
20
|
+
# permissões nem proprietários existentes no servidor de destino.
|
|
21
|
+
|
|
22
|
+
.ssh-agent-setup: &ssh-agent-setup
|
|
23
|
+
- eval "$(ssh-agent -s)"
|
|
24
|
+
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
25
|
+
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
|
26
|
+
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts
|
|
27
|
+
|
|
28
|
+
build:deps:
|
|
29
|
+
stage: build
|
|
30
|
+
image: composer:latest
|
|
31
|
+
script:
|
|
32
|
+
- composer install --no-dev --optimize-autoloader --no-interaction
|
|
33
|
+
artifacts:
|
|
34
|
+
paths:
|
|
35
|
+
- vendor/
|
|
36
|
+
expire_in: 1 hour
|
|
37
|
+
rules:
|
|
38
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
39
|
+
|
|
40
|
+
build:assets:
|
|
41
|
+
stage: build
|
|
42
|
+
image: node:{{nodeVersion}}-alpine
|
|
43
|
+
before_script:
|
|
44
|
+
- apk add --no-cache git
|
|
45
|
+
script:
|
|
46
|
+
- |
|
|
47
|
+
{{#if ci.theme.paths.themeRoot}}
|
|
48
|
+
if [ -d "{{ci.theme.paths.themeRoot}}" ]; then
|
|
49
|
+
npm install --prefix "{{ci.theme.paths.themeRoot}}"
|
|
50
|
+
npm run build --prefix "{{ci.theme.paths.themeRoot}}"
|
|
51
|
+
fi
|
|
52
|
+
{{else}}
|
|
53
|
+
if [ -f package.json ]; then npm ci && npm run build --if-present; fi
|
|
54
|
+
{{/if}}
|
|
55
|
+
artifacts:
|
|
56
|
+
paths:
|
|
57
|
+
- content/themes/*/public/
|
|
58
|
+
- public/
|
|
59
|
+
expire_in: 1 hour
|
|
60
|
+
rules:
|
|
61
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
62
|
+
|
|
63
|
+
deploy:ssh:
|
|
64
|
+
stage: deploy
|
|
65
|
+
image: alpine:latest
|
|
66
|
+
needs:
|
|
67
|
+
- job: build:deps
|
|
68
|
+
- job: build:assets
|
|
69
|
+
before_script:
|
|
70
|
+
- apk add --no-cache rsync openssh-client
|
|
71
|
+
- *ssh-agent-setup
|
|
72
|
+
script:
|
|
73
|
+
- |
|
|
74
|
+
rsync -avz --delete \
|
|
75
|
+
--no-perms --no-owner --no-group \
|
|
76
|
+
--exclude='.git' \
|
|
77
|
+
--exclude='.env' \
|
|
78
|
+
--exclude='node_modules' \
|
|
79
|
+
--exclude='node_modules/.cache' \
|
|
80
|
+
./ \
|
|
81
|
+
"$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/"
|
|
82
|
+
rules:
|
|
83
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Job reutilizável — Semantic Release
|
|
2
|
+
#
|
|
3
|
+
# Como usar no .gitlab-ci.yml principal:
|
|
4
|
+
#
|
|
5
|
+
# include:
|
|
6
|
+
# - local: '.gitlab/ci/release.yml'
|
|
7
|
+
#
|
|
8
|
+
# stages:
|
|
9
|
+
# - release
|
|
10
|
+
#
|
|
11
|
+
# Variáveis necessárias (Settings → CI/CD → Variables):
|
|
12
|
+
# GITLAB_TOKEN — Personal/Project Access Token com scope "api"
|
|
13
|
+
# NPM_TOKEN — Token npm (omita se o projeto não publicar no npm)
|
|
14
|
+
|
|
15
|
+
semantic-release:
|
|
16
|
+
stage: release
|
|
17
|
+
image: node:{{nodeVersion}}-alpine
|
|
18
|
+
rules:
|
|
19
|
+
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
20
|
+
before_script:
|
|
21
|
+
- npm ci
|
|
22
|
+
script:
|
|
23
|
+
- npx semantic-release
|
|
24
|
+
variables:
|
|
25
|
+
GITLAB_TOKEN: $GITLAB_TOKEN
|
|
26
|
+
NPM_TOKEN: $NPM_TOKEN
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
echo "🔍 Validating commit message..."
|
|
2
|
+
if command -v lando >/dev/null 2>&1 && lando info >/dev/null 2>&1; then
|
|
3
|
+
echo "🐳 Using Lando environment..."
|
|
4
|
+
lando commitlint --edit "$1"
|
|
5
|
+
else
|
|
6
|
+
echo "🏠 Using local environment..."
|
|
7
|
+
npx --no commitlint --edit "$1"
|
|
8
|
+
fi
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{ "scripts": { "prepare": "husky
|
|
2
|
-
"@commitlint/cli": "^
|
|
3
|
-
"^
|
|
4
|
-
"lint-staged": "^15.
|
|
1
|
+
{ "scripts": { "prepare": "husky", "commit": "lando git-cz" }, "devDependencies": {
|
|
2
|
+
"@commitlint/cli": "^19.7.1", "@commitlint/config-conventional": "^19.7.1", "@commitlint/prompt":
|
|
3
|
+
"^19.5.0", "commitizen": "^4.3.1", "husky": "^9.0.11",
|
|
4
|
+
"lint-staged": "^15.5.0" } }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{ "scripts": { "format": "prettier --write .", "lint": "lando eslint .
|
|
2
|
-
"lando eslint . --
|
|
3
|
-
"@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.30.1", "eslint": "^
|
|
4
|
-
"eslint-config-prettier": "^
|
|
1
|
+
{ "scripts": { "format": "prettier --write .", "lint": "lando eslint .", "lint:fix":
|
|
2
|
+
"lando eslint . --fix" }, "devDependencies": { "globals": "^16.3.0",
|
|
3
|
+
"@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.30.1", "eslint": "^9.30.1",
|
|
4
|
+
"eslint-config-prettier": "^10.1.5", "eslint-plugin-prettier": "^5.3.1", "prettier": "^3.6.2" } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "require-dev": { "laravel/pint": "^1.
|
|
1
|
+
{ "require-dev": { "laravel/pint": "^1.29", "phpunit/phpunit": "^11.5", "phpstan/phpstan": "^2.1", "phpstan/extension-installer": "^1.4", "szepeviktor/phpstan-wordpress": "^2.0", "php-stubs/wordpress-stubs": "^6.8" }, "config": { "allow-plugins": { "phpstan/extension-installer": true } } }
|
package/modules/sage/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { VERSION_REGISTRY, validateVersionCompatibility } from '../../lib/config
|
|
|
16
16
|
export async function setupModule(context, generator) {
|
|
17
17
|
const themeDir = path.join(context.cwd, 'content', 'themes', context.projectName);
|
|
18
18
|
const relativeThemeDir = `content/themes/${context.projectName}`;
|
|
19
|
+
const relativeDevcontainerDir = '.devcontainer';
|
|
19
20
|
|
|
20
21
|
try {
|
|
21
22
|
// 1. Validate version compatibility
|
|
@@ -46,11 +47,17 @@ export async function setupModule(context, generator) {
|
|
|
46
47
|
// 3. Prepare and validate directory
|
|
47
48
|
await fs.ensureDir(themeDir);
|
|
48
49
|
const files = await fs.readdir(themeDir);
|
|
50
|
+
let shouldInstallSage = true;
|
|
51
|
+
|
|
49
52
|
if (files.length > 0) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const alreadyInstalled = await isSageThemeInstalled(themeDir);
|
|
54
|
+
if (alreadyInstalled) {
|
|
55
|
+
shouldInstallSage = false;
|
|
56
|
+
log(color.blue, '[sage] ♻️ Existing Sage theme detected. Reusing installation.');
|
|
57
|
+
} else {
|
|
58
|
+
log(color.orange, `⚠️ ${themeDir} has stale files. Cleaning before installation.`);
|
|
59
|
+
await fs.emptyDir(themeDir);
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
|
|
56
63
|
// 4. Build composer command with proper error handling
|
|
@@ -63,32 +70,114 @@ export async function setupModule(context, generator) {
|
|
|
63
70
|
'--ignore-platform-reqs',
|
|
64
71
|
].join(' ');
|
|
65
72
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
if (shouldInstallSage) {
|
|
74
|
+
log(color.blue, `[sage] 📦 Installing Sage ${context.sageVersion} (${sageConfig.tag})...`);
|
|
75
|
+
log(color.blue, `[sage] 📍 Location: ${relativeThemeDir}`);
|
|
76
|
+
execSync(cmd, { stdio: 'inherit', cwd: context.cwd });
|
|
77
|
+
}
|
|
71
78
|
|
|
72
79
|
// 6. Validate theme installation
|
|
73
80
|
await validateThemeInstallation(themeDir, sageConfig);
|
|
74
81
|
log(color.green, `[sage] ✅ Theme installation verified`);
|
|
75
82
|
|
|
76
83
|
// 7. Generate customizations
|
|
77
|
-
log(color.blue,
|
|
84
|
+
log(color.blue, '[sage] 🛠️ Applying advanced Sage DX customizations...');
|
|
85
|
+
if (context.sageVersion === '11') {
|
|
86
|
+
await generator.generateFile(
|
|
87
|
+
'theme/vite.config.js',
|
|
88
|
+
context,
|
|
89
|
+
'sage',
|
|
90
|
+
`${relativeThemeDir}/vite.config.js`
|
|
91
|
+
);
|
|
92
|
+
} else {
|
|
93
|
+
log(color.blue, '[sage] ℹ️ Keeping default Vite config for Sage 10 compatibility.');
|
|
94
|
+
}
|
|
78
95
|
await generator.generateFile(
|
|
79
|
-
'theme/
|
|
96
|
+
'theme/style.css',
|
|
80
97
|
context,
|
|
81
98
|
'sage',
|
|
82
|
-
`${relativeThemeDir}/
|
|
99
|
+
`${relativeThemeDir}/style.css`
|
|
83
100
|
);
|
|
101
|
+
|
|
84
102
|
await generator.generateFile(
|
|
85
|
-
'theme/
|
|
103
|
+
'theme/app/Blocks/.gitkeep',
|
|
86
104
|
context,
|
|
87
105
|
'sage',
|
|
88
|
-
`${relativeThemeDir}/
|
|
106
|
+
`${relativeThemeDir}/app/Blocks/.gitkeep`
|
|
107
|
+
);
|
|
108
|
+
await generator.generateFile(
|
|
109
|
+
'theme/app/Fields/.gitkeep',
|
|
110
|
+
context,
|
|
111
|
+
'sage',
|
|
112
|
+
`${relativeThemeDir}/app/Fields/.gitkeep`
|
|
113
|
+
);
|
|
114
|
+
await generator.generateFile(
|
|
115
|
+
'theme/resources/views/blocks/.gitkeep',
|
|
116
|
+
context,
|
|
117
|
+
'sage',
|
|
118
|
+
`${relativeThemeDir}/resources/views/blocks/.gitkeep`
|
|
89
119
|
);
|
|
90
120
|
|
|
91
|
-
|
|
121
|
+
await generator.mergeWithExistingFile({
|
|
122
|
+
existingFile: `${relativeThemeDir}/package.json`,
|
|
123
|
+
moduleTemplatePath: 'theme/package.json',
|
|
124
|
+
context,
|
|
125
|
+
format: 'json',
|
|
126
|
+
moduleName: 'sage',
|
|
127
|
+
mergeStrategy: 'replace',
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
await generator.mergeWithExistingFile({
|
|
131
|
+
existingFile: `${relativeThemeDir}/composer.json`,
|
|
132
|
+
moduleTemplatePath: 'theme/composer.json',
|
|
133
|
+
context,
|
|
134
|
+
format: 'json',
|
|
135
|
+
moduleName: 'sage',
|
|
136
|
+
mergeStrategy: 'replace',
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
await generator.generateFile(
|
|
140
|
+
'.devcontainer/docker-compose.override.yml',
|
|
141
|
+
context,
|
|
142
|
+
'sage',
|
|
143
|
+
`${relativeDevcontainerDir}/docker-compose.override.yml`
|
|
144
|
+
);
|
|
145
|
+
await generator.generateFile(
|
|
146
|
+
'.devcontainer/post-create.sh',
|
|
147
|
+
context,
|
|
148
|
+
'sage',
|
|
149
|
+
`${relativeDevcontainerDir}/post-create.sh`
|
|
150
|
+
);
|
|
151
|
+
await fs.chmod(path.join(context.cwd, relativeDevcontainerDir, 'post-create.sh'), 0o755);
|
|
152
|
+
|
|
153
|
+
// Unified setup scripts for Sage — shared between Lando, devcontainer and CI/CD
|
|
154
|
+
await generator.generateFile(
|
|
155
|
+
'server/cmd/setup-sage-php.sh',
|
|
156
|
+
context,
|
|
157
|
+
'sage',
|
|
158
|
+
'server/cmd/setup-sage-php.sh'
|
|
159
|
+
);
|
|
160
|
+
await generator.generateFile(
|
|
161
|
+
'server/cmd/setup-sage-node.sh',
|
|
162
|
+
context,
|
|
163
|
+
'sage',
|
|
164
|
+
'server/cmd/setup-sage-node.sh'
|
|
165
|
+
);
|
|
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
|
+
|
|
169
|
+
await generator.mergeWithExistingFile({
|
|
170
|
+
existingFile: `${relativeDevcontainerDir}/devcontainer.json`,
|
|
171
|
+
moduleTemplatePath: '.devcontainer/devcontainer.json',
|
|
172
|
+
context,
|
|
173
|
+
format: 'json',
|
|
174
|
+
moduleName: 'sage',
|
|
175
|
+
mergeStrategy: 'replace',
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
log(color.green, '[sage] ✅ Advanced Sage setup completed successfully');
|
|
179
|
+
log(color.green, `[sage] ✅ Theme directory: ${relativeThemeDir}`);
|
|
180
|
+
log(color.green, '[sage] ✅ Lando + Devcontainer command parity enabled');
|
|
92
181
|
} catch (error) {
|
|
93
182
|
log(color.red, `[sage] ❌ Installation failed: ${error.message}`);
|
|
94
183
|
throw error;
|
|
@@ -126,3 +215,13 @@ async function validateThemeInstallation(themeDir, sageConfig) {
|
|
|
126
215
|
|
|
127
216
|
log(color.blue, `[sage] ℹ️ Theme info: ${packageJson.name} v${packageJson.version || '1.0.0'}`);
|
|
128
217
|
}
|
|
218
|
+
|
|
219
|
+
async function isSageThemeInstalled(themeDir) {
|
|
220
|
+
const requiredFiles = ['package.json', 'composer.json', 'theme.json'];
|
|
221
|
+
for (const file of requiredFiles) {
|
|
222
|
+
if (!(await fs.pathExists(path.join(themeDir, file)))) {
|
|
223
|
+
return false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return true;
|
|
227
|
+
}
|
package/modules/sage/prompts.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Sage devcontainer post-create — delegates to unified setup scripts.
|
|
3
|
+
# Invoked from: devcontainer.json postCreateCommand.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.."; pwd)"
|
|
7
|
+
|
|
8
|
+
bash "${PROJECT_ROOT}/server/cmd/setup-sage-php.sh"
|
|
9
|
+
bash "${PROJECT_ROOT}/server/cmd/setup-sage-node.sh"
|
|
10
|
+
|
|
11
|
+
echo "Sage post-create bootstrap completed."
|
|
@@ -1,63 +1,49 @@
|
|
|
1
|
+
services:
|
|
2
|
+
build:
|
|
3
|
+
type: node:24
|
|
4
|
+
ssl: true
|
|
5
|
+
build:
|
|
6
|
+
- bash /app/server/cmd/setup-sage-node.sh
|
|
7
|
+
scanner: false
|
|
1
8
|
events:
|
|
2
9
|
post-start:
|
|
3
|
-
-
|
|
4
|
-
-
|
|
10
|
+
- bash ./server/cmd/setup-sage-php.sh
|
|
11
|
+
- bash ./server/cmd/setup-sage-node.sh
|
|
5
12
|
- wp theme activate {{projectName}}
|
|
6
|
-
- cd /app/content/themes/{{projectName}} && wp acorn optimize:clear
|
|
13
|
+
- cd /app/content/themes/{{projectName}} && wp acorn optimize:clear
|
|
7
14
|
tooling:
|
|
8
|
-
|
|
15
|
+
dev:
|
|
16
|
+
service: build
|
|
17
|
+
description: Run the Sage/Vite development server
|
|
18
|
+
cmd: npm run dev --prefix /app/content/themes/{{projectName}}
|
|
19
|
+
theme-bootstrap:
|
|
9
20
|
service: appserver
|
|
10
|
-
description:
|
|
21
|
+
description: Install theme dependencies
|
|
11
22
|
dir: /app/content/themes/{{projectName}}
|
|
12
23
|
cmd:
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
24
|
+
- appserver: bash /app/server/cmd/setup-sage-php.sh
|
|
25
|
+
- build: bash /app/server/cmd/setup-sage-node.sh
|
|
26
|
+
theme-build:
|
|
27
|
+
service: build
|
|
28
|
+
description: Build the Sage theme
|
|
29
|
+
cmd: npm run build --prefix /app/content/themes/{{projectName}}
|
|
16
30
|
theme-lint:
|
|
31
|
+
service: build
|
|
32
|
+
description: Lint the Sage theme
|
|
33
|
+
cmd: npm run lint --prefix /app/content/themes/{{projectName}}
|
|
34
|
+
acorn:
|
|
17
35
|
service: appserver
|
|
18
|
-
description:
|
|
36
|
+
description: Run Acorn artisan commands
|
|
19
37
|
dir: /app/content/themes/{{projectName}}
|
|
20
|
-
cmd:
|
|
21
|
-
- yarn lint
|
|
22
|
-
- pint --test
|
|
23
|
-
theme-dev:
|
|
24
|
-
service: appserver
|
|
25
|
-
description: "Dev the Sage theme"
|
|
26
|
-
dir: /app/content/themes/{{projectName}}
|
|
27
|
-
cmd:
|
|
28
|
-
- yarn dev
|
|
29
|
-
acorn-make:
|
|
30
|
-
service: appserver
|
|
31
|
-
description: Create new Acorn classes interactively
|
|
32
|
-
dir: /app/content/themes/{{projectName}}
|
|
33
|
-
cmd: wp acorn make:$ACORN_TYPE $ACORN_NAME
|
|
38
|
+
cmd: wp acorn $ACORN_COMMAND
|
|
34
39
|
options:
|
|
35
|
-
|
|
36
|
-
passthrough: true
|
|
37
|
-
alias:
|
|
38
|
-
- t
|
|
39
|
-
describe: Type of class to create
|
|
40
|
-
interactive:
|
|
41
|
-
type: list
|
|
42
|
-
message: What type of class would you like to create?
|
|
43
|
-
choices:
|
|
44
|
-
- name: Command (Artisan command)
|
|
45
|
-
value: command
|
|
46
|
-
- name: Component (View component class)
|
|
47
|
-
value: component
|
|
48
|
-
- name: Composer (View composer class)
|
|
49
|
-
value: composer
|
|
50
|
-
- name: Provider (Service provider class)
|
|
51
|
-
value: provider
|
|
52
|
-
weight: 100
|
|
53
|
-
env: ACORN_TYPE
|
|
54
|
-
filename:
|
|
40
|
+
command:
|
|
55
41
|
passthrough: true
|
|
56
42
|
alias:
|
|
57
|
-
-
|
|
58
|
-
describe:
|
|
43
|
+
- c
|
|
44
|
+
describe: Acorn command to execute
|
|
59
45
|
interactive:
|
|
60
46
|
type: input
|
|
61
|
-
message:
|
|
62
|
-
weight:
|
|
63
|
-
env:
|
|
47
|
+
message: "Acorn command (example: make:component Hero)"
|
|
48
|
+
weight: 100
|
|
49
|
+
env: ACORN_COMMAND
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs and builds Sage theme Node.js dependencies.
|
|
3
|
+
# Invoked from: Lando (build service build step + post-start), Devcontainer (post-create.sh), CI/CD.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
|
7
|
+
THEME_DIR="${PROJECT_ROOT}/content/themes/{{projectName}}"
|
|
8
|
+
|
|
9
|
+
if [ ! -d "${THEME_DIR}" ]; then
|
|
10
|
+
echo "Theme directory not found: ${THEME_DIR}" && exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if [ ! -d "${THEME_DIR}/node_modules" ]; then
|
|
14
|
+
echo "Installing Sage theme Node.js dependencies..."
|
|
15
|
+
npm install --prefix "${THEME_DIR}"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
if [ ! -f "${THEME_DIR}/public/build/manifest.json" ]; then
|
|
19
|
+
echo "Building Sage theme..."
|
|
20
|
+
npm run build --prefix "${THEME_DIR}"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
echo "Sage theme Node.js setup complete."
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs Sage theme PHP dependencies via Composer.
|
|
3
|
+
# Invoked from: Lando (post-start), Devcontainer (post-create.sh), CI/CD.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
|
|
6
|
+
PROJECT_ROOT="${PROJECT_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
|
7
|
+
THEME_DIR="${PROJECT_ROOT}/content/themes/{{projectName}}"
|
|
8
|
+
|
|
9
|
+
if [ ! -d "${THEME_DIR}" ]; then
|
|
10
|
+
echo "Theme directory not found: ${THEME_DIR}" && exit 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
if [ -f "${THEME_DIR}/vendor/autoload.php" ]; then
|
|
14
|
+
echo "Sage PHP dependencies already installed, skipping."
|
|
15
|
+
exit 0
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
echo "Installing Sage theme PHP dependencies..."
|
|
19
|
+
composer install \
|
|
20
|
+
--working-dir="${THEME_DIR}" \
|
|
21
|
+
--no-interaction \
|
|
22
|
+
--no-progress \
|
|
23
|
+
--optimize-autoloader
|
|
24
|
+
echo "Sage PHP dependencies installed."
|
|
File without changes
|
|
File without changes
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
1
|
+
{
|
|
2
|
+
"description": "{{projectDescription}}",
|
|
3
|
+
"authors": [
|
|
4
|
+
{
|
|
5
|
+
"name": "{{author}}",
|
|
6
|
+
"email": "{{authorEmail}}"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"require": {
|
|
10
|
+
"php": ">={{phpVersion}}",
|
|
11
|
+
"log1x/sage-directives": "^2.0",
|
|
12
|
+
"log1x/acf-composer": "^2.0 || ^3.0"
|
|
13
|
+
},
|
|
14
|
+
"require-dev": {
|
|
15
|
+
"laravel/pint": "^1.21"
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"lint": [
|
|
19
|
+
"./vendor/bin/pint --test"
|
|
20
|
+
],
|
|
21
|
+
"acorn:optimize": [
|
|
22
|
+
"wp acorn optimize"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
{
|
|
2
|
-
"
|
|
3
|
-
|
|
1
|
+
{
|
|
2
|
+
"author": "{{author}}",
|
|
3
|
+
"description": "{{projectDescription}}",
|
|
4
|
+
"version": "{{projectVersion}}",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "{{gitRepository}}"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "vite",
|
|
12
|
+
"build": "vite build",
|
|
13
|
+
"lint": "eslint resources --ext .js,.ts,.vue"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
File without changes
|
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { defineConfig } from 'vite';
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
4
|
+
import laravel from 'laravel-vite-plugin';
|
|
5
|
+
import { wordpressPlugin, wordpressThemeJson } from '@roots/vite-plugin';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
base: '/app/content/themes/{{projectName}}/',
|
|
9
|
+
plugins: [
|
|
10
|
+
tailwindcss(),
|
|
11
|
+
laravel({
|
|
12
|
+
input: [
|
|
13
|
+
'resources/css/app.css',
|
|
14
|
+
'resources/js/app.js',
|
|
15
|
+
'resources/css/editor.css',
|
|
16
|
+
'resources/js/editor.js',
|
|
17
|
+
],
|
|
18
|
+
refresh: true,
|
|
19
|
+
watch: {
|
|
20
|
+
usePolling: true,
|
|
21
|
+
interval: 1000,
|
|
22
|
+
ignored: ['node_modules', 'public/build/hot'],
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
wordpressPlugin(),
|
|
26
|
+
wordpressThemeJson({
|
|
27
|
+
disableTailwindColors: false,
|
|
28
|
+
disableTailwindFonts: false,
|
|
29
|
+
disableTailwindFontSizes: false,
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
resolve: {
|
|
33
|
+
alias: {
|
|
34
|
+
'@scripts': '/resources/js',
|
|
35
|
+
'@styles': '/resources/css',
|
|
36
|
+
'@fonts': '/resources/fonts',
|
|
37
|
+
'@images': '/resources/images',
|
|
38
|
+
'@blocks': '/app/Blocks',
|
|
39
|
+
'@fields': '/app/Fields',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
server: {
|
|
43
|
+
https: {
|
|
44
|
+
key: fs.readFileSync('/certs/cert.key'),
|
|
45
|
+
cert: fs.readFileSync('/certs/cert.crt'),
|
|
46
|
+
},
|
|
47
|
+
host: true,
|
|
48
|
+
port: 3009,
|
|
49
|
+
strictPort: true,
|
|
50
|
+
hmr: {
|
|
51
|
+
host: 'localhost',
|
|
52
|
+
protocol: 'wss',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|