@codigodoleo/wp-kit 1.0.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 (112) hide show
  1. package/.cspell.json +104 -0
  2. package/.editorconfig +13 -0
  3. package/.eslintignore +3 -0
  4. package/.eslintrc.json +24 -0
  5. package/.github/workflows/publish-npm.yml +32 -0
  6. package/.github/workflows/release-please.yml +25 -0
  7. package/.gitkeep +0 -0
  8. package/.husky/_/post-merge +0 -0
  9. package/.prettierignore +4 -0
  10. package/.prettierrc +8 -0
  11. package/.vscode/settings.json +19 -0
  12. package/CHANGELOG.md +47 -0
  13. package/README.md +115 -0
  14. package/VSCODE_EXTENSIONS.md +11 -0
  15. package/bin/index.js +4 -0
  16. package/docs/HOOKS-SYSTEM.md +172 -0
  17. package/git-deploy.sh +74 -0
  18. package/index.php +17 -0
  19. package/lib/cli.js +15 -0
  20. package/lib/commands/init.js +132 -0
  21. package/lib/core/generator.js +261 -0
  22. package/lib/core/hook-manager.js +172 -0
  23. package/lib/core/infer-ci-capabilities.js +119 -0
  24. package/lib/prompts/index.js +105 -0
  25. package/lib/prompts/loadModulePrompts.js +27 -0
  26. package/lib/utils/generate-from-template.js +17 -0
  27. package/lib/utils/git.js +17 -0
  28. package/lib/utils/logger.js +28 -0
  29. package/modules/deploy/index.js +39 -0
  30. package/modules/deploy/prompts.js +27 -0
  31. package/modules/deploy/templates/.github/workflows/ci.yml.hbs +103 -0
  32. package/modules/deploy/templates/.gitlab/gitlab-ci.yml.hbs +154 -0
  33. package/modules/deploy/templates/bitbucket-pipelines.yml.hbs +97 -0
  34. package/modules/docs/index.js +3 -0
  35. package/modules/docs/prompts.js +8 -0
  36. package/modules/docs/templates/README.md.hbs +160 -0
  37. package/modules/docs/templates/docs/Arquitetura.md +399 -0
  38. package/modules/docs/templates/docs/Deploy-Pipeline.md +113 -0
  39. package/modules/docs/templates/docs/Desenvolvimento.md +1116 -0
  40. package/modules/docs/templates/docs/Getting-Started.md +493 -0
  41. package/modules/docs/templates/docs/Infraestrutura.md +211 -0
  42. package/modules/docs/templates/docs/Monitoramento.md +302 -0
  43. package/modules/docs/templates/docs/Sync-the-Production-DB-with-the-Staging-DB.md +8 -0
  44. package/modules/docs/templates/docs/Troubleshooting.md +3 -0
  45. package/modules/git/.commitlintrc.json +136 -0
  46. package/modules/git/.github/PULL_REQUEST_TEMPLATE.md +42 -0
  47. package/modules/git/.gitlab/merge_request_templates/default.md +42 -0
  48. package/modules/git/.gitmessage +29 -0
  49. package/modules/git/.husky/commit-msg +4 -0
  50. package/modules/git/.husky/pre-commit +27 -0
  51. package/modules/git/.lintstagedrc.json +7 -0
  52. package/modules/git/.vscode/commit-instructions.md +59 -0
  53. package/modules/git/.vscode/conventional-commits.code-snippets +62 -0
  54. package/modules/git/.vscode/copilot.json +39 -0
  55. package/modules/git/docs/CONVENTIONAL-COMMITS.md +131 -0
  56. package/modules/git/index.js +137 -0
  57. package/modules/git/prompts.js +23 -0
  58. package/modules/git/templates/.lando.yml.hbs +13 -0
  59. package/modules/git/templates/package.json.hbs +15 -0
  60. package/modules/git/templates/workspace.json.hbs +114 -0
  61. package/modules/lint/.eslintignore +36 -0
  62. package/modules/lint/.eslintrc.json +8 -0
  63. package/modules/lint/.prettierignore +36 -0
  64. package/modules/lint/.prettierrc.json +29 -0
  65. package/modules/lint/.stylelintignore +19 -0
  66. package/modules/lint/.stylelintrc.json +9 -0
  67. package/modules/lint/index.js +15 -0
  68. package/modules/lint/pint.json +26 -0
  69. package/modules/lint/prompts.js +16 -0
  70. package/modules/lint/templates/.lando.yml.hbs +10 -0
  71. package/modules/lint/templates/package.json.hbs +16 -0
  72. package/modules/lint/templates/workspace.json.hbs +56 -0
  73. package/modules/php/index.js +3 -0
  74. package/modules/php/prompts.js +8 -0
  75. package/modules/php/scripts/php-wrapper.sh +38 -0
  76. package/modules/php/scripts/pint-wrapper.sh +44 -0
  77. package/modules/php/templates/.lando.yml.hbs +11 -0
  78. package/modules/php/templates/composer.json.hbs +6 -0
  79. package/modules/php/templates/workspace.json.hbs +74 -0
  80. package/modules/redis/prompts.js +8 -0
  81. package/modules/redis/templates/.lando.yml.hbs +8 -0
  82. package/modules/sage/index.js +20 -0
  83. package/modules/sage/prompts.js +16 -0
  84. package/modules/sage/templates/.lando.yml.hbs +64 -0
  85. package/modules/sage/templates/theme/composer.json.hbs +18 -0
  86. package/modules/sage/templates/theme/package.json.hbs +11 -0
  87. package/modules/sage/templates/theme/style.css.hbs +13 -0
  88. package/modules/sage/templates/theme/vite.config.js.hbs +53 -0
  89. package/modules/sage/templates/workspace.json.hbs +67 -0
  90. package/modules/test-directory/assets/module-file.txt +1 -0
  91. package/modules/test-directory/index.js +19 -0
  92. package/modules/test-directory/prompts.js +8 -0
  93. package/modules/test-directory/test-assets/file1.txt +1 -0
  94. package/modules/test-directory/test-assets/file2.txt +1 -0
  95. package/modules/test-directory/test-assets/subfolder/config.json +4 -0
  96. package/package.json +54 -0
  97. package/release-please-config.json +17 -0
  98. package/server/php/php.ini +48 -0
  99. package/server/www/rocket.conf +283 -0
  100. package/templates/.editorconfig.hbs +39 -0
  101. package/templates/.env.hbs +48 -0
  102. package/templates/.gitignore.hbs +86 -0
  103. package/templates/.lando.yml.hbs +44 -0
  104. package/templates/README.md.hbs +12 -0
  105. package/templates/composer.json.hbs +60 -0
  106. package/templates/package.json.hbs +47 -0
  107. package/templates/server/cmd/install-wp.sh.hbs +58 -0
  108. package/templates/server/www/vhosts.conf.hbs +71 -0
  109. package/templates/workspace.json.hbs +177 -0
  110. package/test-copy-directory.js +43 -0
  111. package/test-overwrite.js +45 -0
  112. package/wp-config.php +190 -0
