@codigodoleo/wp-kit 5.0.1 → 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 (68) 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/lib/utils/logger.js +1 -1
  6. package/modules/blank-theme/index.js +49 -41
  7. package/modules/blank-theme/prompts.js +9 -25
  8. package/modules/blank-theme/templates/.lando.yml.hbs +5 -8
  9. package/modules/blank-theme/templates/functions.php.hbs +21 -15
  10. package/modules/blank-theme/templates/package.json.hbs +1 -1
  11. package/modules/deploy/index.js +51 -61
  12. package/modules/deploy/prompts.js +36 -12
  13. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +356 -63
  14. package/modules/deploy/templates/.gitlab/ci/lint-blank-theme.yml.hbs +4 -4
  15. package/modules/deploy/templates/.gitlab/ci/lint-mu-plugin.yml.hbs +3 -2
  16. package/modules/deploy/templates/.gitlab/ci/lint-plugin.yml.hbs +3 -2
  17. package/modules/deploy/templates/.gitlab/ci/lint-sage.yml.hbs +17 -14
  18. package/modules/git/.lintstagedrc.json +2 -5
  19. package/modules/lint/.oxlintrc.json +19 -0
  20. package/modules/lint/.prettierignore +16 -1
  21. package/modules/lint/index.js +32 -40
  22. package/modules/lint/templates/mago.toml.hbs +83 -0
  23. package/modules/lint/templates/package.json.hbs +6 -10
  24. package/modules/lint/templates/workspace.json.hbs +2 -36
  25. package/modules/mu-plugin/index.js +64 -56
  26. package/modules/mu-plugin/prompts.js +21 -23
  27. package/modules/mu-plugin/templates/.lando.yml.hbs +8 -10
  28. package/modules/mu-plugin/templates/acorn/app/Providers/CoreServiceProvider.php.hbs +1 -1
  29. package/modules/mu-plugin/templates/acorn/composer.json.hbs +6 -5
  30. package/modules/mu-plugin/templates/composer.json.hbs +4 -2
  31. package/modules/php/templates/.lando.yml.hbs +13 -8
  32. package/modules/php/templates/composer.json.hbs +15 -7
  33. package/modules/php/templates/workspace.json.hbs +22 -19
  34. package/modules/plugin/index.js +10 -18
  35. package/modules/plugin/prompts.js +5 -19
  36. package/modules/plugin/templates/.lando.yml.hbs +8 -10
  37. package/modules/plugin/templates/composer.json.hbs +4 -2
  38. package/modules/sage/index.js +78 -88
  39. package/modules/sage/prompts.js +10 -24
  40. package/modules/sage/templates/.lando.yml.hbs +17 -7
  41. package/modules/sage/templates/theme/composer.json.hbs +36 -23
  42. package/modules/sage/templates/theme/package.json.hbs +24 -13
  43. package/modules/sage/templates/theme/style.css.hbs +12 -20
  44. package/modules/test/templates/composer.json.hbs +1 -1
  45. package/package.json +30 -35
  46. package/templates/.devcontainer/devcontainer.json.hbs +2 -2
  47. package/templates/.gitignore.hbs +9 -3
  48. package/templates/README.md.hbs +1 -1
  49. package/templates/auth.json.hbs +8 -0
  50. package/templates/composer.json.hbs +13 -5
  51. package/templates/package.json.hbs +2 -4
  52. package/templates/workspace.json.hbs +3 -4
  53. package/wp-config.php +5 -0
  54. package/modules/blank-theme/lint/eslint.config.mjs +0 -30
  55. package/modules/blank-theme/lint/pint.json +0 -11
  56. package/modules/deploy/.github/workflows/deploy-docker.yml +0 -104
  57. package/modules/deploy/.github/workflows/deploy-ssh.yml +0 -128
  58. package/modules/deploy/.github/workflows/release.yml +0 -57
  59. package/modules/mu-plugin/lint/eslint.config.mjs +0 -30
  60. package/modules/mu-plugin/lint/pint.json +0 -11
  61. package/modules/mu-plugin/templates/acorn/resources/.gitkeep +0 -0
  62. package/modules/mu-plugin/templates/acorn/storage/framework/cache/.gitkeep +0 -0
  63. package/modules/mu-plugin/templates/acorn/storage/framework/sessions/.gitkeep +0 -0
  64. package/modules/mu-plugin/templates/acorn/storage/framework/views/.gitkeep +0 -0
  65. package/modules/plugin/lint/eslint.config.mjs +0 -30
  66. package/modules/plugin/lint/pint.json +0 -11
  67. package/modules/sage/lint/eslint.config.mjs +0 -30
  68. package/modules/sage/lint/pint.json +0 -11
