@fishawack/lab-env 4.39.0-beta.5 → 4.39.0-beta.7
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/.husky/commit-msg +1 -1
- package/.husky/pre-push +1 -0
- package/.prettierignore +2 -1
- package/CHANGELOG.md +30 -0
- package/_Test/provision.js +13 -4
- package/_Test/s3.js +3 -1
- package/_Test/utilities.js +4 -0
- package/cli.js +6 -5
- package/commands/check.js +1 -0
- package/commands/clean.js +2 -2
- package/commands/content.js +2 -2
- package/commands/create/cmds/dekey.js +2 -3
- package/commands/create/cmds/deprovision.js +2 -2
- package/commands/create/cmds/diagnose.js +3 -2
- package/commands/create/cmds/key.js +2 -2
- package/commands/create/cmds/provision.js +3 -3
- package/commands/create/libs/aws-cloudfront-auth.js +11 -8
- package/commands/create/libs/aws-cloudfront-response.js +1 -0
- package/commands/create/libs/aws-cloudfront-simple.js +10 -7
- package/commands/create/libs/utilities.js +3 -0
- package/commands/create/libs/vars.js +20 -24
- package/commands/create/services/aws/cloudfront.js +1 -1
- package/commands/create/services/aws/iam.js +5 -3
- package/commands/create/services/aws/index.js +36 -12
- package/commands/create/services/aws/s3.js +1 -0
- package/commands/create/services/bitbucket.js +4 -4
- package/commands/create/services/egnyte.js +2 -2
- package/commands/create/services/gitlab.js +2 -2
- package/commands/create/services/guide.js +26 -19
- package/commands/create/services/test.js +13 -11
- package/commands/deploy.js +2 -2
- package/commands/docker/config.js +2 -2
- package/commands/docker/down.js +2 -2
- package/commands/docker/mocha.js +2 -4
- package/commands/docker/volumes.js +2 -2
- package/commands/lint.js +23 -0
- package/commands/nuke.js +5 -3
- package/commands/origin.js +3 -3
- package/commands/pretty.js +12 -0
- package/commands/production.js +2 -2
- package/commands/regenerate.js +2 -2
- package/commands/reinstall.js +2 -2
- package/commands/setup.js +2 -2
- package/commands/test.js +2 -2
- package/commands/watch.js +2 -2
- package/commands/wp.js +0 -2
- package/eslint.config.js +67 -0
- package/globals.js +71 -25
- package/package.json +1 -1
package/globals.js
CHANGED
|
@@ -39,6 +39,7 @@ var repo;
|
|
|
39
39
|
var platform;
|
|
40
40
|
var pkg;
|
|
41
41
|
var composer;
|
|
42
|
+
var wordpress;
|
|
42
43
|
var docker;
|
|
43
44
|
var exec;
|
|
44
45
|
var running;
|
|
@@ -55,7 +56,7 @@ try {
|
|
|
55
56
|
config = JSON.parse(
|
|
56
57
|
readFileSync(`${os.homedir()}/.lab-env`, { encoding: "utf8" }),
|
|
57
58
|
);
|
|
58
|
-
} catch
|
|
59
|
+
} catch {
|
|
59
60
|
config = {};
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -64,7 +65,7 @@ try {
|
|
|
64
65
|
process.env.BRANCH ||
|
|
65
66
|
process.env.CI_COMMIT_REF_NAME ||
|
|
66
67
|
require("git-branch").sync();
|
|
67
|
-
} catch
|
|
68
|
+
} catch {
|
|
68
69
|
branch = "unknown";
|
|
69
70
|
}
|
|
70
71
|
|
|
@@ -74,25 +75,31 @@ try {
|
|
|
74
75
|
encoding: "utf8",
|
|
75
76
|
stdio: "pipe",
|
|
76
77
|
}).trim() || path.basename(cwd);
|
|
77
|
-
} catch
|
|
78
|
+
} catch {
|
|
78
79
|
repo = path.basename(cwd);
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
process.env.REPO = process.env.REPO || repo;
|
|
82
83
|
|
|
83
|
-
const
|
|
84
|
+
const repoSafe = repo.replace(/\./g, "");
|
|
84
85
|
|
|
85
86
|
try {
|
|
86
87
|
pkg = require(path.join(cwd, "package.json"));
|
|
87
|
-
} catch
|
|
88
|
+
} catch {
|
|
89
|
+
/* empty */
|
|
90
|
+
}
|
|
88
91
|
|
|
89
92
|
try {
|
|
90
93
|
composer = require(path.join(cwd, "composer.json"));
|
|
91
|
-
} catch
|
|
94
|
+
} catch {
|
|
95
|
+
/* empty */
|
|
96
|
+
}
|
|
92
97
|
|
|
93
98
|
try {
|
|
94
99
|
wordpress = existsSync(path.join(cwd, "wp-content/"));
|
|
95
|
-
} catch
|
|
100
|
+
} catch {
|
|
101
|
+
/* empty */
|
|
102
|
+
}
|
|
96
103
|
|
|
97
104
|
if (composer && composer.require && composer.require["laravel/framework"]) {
|
|
98
105
|
platform = "laravel";
|
|
@@ -118,7 +125,9 @@ if (composer && composer.require && composer.require["laravel/framework"]) {
|
|
|
118
125
|
args[0] !== "--help" &&
|
|
119
126
|
args[0] !== "new" &&
|
|
120
127
|
args[0] !== "key" &&
|
|
121
|
-
args[0] !== "dekey"
|
|
128
|
+
args[0] !== "dekey" &&
|
|
129
|
+
args[0] !== "lint" &&
|
|
130
|
+
args[0] !== "pretty"
|
|
122
131
|
) {
|
|
123
132
|
if (!args.find((d) => d === "--force")) {
|
|
124
133
|
console.log(
|
|
@@ -166,7 +175,9 @@ if (composer && composer.require && composer.require["laravel/framework"]) {
|
|
|
166
175
|
args[0] !== "--help" &&
|
|
167
176
|
args[0] !== "new" &&
|
|
168
177
|
args[0] !== "key" &&
|
|
169
|
-
args[0] !== "dekey"
|
|
178
|
+
args[0] !== "dekey" &&
|
|
179
|
+
args[0] !== "lint" &&
|
|
180
|
+
args[0] !== "pretty"
|
|
170
181
|
) {
|
|
171
182
|
if (!args.find((d) => d === "--force")) {
|
|
172
183
|
console.log(
|
|
@@ -190,7 +201,9 @@ if (composer && composer.require && composer.require["laravel/framework"]) {
|
|
|
190
201
|
);
|
|
191
202
|
process.exit(1);
|
|
192
203
|
}
|
|
193
|
-
} catch
|
|
204
|
+
} catch {
|
|
205
|
+
/* empty */
|
|
206
|
+
}
|
|
194
207
|
|
|
195
208
|
platform = "core";
|
|
196
209
|
}
|
|
@@ -224,7 +237,9 @@ if (process.env.FW_NEXT) {
|
|
|
224
237
|
args[0] !== "--help" &&
|
|
225
238
|
args[0] !== "new" &&
|
|
226
239
|
args[0] !== "key" &&
|
|
227
|
-
args[0] !== "dekey"
|
|
240
|
+
args[0] !== "dekey" &&
|
|
241
|
+
args[0] !== "lint" &&
|
|
242
|
+
args[0] !== "pretty"
|
|
228
243
|
) {
|
|
229
244
|
if (!args.find((d) => d === "--force")) {
|
|
230
245
|
console.log(
|
|
@@ -304,7 +319,7 @@ process.env.FW_CORE_1_CONTEXT =
|
|
|
304
319
|
let contextOverride = path.join(cwd, "_Docker/core/1/");
|
|
305
320
|
if (existsSync(path.join(contextOverride, "Dockerfile"))) {
|
|
306
321
|
process.env.FW_CORE_1_CONTEXT = contextOverride;
|
|
307
|
-
process.env.FW_CORE_1_IMAGE += `-${
|
|
322
|
+
process.env.FW_CORE_1_IMAGE += `-${repoSafe}`;
|
|
308
323
|
}
|
|
309
324
|
|
|
310
325
|
process.env.FW_LARAVEL_8_NGINX_CONTEXT =
|
|
@@ -313,7 +328,7 @@ process.env.FW_LARAVEL_8_NGINX_CONTEXT =
|
|
|
313
328
|
contextOverride = path.join(cwd, "_Docker/laravel/8/nginx");
|
|
314
329
|
if (existsSync(path.join(contextOverride, "Dockerfile"))) {
|
|
315
330
|
process.env.FW_LARAVEL_8_NGINX_CONTEXT = contextOverride;
|
|
316
|
-
process.env.FW_LARAVEL_8_NGINX_IMAGE += `-${
|
|
331
|
+
process.env.FW_LARAVEL_8_NGINX_IMAGE += `-${repoSafe}`;
|
|
317
332
|
process.env.FW_LARAVEL_8_NGINX_VERSION = require(
|
|
318
333
|
`${contextOverride}/package.json`,
|
|
319
334
|
).version;
|
|
@@ -326,7 +341,7 @@ process.env.FW_ADONIS_0_NGINX_CONTEXT =
|
|
|
326
341
|
contextOverride = path.join(cwd, "_Docker/adonis/0/nginx");
|
|
327
342
|
if (existsSync(path.join(contextOverride, "Dockerfile"))) {
|
|
328
343
|
process.env.FW_ADONIS_0_NGINX_CONTEXT = contextOverride;
|
|
329
|
-
process.env.FW_ADONIS_0_NGINX_IMAGE += `-${
|
|
344
|
+
process.env.FW_ADONIS_0_NGINX_IMAGE += `-${repoSafe}`;
|
|
330
345
|
process.env.FW_ADONIS_0_NGINX_VERSION = require(
|
|
331
346
|
`${contextOverride}/package.json`,
|
|
332
347
|
).version;
|
|
@@ -338,7 +353,7 @@ process.env.FW_ADONIS_0_NODE_CONTEXT =
|
|
|
338
353
|
contextOverride = path.join(cwd, "_Docker/adonis/0/node");
|
|
339
354
|
if (existsSync(path.join(contextOverride, "Dockerfile"))) {
|
|
340
355
|
process.env.FW_ADONIS_0_NODE_CONTEXT = contextOverride;
|
|
341
|
-
process.env.FW_ADONIS_0_NODE_IMAGE = `fishawack/lab-env-adonis-0-node-${
|
|
356
|
+
process.env.FW_ADONIS_0_NODE_IMAGE = `fishawack/lab-env-adonis-0-node-${repoSafe}`;
|
|
342
357
|
process.env.FW_ADONIS_0_NODE_VERSION = require(
|
|
343
358
|
`${contextOverride}/package.json`,
|
|
344
359
|
).version;
|
|
@@ -366,6 +381,34 @@ if (!existsSync(path.join(cwd, ".commitlintrc.json"))) {
|
|
|
366
381
|
);
|
|
367
382
|
}
|
|
368
383
|
|
|
384
|
+
if (!existsSync(path.join(cwd, ".prettierignore"))) {
|
|
385
|
+
copyFileSync(
|
|
386
|
+
path.join(__dirname, ".prettierignore"),
|
|
387
|
+
path.join(cwd, ".prettierignore"),
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
if (!existsSync(path.join(cwd, ".prettierrc.js"))) {
|
|
392
|
+
copyFileSync(
|
|
393
|
+
path.join(__dirname, ".prettierrc.js"),
|
|
394
|
+
path.join(cwd, ".prettierrc.js"),
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!existsSync(path.join(cwd, ".editorconfig"))) {
|
|
399
|
+
copyFileSync(
|
|
400
|
+
path.join(__dirname, ".editorconfig"),
|
|
401
|
+
path.join(cwd, ".editorconfig"),
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
if (!existsSync(path.join(cwd, "eslint.config.js"))) {
|
|
406
|
+
copyFileSync(
|
|
407
|
+
path.join(__dirname, "eslint.config.js"),
|
|
408
|
+
path.join(cwd, "eslint.config.js"),
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
|
|
369
412
|
// If docker-compose.yml exists in project _Docker folder append to end
|
|
370
413
|
let localOverride = "";
|
|
371
414
|
if (existsSync(path.join(cwd, "_Docker/docker-compose.yml"))) {
|
|
@@ -375,19 +418,19 @@ if (existsSync(path.join(cwd, "_Docker/docker-compose.yml"))) {
|
|
|
375
418
|
if (platform === "laravel") {
|
|
376
419
|
let container = `-f ${__dirname}/laravel/${process.env.VERSION_LARAVEL}/docker-compose.yml`;
|
|
377
420
|
|
|
378
|
-
docker = `docker compose --env-file ${path.join(cwd, ".env")} ${container} ${core} ${localOverride} -p ${
|
|
421
|
+
docker = `docker compose --env-file ${path.join(cwd, ".env")} ${container} ${core} ${localOverride} -p ${repoSafe}`;
|
|
379
422
|
} else if (platform === "wordpress") {
|
|
380
|
-
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/wordpress/${process.env.VERSION_WORDPRESS}/docker-compose.yml ${core} ${localOverride} -p ${
|
|
423
|
+
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/wordpress/${process.env.VERSION_WORDPRESS}/docker-compose.yml ${core} ${localOverride} -p ${repoSafe}`;
|
|
381
424
|
} else if (platform === "drupal") {
|
|
382
425
|
let container = `-f ${__dirname}/drupal/9/docker-compose.yml`;
|
|
383
426
|
|
|
384
|
-
docker = `docker compose --env-file ${path.join(cwd, ".env")} ${container} ${core} ${localOverride} -p ${
|
|
427
|
+
docker = `docker compose --env-file ${path.join(cwd, ".env")} ${container} ${core} ${localOverride} -p ${repoSafe}`;
|
|
385
428
|
} else if (platform === "craftcms") {
|
|
386
|
-
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} ${localOverride} -p ${
|
|
429
|
+
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/craftcms/3/docker-compose.yml ${core} ${localOverride} -p ${repoSafe}`;
|
|
387
430
|
} else if (platform === "adonis") {
|
|
388
|
-
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/adonis/0/docker-compose.yml ${core} ${localOverride} -p ${
|
|
431
|
+
docker = `docker compose --env-file ${path.join(cwd, ".env")} -f ${__dirname}/adonis/0/docker-compose.yml ${core} ${localOverride} -p ${repoSafe}`;
|
|
389
432
|
} else {
|
|
390
|
-
docker = `docker compose ${core} ${localOverride} -p ${
|
|
433
|
+
docker = `docker compose ${core} ${localOverride} -p ${repoSafe}`;
|
|
391
434
|
}
|
|
392
435
|
|
|
393
436
|
try {
|
|
@@ -412,7 +455,9 @@ if (
|
|
|
412
455
|
args[0] !== "--help" &&
|
|
413
456
|
args[0] !== "new" &&
|
|
414
457
|
args[0] !== "key" &&
|
|
415
|
-
args[0] !== "dekey"
|
|
458
|
+
args[0] !== "dekey" &&
|
|
459
|
+
args[0] !== "lint" &&
|
|
460
|
+
args[0] !== "pretty"
|
|
416
461
|
) {
|
|
417
462
|
// Stop here if diagnosis either unset or outdated
|
|
418
463
|
if (
|
|
@@ -475,10 +520,10 @@ module.exports = {
|
|
|
475
520
|
diagnosis,
|
|
476
521
|
services,
|
|
477
522
|
platform,
|
|
478
|
-
volumes: volumes.map((d) => `${
|
|
523
|
+
volumes: volumes.map((d) => `${repoSafe}_${d}`),
|
|
479
524
|
repo,
|
|
480
525
|
branch,
|
|
481
|
-
|
|
526
|
+
repoSafe,
|
|
482
527
|
pkg,
|
|
483
528
|
docker,
|
|
484
529
|
exec,
|
|
@@ -527,7 +572,7 @@ module.exports = {
|
|
|
527
572
|
}
|
|
528
573
|
},
|
|
529
574
|
},
|
|
530
|
-
up(cb
|
|
575
|
+
up(cb) {
|
|
531
576
|
let alreadyRunning = running;
|
|
532
577
|
|
|
533
578
|
if (!running) {
|
|
@@ -537,6 +582,7 @@ module.exports = {
|
|
|
537
582
|
|
|
538
583
|
try {
|
|
539
584
|
cb();
|
|
585
|
+
// eslint-disable-next-line no-useless-catch
|
|
540
586
|
} catch (e) {
|
|
541
587
|
throw e;
|
|
542
588
|
} finally {
|