@fishawack/lab-env 5.9.0 → 5.10.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 (47) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/_Test/config-drupal.js +197 -0
  3. package/_Test/config-laravel.js +239 -0
  4. package/_Test/config-wordpress.js +200 -0
  5. package/_Test/force-managed-updates.js +1 -0
  6. package/bitbucket-pipelines.yml +2 -0
  7. package/commands/create/libs/runtime-versions.js +34 -0
  8. package/commands/create/services/aws/elasticbeanstalk.js +3 -2
  9. package/craftcms/3/docker-compose.yml +7 -5
  10. package/craftcms/3/php/Dockerfile +2 -1
  11. package/drupal/10/docker-compose.yml +71 -0
  12. package/drupal/10/php/CHANGELOG.md +4 -0
  13. package/drupal/10/php/Dockerfile +44 -0
  14. package/drupal/10/php/custom.ini +5 -0
  15. package/drupal/10/php/entrypoint.sh +27 -0
  16. package/drupal/10/php/package.json +11 -0
  17. package/drupal/10/php/policy.xml +99 -0
  18. package/drupal/9/docker-compose.yml +7 -5
  19. package/drupal/9/php/Dockerfile +2 -1
  20. package/globals.js +283 -209
  21. package/laravel/10/docker-compose.yml +3 -1
  22. package/laravel/10/php/CHANGELOG.md +3 -0
  23. package/laravel/10/php/Dockerfile +3 -2
  24. package/laravel/10/php/package.json +1 -1
  25. package/laravel/11/docker-compose.yml +92 -0
  26. package/laravel/11/php/CHANGELOG.md +4 -0
  27. package/laravel/11/php/Dockerfile +48 -0
  28. package/laravel/11/php/custom.ini +5 -0
  29. package/laravel/11/php/entrypoint.sh +27 -0
  30. package/laravel/11/php/package.json +11 -0
  31. package/laravel/11/php/policy.xml +99 -0
  32. package/laravel/8/docker-compose.yml +3 -1
  33. package/laravel/8/php/Dockerfile +2 -1
  34. package/laravel/9/docker-compose.yml +3 -1
  35. package/laravel/9/php/Dockerfile +2 -1
  36. package/package.json +1 -1
  37. package/php/8.2/Dockerfile +1 -1
  38. package/wordpress/1/docker-compose.yml +7 -5
  39. package/wordpress/1/php/Dockerfile +2 -1
  40. package/wordpress/2/docker-compose.yml +63 -0
  41. package/wordpress/2/php/CHANGELOG.md +4 -0
  42. package/wordpress/2/php/Dockerfile +44 -0
  43. package/wordpress/2/php/custom.ini +5 -0
  44. package/wordpress/2/php/entrypoint.sh +27 -0
  45. package/wordpress/2/php/package.json +11 -0
  46. package/wordpress/2/php/policy.xml +99 -0
  47. /package/_Ai/{laravel-12.md → laravel-@.md} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  ## Changelog
2
2
 
