@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
|
@@ -25,7 +25,7 @@ module.exports.request = async (username, password, host) => {
|
|
|
25
25
|
!(await new Promise((resolve, reject) => {
|
|
26
26
|
exec(
|
|
27
27
|
`curl -I -k --ftp-ssl --ftp-pasv -u "${username.replace("$", "\\$")}:${password}" ftp://${host}`,
|
|
28
|
-
(error, stdout
|
|
28
|
+
(error, stdout) => {
|
|
29
29
|
if (error) {
|
|
30
30
|
reject(error);
|
|
31
31
|
return;
|
|
@@ -42,7 +42,7 @@ module.exports.request = async (username, password, host) => {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return true;
|
|
45
|
-
} catch
|
|
45
|
+
} catch {
|
|
46
46
|
spinner.update(`Failed to communicate with Egnyte.`, "fail");
|
|
47
47
|
|
|
48
48
|
return false;
|
|
@@ -13,7 +13,7 @@ module.exports.check = async () => {
|
|
|
13
13
|
await new Promise((resolve, reject) => {
|
|
14
14
|
exec(
|
|
15
15
|
`curl -H "Content-Type:application/json" http://${misc.gitlab.workspace}/api/v4/users?private_token=${misc.gitlab.token}`,
|
|
16
|
-
(error, stdout
|
|
16
|
+
(error, stdout) => {
|
|
17
17
|
if (error) {
|
|
18
18
|
reject(error);
|
|
19
19
|
return;
|
|
@@ -33,7 +33,7 @@ module.exports.check = async () => {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return true;
|
|
36
|
-
} catch
|
|
36
|
+
} catch {
|
|
37
37
|
spinner.update(
|
|
38
38
|
`Failed to communicate with ${misc.gitlab.workspace} on Gitlab.`,
|
|
39
39
|
"fail",
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const inquirer = require("inquirer");
|
|
2
2
|
const { homedir } = require("os");
|
|
3
3
|
const { mkdirSync, writeFileSync, readFileSync } = require("fs");
|
|
4
|
-
const { encode } = require("../libs/utilities");
|
|
4
|
+
const { encode, Spinner } = require("../libs/utilities");
|
|
5
5
|
const {
|
|
6
6
|
urls,
|
|
7
7
|
apis,
|
|
8
|
-
misc:
|
|
8
|
+
misc: credsMisc,
|
|
9
9
|
bitbucketApi,
|
|
10
10
|
headers,
|
|
11
|
-
ftppass:
|
|
11
|
+
ftppass: credsFtppass,
|
|
12
12
|
creds,
|
|
13
13
|
presets,
|
|
14
|
-
|
|
14
|
+
globalModules,
|
|
15
15
|
} = require("../libs/vars");
|
|
16
16
|
const { execSync } = require("child_process");
|
|
17
17
|
|
|
@@ -75,7 +75,7 @@ module.exports.bitbucket = async ({ confirm }) => {
|
|
|
75
75
|
type: "input",
|
|
76
76
|
name: "username",
|
|
77
77
|
message: "What is your bitbucket username? (e.g. mmellor)",
|
|
78
|
-
default:
|
|
78
|
+
default: credsMisc.bitbucket && credsMisc.bitbucket.username,
|
|
79
79
|
validate: (input) =>
|
|
80
80
|
input.trim().length > 0 ||
|
|
81
81
|
"Username cannot be an empty string",
|
|
@@ -83,7 +83,7 @@ module.exports.bitbucket = async ({ confirm }) => {
|
|
|
83
83
|
{
|
|
84
84
|
type: "password",
|
|
85
85
|
name: "password",
|
|
86
|
-
default:
|
|
86
|
+
default: credsMisc.bitbucket && credsMisc.bitbucket.password,
|
|
87
87
|
message: "What is your bitbucket password? (e.g. password1234)",
|
|
88
88
|
validate: (input) =>
|
|
89
89
|
input.trim().length > 0 ||
|
|
@@ -103,7 +103,7 @@ module.exports.bitbucket = async ({ confirm }) => {
|
|
|
103
103
|
}),
|
|
104
104
|
);
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
credsMisc.bitbucket = file.bitbucket = { ...inputs };
|
|
107
107
|
apis.bbWorkspaceAPI = `${bitbucketApi}/${inputs.workspace}`;
|
|
108
108
|
headers.bbHeaders = encode(inputs.username, inputs.password);
|
|
109
109
|
urls.bitbucketSSH = `git@bitbucket.org:${inputs.workspace}`;
|
|
@@ -137,7 +137,7 @@ module.exports.gitlab = async ({ confirm }) => {
|
|
|
137
137
|
name: "token",
|
|
138
138
|
message:
|
|
139
139
|
"What is your gitlab token? (e.g. puhQmpZGooQyLCa5LhTg)",
|
|
140
|
-
default: (
|
|
140
|
+
default: (credsMisc.gitlab && credsMisc.gitlab.token) || null,
|
|
141
141
|
validate: (input) =>
|
|
142
142
|
input.trim().length > 0 ||
|
|
143
143
|
"Password cannot be an empty string",
|
|
@@ -156,7 +156,7 @@ module.exports.gitlab = async ({ confirm }) => {
|
|
|
156
156
|
}),
|
|
157
157
|
);
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
credsMisc.gitlab = file.gitlab = { ...inputs };
|
|
160
160
|
|
|
161
161
|
writeFileSync(
|
|
162
162
|
`${homedir()}/targets/misc.json`,
|
|
@@ -210,8 +210,8 @@ module.exports.egnyte = async ({ confirm }) => {
|
|
|
210
210
|
message:
|
|
211
211
|
"What is your egnyte username? (e.g. mmellor$fishawack)",
|
|
212
212
|
default:
|
|
213
|
-
(
|
|
214
|
-
|
|
213
|
+
(credsFtppass["ftp-fishawack.egnyte.com"] &&
|
|
214
|
+
credsFtppass["ftp-fishawack.egnyte.com"].username) ||
|
|
215
215
|
null,
|
|
216
216
|
validate: (input) =>
|
|
217
217
|
input.trim().length > 0 ||
|
|
@@ -222,8 +222,8 @@ module.exports.egnyte = async ({ confirm }) => {
|
|
|
222
222
|
name: "password",
|
|
223
223
|
message: "What is your egnyte password? (e.g. password1234)",
|
|
224
224
|
default:
|
|
225
|
-
(
|
|
226
|
-
|
|
225
|
+
(credsFtppass["ftp-fishawack.egnyte.com"] &&
|
|
226
|
+
credsFtppass["ftp-fishawack.egnyte.com"].password) ||
|
|
227
227
|
null,
|
|
228
228
|
validate: (input) =>
|
|
229
229
|
input.trim().length > 0 ||
|
|
@@ -247,7 +247,7 @@ module.exports.egnyte = async ({ confirm }) => {
|
|
|
247
247
|
);
|
|
248
248
|
|
|
249
249
|
creds.egnyte =
|
|
250
|
-
|
|
250
|
+
credsFtppass["ftp-fishawack.egnyte.com"] =
|
|
251
251
|
file["ftp-fishawack.egnyte.com"] =
|
|
252
252
|
{ ...inputs };
|
|
253
253
|
|
|
@@ -431,6 +431,7 @@ module.exports.watertight = async ({ confirm }) => {
|
|
|
431
431
|
]);
|
|
432
432
|
|
|
433
433
|
if (inputs.confirm) {
|
|
434
|
+
/* empty */
|
|
434
435
|
} else {
|
|
435
436
|
throw "";
|
|
436
437
|
}
|
|
@@ -455,23 +456,29 @@ module.exports.gitconfig = async ({ confirm }) => {
|
|
|
455
456
|
}
|
|
456
457
|
};
|
|
457
458
|
|
|
458
|
-
module.exports.
|
|
459
|
+
module.exports.globalModules = async ({ confirm }) => {
|
|
459
460
|
let inputs = confirm
|
|
460
461
|
? { confirm }
|
|
461
462
|
: await inquirer.prompt([
|
|
462
463
|
{
|
|
463
464
|
type: "confirm",
|
|
464
465
|
name: "confirm",
|
|
465
|
-
message: `Install required global dependencies? ${
|
|
466
|
+
message: `Install required global dependencies? ${globalModules.map((d) => `${d.package}@${d.version}`).join(", ")}`,
|
|
466
467
|
default: true,
|
|
467
468
|
},
|
|
468
469
|
]);
|
|
469
470
|
|
|
470
471
|
if (inputs.confirm) {
|
|
471
|
-
|
|
472
|
-
const { package, version } = global_modules[i];
|
|
472
|
+
let spinner;
|
|
473
473
|
|
|
474
|
-
|
|
474
|
+
for (let i = 0; i < globalModules.length; i++) {
|
|
475
|
+
const { package: packageName, version } = globalModules[i];
|
|
476
|
+
|
|
477
|
+
spinner = new Spinner(`Installing ${packageName}@${version}`);
|
|
478
|
+
|
|
479
|
+
execSync(`npm install -g ${packageName}@${version}`);
|
|
480
|
+
|
|
481
|
+
spinner.update(`Installed ${packageName}@${version}`);
|
|
475
482
|
}
|
|
476
483
|
} else {
|
|
477
484
|
throw "";
|
|
@@ -193,13 +193,13 @@ module.exports.watertight = async () => {
|
|
|
193
193
|
!(await new Promise((resolve, reject) =>
|
|
194
194
|
exec(
|
|
195
195
|
"git clone --bare git@bitbucket.org:fishawackdigital/watertight-node-auto ./.tmp/watertight-node-auto",
|
|
196
|
-
(error
|
|
196
|
+
(error) => (error ? reject(error) : resolve()),
|
|
197
197
|
),
|
|
198
198
|
));
|
|
199
199
|
|
|
200
200
|
spinner.update("Successfully accessed watertight-node-auto repository");
|
|
201
201
|
return true;
|
|
202
|
-
} catch
|
|
202
|
+
} catch {
|
|
203
203
|
spinner.update(
|
|
204
204
|
"Could not access watertight-node-auto repository",
|
|
205
205
|
"fail",
|
|
@@ -221,20 +221,20 @@ module.exports.gitconfig = async () => {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
|
|
224
|
-
module.exports.
|
|
224
|
+
module.exports.globalModules = async () => {
|
|
225
225
|
// Get list of all globally installed node modules
|
|
226
226
|
let spinner = new utils.Spinner(
|
|
227
227
|
"Retrieving a list of all globally installed node_modules",
|
|
228
228
|
);
|
|
229
229
|
|
|
230
|
-
let
|
|
230
|
+
let globalModules;
|
|
231
231
|
|
|
232
232
|
try {
|
|
233
233
|
const stdout = execSync("npm ls -g --depth=0 --json", {
|
|
234
234
|
encoding: "utf8",
|
|
235
235
|
});
|
|
236
236
|
const data = JSON.parse(stdout);
|
|
237
|
-
|
|
237
|
+
globalModules = data.dependencies || {};
|
|
238
238
|
|
|
239
239
|
spinner.update("Global node_module list retrieved");
|
|
240
240
|
} catch (error) {
|
|
@@ -244,19 +244,21 @@ module.exports.global_modules = async () => {
|
|
|
244
244
|
);
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
-
for (let i = 0; i < vars.
|
|
248
|
-
const { package, version } = vars.
|
|
247
|
+
for (let i = 0; i < vars.globalModules.length; i++) {
|
|
248
|
+
const { package: packageName, version } = vars.globalModules[i];
|
|
249
249
|
|
|
250
250
|
spinner = new utils.Spinner(
|
|
251
|
-
`Checking ${
|
|
251
|
+
`Checking ${packageName}@${version} is installed`,
|
|
252
252
|
);
|
|
253
253
|
|
|
254
|
-
if (
|
|
254
|
+
if (
|
|
255
|
+
semver.satisfies(globalModules[packageName]?.version, `=${version}`)
|
|
256
|
+
) {
|
|
255
257
|
spinner.update(
|
|
256
|
-
`Package: ${
|
|
258
|
+
`Package: ${packageName}@${globalModules[packageName]?.version} found`,
|
|
257
259
|
);
|
|
258
260
|
} else {
|
|
259
|
-
spinner.update(`Could not find ${
|
|
261
|
+
spinner.update(`Could not find ${packageName}@${version}`, "fail");
|
|
260
262
|
return false;
|
|
261
263
|
}
|
|
262
264
|
}
|
package/commands/deploy.js
CHANGED
package/commands/docker/down.js
CHANGED
package/commands/docker/mocha.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
const _ = require("../../globals.js");
|
|
2
2
|
|
|
3
|
-
const execSync = require("child_process").execSync;
|
|
4
|
-
|
|
5
3
|
module.exports = [
|
|
6
4
|
"mocha",
|
|
7
5
|
false,
|
|
8
|
-
(
|
|
9
|
-
(
|
|
6
|
+
() => {},
|
|
7
|
+
() =>
|
|
10
8
|
_.command(
|
|
11
9
|
"core",
|
|
12
10
|
`${process.env.VERSION === "0" ? "xvfb-run " : ""}npm run mocha`,
|
package/commands/lint.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const execSync = require("child_process").execSync;
|
|
2
|
+
|
|
3
|
+
const _ = require("../globals.js");
|
|
4
|
+
|
|
5
|
+
module.exports = [
|
|
6
|
+
"lint [linters]",
|
|
7
|
+
"runs code style, javascript, scss & php linting",
|
|
8
|
+
(yargs) => {
|
|
9
|
+
yargs.positional("linters", {
|
|
10
|
+
describe: "linters to run",
|
|
11
|
+
default: "js css php style",
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
(argv) => {
|
|
15
|
+
if (argv.linters.includes("js")) {
|
|
16
|
+
execSync("eslint '**/*.{js,vue}'", _.opts);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (argv.linters.includes("style")) {
|
|
20
|
+
execSync("prettier --check .", _.opts);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
];
|
package/commands/nuke.js
CHANGED
|
@@ -5,13 +5,15 @@ const execSync = require("child_process").execSync;
|
|
|
5
5
|
module.exports = [
|
|
6
6
|
"nuke",
|
|
7
7
|
"cleans out all files not tracked by git",
|
|
8
|
-
(
|
|
9
|
-
(
|
|
8
|
+
() => {},
|
|
9
|
+
() => {
|
|
10
10
|
execSync(`git clean -xfd`, _.opts);
|
|
11
11
|
|
|
12
12
|
// Remove all virtual volumes
|
|
13
13
|
try {
|
|
14
14
|
execSync(`docker volume rm ${_.volumes.join(" ")}`, _.opts);
|
|
15
|
-
} catch
|
|
15
|
+
} catch {
|
|
16
|
+
/* empty */
|
|
17
|
+
}
|
|
16
18
|
},
|
|
17
19
|
];
|
package/commands/origin.js
CHANGED
|
@@ -7,8 +7,8 @@ const chalk = require("chalk");
|
|
|
7
7
|
module.exports = [
|
|
8
8
|
"origin",
|
|
9
9
|
"add gitlab as a second remote",
|
|
10
|
-
(
|
|
11
|
-
(
|
|
10
|
+
() => {},
|
|
11
|
+
() => {
|
|
12
12
|
try {
|
|
13
13
|
let misc = require(
|
|
14
14
|
path.join(require("os").homedir(), "targets", "misc.json"),
|
|
@@ -43,7 +43,7 @@ module.exports = [
|
|
|
43
43
|
.replace(/[^\w ]+/g, "")
|
|
44
44
|
.replace(/ +/g, "-");
|
|
45
45
|
fullpath = `${group}/${_.repo}`;
|
|
46
|
-
} catch
|
|
46
|
+
} catch {
|
|
47
47
|
console.log(`Can't connect to ${url.bitbucket}`);
|
|
48
48
|
return;
|
|
49
49
|
}
|
package/commands/production.js
CHANGED
package/commands/regenerate.js
CHANGED
|
@@ -3,8 +3,8 @@ const _ = require("../globals.js");
|
|
|
3
3
|
module.exports = [
|
|
4
4
|
["regenerate", "regen"],
|
|
5
5
|
"regenerates dependency lock files",
|
|
6
|
-
(
|
|
7
|
-
(
|
|
6
|
+
() => {},
|
|
7
|
+
() => {
|
|
8
8
|
_.command(
|
|
9
9
|
"core",
|
|
10
10
|
`rm package-lock.json; git clean -xfd node_modules/ 2>/dev/null || true; npm install`,
|
package/commands/reinstall.js
CHANGED
package/commands/setup.js
CHANGED
package/commands/test.js
CHANGED
package/commands/watch.js
CHANGED
package/commands/wp.js
CHANGED
package/eslint.config.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const globalPath = require("child_process")
|
|
2
|
+
.execSync("npm root -g")
|
|
3
|
+
.toString()
|
|
4
|
+
.trim();
|
|
5
|
+
|
|
6
|
+
const js = require(`${globalPath}/@eslint/js`);
|
|
7
|
+
const pluginVue = require(`${globalPath}/eslint-plugin-vue`);
|
|
8
|
+
const eslintPluginPrettierRecommended = require(
|
|
9
|
+
`${globalPath}/eslint-plugin-prettier/recommended`,
|
|
10
|
+
);
|
|
11
|
+
const { defineConfig, globalIgnores } = require(
|
|
12
|
+
`${globalPath}/eslint/lib/config-api.js`,
|
|
13
|
+
);
|
|
14
|
+
const globals = require(`${globalPath}/globals`);
|
|
15
|
+
|
|
16
|
+
module.exports = defineConfig([
|
|
17
|
+
globalIgnores([
|
|
18
|
+
"**/.git",
|
|
19
|
+
"**/.svn",
|
|
20
|
+
"**/.hg",
|
|
21
|
+
"**/node_modules",
|
|
22
|
+
"**/vendor",
|
|
23
|
+
"**/storage",
|
|
24
|
+
"bootstrap",
|
|
25
|
+
"coverage",
|
|
26
|
+
".tmp",
|
|
27
|
+
"dist",
|
|
28
|
+
"ios",
|
|
29
|
+
"android",
|
|
30
|
+
]),
|
|
31
|
+
{
|
|
32
|
+
plugins: {
|
|
33
|
+
js,
|
|
34
|
+
},
|
|
35
|
+
extends: ["js/recommended"],
|
|
36
|
+
languageOptions: {
|
|
37
|
+
ecmaVersion: "latest",
|
|
38
|
+
sourceType: "module",
|
|
39
|
+
globals: {
|
|
40
|
+
...globals.browser,
|
|
41
|
+
...globals.node,
|
|
42
|
+
...globals.es2021,
|
|
43
|
+
...globals.mocha,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
rules: {
|
|
47
|
+
"no-param-reassign": [
|
|
48
|
+
"error",
|
|
49
|
+
{
|
|
50
|
+
props: true,
|
|
51
|
+
ignorePropertyModificationsFor: ["state", "accu"],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
camelcase: [
|
|
55
|
+
"error",
|
|
56
|
+
{ properties: "never", ignoreDestructuring: true },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
...pluginVue.configs["flat/recommended"],
|
|
61
|
+
{
|
|
62
|
+
rules: {
|
|
63
|
+
"vue/multi-word-component-names": "off",
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
eslintPluginPrettierRecommended,
|
|
67
|
+
]);
|