@@ -0,0 +1,4 @@
1
+ {
2
+ "test": true,
3
+ "message": "Arquivo de configuração em subpasta"
4
+ }
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@codigodoleo/wp-kit",
3
+ "version": "1.0.0",
4
+ "description": "Kit opinativo para padronizar projetos WordPress com CI/CD dinâmico.",
5
+ "main": "bin/index.js",
6
+ "bin": {
7
+ "leo-wp": "./bin/index.js",
8
+ "wp-kit": "./bin/index.js"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "directories": {
14
+ "lib": "lib"
15
+ },
16
+ "scripts": {
17
+ "lint": "eslint .",
18
+ "format": "prettier --write .",
19
+ "test:setup": "npm run test:clean && npm run test:scaffold",
20
+ "test:clean": "rm -rf __test-sandbox__",
21
+ "test:scaffold": "node ./bin/index.js init --output=__test-sandbox__/test-project --defaults",
22
+ "open-cursor": "cursor ./__test-sandbox__/test-project/wordpress-dev.code-workspace"
23
+ },
24
+ "keywords": [
25
+ "wordpress",
26
+ "devops",
27
+ "scaffold",
28
+ "kit",
29
+ "codigodoleo",
30
+ "leo"
31
+ ],
32
+ "author": "Leo (@codigodoleo)",
33
+ "license": "ISC",
34
+ "type": "module",
35
+ "devDependencies": {
36
+ "@cspell/dict-php": "^4.0.14",
37
+ "@cspell/dict-pt-br": "^2.4.0",
38
+ "eslint": "^9.30.1",
39
+ "eslint-config-prettier": "^10.1.5",
40
+ "eslint-plugin-import": "^2.32.0",
41
+ "prettier": "^3.6.2",
42
+ "stylelint": "^16.21.1",
43
+ "stylelint-config-standard-scss": "^15.0.1"
44
+ },
45
+ "dependencies": {
46
+ "chalk": "^5.4.1",
47
+ "commander": "^14.0.0",
48
+ "fs-extra": "^11.3.0",
49
+ "handlebars": "^4.7.8",
50
+ "inquirer": "^12.7.0",
51
+ "js-yaml": "^4.1.0",
52
+ "lodash.mergewith": "^4.6.2"
53
+ }
54
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3
+ "release-type": "node",
4
+ "packages": {
5
+ ".": {
6
+ "changelog-path": "CHANGELOG.md"
7
+ }
8
+ },
9
+ "changelog-types": [
10
+ { "type": "feat", "section": "Features", "hidden": false },
11
+ { "type": "fix", "section": "Bug Fixes", "hidden": false },
12
+ { "type": "docs", "section": "Documentation", "hidden": false },
13
+ { "type": "refactor", "section": "Refactors", "hidden": false },
14
+ { "type": "chore", "section": "Chores", "hidden": false }
15
+ ]
16
+ }
17
+
@@ -0,0 +1,48 @@
1
+ [PHP]
2
+
3
+ ;;;;;;;;;;;;;;;
4
+ ; PHP Globals ;
5
+ ;;;;;;;;;;;;;;;
6
+
7
+ short_open_tag = Off
8
+ output_buffering = 4096
9
+ allow_call_time_pass_reference = Off
10
+ request_order = "GP"
11
+ register_long_arrays = Off
12
+ register_argc_argv = Off
13
+ magic_quotes_gpc = Off
14
+ enable_dl = Off
15
+ allow_url_fopen = On
16
+ realpath_cache_size = "800K"
17
+ realpath_cache_ttl = "86400"
18
+ disable_functions =
19
+ sendmail_path=/bin/true
20
+
21
+ [Date]
22
+ date.timezone = "UTC"
23
+
24
+ ;;;;;;;;;;;;;;;;;;;;;;
25
+ ;; PACKAGE SETTINGS ;;
26
+ ;;;;;;;;;;;;;;;;;;;;;;
27
+
28
+ [xdebug]
29
+ xdebug.mode=debug
30
+ xdebug.start_with_request=yes
31
+ xdebug.client_host=host.docker.internal
32
+ xdebug.client_port=9003
33
+ xdebug.log_level=0
34
+ xdebug.idekey=VSCODE
35
+
36
+ ; Globals
37
+ expose_php = on
38
+ max_execution_time = 90
39
+ max_input_time = 900
40
+ max_input_vars = 10000
41
+ memory_limit = 512M
42
+ upload_max_filesize = 100M
43
+ post_max_size = 100M
44
+ error_reporting = E_ALL & ~E_DEPRECATED
45
+ ignore_repeated_errors = on
46
+ html_errors = off
47
+ display_errors = on
48
+ log_errors = on
@@ -0,0 +1,283 @@
1
+ ###################################################################################################
2
+ # Rocket-Nginx
3
+ #
4
+ # Rocket-Nginx is a NGINX configuration to speedup your WordPress
5
+ # website with the cache plugin WP-Rocket (http://wp-rocket.me)
6
+ #
7
+ # Author: Maxime Jobin
8
+ # Maintainer: SatelliteWP.com
9
+ # URL: https://github.com/satellitewp/rocket-nginx
10
+ #
11
+ # Tested with WP-Rocket version: 3.16.2.1
12
+ # Tested with NGINX: 1.26.1 (mainline)
13
+ #
14
+ # Version 3.1.0
15
+ #
16
+ ###################################################################################################
17
+
18
+ # Add debug information into header
19
+ set $rocket_debug 1;
20
+
21
+
22
+ ###################################################################################################
23
+ # Do not alter theses values
24
+ #
25
+ set $rocket_bypass 1; # Should NGINX bypass WordPress and call cache file directly ?
26
+ set $rocket_encryption ""; # Is GZIP accepted by client ?
27
+ set $rocket_file ""; # Filename to look for
28
+ set $rocket_is_bypassed "MISS"; # Header text added to check if the bypass worked or not. Header: X-Rocket-Nginx-Serving-Static
29
+ set $rocket_reason ""; # Reason why cache file was not used. If cache file is used, what file was used
30
+ set $rocket_https_prefix ""; # HTTPS prefix to use when cached files are using HTTPS
31
+ set $rocket_mobile_prefix ""; # Mobile prefix to use when mobile device is detected and mobile cache is activated
32
+ set $rocket_is_https 0; # Checks if the request is HTTPS
33
+ set $rocket_dynamic ""; # Dynamic value to add to cached filename
34
+ set $rocket_device "desktop"; # Device type (desktop or mobile)
35
+
36
+ ###################################################################################################
37
+ # PAGE CACHE
38
+ #
39
+
40
+ # Define Rocket-Nginx $is_args
41
+ set $rocket_is_args $is_args;
42
+
43
+ # Get query string without the parameters (before the '?')
44
+ set $rocket_uri_path $request_uri;
45
+ if ($request_uri ~* "^([^?]*)(\?.+)$") {
46
+ set $rocket_uri_path $1;
47
+ }
48
+
49
+ # Is GZIP accepted by client ?
50
+ if ($http_accept_encoding ~ gzip) {
51
+ set $rocket_encryption "_gzip";
52
+ }
53
+
54
+ # Is Brotli accepted by client ?
55
+ if ($http_accept_encoding ~ br) {
56
+ set $rocket_encryption "";
57
+ }
58
+
59
+ # Is HTTPS request ?
60
+ if ($https = "on") { set $rocket_is_https 1; }
61
+ if ($http_x_forwarded_proto = "https") { set $rocket_is_https 1; }
62
+ if ($http_front_end_https = "on") { set $rocket_is_https 1; }
63
+ if ($http_x_forwarded_protocol = "https") { set $rocket_is_https 1; }
64
+ if ($http_x_forwarded_ssl = "on") { set $rocket_is_https 1; }
65
+ if ($http_x_url_scheme = "https") { set $rocket_is_https 1; }
66
+ if ($http_forwarded ~ /proto=https/) { set $rocket_is_https 1; }
67
+
68
+ if ($rocket_is_https = "1") {
69
+ set $rocket_https_prefix "-https";
70
+ }
71
+
72
+ # Set mobile detection file path
73
+ # This variable contains a file to look for. If it exists, WP Rocket is set to
74
+ # generate both Desktop and Mobile cache.
75
+ set $rocket_mobile_detection "$document_root/wp-content/cache/wp-rocket/$http_host/$request_uri/.mobile-active";
76
+
77
+ # Query strings to ignore
78
+ set $rocket_args $args;
79
+ if ($rocket_args ~ (.*)(?:&|^)utm_source=[^&]*(.*)) { set $rocket_args $1$2; }
80
+ if ($rocket_args ~ (.*)(?:&|^)utm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
81
+ if ($rocket_args ~ (.*)(?:&|^)utm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
82
+ if ($rocket_args ~ (.*)(?:&|^)utm_expid=[^&]*(.*)) { set $rocket_args $1$2; }
83
+ if ($rocket_args ~ (.*)(?:&|^)utm_term=[^&]*(.*)) { set $rocket_args $1$2; }
84
+ if ($rocket_args ~ (.*)(?:&|^)utm_content=[^&]*(.*)) { set $rocket_args $1$2; }
85
+ if ($rocket_args ~ (.*)(?:&|^)utm_id=[^&]*(.*)) { set $rocket_args $1$2; }
86
+ if ($rocket_args ~ (.*)(?:&|^)utm_source_platform=[^&]*(.*)) { set $rocket_args $1$2; }
87
+ if ($rocket_args ~ (.*)(?:&|^)utm_creative_format=[^&]*(.*)) { set $rocket_args $1$2; }
88
+ if ($rocket_args ~ (.*)(?:&|^)utm_marketing_tactic=[^&]*(.*)) { set $rocket_args $1$2; }
89
+ if ($rocket_args ~ (.*)(?:&|^)_ga=[^&]*(.*)) { set $rocket_args $1$2; }
90
+ if ($rocket_args ~ (.*)(?:&|^)gclid=[^&]*(.*)) { set $rocket_args $1$2; }
91
+ if ($rocket_args ~ (.*)(?:&|^)campaignid=[^&]*(.*)) { set $rocket_args $1$2; }
92
+ if ($rocket_args ~ (.*)(?:&|^)adgroupid=[^&]*(.*)) { set $rocket_args $1$2; }
93
+ if ($rocket_args ~ (.*)(?:&|^)adid=[^&]*(.*)) { set $rocket_args $1$2; }
94
+ if ($rocket_args ~ (.*)(?:&|^)gbraid=[^&]*(.*)) { set $rocket_args $1$2; }
95
+ if ($rocket_args ~ (.*)(?:&|^)wbraid=[^&]*(.*)) { set $rocket_args $1$2; }
96
+ if ($rocket_args ~ (.*)(?:&|^)gclsrc=[^&]*(.*)) { set $rocket_args $1$2; }
97
+ if ($rocket_args ~ (.*)(?:&|^)ef_id=[^&]*(.*)) { set $rocket_args $1$2; }
98
+ if ($rocket_args ~ (.*)(?:&|^)fb_action_ids=[^&]*(.*)) { set $rocket_args $1$2; }
99
+ if ($rocket_args ~ (.*)(?:&|^)fb_action_types=[^&]*(.*)) { set $rocket_args $1$2; }
100
+ if ($rocket_args ~ (.*)(?:&|^)fb_source=[^&]*(.*)) { set $rocket_args $1$2; }
101
+ if ($rocket_args ~ (.*)(?:&|^)fbclid=[^&]*(.*)) { set $rocket_args $1$2; }
102
+ if ($rocket_args ~ (.*)(?:&|^)mc_cid=[^&]*(.*)) { set $rocket_args $1$2; }
103
+ if ($rocket_args ~ (.*)(?:&|^)mc_eid=[^&]*(.*)) { set $rocket_args $1$2; }
104
+ if ($rocket_args ~ (.*)(?:&|^)mtm_source=[^&]*(.*)) { set $rocket_args $1$2; }
105
+ if ($rocket_args ~ (.*)(?:&|^)mtm_medium=[^&]*(.*)) { set $rocket_args $1$2; }
106
+ if ($rocket_args ~ (.*)(?:&|^)mtm_campaign=[^&]*(.*)) { set $rocket_args $1$2; }
107
+ if ($rocket_args ~ (.*)(?:&|^)mtm_keyword=[^&]*(.*)) { set $rocket_args $1$2; }
108
+ if ($rocket_args ~ (.*)(?:&|^)mtm_cid=[^&]*(.*)) { set $rocket_args $1$2; }
109
+ if ($rocket_args ~ (.*)(?:&|^)mtm_content=[^&]*(.*)) { set $rocket_args $1$2; }
110
+ if ($rocket_args ~ (.*)(?:&|^)_ke=[^&]*(.*)) { set $rocket_args $1$2; }
111
+ if ($rocket_args ~ (.*)(?:&|^)age-verified=[^&]*(.*)) { set $rocket_args $1$2; }
112
+ if ($rocket_args ~ (.*)(?:&|^)ao_noptimize=[^&]*(.*)) { set $rocket_args $1$2; }
113
+ if ($rocket_args ~ (.*)(?:&|^)usqp=[^&]*(.*)) { set $rocket_args $1$2; }
114
+ if ($rocket_args ~ (.*)(?:&|^)cn-reloaded=[^&]*(.*)) { set $rocket_args $1$2; }
115
+ if ($rocket_args ~ (.*)(?:&|^)sscid=[^&]*(.*)) { set $rocket_args $1$2; }
116
+ if ($rocket_args ~ (.*)(?:&|^)msclkid=[^&]*(.*)) { set $rocket_args $1$2; }
117
+
118
+ # Remove & at the beginning (if needed)
119
+ if ($rocket_args ~ ^&(.*)) { set $rocket_args $1; }
120
+
121
+ # Do not count arguments if part of caching arguments
122
+ if ($rocket_args ~ ^\?$) {
123
+ set $rocket_is_args "";
124
+ }
125
+
126
+ # Adjust $rocket_is_args after processing query strings to ignore
127
+ if ($rocket_args = "") {
128
+ set $rocket_is_args "";
129
+ }
130
+
131
+ # Query string to cache
132
+ # None
133
+
134
+ # Check if device is Mobile
135
+ if ($http_user_agent ~* "(?:phone|windows\s+phone|ipod|blackberry|(?:android|bb\d+|meego|silk|googlebot) .+? mobile|palm|windows\s+ce|opera mini|avantgo|mobilesafari|docomo|kaios)") {
136
+ set $rocket_device "mobile";
137
+ }
138
+
139
+ # Set mobile prefix if mobile mode is activated
140
+ if (-f "$rocket_mobile_detection") {
141
+ set $rocket_mobile_prefix "-mobile";
142
+ }
143
+
144
+ if ($rocket_device != "mobile") {
145
+ set $rocket_mobile_prefix "";
146
+ }
147
+
148
+ # File/URL to return IF we must bypass WordPress
149
+ # Desktop: index.html
150
+ # Gzip: index.html_gzip
151
+ # HTTPS: index-https.html
152
+ # Mobile: index-mobile-https.html
153
+ set $rocket_file_start "index$rocket_mobile_prefix$rocket_https_prefix";
154
+
155
+
156
+ set $rocket_pre_url "/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
157
+ set $rocket_pre_file "$document_root/wp-content/cache/wp-rocket/$http_host/$rocket_uri_path/$rocket_args/";
158
+
159
+ # Standard cache file format
160
+ set $rocket_url "$rocket_pre_url$rocket_file_start$rocket_dynamic.html";
161
+ set $rocket_file "$rocket_pre_file$rocket_file_start$rocket_dynamic.html";
162
+
163
+ # Check if gzip version cached file is available
164
+ if (-f "$rocket_file$rocket_encryption") {
165
+ set $rocket_file "$rocket_file$rocket_encryption";
166
+ set $rocket_url "$rocket_url$rocket_encryption";
167
+ }
168
+
169
+ # Do not bypass if the cached file does not exist
170
+ if (!-f "$rocket_file") {
171
+ set $rocket_bypass 0;
172
+ set $rocket_is_bypassed "MISS";
173
+ set $rocket_reason "File not cached";
174
+ }
175
+
176
+ # Do not bypass if it's a POST request
177
+ if ($request_method = POST) {
178
+ set $rocket_bypass 0;
179
+ set $rocket_is_bypassed "BYPASS";
180
+ set $rocket_reason "POST request";
181
+ }
182
+
183
+ # Do not bypass if arguments are found (e.g. ?page=2)
184
+ if ($rocket_is_args) {
185
+ set $rocket_bypass 0;
186
+ set $rocket_is_bypassed "BYPASS";
187
+ set $rocket_reason "Arguments found";
188
+ }
189
+
190
+ # Do not bypass if the site is in maintenance mode
191
+ if (-f "$document_root/.maintenance") {
192
+ set $rocket_bypass 0;
193
+ set $rocket_is_bypassed "BYPASS";
194
+ set $rocket_reason "Maintenance mode";
195
+ }
196
+
197
+ # Do not bypass if one of those cookie if found
198
+ # wordpress_logged_in_[hash] : When a user is logged in, this cookie is created (we'd rather let WP-Rocket handle that)
199
+ # wp-postpass_[hash] : When a protected post requires a password, this cookie is created.
200
+ if ($http_cookie ~* "(wordpress_logged_in_|wp\-postpass_|woocommerce_items_in_cart|woocommerce_cart_hash|wptouch_switch_toogle|comment_author_|comment_author_email_)") {
201
+ set $rocket_bypass 0;
202
+ set $rocket_is_bypassed "BYPASS";
203
+ set $rocket_reason "Cookie";
204
+ }
205
+
206
+ # If the bypass token is still on, let's bypass WordPress with the cached URL
207
+ if ($rocket_bypass = 1) {
208
+ set $rocket_is_bypassed "HIT";
209
+ set $rocket_reason "$rocket_url";
210
+ }
211
+
212
+ # Clear variables if debug is not needed
213
+ if ($rocket_debug = 0) {
214
+ set $rocket_reason "";
215
+ set $rocket_file "";
216
+ set $rocket_device "";
217
+ }
218
+
219
+ # If the bypass token is still on, rewrite according to the file linked to the request
220
+ if ($rocket_bypass = 1) {
221
+ rewrite .* "$rocket_url" last;
222
+ }
223
+
224
+ # Add header to HTML cached files
225
+ location ~ /wp-content/cache/wp-rocket/.*html$ {
226
+ etag on;
227
+ add_header Vary "Accept-Encoding, Cookie";
228
+ add_header Cache-Control "no-cache, no-store, must-revalidate";
229
+ add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
230
+ add_header X-Rocket-Nginx-Reason $rocket_reason;
231
+ add_header X-Rocket-Nginx-File $rocket_file;
232
+ add_header X-Rocket-Nginx-Device $rocket_device;
233
+ }
234
+
235
+ # Do not gzip cached files that are already gzipped
236
+ location ~ /wp-content/cache/wp-rocket/.*_gzip$ {
237
+ etag on;
238
+ gzip off;
239
+ types {}
240
+ default_type text/html;
241
+ add_header Content-Encoding gzip;
242
+ add_header Vary "Accept-Encoding, Cookie";
243
+ add_header Cache-Control "no-cache, no-store, must-revalidate";
244
+ add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
245
+ add_header X-Rocket-Nginx-Reason $rocket_reason;
246
+ add_header X-Rocket-Nginx-File $rocket_file;
247
+ add_header X-Rocket-Nginx-Device $rocket_device;
248
+ }
249
+
250
+ # Debug header (when file is not cached)
251
+ add_header X-Rocket-Nginx-Serving-Static $rocket_is_bypassed;
252
+ add_header X-Rocket-Nginx-Reason $rocket_reason;
253
+ add_header X-Rocket-Nginx-File $rocket_file;
254
+ add_header X-Rocket-Nginx-Device $rocket_device;
255
+
256
+
257
+ ###################################################################################################
258
+ # BROWSER CSS CACHE
259
+ #
260
+ location ~* \.css$ {
261
+ etag on;
262
+ gzip_vary on;
263
+ expires 30d;
264
+ }
265
+
266
+
267
+ ###################################################################################################
268
+ # BROWSER JS CACHE
269
+ #
270
+ location ~* \.js$ {
271
+ etag on;
272
+ gzip_vary on;
273
+ expires 30d;
274
+ }
275
+
276
+
277
+ ###################################################################################################
278
+ # BROWSER MEDIA CACHE
279
+ #
280
+ location ~* \.(ico|gif|jpe?g|png|svg|eot|otf|woff|woff2|ttf|ogg|webp)$ {
281
+ etag on;
282
+ expires 30d;
283
+ }
@@ -0,0 +1,39 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.php]
12
+ indent_size = 4
13
+ max_line_length = 120
14
+
15
+ [*.blade.php]
16
+ indent_size = 4
17
+ insert_final_newline = true
18
+ trim_trailing_whitespace = true
19
+
20
+ [*.js]
21
+ indent_size = 2
22
+
23
+ [*.json]
24
+ indent_size = 2
25
+
26
+ [*.css]
27
+ indent_size = 2
28
+
29
+ [*.scss]
30
+ indent_size = 2
31
+
32
+ [*.md]
33
+ trim_trailing_whitespace = false
34
+
35
+ [*.yml]
36
+ indent_size = 2
37
+
38
+ [*.yaml]
39
+ indent_size = 2
@@ -0,0 +1,48 @@
1
+ PROJECT_NAME="{{projectName}}"
2
+ PROJECT_VERSION="{{projectVersion}}"
3
+ PROJECT_DOMAIN="{{projectDomain}}"
4
+ APP_URL="https://{{projectDomain}}"
5
+ AUTHOR="{{author}}"
6
+ PHP_VERSION="{{phpVersion}}"
7
+ NODE_VERSION="{{nodeVersion}}"
8
+ WP_CORE_VERSION="{{wpCoreVersion}}"{{#if enable_sage}}
9
+ SAGE_VERSION="{{sageVersion}}"{{/if}}
10
+ GIT_REPOSITORY="{{gitRepository}}"
11
+
12
+ WORDPRESS_SITE_URL="https://{{projectDomain}}"
13
+ WORDPRESS_DB_NAME="wordpress"
14
+ WORDPRESS_DB_USER="wordpress"
15
+ WORDPRESS_DB_PASSWORD="wordpress"
16
+ WORDPRESS_DB_HOST="database"
17
+ WORDPRESS_DB_CHARSET="utf8"
18
+ WORDPRESS_DB_COLLATE=""
19
+ WORDPRESS_TABLE_PREFIX="wp_"
20
+ WORDPRESS_DEBUG={{enableDebug}}
21
+ WORDPRESS_DEBUG_DISPLAY={{enableDebug}}
22
+ WORDPRESS_DEBUG_LOG={{enableDebug}}
23
+ WORDPRESS_SCRIPT_DEBUG={{enableDebug}}
24
+ WORDPRESS_DISABLE_UPDATE=true
25
+ WORDPRESS_DISABLE_CRON=true
26
+ WORDPRESS_AUTOSAVE_INTERVAL="600"
27
+ WORDPRESS_POST_REVISIONS="2"
28
+ WORDPRESS_WP_ENVIRONMENT_TYPE="local"
29
+ WORDPRESS_DISALLOW_FILE_MODS=true
30
+ WORDPRESS_FORCE_SSL_ADMIN=true
31
+ WORDPRESS_AUTOMATIC_UPDATER_DISABLED=true
32
+ WORDPRESS_WP_AUTO_UPDATE_CORE=false
33
+
34
+ ### Redis ###
35
+ {{#if enable_redis}}
36
+ WORDPRESS_REDIS_HOST=redis
37
+ WORDPRESS_REDIS_PORT=6379
38
+ {{/if}}
39
+
40
+ ### WordPress salts ###
41
+ WORDPRESS_AUTH_KEY={{{salts.AUTH_KEY}}}
42
+ WORDPRESS_SECURE_AUTH_KEY={{{salts.SECURE_AUTH_KEY}}}
43
+ WORDPRESS_LOGGED_IN_KEY={{{salts.LOGGED_IN_KEY}}}
44
+ WORDPRESS_NONCE_KEY={{{salts.NONCE_KEY}}}
45
+ WORDPRESS_AUTH_SALT={{{salts.AUTH_SALT}}}
46
+ WORDPRESS_SECURE_AUTH_SALT={{{salts.SECURE_AUTH_SALT}}}
47
+ WORDPRESS_LOGGED_IN_SALT={{{salts.LOGGED_IN_SALT}}}
48
+ WORDPRESS_NONCE_SALT={{{salts.NONCE_SALT}}}
@@ -0,0 +1,86 @@
1
+ # WordPress
2
+ wp/
3
+ content/uploads/*
4
+ !content/uploads/.gitkeep
5
+ content/upgrade/*
6
+ content/backup-db/*
7
+ content/backups/*
8
+ content/blogs.dir/*
9
+ content/cache/*
10
+ content/advanced-cache.php
11
+ content/wp-cache-config.php
12
+ content/plugins/*
13
+ !content/plugins/.gitkeep
14
+ content/themes/*
15
+ content/languages/*
16
+ !content/languages/.gitkeep
17
+ content/mu-plugins/*
18
+ !content/mu-plugins/.gitkeep
19
+
20
+ # Theme{{#if enable_sage}}
21
+ !content/themes/{{projectName}}{{/if}}
22
+
23
+
24
+ # Composer
25
+ vendor/
26
+ composer.phar
27
+ composer.lock
28
+ wp-translation-downloader.lock
29
+
30
+ # Node.js
31
+ node_modules/
32
+ npm-debug.log*
33
+ yarn-debug.log*
34
+ yarn-error.log*
35
+ .npm
36
+ .yarn-integrity
37
+
38
+
39
+ # IDE/Editor
40
+ *.swp
41
+ *.swo
42
+ *~
43
+
44
+ # OS
45
+ .DS_Store
46
+ .DS_Store?
47
+ ._*
48
+ .Spotlight-V100
49
+ .Trashes
50
+ ehthumbs.db
51
+ Thumbs.db
52
+
53
+ # Logs
54
+ *.log
55
+ logs/
56
+
57
+ # Temporary files
58
+ *.tmp
59
+ *.temp
60
+ .cache/
61
+
62
+ # Build artifacts
63
+ dist/
64
+ build/
65
+ public/build/
66
+
67
+ # Database
68
+ *.sql
69
+ *.sqlite
70
+
71
+ # Backup files
72
+ *.bak
73
+ *.backup
74
+ *.old
75
+
76
+ # Lando
77
+ .lando.local.yml
78
+
79
+ # PHP
80
+ *.php~
81
+ *.php.bak
82
+ php_errors.log
83
+
84
+ # Testing
85
+ coverage/
86
+ .phpunit.result.cache
@@ -0,0 +1,44 @@
1
+ name: {{projectName}}
2
+ recipe: wordpress
3
+ config:
4
+ webroot: ./
5
+ via: nginx
6
+ php: "{{phpVersion}}"
7
+ xdebug: true
8
+ extra_php_extensions:
9
+ - bcmath
10
+ - exif
11
+ - gd
12
+ - mysqli
13
+ - zip
14
+ - imagick
15
+ - redis
16
+ config:
17
+ php: ./server/php/php.ini
18
+ vhosts: ./server/www/vhosts.conf
19
+ env_file:
20
+ - .env
21
+ services:
22
+ appserver:
23
+ build_as_root:
24
+ - apt-get update
25
+ - apt-get install -y curl gnupg
26
+ - curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
27
+ - apt-get install -y nodejs
28
+ - npm install -g npm@latest
29
+ - npm install -g yarn@1.22
30
+ build:
31
+ - composer install --no-interaction --no-progress --optimize-autoloader
32
+ run:
33
+ - ./server/cmd/install-wp.sh
34
+ tooling:
35
+ yarn:
36
+ service: appserver
37
+ yarn-upgrade:
38
+ service: appserver
39
+ cmd: yarn upgrade --latest
40
+ yarn-clean-install:
41
+ service: appserver
42
+ cmd:
43
+ - rm -rf node_modules
44
+ - yarn install
@@ -0,0 +1,12 @@
1
+ # {{projectName}}
2
+
3
+ Scaffolded by wp-devops.
4
+
5
+ ## 🧱 Stack
6
+
7
+ - PHP {{phpVersion}}
8
+ - Node.js {{nodeVersion}}
9
+
10
+ ## 👤 Author
11
+
12
+ {{author}}