3
+ ### 5.10.0 (2026-11-11)
4
+
5
+ #### Features
6
+
7
+ * added new branch support for laravel 13 which uses php 8.5 ([73acd66](https://bitbucket.org/fishawackdigital/lab-env/commits/73acd66ed003e3b46b84fd280ab315e67362d7d2))
8
+ * cut a new version of drupal for 11 and below that maps to php 8.4 ([4fe3661](https://bitbucket.org/fishawackdigital/lab-env/commits/4fe36611789a939d056733a42b286d5856e4bbfc))
9
+ * single source of truth for PHP/MySQL runtime versions per framework ([f1770db](https://bitbucket.org/fishawackdigital/lab-env/commits/f1770db7debb59e0a9db808c083efae084b39feb))
10
+ * support wordpress 7 with php 8.4 ([13c88f6](https://bitbucket.org/fishawackdigital/lab-env/commits/13c88f63d3b0f3c88781a76df48cde84f43f20ef))
11
+ * warn when override maps to older laravel version ([4395db0](https://bitbucket.org/fishawackdigital/lab-env/commits/4395db0b7505b24ef3e84755b32b44d5ba3c8d8e))
12
+
13
+ #### Bug Fixes
14
+
15
+ * copy laravel instructions regardless of laravel version until we have more specific steps ([3a8f941](https://bitbucket.org/fishawackdigital/lab-env/commits/3a8f941e4242f1f2a4e1d34ca69ff4e7298afb65))
16
+ * force now respects the known version instead of defaulting to the latest ([ab6d3f8](https://bitbucket.org/fishawackdigital/lab-env/commits/ab6d3f858248bf70b8cd6198bb16c2f4dcc824a5))
17
+ * laravel 11 and 12 now use php 8.4 ([0055f95](https://bitbucket.org/fishawackdigital/lab-env/commits/0055f95434df595db75c6df15241c16f2c7e6d77))
18
+ * link npm so the globally installed invoked via tests resolves to our latest instance ([1458f24](https://bitbucket.org/fishawackdigital/lab-env/commits/1458f24cd2147a5194ba480249e7186e59c31d64))
19
+ * missing managed action helper ([d65de71](https://bitbucket.org/fishawackdigital/lab-env/commits/d65de7157abe6e1b6e5728c1614f5a57cee5c8ec))
20
+ * run npm link as root ([66e282a](https://bitbucket.org/fishawackdigital/lab-env/commits/66e282a954dc229dda24621f43ca0464b4d2daf2))
21
+ * share drupal config for apache ([4afdaf9](https://bitbucket.org/fishawackdigital/lab-env/commits/4afdaf9e1c3fb0370e81b39abfe6463042bc81cc))
22
+ * two small prod image issues ([7779366](https://bitbucket.org/fishawackdigital/lab-env/commits/777936663ffa49616bf3f217facb9427ca0c7b3e))
23
+
24
+ #### Build Updates
25
+
26
+ * bumped fishawack/lab-env-wordpress-2-php to 1.0.0 ([27c0816](https://bitbucket.org/fishawackdigital/lab-env/commits/27c0816e51019ff49fbb2391fdb65221724a9d0b))
27
+
28
+ ### 5.10.0-beta.1 (2026-11-11)
29
+
30
+ #### Features
31
+
32
+ * added new branch support for laravel 13 which uses php 8.5 ([73acd66](https://bitbucket.org/fishawackdigital/lab-env/commits/73acd66ed003e3b46b84fd280ab315e67362d7d2))
33
+ * cut a new version of drupal for 11 and below that maps to php 8.4 ([4fe3661](https://bitbucket.org/fishawackdigital/lab-env/commits/4fe36611789a939d056733a42b286d5856e4bbfc))
34
+ * single source of truth for PHP/MySQL runtime versions per framework ([f1770db](https://bitbucket.org/fishawackdigital/lab-env/commits/f1770db7debb59e0a9db808c083efae084b39feb))
35
+ * support wordpress 7 with php 8.4 ([13c88f6](https://bitbucket.org/fishawackdigital/lab-env/commits/13c88f63d3b0f3c88781a76df48cde84f43f20ef))
36
+ * warn when override maps to older laravel version ([4395db0](https://bitbucket.org/fishawackdigital/lab-env/commits/4395db0b7505b24ef3e84755b32b44d5ba3c8d8e))
37
+
38
+ #### Bug Fixes
39
+
40
+ * copy laravel instructions regardless of laravel version until we have more specific steps ([3a8f941](https://bitbucket.org/fishawackdigital/lab-env/commits/3a8f941e4242f1f2a4e1d34ca69ff4e7298afb65))
41
+ * force now respects the known version instead of defaulting to the latest ([ab6d3f8](https://bitbucket.org/fishawackdigital/lab-env/commits/ab6d3f858248bf70b8cd6198bb16c2f4dcc824a5))
42
+ * laravel 11 and 12 now use php 8.4 ([0055f95](https://bitbucket.org/fishawackdigital/lab-env/commits/0055f95434df595db75c6df15241c16f2c7e6d77))
43
+ * link npm so the globally installed invoked via tests resolves to our latest instance ([1458f24](https://bitbucket.org/fishawackdigital/lab-env/commits/1458f24cd2147a5194ba480249e7186e59c31d64))
44
+ * missing managed action helper ([d65de71](https://bitbucket.org/fishawackdigital/lab-env/commits/d65de7157abe6e1b6e5728c1614f5a57cee5c8ec))
45
+ * run npm link as root ([66e282a](https://bitbucket.org/fishawackdigital/lab-env/commits/66e282a954dc229dda24621f43ca0464b4d2daf2))
46
+ * share drupal config for apache ([4afdaf9](https://bitbucket.org/fishawackdigital/lab-env/commits/4afdaf9e1c3fb0370e81b39abfe6463042bc81cc))
47
+ * two small prod image issues ([7779366](https://bitbucket.org/fishawackdigital/lab-env/commits/777936663ffa49616bf3f217facb9427ca0c7b3e))
48
+
49
+ #### Build Updates
50
+
51
+ * bumped fishawack/lab-env-wordpress-2-php to 1.0.0 ([27c0816](https://bitbucket.org/fishawackdigital/lab-env/commits/27c0816e51019ff49fbb2391fdb65221724a9d0b))
52
+
3
53
  ### 5.9.0 (2026-10-23)
4
54
 
5
55
  #### Features
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ const repo = `boilerplate-drupal`;
4
+ const opts = {
5
+ encoding: "utf8",
6
+ stdio: "inherit",
7
+ cwd: `_Test/_fixtures/${repo}`,
8
+ };
9
+
10
+ const expect = require("chai").expect;
11
+ const execSync = require("child_process").execSync;
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const { runtimeVersions } = require("../commands/create/libs/runtime-versions");
15
+
16
+ // Each branch is a real, maintained major-version cut of the boilerplate - maps to the lab-env dir we expect `fw config` to resolve
17
+ const branches = [
18
+ { branch: "9.x", version: "9" },
19
+ { branch: "10.x", version: "10" },
20
+ { branch: "11.x", version: "10" },
21
+ ];
22
+
23
+ describe("config: drupal", () => {
24
+ before(function () {
25
+ this.timeout(60000 * 2);
26
+
27
+ execSync(
28
+ `git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
29
+ { encoding: "utf8", stdio: "inherit" },
30
+ );
31
+ });
32
+
33
+ branches.forEach(({ branch, version }) => {
34
+ const image = `fishawack/lab-env-drupal-${version}-php`;
35
+ const { php, mysql } = runtimeVersions.drupal[version];
36
+
37
+ describe(branch, () => {
38
+ let output;
39
+
40
+ before(() => {
41
+ execSync(`git checkout -f ${branch}`, opts);
42
+
43
+ output = execSync("node ../../../cli.js config", {
44
+ encoding: "utf8",
45
+ cwd: `_Test/_fixtures/${repo}`,
46
+ });
47
+ });
48
+
49
+ it(`Should resolve to ${image}`, () => {
50
+ expect(output).to.contain(image);
51
+ });
52
+
53
+ it(`Should keep the shared apache pinned to fishawack/lab-env-drupal-9-apache`, () => {
54
+ expect(output).to.contain("fishawack/lab-env-drupal-9-apache");
55
+ });
56
+
57
+ it(`Should build php from PHP ${php} per the shared runtime-versions table`, () => {
58
+ expect(output).to.contain(`PHP_VERSION: "${php}"`);
59
+ });
60
+
61
+ it(`Should run mysql ${mysql} per the shared runtime-versions table`, () => {
62
+ expect(output).to.contain(`image: mysql:${mysql}`);
63
+ });
64
+ });
65
+ });
66
+
67
+ describe("unsupported version", () => {
68
+ before(() => {
69
+ execSync(`git checkout -f 11.x`, opts);
70
+
71
+ const composerPath = path.join(
72
+ `_Test/_fixtures/${repo}`,
73
+ "composer.json",
74
+ );
75
+ const composer = JSON.parse(fs.readFileSync(composerPath, "utf8"));
76
+
77
+ composer.require["drupal/core-recommended"] = "^999";
78
+
79
+ fs.writeFileSync(composerPath, JSON.stringify(composer, null, 4));
80
+ });
81
+
82
+ it(`Should warn and exit non-zero instead of silently picking a config`, () => {
83
+ let error;
84
+
85
+ try {
86
+ execSync("node ../../../cli.js config", {
87
+ encoding: "utf8",
88
+ cwd: `_Test/_fixtures/${repo}`,
89
+ });
90
+ } catch (e) {
91
+ error = e;
92
+ }
93
+
94
+ expect(error).to.not.be.undefined;
95
+ expect(error.status).to.equal(1);
96
+ expect(error.stdout).to.contain("doesn't recognize");
97
+ });
98
+
99
+ it(`Should let exempt commands (e.g. --version) through without warning`, () => {
100
+ const output = execSync("node ../../../cli.js --version", {
101
+ encoding: "utf8",
102
+ cwd: `_Test/_fixtures/${repo}`,
103
+ });
104
+
105
+ expect(output).to.not.contain("doesn't recognize");
106
+ });
107
+ });
108
+
109
+ // These two are expected to FAIL until _Docker override support is generalized to drupal (currently laravel-only) - see the globals.js refactor plan
110
+ describe("_Docker override", () => {
111
+ // 11.x resolves to drupal/10 - override that exact dir so it's the active version
112
+ const overrideDir = path.join(
113
+ `_Test/_fixtures/${repo}`,
114
+ "_Docker/drupal/10/php",
115
+ );
116
+
117
+ before(() => {
118
+ execSync(`git checkout -f 11.x`, opts);
119
+
120
+ fs.mkdirSync(overrideDir, { recursive: true });
121
+ fs.writeFileSync(
122
+ path.join(overrideDir, "Dockerfile"),
123
+ "FROM scratch\n",
124
+ );
125
+ fs.writeFileSync(
126
+ path.join(overrideDir, "package.json"),
127
+ JSON.stringify({ name: "override", version: "9.9.9" }),
128
+ );
129
+ });
130
+
131
+ after(() => {
132
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
133
+ recursive: true,
134
+ force: true,
135
+ });
136
+ });
137
+
138
+ it(`Should build the active version's php service from the _Docker override`, () => {
139
+ const output = execSync("node ../../../cli.js config", {
140
+ encoding: "utf8",
141
+ cwd: `_Test/_fixtures/${repo}`,
142
+ });
143
+
144
+ expect(output).to.contain(path.resolve(overrideDir));
145
+ expect(output).to.contain(
146
+ "fishawack/lab-env-drupal-10-php-boilerplate-drupal",
147
+ );
148
+ });
149
+ });
150
+
151
+ describe("_Docker override version drift", () => {
152
+ // 11.x resolves to drupal/10 - overriding drupal/9 here is deliberately the WRONG/inactive version
153
+ const overrideDir = path.join(
154
+ `_Test/_fixtures/${repo}`,
155
+ "_Docker/drupal/9/php",
156
+ );
157
+
158
+ before(() => {
159
+ execSync(`git checkout -f 11.x`, opts);
160
+
161
+ fs.mkdirSync(overrideDir, { recursive: true });
162
+ fs.writeFileSync(
163
+ path.join(overrideDir, "Dockerfile"),
164
+ "FROM scratch\n",
165
+ );
166
+ fs.writeFileSync(
167
+ path.join(overrideDir, "package.json"),
168
+ JSON.stringify({ name: "override", version: "9.9.9" }),
169
+ );
170
+ });
171
+
172
+ after(() => {
173
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
174
+ recursive: true,
175
+ force: true,
176
+ });
177
+ });
178
+
179
+ it(`Should warn the mismatched override won't be used, and still use the active version's own config`, () => {
180
+ const output = execSync("node ../../../cli.js config", {
181
+ encoding: "utf8",
182
+ cwd: `_Test/_fixtures/${repo}`,
183
+ });
184
+
185
+ expect(output).to.contain("will NOT be used");
186
+ expect(output).to.contain("fishawack/lab-env-drupal-10-php");
187
+ expect(output).to.not.contain(path.resolve(overrideDir));
188
+ });
189
+ });
190
+
191
+ after(() => {
192
+ execSync(`rm -rf _Test/_fixtures/${repo}`, {
193
+ encoding: "utf8",
194
+ stdio: "inherit",
195
+ });
196
+ });
197
+ });
@@ -0,0 +1,239 @@
1
+ "use strict";
2
+
3
+ const repo = `boilerplate-laravel`;
4
+ const opts = {
5
+ encoding: "utf8",
6
+ stdio: "inherit",
7
+ cwd: `_Test/_fixtures/${repo}`,
8
+ };
9
+
10
+ const expect = require("chai").expect;
11
+ const execSync = require("child_process").execSync;
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const { runtimeVersions } = require("../commands/create/libs/runtime-versions");
15
+
16
+ // Each branch is a real, maintained major-version cut of the boilerplate - maps to the lab-env dir we expect `fw config` to resolve
17
+ const branches = [
18
+ { branch: "9.x", version: "9" },
19
+ { branch: "10.x", version: "9" },
20
+ { branch: "11.x", version: "10" },
21
+ { branch: "12.x", version: "10" },
22
+ { branch: "13.x", version: "11" },
23
+ ];
24
+
25
+ describe("config: laravel", () => {
26
+ before(function () {
27
+ this.timeout(60000 * 2);
28
+
29
+ execSync(
30
+ `git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
31
+ { encoding: "utf8", stdio: "inherit" },
32
+ );
33
+ });
34
+
35
+ branches.forEach(({ branch, version }) => {
36
+ const image = `fishawack/lab-env-laravel-${version}-php`;
37
+ const { php, mysql } = runtimeVersions.laravel[version];
38
+
39
+ describe(branch, () => {
40
+ let output;
41
+
42
+ before(() => {
43
+ execSync(`git checkout -f ${branch}`, opts);
44
+
45
+ output = execSync("node ../../../cli.js config", {
46
+ encoding: "utf8",
47
+ cwd: `_Test/_fixtures/${repo}`,
48
+ });
49
+ });
50
+
51
+ it(`Should resolve to ${image}`, () => {
52
+ expect(output).to.contain(image);
53
+ });
54
+
55
+ it(`Should keep the shared nginx pinned to fishawack/lab-env-laravel-8-nginx`, () => {
56
+ expect(output).to.contain("fishawack/lab-env-laravel-8-nginx");
57
+ });
58
+
59
+ it(`Should build php from PHP ${php} per the shared runtime-versions table`, () => {
60
+ expect(output).to.contain(`PHP_VERSION: "${php}"`);
61
+ });
62
+
63
+ it(`Should run mysql ${mysql} per the shared runtime-versions table`, () => {
64
+ expect(output).to.contain(`image: mysql:${mysql}`);
65
+ });
66
+ });
67
+ });
68
+
69
+ describe("unsupported version", () => {
70
+ before(() => {
71
+ execSync(`git checkout -f 13.x`, opts);
72
+
73
+ const composerPath = path.join(
74
+ `_Test/_fixtures/${repo}`,
75
+ "composer.json",
76
+ );
77
+ const composer = JSON.parse(fs.readFileSync(composerPath, "utf8"));
78
+
79
+ composer.require["laravel/framework"] = "^999.0";
80
+
81
+ fs.writeFileSync(composerPath, JSON.stringify(composer, null, 4));
82
+ });
83
+
84
+ it(`Should warn and exit non-zero instead of silently picking a config`, () => {
85
+ let error;
86
+
87
+ try {
88
+ execSync("node ../../../cli.js config", {
89
+ encoding: "utf8",
90
+ cwd: `_Test/_fixtures/${repo}`,
91
+ });
92
+ } catch (e) {
93
+ error = e;
94
+ }
95
+
96
+ expect(error).to.not.be.undefined;
97
+ expect(error.status).to.equal(1);
98
+ expect(error.stdout).to.contain("doesn't recognize");
99
+ });
100
+
101
+ it(`--force should let it continue (falling back to latest) instead of exiting`, () => {
102
+ const output = execSync("node ../../../cli.js config --force", {
103
+ encoding: "utf8",
104
+ cwd: `_Test/_fixtures/${repo}`,
105
+ });
106
+
107
+ expect(output).to.contain("fishawack/lab-env-laravel-11-php");
108
+ });
109
+
110
+ it(`Should let exempt commands (e.g. --version) through without warning`, () => {
111
+ const output = execSync("node ../../../cli.js --version", {
112
+ encoding: "utf8",
113
+ cwd: `_Test/_fixtures/${repo}`,
114
+ });
115
+
116
+ expect(output).to.not.contain("doesn't recognize");
117
+ });
118
+ });
119
+
120
+ describe("--force", () => {
121
+ before(() => {
122
+ execSync(`git checkout -f 9.x`, opts);
123
+ });
124
+
125
+ it(`Should NOT override a recognized version's resolved config`, () => {
126
+ const output = execSync("node ../../../cli.js config --force", {
127
+ encoding: "utf8",
128
+ cwd: `_Test/_fixtures/${repo}`,
129
+ });
130
+
131
+ expect(output).to.contain("fishawack/lab-env-laravel-9-php");
132
+ expect(output).to.not.contain("fishawack/lab-env-laravel-11-php");
133
+ });
134
+ });
135
+
136
+ describe("FW_NEXT", () => {
137
+ before(() => {
138
+ execSync(`git checkout -f 9.x`, opts);
139
+ });
140
+
141
+ it(`Should always force the latest config, even on a recognized older version`, () => {
142
+ const output = execSync("node ../../../cli.js config", {
143
+ encoding: "utf8",
144
+ cwd: `_Test/_fixtures/${repo}`,
145
+ env: { ...process.env, FW_NEXT: "true" },
146
+ });
147
+
148
+ expect(output).to.contain("fishawack/lab-env-laravel-11-php");
149
+ });
150
+ });
151
+
152
+ describe("_Docker override", () => {
153
+ // 11.x resolves to laravel/10 - override that exact dir so it's the active version
154
+ const overrideDir = path.join(
155
+ `_Test/_fixtures/${repo}`,
156
+ "_Docker/laravel/10/php",
157
+ );
158
+
159
+ before(() => {
160
+ execSync(`git checkout -f 11.x`, opts);
161
+
162
+ fs.mkdirSync(overrideDir, { recursive: true });
163
+ fs.writeFileSync(
164
+ path.join(overrideDir, "Dockerfile"),
165
+ "FROM scratch\n",
166
+ );
167
+ fs.writeFileSync(
168
+ path.join(overrideDir, "package.json"),
169
+ JSON.stringify({ name: "override", version: "9.9.9" }),
170
+ );
171
+ });
172
+
173
+ after(() => {
174
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
175
+ recursive: true,
176
+ force: true,
177
+ });
178
+ });
179
+
180
+ it(`Should build the active version's php service from the _Docker override`, () => {
181
+ const output = execSync("node ../../../cli.js config", {
182
+ encoding: "utf8",
183
+ cwd: `_Test/_fixtures/${repo}`,
184
+ });
185
+
186
+ expect(output).to.contain(path.resolve(overrideDir));
187
+ expect(output).to.contain(
188
+ "fishawack/lab-env-laravel-10-php-boilerplate-laravel",
189
+ );
190
+ });
191
+ });
192
+
193
+ describe("_Docker override version drift", () => {
194
+ // 11.x resolves to laravel/10 - overriding laravel/9 here is deliberately the WRONG/inactive version
195
+ const overrideDir = path.join(
196
+ `_Test/_fixtures/${repo}`,
197
+ "_Docker/laravel/9/php",
198
+ );
199
+
200
+ before(() => {
201
+ execSync(`git checkout -f 11.x`, opts);
202
+
203
+ fs.mkdirSync(overrideDir, { recursive: true });
204
+ fs.writeFileSync(
205
+ path.join(overrideDir, "Dockerfile"),
206
+ "FROM scratch\n",
207
+ );
208
+ fs.writeFileSync(
209
+ path.join(overrideDir, "package.json"),
210
+ JSON.stringify({ name: "override", version: "9.9.9" }),
211
+ );
212
+ });
213
+
214
+ after(() => {
215
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
216
+ recursive: true,
217
+ force: true,
218
+ });
219
+ });
220
+
221
+ it(`Should warn the mismatched override won't be used, and still use the active version's own config`, () => {
222
+ const output = execSync("node ../../../cli.js config", {
223
+ encoding: "utf8",
224
+ cwd: `_Test/_fixtures/${repo}`,
225
+ });
226
+
227
+ expect(output).to.contain("will NOT be used");
228
+ expect(output).to.contain("fishawack/lab-env-laravel-10-php");
229
+ expect(output).to.not.contain(path.resolve(overrideDir));
230
+ });
231
+ });
232
+
233
+ after(() => {
234
+ execSync(`rm -rf _Test/_fixtures/${repo}`, {
235
+ encoding: "utf8",
236
+ stdio: "inherit",
237
+ });
238
+ });
239
+ });
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+
3
+ const repo = `boilerplate-wordpress`;
4
+ const opts = {
5
+ encoding: "utf8",
6
+ stdio: "inherit",
7
+ cwd: `_Test/_fixtures/${repo}`,
8
+ };
9
+
10
+ const expect = require("chai").expect;
11
+ const execSync = require("child_process").execSync;
12
+ const fs = require("fs");
13
+ const path = require("path");
14
+ const { runtimeVersions } = require("../commands/create/libs/runtime-versions");
15
+
16
+ // Each branch is a real, maintained major-version cut of the boilerplate - maps to the lab-env dir we expect `fw config` to resolve
17
+ // Note: wordpress dir "0" (bundled wordpress:5.7.2 image, used when no johnpbloch/wordpress requirement exists at all) is intentionally
18
+ // not covered here - it can't be represented by a version branch since it's triggered by the absence of a version requirement.
19
+ const branches = [
20
+ { branch: "6.x", version: "1" },
21
+ { branch: "7.x", version: "2" },
22
+ ];
23
+
24
+ describe("config: wordpress", () => {
25
+ before(function () {
26
+ this.timeout(60000 * 2);
27
+
28
+ execSync(
29
+ `git -C _Test/_fixtures clone git@bitbucket.org:fishawackdigital/${repo}`,
30
+ { encoding: "utf8", stdio: "inherit" },
31
+ );
32
+ });
33
+
34
+ branches.forEach(({ branch, version }) => {
35
+ const image = `fishawack/lab-env-wordpress-${version}-php`;
36
+ const { php, mysql } = runtimeVersions.wordpress[version];
37
+
38
+ describe(branch, () => {
39
+ let output;
40
+
41
+ before(() => {
42
+ execSync(`git checkout -f ${branch}`, opts);
43
+
44
+ output = execSync("node ../../../cli.js config", {
45
+ encoding: "utf8",
46
+ cwd: `_Test/_fixtures/${repo}`,
47
+ });
48
+ });
49
+
50
+ it(`Should resolve to ${image}`, () => {
51
+ expect(output).to.contain(image);
52
+ });
53
+
54
+ it(`Should keep the shared apache pinned to fishawack/lab-env-wordpress-1-apache`, () => {
55
+ expect(output).to.contain(
56
+ "fishawack/lab-env-wordpress-1-apache",
57
+ );
58
+ });
59
+
60
+ it(`Should build php from PHP ${php} per the shared runtime-versions table`, () => {
61
+ expect(output).to.contain(`PHP_VERSION: "${php}"`);
62
+ });
63
+
64
+ it(`Should run mysql ${mysql} per the shared runtime-versions table`, () => {
65
+ expect(output).to.contain(`image: mysql:${mysql}`);
66
+ });
67
+ });
68
+ });
69
+
70
+ describe("unsupported version", () => {
71
+ before(() => {
72
+ execSync(`git checkout -f 7.x`, opts);
73
+
74
+ const composerPath = path.join(
75
+ `_Test/_fixtures/${repo}`,
76
+ "composer.json",
77
+ );
78
+ const composer = JSON.parse(fs.readFileSync(composerPath, "utf8"));
79
+
80
+ composer.require["johnpbloch/wordpress"] = "^999.0";
81
+
82
+ fs.writeFileSync(composerPath, JSON.stringify(composer, null, 4));
83
+ });
84
+
85
+ it(`Should warn and exit non-zero instead of silently picking a config`, () => {
86
+ let error;
87
+
88
+ try {
89
+ execSync("node ../../../cli.js config", {
90
+ encoding: "utf8",
91
+ cwd: `_Test/_fixtures/${repo}`,
92
+ });
93
+ } catch (e) {
94
+ error = e;
95
+ }
96
+
97
+ expect(error).to.not.be.undefined;
98
+ expect(error.status).to.equal(1);
99
+ expect(error.stdout).to.contain("doesn't recognize");
100
+ });
101
+
102
+ it(`Should let exempt commands (e.g. --version) through without warning`, () => {
103
+ const output = execSync("node ../../../cli.js --version", {
104
+ encoding: "utf8",
105
+ cwd: `_Test/_fixtures/${repo}`,
106
+ });
107
+
108
+ expect(output).to.not.contain("doesn't recognize");
109
+ });
110
+ });
111
+
112
+ // These two are expected to FAIL until _Docker override support is generalized to wordpress (currently laravel-only) - see the globals.js refactor plan
113
+ describe("_Docker override", () => {
114
+ // 7.x resolves to wordpress/2 - override that exact dir so it's the active version
115
+ const overrideDir = path.join(
116
+ `_Test/_fixtures/${repo}`,
117
+ "_Docker/wordpress/2/php",
118
+ );
119
+
120
+ before(() => {
121
+ execSync(`git checkout -f 7.x`, opts);
122
+
123
+ fs.mkdirSync(overrideDir, { recursive: true });
124
+ fs.writeFileSync(
125
+ path.join(overrideDir, "Dockerfile"),
126
+ "FROM scratch\n",
127
+ );
128
+ fs.writeFileSync(
129
+ path.join(overrideDir, "package.json"),
130
+ JSON.stringify({ name: "override", version: "9.9.9" }),
131
+ );
132
+ });
133
+
134
+ after(() => {
135
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
136
+ recursive: true,
137
+ force: true,
138
+ });
139
+ });
140
+
141
+ it(`Should build the active version's php service from the _Docker override`, () => {
142
+ const output = execSync("node ../../../cli.js config", {
143
+ encoding: "utf8",
144
+ cwd: `_Test/_fixtures/${repo}`,
145
+ });
146
+
147
+ expect(output).to.contain(path.resolve(overrideDir));
148
+ expect(output).to.contain(
149
+ "fishawack/lab-env-wordpress-2-php-boilerplate-wordpress",
150
+ );
151
+ });
152
+ });
153
+
154
+ describe("_Docker override version drift", () => {
155
+ // 7.x resolves to wordpress/2 - overriding wordpress/1 here is deliberately the WRONG/inactive version
156
+ const overrideDir = path.join(
157
+ `_Test/_fixtures/${repo}`,
158
+ "_Docker/wordpress/1/php",
159
+ );
160
+
161
+ before(() => {
162
+ execSync(`git checkout -f 7.x`, opts);
163
+
164
+ fs.mkdirSync(overrideDir, { recursive: true });
165
+ fs.writeFileSync(
166
+ path.join(overrideDir, "Dockerfile"),
167
+ "FROM scratch\n",
168
+ );
169
+ fs.writeFileSync(
170
+ path.join(overrideDir, "package.json"),
171
+ JSON.stringify({ name: "override", version: "9.9.9" }),
172
+ );
173
+ });
174
+
175
+ after(() => {
176
+ fs.rmSync(path.join(`_Test/_fixtures/${repo}`, "_Docker"), {
177
+ recursive: true,
178
+ force: true,
179
+ });
180
+ });
181
+
182
+ it(`Should warn the mismatched override won't be used, and still use the active version's own config`, () => {
183
+ const output = execSync("node ../../../cli.js config", {
184
+ encoding: "utf8",
185
+ cwd: `_Test/_fixtures/${repo}`,
186
+ });
187
+
188
+ expect(output).to.contain("will NOT be used");
189
+ expect(output).to.contain("fishawack/lab-env-wordpress-2-php");
190
+ expect(output).to.not.contain(path.resolve(overrideDir));
191
+ });
192
+ });
193
+
194
+ after(() => {
195
+ execSync(`rm -rf _Test/_fixtures/${repo}`, {
196
+ encoding: "utf8",
197
+ stdio: "inherit",
198
+ });
199
+ });
200
+ });