@automattic/vip 2.13.1 → 2.14.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.
- package/README.md +7 -0
- package/dist/bin/vip-dev-env-exec.js +9 -2
- package/dist/lib/dev-environment/dev-environment-cli.js +2 -2
- package/dist/lib/dev-environment/dev-environment-core.js +3 -3
- package/dist/lib/dev-environment/dev-environment-lando.js +8 -5
- package/dist/lib/validations/sql.js +46 -6
- package/npm-shrinkwrap.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -26,6 +26,13 @@ By default, we record information about the usage of this tool using an in-house
|
|
|
26
26
|
|
|
27
27
|
## Changelog
|
|
28
28
|
|
|
29
|
+
### 2.14.0 (19 Jul 2022)
|
|
30
|
+
|
|
31
|
+
- #1059 Update engines to show support for npm > 6
|
|
32
|
+
- #1058 [dev-env] switch dev-env error during import to warning
|
|
33
|
+
- #1057 [dev-env] Update debug instruction example
|
|
34
|
+
- #1055 [dev-env] Makes exec attempt to run the task even if env seems to be down
|
|
35
|
+
|
|
29
36
|
### 2.13.1 (20 Jun 2022)
|
|
30
37
|
|
|
31
38
|
- #1052 [dev-env] Update/lando compose version
|
|
@@ -38,7 +38,11 @@ const examples = [{
|
|
|
38
38
|
}];
|
|
39
39
|
(0, _command.default)({
|
|
40
40
|
wildcardCommand: true
|
|
41
|
-
}).option('slug', 'Custom name of the dev environment').
|
|
41
|
+
}).option('slug', 'Custom name of the dev environment').option('force', 'Disabling validations before task execution', undefined, value => {
|
|
42
|
+
var _value$toLowerCase;
|
|
43
|
+
|
|
44
|
+
return 'false' !== (value === null || value === void 0 ? void 0 : (_value$toLowerCase = value.toLowerCase) === null || _value$toLowerCase === void 0 ? void 0 : _value$toLowerCase.call(value));
|
|
45
|
+
}).examples(examples).argv(process.argv, async (unmatchedArgs, opt) => {
|
|
42
46
|
await (0, _devEnvironmentCli.validateDependencies)();
|
|
43
47
|
const slug = (0, _devEnvironmentCli.getEnvironmentName)(opt);
|
|
44
48
|
const trackingInfo = (0, _devEnvironmentCli.getEnvTrackingInfo)(slug);
|
|
@@ -59,7 +63,10 @@ const examples = [{
|
|
|
59
63
|
arg = process.argv.slice(argSplitterIx + 1);
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
const options = {
|
|
67
|
+
force: opt.force
|
|
68
|
+
};
|
|
69
|
+
await (0, _devEnvironmentCore.exec)(slug, arg, options);
|
|
63
70
|
await (0, _tracker.trackEvent)('dev_env_exec_command_success', trackingInfo);
|
|
64
71
|
} catch (error) {
|
|
65
72
|
(0, _devEnvironmentCli.handleCLIException)(error, 'dev_env_exec_command_error', trackingInfo);
|
|
@@ -91,9 +91,9 @@ async function handleCLIException(exception, trackKey, trackBaseInfo = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if (!process.env.DEBUG) {
|
|
94
|
-
console.log(
|
|
94
|
+
console.log(`\nPlease re-run the command with "--debug ${_chalk.default.bold('@automattic/vip:bin:dev-environment')}" appended to it and provide the stack trace on the support ticket.`);
|
|
95
95
|
console.log(_chalk.default.bold('\nExample:\n'));
|
|
96
|
-
console.log('vip dev-env
|
|
96
|
+
console.log('vip dev-env <command> <arguments> --debug @automattic/vip:bin:dev-environment \n');
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
debug(exception);
|
|
@@ -213,8 +213,8 @@ async function printEnvironmentInfo(slug) {
|
|
|
213
213
|
(0, _devEnvironmentCli.printTable)(appInfo);
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
async function exec(slug, args) {
|
|
217
|
-
debug('Will run a wp command on env', slug, 'with args', args);
|
|
216
|
+
async function exec(slug, args, options = {}) {
|
|
217
|
+
debug('Will run a wp command on env', slug, 'with args', args, ' and options', options);
|
|
218
218
|
const instancePath = getEnvironmentPath(slug);
|
|
219
219
|
debug('Instance path for', slug, 'is:', instancePath);
|
|
220
220
|
|
|
@@ -231,7 +231,7 @@ async function exec(slug, args) {
|
|
|
231
231
|
commandArgs = [...args.map(argument => argument.replace('--new-site-', '--'))];
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
await (0, _devEnvironmentLando.landoExec)(instancePath, command, commandArgs);
|
|
234
|
+
await (0, _devEnvironmentLando.landoExec)(instancePath, command, commandArgs, options);
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
function doesEnvironmentExist(slug) {
|
|
@@ -140,7 +140,7 @@ async function healthcheckHook(app, lando) {
|
|
|
140
140
|
services: [container.service]
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
|
-
} catch (
|
|
143
|
+
} catch (exception) {
|
|
144
144
|
debug(`${container.service} Health check failed`);
|
|
145
145
|
notHealthyContainers.push(container);
|
|
146
146
|
}
|
|
@@ -272,15 +272,18 @@ async function isEnvUp(app) {
|
|
|
272
272
|
return (scanResult === null || scanResult === void 0 ? void 0 : scanResult.length) && scanResult.filter(result => result.status).length === scanResult.length;
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
async function landoExec(instancePath, toolName, args) {
|
|
275
|
+
async function landoExec(instancePath, toolName, args, options) {
|
|
276
276
|
const lando = new _lando.default(getLandoConfig());
|
|
277
277
|
await lando.bootstrap();
|
|
278
278
|
const app = lando.getApp(instancePath);
|
|
279
279
|
await app.init();
|
|
280
|
-
const isUp = await isEnvUp(app);
|
|
281
280
|
|
|
282
|
-
if (!
|
|
283
|
-
|
|
281
|
+
if (!options.force) {
|
|
282
|
+
const isUp = await isEnvUp(app);
|
|
283
|
+
|
|
284
|
+
if (!isUp) {
|
|
285
|
+
throw new Error('environment needs to be started before running wp command');
|
|
286
|
+
}
|
|
284
287
|
}
|
|
285
288
|
|
|
286
289
|
const tool = app.config.tooling[toolName];
|
|
@@ -41,6 +41,10 @@ function formatError(message) {
|
|
|
41
41
|
return `${_chalk.default.red('SQL Error:')} ${message}`;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
function formatWarning(message) {
|
|
45
|
+
return `${_chalk.default.yellow('Warning:')} ${message}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
44
48
|
function formatRecommendation(message) {
|
|
45
49
|
return `${_chalk.default.yellow('Recommendation:')} ${message}`;
|
|
46
50
|
}
|
|
@@ -51,13 +55,24 @@ const generalCheckFormatter = check => {
|
|
|
51
55
|
const validProblems = check.results.filter(result => !result.falsePositive);
|
|
52
56
|
|
|
53
57
|
if (validProblems.length > 0) {
|
|
54
|
-
|
|
58
|
+
if (validProblems.some(result => !result.warning)) {
|
|
59
|
+
problemsFound += 1;
|
|
60
|
+
}
|
|
55
61
|
|
|
56
62
|
for (const problem of validProblems) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
const text = `${problem.text || check.message} on line ${problem.lineNumber || ''}.`;
|
|
64
|
+
|
|
65
|
+
if (problem.warning) {
|
|
66
|
+
errors.push({
|
|
67
|
+
warning: formatWarning(text),
|
|
68
|
+
recommendation: formatRecommendation(problem.recomendation || check.recommendation)
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
errors.push({
|
|
72
|
+
error: formatError(text),
|
|
73
|
+
recommendation: formatRecommendation(problem.recomendation || check.recommendation)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
61
76
|
}
|
|
62
77
|
} else {
|
|
63
78
|
infos.push(`✅ ${check.message} was found 0 times.`);
|
|
@@ -268,6 +283,7 @@ const checks = {
|
|
|
268
283
|
}
|
|
269
284
|
|
|
270
285
|
return {
|
|
286
|
+
warning: true,
|
|
271
287
|
lineNumber,
|
|
272
288
|
recomendation: `Use '--search-replace="${foundDomain},${expectedDomain}"' switch to replace the domain`
|
|
273
289
|
};
|
|
@@ -304,12 +320,21 @@ const postValidation = async options => {
|
|
|
304
320
|
|
|
305
321
|
const errorSummary = {};
|
|
306
322
|
const checkEntries = Object.entries(checks).filter(([type]) => !options.skipChecks.includes(type));
|
|
323
|
+
const formattedWarnings = [];
|
|
307
324
|
let formattedErrors = [];
|
|
308
325
|
let formattedInfos = [];
|
|
309
326
|
|
|
310
327
|
for (const [type, check] of checkEntries) {
|
|
311
328
|
const formattedOutput = check.outputFormatter(check, type, options.isImport);
|
|
312
|
-
|
|
329
|
+
|
|
330
|
+
for (const error of formattedOutput.errors) {
|
|
331
|
+
if (error.warning) {
|
|
332
|
+
formattedWarnings.push(error);
|
|
333
|
+
} else {
|
|
334
|
+
formattedErrors.push(error);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
313
338
|
formattedInfos = formattedInfos.concat(formattedOutput.infos);
|
|
314
339
|
errorSummary[type] = check.results.length;
|
|
315
340
|
} // eslint-disable-next-line camelcase
|
|
@@ -341,6 +366,21 @@ const postValidation = async options => {
|
|
|
341
366
|
formattedErrors = formattedErrors.concat(errorObject);
|
|
342
367
|
}
|
|
343
368
|
|
|
369
|
+
if (formattedWarnings.length) {
|
|
370
|
+
const warningOutput = [];
|
|
371
|
+
formattedWarnings.forEach(warning => {
|
|
372
|
+
warningOutput.push(warning.warning);
|
|
373
|
+
|
|
374
|
+
if (warning.recommendation) {
|
|
375
|
+
warningOutput.push(warning.recommendation);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
warningOutput.push('');
|
|
379
|
+
});
|
|
380
|
+
console.log(warningOutput.join('\n'));
|
|
381
|
+
console.log('');
|
|
382
|
+
}
|
|
383
|
+
|
|
344
384
|
if (problemsFound > 0) {
|
|
345
385
|
await (0, _tracker.trackEvent)('import_validate_sql_command_failure', {
|
|
346
386
|
is_import: options.isImport,
|
package/npm-shrinkwrap.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.14.0",
|
|
4
4
|
"description": "The VIP Javascript library & CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"license": "MIT",
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=14.14.0",
|
|
75
|
-
"npm": "
|
|
75
|
+
"npm": ">=6"
|
|
76
76
|
},
|
|
77
77
|
"bugs": {
|
|
78
78
|
"url": "https://github.com/Automattic/vip/issues"
|