@@ -1,77 +1,370 @@
1
- # 🚀 WordPress CI (GitHub Actions) name: CI on: push: branches: [ main, develop, staging ]
2
- pull_request: branches: [ main, develop, staging ] jobs: build-basic: name: Build basic runs-on:
3
- ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node uses:
4
- actions/setup-node@v4 with: node-version: ${{'{{'}}
5
- env.NODE_VERSION
6
- {{'}}'}}
7
- - name: Install deps (if present) run: | if [ -f package.json ]; then npm ci; fi
8
-
9
- {{#if ci.build.composer}}
10
- build-composer: name: Build Composer runs-on: ubuntu-latest steps: - name: Checkout uses:
11
- actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: ${{'{{'}}
12
- env.PHP_VERSION
13
- {{'}}'}}
14
- - name: Install Composer deps run: | if [ -f composer.json ]; then composer install --no-dev
15
- --optimize-autoloader; fi
1
+ # CI — {{projectName}}
2
+ #
3
+ # Quality gate and deploy pipeline using hekivo/gha-workflows shared actions.
4
+ # Secrets are resolved via 1Password Connect (Connect server at vars.OP_CONNECT_HOST,
5
+ # authenticated with secrets.OP_CONNECT_TOKEN). Update the op:// paths below to
6
+ # match your project's vault items before first run.
7
+
8
+ name: CI
9
+
10
+ on:
11
+ push:
12
+ branches: [main, staging]
13
+ pull_request:
14
+ branches: [main, staging]
15
+ workflow_dispatch:
16
+ inputs:
17
+ deploy:
18
+ description: "Run deploy after build"
19
+ required: false
20
+ type: boolean
21
+ default: false
22
+ {{#if ci.deploy.ssh}}
23
+ deploy-environment:
24
+ description: "Target environment when deploy=true"
25
+ required: false
26
+ type: choice
27
+ options:
28
+ - staging
29
+ - production
30
+ default: staging
31
+ {{/if}}
32
+
33
+ permissions:
34
+ contents: read
35
+ {{#if ci.deploy.docker}}
36
+ packages: write
16
37
  {{/if}}
17
38
 
39
+ concurrency:
40
+ group: ci-${{'{{'}} github.ref {{'}}'}}
41
+ cancel-in-progress: true
42
+
43
+ env:
44
+ PHP_VERSION: "{{phpVersion}}"
45
+ NODE_VERSION: "{{nodeVersion}}"
18
46
  {{#if ci.build.sage}}
19
- build-sage: name: Build Sage Theme runs-on: ubuntu-latest steps: - name: Checkout uses:
20
- actions/checkout@v4 - name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
21
- env.NODE_VERSION
22
- {{'}}'}}
23
- - name: Build theme run: | THEME="{{ci.theme.paths.themeRoot}}" if [ -d "$THEME" ]; then cd
24
- "$THEME" if [ -f package.json ]; then npm ci; fi if [ -f yarn.lock ]; then yarn install
25
- --frozen-lockfile; fi if [ -f package.json ]; then npm run build || yarn build; fi else echo "Tema
26
- não encontrado em $THEME — pulando build do tema" fi
47
+ THEME_PATH: {{ci.theme.paths.themeRoot}}
27
48
  {{/if}}
49
+ # Disable husky in CI — no human commits, and semantic-release's auto-commit
50
+ # (chore(release): vX.Y.Z [skip ci]) would trip the commitlint hook.
51
+ # https://typioca.github.io/husky/how-to.html#ci-server-and-docker
52
+ HUSKY: "0"
28
53
 
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}"
54
+ jobs:
55
+ # ── Quality Gate ────────────────────────────────────────────────────────────
56
+ quality:
57
+ uses: hekivo/gha-workflows/.github/workflows/quality.yml@v1
58
+ with:
59
+ php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
60
+ node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
61
+ {{#if ci.build.sage}}
62
+ theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
63
+ {{/if}}
64
+ mago-lint-continue-on-error: false
65
+ secrets:
66
+ OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
67
+ {{#if enable_acf_pro}}
68
+ ACF_CONNECT_USERNAME: ${{'{{'}} secrets.ACF_CONNECT_USERNAME {{'}}'}}
69
+ ACF_CONNECT_PASSWORD: ${{'{{'}} secrets.ACF_CONNECT_PASSWORD {{'}}'}}
70
+ {{/if}}
71
+
72
+ {{#if ci.deploy.docker}}
73
+ # ── Docker Build ─────────────────────────────────────────────────────────────
74
+ docker-build:
75
+ needs: quality
76
+ uses: hekivo/gha-workflows/.github/workflows/docker-build.yml@v1
77
+ with:
78
+ image-name: ${{'{{'}} github.repository {{'}}'}}
79
+ platforms: linux/amd64
80
+ permissions:
81
+ packages: write
82
+ contents: read
83
+
84
+ # ── Docker Publish ────────────────────────────────────────────────────────────
85
+ docker-publish:
86
+ needs: docker-build
87
+ if: |
88
+ github.event_name == 'push' ||
89
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true)
90
+ uses: hekivo/gha-workflows/.github/workflows/docker-publish.yml@v1
91
+ with:
92
+ source-image: ${{'{{'}} needs.docker-build.outputs.image-ref {{'}}'}}
93
+ registry-type: {{docker_registry}}
94
+ image-name: ${{'{{'}} github.repository {{'}}'}}
95
+ image-tag: ${{'{{'}} github.ref_name {{'}}'}}
96
+ {{#if ci.docker.registryEcr}}
97
+ aws-region: us-east-1 # TODO: update region
98
+ ecr-registry: "" # TODO: 123456789012.dkr.ecr.us-east-1.amazonaws.com
99
+ {{/if}}
100
+ {{#if ci.docker.registryDockerHub}}
101
+ dockerhub-username: "" # TODO: set your Docker Hub username
102
+ {{/if}}
103
+ {{#if ci.docker.registryGitlab}}
104
+ gitlab-registry: registry.gitlab.com # TODO: update if self-hosted
105
+ {{/if}}
106
+ secrets:
107
+ {{#if ci.docker.registryEcr}}
108
+ AWS_ROLE_ARN: ${{'{{'}} secrets.AWS_ROLE_ARN {{'}}'}}
34
109
  {{/if}}
110
+ {{#if ci.docker.registryDockerHub}}
111
+ DOCKERHUB_TOKEN: ${{'{{'}} secrets.DOCKERHUB_TOKEN {{'}}'}}
112
+ {{/if}}
113
+ {{#if ci.docker.registryGitlab}}
114
+ GITLAB_REGISTRY_TOKEN: ${{'{{'}} secrets.GITLAB_REGISTRY_TOKEN {{'}}'}}
115
+ {{/if}}
116
+ permissions:
117
+ packages: read
118
+ contents: read
119
+ id-token: write
120
+ {{/if}}
121
+
122
+ {{#if ci.deploy.ssh}}
123
+ # ── Deploy Staging ───────────────────────────────────────────────────────────
124
+ deploy-staging:
125
+ needs: quality
126
+ runs-on: ubuntu-latest
127
+ environment: staging
128
+ if: |
129
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'staging') ||
130
+ (github.event_name == 'push' && github.ref == 'refs/heads/staging')
35
131
 
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
132
+ steps:
133
+ - name: Checkout
134
+ uses: actions/checkout@v4
135
+
136
+ - name: Load secrets from 1Password
137
+ uses: 1password/load-secrets-action@v2
138
+ with:
139
+ export-env: true
140
+ env:
141
+ OP_CONNECT_HOST: ${{'{{'}} vars.OP_CONNECT_HOST {{'}}'}}
142
+ OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
143
+ {{#if enable_acf_pro}}
144
+ # ACF Pro Composer auth — item shared across all projects in Hekivo-Internal
145
+ ACF_CONNECT_USERNAME: op://Hekivo-Internal/{{projectName}}-acf-connect/username
146
+ ACF_CONNECT_PASSWORD: op://Hekivo-Internal/{{projectName}}-acf-connect/password
147
+ {{/if}}
148
+ # SSH transport credentials — update vault/item paths for this project
149
+ SSH_HOST: op://Client-{{projectName}}/ssh-staging/hostname
150
+ SSH_USER: op://Client-{{projectName}}/ssh-staging/username
151
+ SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-staging/remote-path
152
+ SSH_PRIVATE_KEY: op://Client-{{projectName}}/staging-server-ssh-key/private_key?ssh-format=openssh
153
+ {{#if ci.ssh.useCloudflare}}
154
+ # Cloudflare Access Service Token for SSH tunnel (staging)
155
+ TUNNEL_SERVICE_TOKEN_ID: op://Hekivo-Internal/{{projectName}}-cf-access-gha-staging/client-id
156
+ TUNNEL_SERVICE_TOKEN_SECRET: op://Hekivo-Internal/{{projectName}}-cf-access-gha-staging/client-secret
41
157
  {{/if}}
158
+ # .env composition (3 layers: template + salts + DB)
159
+ ENV_TEMPLATE: op://Client-{{projectName}}/staging-env-file/notesPlain
160
+ WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
161
+ WORDPRESS_DB_NAME: op://Client-{{projectName}}/staging-wp-database/database
162
+ WORDPRESS_DB_USER: op://Client-{{projectName}}/staging-wp-database/username
163
+ WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/staging-wp-database/password
164
+ WORDPRESS_DB_HOST: op://Client-{{projectName}}/staging-wp-database/hostname
165
+ WORDPRESS_DB_PORT: op://Client-{{projectName}}/staging-wp-database/port
166
+ # Cloudflare cache purge
167
+ CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/{{projectName}}-cloudflare-api/zone id
168
+ CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/{{projectName}}-cloudflare-api/credential
42
169
 
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
170
+ - name: Setup WordPress (production deps)
171
+ uses: hekivo/gha-workflows/actions/setup-wordpress@v1
172
+ with:
173
+ php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
174
+ no-dev: "true"
175
+ {{#if ci.build.sage}}
176
+ working-dir: ${{'{{'}} env.THEME_PATH {{'}}'}}
177
+ {{/if}}
178
+ {{#if enable_acf_pro}}
179
+ acf-username: ${{'{{'}} env.ACF_CONNECT_USERNAME {{'}}'}}
180
+ acf-password: ${{'{{'}} env.ACF_CONNECT_PASSWORD {{'}}'}}
48
181
  {{/if}}
49
182
 
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"
183
+ {{#if ci.build.sage}}
184
+ - name: Setup Node.js + theme
185
+ uses: hekivo/gha-workflows/actions/setup-node-theme@v1
186
+ with:
187
+ node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
188
+ install-root: "false"
189
+ theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
190
+
191
+ - name: Build theme assets
192
+ run: npm run build --prefix "${{'{{'}} env.THEME_PATH {{'}}'}}"
193
+
55
194
  {{/if}}
195
+ - name: Compose .env
196
+ uses: hekivo/gha-workflows/actions/compose-dotenv@v1
197
+ with:
198
+ env-template: ${{'{{'}} env.ENV_TEMPLATE {{'}}'}}
199
+ wp-salts: ${{'{{'}} env.WP_SALTS_BLOCK {{'}}'}}
200
+ db-name: ${{'{{'}} env.WORDPRESS_DB_NAME {{'}}'}}
201
+ db-user: ${{'{{'}} env.WORDPRESS_DB_USER {{'}}'}}
202
+ db-password: ${{'{{'}} env.WORDPRESS_DB_PASSWORD {{'}}'}}
203
+ db-host: ${{'{{'}} env.WORDPRESS_DB_HOST {{'}}'}}
204
+ db-port: ${{'{{'}} env.WORDPRESS_DB_PORT {{'}}'}}
56
205
 
57
- test-basic: name: Tests runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 -
58
- name: Setup Node uses: actions/setup-node@v4 with: node-version: ${{'{{'}}
59
- env.NODE_VERSION
60
- {{'}}'}}
61
- - name: Run basic tests run: echo "No tests yet"
206
+ {{#if ci.ssh.useCloudflare}}
207
+ - name: Setup SSH via Cloudflare Tunnel
208
+ uses: hekivo/gha-workflows/actions/setup-cloudflare-ssh@v1
209
+ with:
210
+ ssh-host: ${{'{{'}} env.SSH_HOST {{'}}'}}
211
+ ssh-user: ${{'{{'}} env.SSH_USER {{'}}'}}
212
+ ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
213
+ tunnel-token-id: ${{'{{'}} env.TUNNEL_SERVICE_TOKEN_ID {{'}}'}}
214
+ tunnel-token-secret: ${{'{{'}} env.TUNNEL_SERVICE_TOKEN_SECRET {{'}}'}}
215
+ {{else}}
216
+ - name: Configure SSH agent
217
+ uses: webfactory/ssh-agent@v0.9.0
218
+ with:
219
+ ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
62
220
 
63
- {{#if ci.deploy.docker}}
64
- deploy-docker: if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/staging' name:
65
- Deploy Docker runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Set
66
- up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GHCR uses:
67
- docker/login-action@v3 with: registry: ghcr.io username: ${{'{{'}}
68
- github.actor
69
- {{'}}'}}
70
- password: ${{'{{'}}
71
- secrets.GITHUB_TOKEN
72
- {{'}}'}}
73
- - name: Build (placeholder) run: echo "Deploy Docker"
74
- {{/if}}
75
-
76
- env: PHP_VERSION: "{{phpVersion}}" NODE_VERSION: "{{ci.nodeVersion}}" WORDPRESS_VERSION: "{{wpCoreVersion}}"
77
- PROJECT_NAME: "{{projectName}}"
221
+ - name: Add known hosts
222
+ run: |
223
+ mkdir -p ~/.ssh
224
+ ssh-keyscan -H "$SSH_HOST" >> ~/.ssh/known_hosts
225
+ chmod 600 ~/.ssh/known_hosts
226
+ {{/if}}
227
+
228
+ - name: Deploy via rsync
229
+ uses: hekivo/gha-workflows/actions/deploy-rsync@v1
230
+ with:
231
+ ssh-target: ${{'{{'}} env.SSH_HOST {{'}}'}}
232
+ remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
233
+ {{#if ci.build.sage}}
234
+ theme-slug: {{projectName}}
235
+ {{/if}}
236
+
237
+ - name: WordPress post-deploy
238
+ uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
239
+ with:
240
+ ssh-target: ${{'{{'}} env.SSH_HOST {{'}}'}}
241
+ remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
242
+ {{#if enable_acf_pro}}
243
+ plugin-slug: advanced-custom-fields-pro
244
+ {{/if}}
245
+ {{#if ci.build.sage}}
246
+ theme-slug: {{projectName}}
247
+ {{/if}}
248
+
249
+ - name: Purge Cloudflare cache
250
+ uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
251
+ with:
252
+ zone-id: ${{'{{'}} env.CLOUDFLARE_PURGE_ZONE_ID {{'}}'}}
253
+ api-token: ${{'{{'}} env.CLOUDFLARE_PURGE_TOKEN {{'}}'}}
254
+
255
+ # ── Deploy Production ─────────────────────────────────────────────────────────
256
+ deploy-production:
257
+ needs: quality
258
+ runs-on: ubuntu-latest
259
+ environment: production
260
+ if: |
261
+ (github.event_name == 'workflow_dispatch' && inputs.deploy == true && inputs['deploy-environment'] == 'production') ||
262
+ (github.event_name == 'push' && github.ref == 'refs/heads/main')
263
+
264
+ steps:
265
+ - name: Checkout
266
+ uses: actions/checkout@v4
267
+
268
+ - name: Load secrets from 1Password
269
+ uses: 1password/load-secrets-action@v2
270
+ with:
271
+ export-env: true
272
+ env:
273
+ OP_CONNECT_HOST: ${{'{{'}} vars.OP_CONNECT_HOST {{'}}'}}
274
+ OP_CONNECT_TOKEN: ${{'{{'}} secrets.OP_CONNECT_TOKEN {{'}}'}}
275
+ {{#if enable_acf_pro}}
276
+ ACF_CONNECT_USERNAME: op://Hekivo-Internal/{{projectName}}-acf-connect/username
277
+ ACF_CONNECT_PASSWORD: op://Hekivo-Internal/{{projectName}}-acf-connect/password
278
+ {{/if}}
279
+ SSH_HOST: op://Client-{{projectName}}/ssh-production/hostname
280
+ SSH_USER: op://Client-{{projectName}}/ssh-production/username
281
+ SSH_PORT: op://Client-{{projectName}}/ssh-production/port
282
+ SSH_REMOTE_PATH: op://Client-{{projectName}}/ssh-production/remote-path
283
+ SSH_PRIVATE_KEY: op://Client-{{projectName}}/production-server-ssh-key/private_key?ssh-format=openssh
284
+ ENV_TEMPLATE: op://Client-{{projectName}}/production-env-file/notesPlain
285
+ WP_SALTS_BLOCK: op://Client-{{projectName}}/wp-salts/notesPlain
286
+ WORDPRESS_DB_NAME: op://Client-{{projectName}}/production-wp-database/database
287
+ WORDPRESS_DB_USER: op://Client-{{projectName}}/production-wp-database/username
288
+ WORDPRESS_DB_PASSWORD: op://Client-{{projectName}}/production-wp-database/password
289
+ WORDPRESS_DB_HOST: op://Client-{{projectName}}/production-wp-database/hostname
290
+ WORDPRESS_DB_PORT: op://Client-{{projectName}}/production-wp-database/port
291
+ CLOUDFLARE_PURGE_ZONE_ID: op://Hekivo-Internal/{{projectName}}-cloudflare-api/zone id
292
+ CLOUDFLARE_PURGE_TOKEN: op://Hekivo-Internal/{{projectName}}-cloudflare-api/credential
293
+
294
+ - name: Setup WordPress (production deps)
295
+ uses: hekivo/gha-workflows/actions/setup-wordpress@v1
296
+ with:
297
+ php-version: ${{'{{'}} env.PHP_VERSION {{'}}'}}
298
+ no-dev: "true"
299
+ {{#if ci.build.sage}}
300
+ working-dir: ${{'{{'}} env.THEME_PATH {{'}}'}}
301
+ {{/if}}
302
+ {{#if enable_acf_pro}}
303
+ acf-username: ${{'{{'}} env.ACF_CONNECT_USERNAME {{'}}'}}
304
+ acf-password: ${{'{{'}} env.ACF_CONNECT_PASSWORD {{'}}'}}
305
+ {{/if}}
306
+
307
+ {{#if ci.build.sage}}
308
+ - name: Setup Node.js + theme
309
+ uses: hekivo/gha-workflows/actions/setup-node-theme@v1
310
+ with:
311
+ node-version: ${{'{{'}} env.NODE_VERSION {{'}}'}}
312
+ install-root: "false"
313
+ theme-path: ${{'{{'}} env.THEME_PATH {{'}}'}}
314
+
315
+ - name: Build theme assets
316
+ run: npm run build --prefix "${{'{{'}} env.THEME_PATH {{'}}'}}"
317
+
318
+ {{/if}}
319
+ - name: Compose .env
320
+ uses: hekivo/gha-workflows/actions/compose-dotenv@v1
321
+ with:
322
+ env-template: ${{'{{'}} env.ENV_TEMPLATE {{'}}'}}
323
+ wp-salts: ${{'{{'}} env.WP_SALTS_BLOCK {{'}}'}}
324
+ db-name: ${{'{{'}} env.WORDPRESS_DB_NAME {{'}}'}}
325
+ db-user: ${{'{{'}} env.WORDPRESS_DB_USER {{'}}'}}
326
+ db-password: ${{'{{'}} env.WORDPRESS_DB_PASSWORD {{'}}'}}
327
+ db-host: ${{'{{'}} env.WORDPRESS_DB_HOST {{'}}'}}
328
+ db-port: ${{'{{'}} env.WORDPRESS_DB_PORT {{'}}'}}
329
+
330
+ - name: Configure SSH agent
331
+ uses: webfactory/ssh-agent@v0.9.0
332
+ with:
333
+ ssh-private-key: ${{'{{'}} env.SSH_PRIVATE_KEY {{'}}'}}
334
+
335
+ - name: Add known hosts
336
+ run: |
337
+ PORT="${SSH_PORT:-22}"
338
+ mkdir -p ~/.ssh
339
+ ssh-keyscan -p "$PORT" -H "$SSH_HOST" >> ~/.ssh/known_hosts
340
+ chmod 600 ~/.ssh/known_hosts
341
+
342
+ - name: Deploy via rsync
343
+ uses: hekivo/gha-workflows/actions/deploy-rsync@v1
344
+ with:
345
+ ssh-target: ${{'{{'}} env.SSH_USER {{'}}'}}@${{'{{'}} env.SSH_HOST {{'}}'}}
346
+ ssh-cmd: ssh -p ${{'{{'}} env.SSH_PORT || '22' {{'}}'}}
347
+ remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
348
+ {{#if ci.build.sage}}
349
+ theme-slug: {{projectName}}
350
+ {{/if}}
351
+
352
+ - name: WordPress post-deploy
353
+ uses: hekivo/gha-workflows/actions/wp-post-deploy@v1
354
+ with:
355
+ ssh-target: ${{'{{'}} env.SSH_USER {{'}}'}}@${{'{{'}} env.SSH_HOST {{'}}'}}
356
+ ssh-cmd: ssh -p ${{'{{'}} env.SSH_PORT || '22' {{'}}'}}
357
+ remote-root: ${{'{{'}} env.SSH_REMOTE_PATH {{'}}'}}
358
+ {{#if enable_acf_pro}}
359
+ plugin-slug: advanced-custom-fields-pro
360
+ {{/if}}
361
+ {{#if ci.build.sage}}
362
+ theme-slug: {{projectName}}
363
+ {{/if}}
364
+
365
+ - name: Purge Cloudflare cache
366
+ uses: hekivo/gha-workflows/actions/cloudflare-purge@v1
367
+ with:
368
+ zone-id: ${{'{{'}} env.CLOUDFLARE_PURGE_ZONE_ID {{'}}'}}
369
+ api-token: ${{'{{'}} env.CLOUDFLARE_PURGE_TOKEN {{'}}'}}
370
+ {{/if}}
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.blank_theme}}
2
- lint:blank-theme:eslint:
2
+ lint:blank-theme:js:
3
3
  stage: lint
4
4
  image: node:${NODE_VERSION}-alpine
5
5
  variables:
@@ -7,9 +7,9 @@ lint:blank-theme:eslint:
7
7
  before_script:
8
8
  - apk add --no-cache git
9
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
10
+ - npm ci
11
+ - npx oxfmt --check
12
+ - npx oxlint
13
13
  rules:
14
14
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
15
15
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.mu_plugin}}
2
- lint:mu-plugin:pint:
2
+ lint:mu-plugin:quality:
3
3
  stage: lint
4
4
  image: php:${PHP_VERSION}-cli
5
5
  variables:
@@ -10,7 +10,8 @@ lint:mu-plugin:pint:
10
10
  script:
11
11
  - cd $PLUGIN_DIR
12
12
  - composer install --no-dev
13
- - ./vendor/bin/pint --test
13
+ - vendor/bin/mago format --check
14
+ - vendor/bin/mago lint
14
15
  rules:
15
16
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
16
17
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,5 +1,5 @@
1
1
  {{#if ci.lint.plugin}}
2
- lint:plugin:pint:
2
+ lint:plugin:quality:
3
3
  stage: lint
4
4
  image: php:${PHP_VERSION}-cli
5
5
  variables:
@@ -10,7 +10,8 @@ lint:plugin:pint:
10
10
  script:
11
11
  - cd $PLUGIN_DIR
12
12
  - composer install --no-dev
13
- - ./vendor/bin/pint --test
13
+ - vendor/bin/mago format --check
14
+ - vendor/bin/mago lint
14
15
  rules:
15
16
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
16
17
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,44 +1,47 @@
1
1
  {{#if ci.lint.sage}}
2
- lint:sage:eslint:
2
+ lint:sage:quality:
3
3
  stage: lint
4
- image: node:${NODE_VERSION}-alpine
4
+ image: php:${PHP_VERSION}-cli
5
5
  before_script:
6
- - apk add --no-cache git
6
+ - apt-get update -qq && apt-get install -qq --no-install-recommends git unzip
7
+ - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
7
8
  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
9
+ - composer install --no-dev --optimize-autoloader
10
+ - vendor/bin/mago format --check
11
+ - vendor/bin/mago lint
11
12
  rules:
12
13
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
13
14
  - if: $CI_COMMIT_BRANCH == "main"
14
15
  - if: $CI_COMMIT_BRANCH == "staging"
15
16
  - if: $CI_COMMIT_BRANCH == "develop"
16
17
 
17
- lint:sage:stylelint:
18
+ lint:sage:js:
18
19
  stage: lint
19
20
  image: node:${NODE_VERSION}-alpine
20
21
  before_script:
21
22
  - apk add --no-cache git
22
23
  script:
24
+ - npm ci
25
+ - npx oxfmt --check
26
+ - npx oxlint
23
27
  - cd {{ci.theme.paths.themeRoot}}
24
28
  - npm ci --cache .npm --prefer-offline
25
- - npx stylelint "resources/**/*.{css,scss}"
29
+ - npm run build
26
30
  rules:
27
31
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
28
32
  - if: $CI_COMMIT_BRANCH == "main"
29
33
  - if: $CI_COMMIT_BRANCH == "staging"
30
34
  - if: $CI_COMMIT_BRANCH == "develop"
31
35
 
32
- lint:sage:pint:
36
+ lint:sage:stylelint:
33
37
  stage: lint
34
- image: php:${PHP_VERSION}-cli
38
+ image: node:${NODE_VERSION}-alpine
35
39
  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
40
+ - apk add --no-cache git
38
41
  script:
39
42
  - cd {{ci.theme.paths.themeRoot}}
40
- - composer install --no-dev --optimize-autoloader
41
- - ./vendor/bin/pint --test
43
+ - npm ci --cache .npm --prefer-offline
44
+ - npx stylelint "resources/**/*.{css,scss}"
42
45
  rules:
43
46
  - if: $CI_PIPELINE_SOURCE == "merge_request_event"
44
47
  - if: $CI_COMMIT_BRANCH == "main"
@@ -1,7 +1,4 @@
1
1
  {
2
- "*.{js,jsx,ts,tsx}": "eslint",
3
- "*.{css,scss,sass}": "stylelint",
4
- "*.{json,yaml,yml,md}": "prettier --check",
5
- "*.{html}": "prettier --check --parser html",
6
- "*.{php}": "pint --test"
2
+ "*.{js,mjs,ts,vue,jsx,tsx}": ["oxfmt --write", "oxlint --fix"],
3
+ "*.{json,jsonc,html,yml,yaml,md,mdx}": ["oxfmt --write"]
7
4
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
3
+ "ignorePatterns": [
4
+ "node_modules/**",
5
+ "vendor/**",
6
+ "content/themes/*/public/build/**",
7
+ "content/themes/*/node_modules/**",
8
+ "content/themes/*/vendor/**",
9
+ "wp/**",
10
+ "content/plugins/**",
11
+ "content/mu-plugins/**",
12
+ "public/build/**",
13
+ "test-results/**",
14
+ "playwright-report/**"
15
+ ],
16
+ "rules": {
17
+ "no-unused-vars": ["error", { "argsIgnorePattern": "^_", "varsIgnorePattern": "^_" }]
18
+ }
19
+ }
@@ -1,8 +1,13 @@
1
+ # Read by both Prettier (legacy) and oxfmt (current).
2
+ # oxfmt automatically picks this file up by default (and .gitignore).
3
+
1
4
  # Node & Composer
2
5
  node_modules/
3
6
  vendor/
4
7
 
5
- # Development module folders — each has its own lint config
8
+ # Theme/plugin/mu-plugin subtrees are formatted by their own
9
+ # lint-staged globs targeting specific paths via mago/oxfmt — skip
10
+ # the whole subtree here so we never accidentally reformat vendored code.
6
11
  content/themes/
7
12
  content/mu-plugins/
8
13
  content/plugins/
@@ -17,6 +22,8 @@ content/cache/
17
22
  public/build/
18
23
  dist/
19
24
  .lando/
25
+ test-results/
26
+ playwright-report/
20
27
 
21
28
  # Env and logs
22
29
  .env
@@ -24,3 +31,11 @@ dist/
24
31
  *.log
25
32
  *.tmp
26
33
  *.bak
34
+
35
+ # Auto-generated lock files (oxfmt would normalize whitespace and
36
+ # defeat npm/composer determinism). Both are still committed.
37
+ package-lock.json
38
+ composer.lock
39
+
40
+ # Auto-generated by semantic-release / release-please.
41
+ CHANGELOG.md