@automattic/vip 3.8.0 → 3.8.2
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/dist/bin/vip-import-media-status.js +5 -3
- package/dist/bin/vip-import-media.js +5 -3
- package/dist/commands/dev-env-import-sql.js +1 -0
- package/dist/lib/cli/command.js +17 -0
- package/dist/lib/dev-environment/dev-environment-database.js +13 -1
- package/dist/lib/dev-environment/dev-environment-lando.js +1 -1
- package/dist/lib/media-import/progress.js +1 -1
- package/dist/lib/media-import/status.js +7 -4
- package/dist/lib/site-import/status.js +1 -4
- package/dist/lib/validations/is-multi-site-sql-dump.js +1 -1
- package/dist/lib/validations/site-type.js +1 -1
- package/docs/CHANGELOG.md +40 -22
- package/npm-shrinkwrap.json +733 -812
- package/package.json +9 -12
|
@@ -30,10 +30,11 @@ const appQuery = `
|
|
|
30
30
|
appQuery,
|
|
31
31
|
envContext: true,
|
|
32
32
|
requiredArgs: 0
|
|
33
|
-
}).option('exportFileErrorsToJson', 'Export any file errors encountered to a JSON file instead of a plain text file', false).argv(process.argv, async (arg, {
|
|
33
|
+
}).option('exportFileErrorsToJson', 'Export any file errors encountered to a JSON file instead of a plain text file', false).option('saveErrorLog', 'Download file-error logs without prompting', 'prompt').argv(process.argv, async (arg, {
|
|
34
34
|
app,
|
|
35
35
|
env,
|
|
36
|
-
exportFileErrorsToJson
|
|
36
|
+
exportFileErrorsToJson,
|
|
37
|
+
saveErrorLog
|
|
37
38
|
}) => {
|
|
38
39
|
const {
|
|
39
40
|
id: envId,
|
|
@@ -56,6 +57,7 @@ Checking the Media import status for your environment...
|
|
|
56
57
|
app,
|
|
57
58
|
env,
|
|
58
59
|
progressTracker,
|
|
59
|
-
exportFileErrorsToJson
|
|
60
|
+
exportFileErrorsToJson,
|
|
61
|
+
saveErrorLog
|
|
60
62
|
});
|
|
61
63
|
});
|
|
@@ -79,18 +79,19 @@ ${_chalk.default.red.bold('If no `uploads/` directory is found, all files will b
|
|
|
79
79
|
|
|
80
80
|
Are you sure you want to import the contents of the url?
|
|
81
81
|
`
|
|
82
|
-
}).command('status', 'Check the status of the latest Media Import').command('abort', 'Abort the Media Import running for your App').option('exportFileErrorsToJson', 'Export any file errors encountered to a JSON file instead of a plain text file', false).option('overwriteExistingFiles', 'Overwrite any existing files', false).option('importIntermediateImages', 'Import intermediate image files', false).examples(examples).argv(process.argv, async (args, opts) => {
|
|
82
|
+
}).command('status', 'Check the status of the latest Media Import').command('abort', 'Abort the Media Import running for your App').option('exportFileErrorsToJson', 'Export any file errors encountered to a JSON file instead of a plain text file', false).option('saveErrorLog', 'Download file-error logs without prompting').option('overwriteExistingFiles', 'Overwrite any existing files', false).option('importIntermediateImages', 'Import intermediate image files', false).examples(examples).argv(process.argv, async (args, opts) => {
|
|
83
83
|
const {
|
|
84
84
|
app,
|
|
85
85
|
env,
|
|
86
86
|
exportFileErrorsToJson,
|
|
87
|
+
saveErrorLog,
|
|
87
88
|
overwriteExistingFiles,
|
|
88
89
|
importIntermediateImages
|
|
89
90
|
} = opts;
|
|
90
91
|
const [url] = args;
|
|
91
92
|
if (!isSupportedUrl(url)) {
|
|
92
93
|
console.log(_chalk.default.red(`
|
|
93
|
-
Error:
|
|
94
|
+
Error:
|
|
94
95
|
Invalid URL provided: ${url}
|
|
95
96
|
Please make sure that it is a publicly accessible web URL containing an archive of the media files to import`));
|
|
96
97
|
return;
|
|
@@ -126,7 +127,8 @@ Importing Media into your App...
|
|
|
126
127
|
app,
|
|
127
128
|
env,
|
|
128
129
|
progressTracker,
|
|
129
|
-
exportFileErrorsToJson
|
|
130
|
+
exportFileErrorsToJson,
|
|
131
|
+
saveErrorLog
|
|
130
132
|
});
|
|
131
133
|
} catch (error) {
|
|
132
134
|
if (error.graphQLErrors) {
|
|
@@ -101,6 +101,7 @@ class DevEnvImportSQLCommand {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
await (0, _devEnvironmentDatabase.addAdminUser)(lando, this.slug);
|
|
104
|
+
await (0, _devEnvironmentDatabase.dataCleanup)(lando, this.slug, this.options.quiet);
|
|
104
105
|
}
|
|
105
106
|
getImportArgs(dumpDetails) {
|
|
106
107
|
let importArg = ['db', '--disable-auto-rehash'].concat(this.options.quiet ? '--silent' : []);
|
package/dist/lib/cli/command.js
CHANGED
|
@@ -296,6 +296,19 @@ _args.default.argv = async function (argv, cb) {
|
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
// Negotiate flag values
|
|
300
|
+
switch (_opts.module) {
|
|
301
|
+
case 'import-media':
|
|
302
|
+
if ([true, 'true', 'yes'].includes(options.saveErrorLog)) {
|
|
303
|
+
options.saveErrorLog = 'true';
|
|
304
|
+
} else if ([false, 'false', 'no'].includes(options.saveErrorLog)) {
|
|
305
|
+
options.saveErrorLog = 'false';
|
|
306
|
+
} else {
|
|
307
|
+
options.saveErrorLog = 'prompt';
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
|
|
299
312
|
// Prompt for confirmation if necessary
|
|
300
313
|
if (_opts.requireConfirm && !options.force) {
|
|
301
314
|
/** @type {Tuple[]} */
|
|
@@ -429,6 +442,10 @@ _args.default.argv = async function (argv, cb) {
|
|
|
429
442
|
key: 'Export any file errors encountered to a JSON file instead of a plain text file.',
|
|
430
443
|
value: options.exportFileErrorsToJson ? '✅ Yes' : `${_chalk.default.red('x')} No`
|
|
431
444
|
});
|
|
445
|
+
info.push({
|
|
446
|
+
key: 'Download file-error logs?',
|
|
447
|
+
value: options.saveErrorLog
|
|
448
|
+
});
|
|
432
449
|
break;
|
|
433
450
|
default:
|
|
434
451
|
}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.reIndexSearch = exports.flushCache = exports.addAdminUser = void 0;
|
|
4
|
+
exports.reIndexSearch = exports.flushCache = exports.dataCleanup = exports.addAdminUser = void 0;
|
|
5
5
|
var _devEnvironmentCore = require("./dev-environment-core");
|
|
6
6
|
const addAdminUser = async (lando, slug, quiet) => {
|
|
7
7
|
const addUserArg = ['wp', 'dev-env-add-admin', '--username=vipgo', '--password=password', '--skip-plugins', '--skip-themes'].concat(quiet ? ['--quiet'] : []);
|
|
8
8
|
await (0, _devEnvironmentCore.exec)(lando, slug, addUserArg);
|
|
9
9
|
};
|
|
10
10
|
exports.addAdminUser = addAdminUser;
|
|
11
|
+
const dataCleanup = async (lando, slug, quiet) => {
|
|
12
|
+
const cleanupArg = ['wp', 'vip', 'data-cleanup', 'sql-import'].concat(quiet ? ['--quiet'] : []);
|
|
13
|
+
try {
|
|
14
|
+
await (0, _devEnvironmentCore.exec)(lando, slug, cleanupArg, {
|
|
15
|
+
stdio: 'inherit'
|
|
16
|
+
});
|
|
17
|
+
} catch (error) {
|
|
18
|
+
// This must not be a fatal error
|
|
19
|
+
console.log('WARNING: data cleanup failed.');
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
exports.dataCleanup = dataCleanup;
|
|
11
23
|
const reIndexSearch = async (lando, slug) => {
|
|
12
24
|
await (0, _devEnvironmentCore.exec)(lando, slug, ['wp', 'cli', 'has-command', 'vip-search']);
|
|
13
25
|
await (0, _devEnvironmentCore.exec)(lando, slug, ['wp', 'vip-search', 'index', '--setup', '--network-wide', '--skip-confirm']);
|
|
@@ -80,7 +80,7 @@ async function getLandoConfig() {
|
|
|
80
80
|
subdir: '.',
|
|
81
81
|
namespace: '@lando'
|
|
82
82
|
}],
|
|
83
|
-
disablePlugins: [
|
|
83
|
+
disablePlugins: [],
|
|
84
84
|
proxyName: 'vip-dev-env-proxy',
|
|
85
85
|
userConfRoot: landoDir,
|
|
86
86
|
home: fakeHomeDir,
|
|
@@ -59,7 +59,7 @@ class MediaImportProgressTracker {
|
|
|
59
59
|
}
|
|
60
60
|
const statusIcon = (0, _status.getGlyphForStatus)(this.status.status ?? '', this.runningSprite);
|
|
61
61
|
let logs;
|
|
62
|
-
if (this.status.filesProcessed && this.status.filesTotal) {
|
|
62
|
+
if (typeof this.status.filesProcessed === 'number' && this.status.filesTotal) {
|
|
63
63
|
const progressPercentage = Math.floor(this.status.filesProcessed / this.status.filesTotal * 100);
|
|
64
64
|
logs = `Imported Files: ${this.status.filesProcessed}/${this.status.filesTotal} - ${progressPercentage}% ${statusIcon}`;
|
|
65
65
|
}
|
|
@@ -121,7 +121,8 @@ async function mediaImportCheckStatus({
|
|
|
121
121
|
app,
|
|
122
122
|
env,
|
|
123
123
|
progressTracker,
|
|
124
|
-
exportFileErrorsToJson
|
|
124
|
+
exportFileErrorsToJson,
|
|
125
|
+
saveErrorLog
|
|
125
126
|
}) {
|
|
126
127
|
// Stop printing so we can pass our callback
|
|
127
128
|
progressTracker.stopPrinting();
|
|
@@ -241,11 +242,13 @@ Downloading errors details from ${fileErrorsUrl}
|
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
async function promptFailureDetailsDownload(fileErrorsUrl) {
|
|
244
|
-
const failureDetails = await (0, _enquirer.prompt)({
|
|
245
|
+
const failureDetails = 'prompt' === saveErrorLog ? await (0, _enquirer.prompt)({
|
|
245
246
|
type: 'confirm',
|
|
246
247
|
name: 'download',
|
|
247
248
|
message: 'Download import errors report now? (Report will be downloadable for up to 7 days from the completion of the import)'
|
|
248
|
-
})
|
|
249
|
+
}) : {
|
|
250
|
+
download: ['true', 'yes'].includes(saveErrorLog)
|
|
251
|
+
};
|
|
249
252
|
if (!failureDetails.download) {
|
|
250
253
|
progressTracker.suffix += `${_chalk.default.yellow(`⚠️ An error report file has been generated for this media import. Access it within the next 15 minutes by clicking on the URL below.`)}`;
|
|
251
254
|
progressTracker.suffix += `\n${_chalk.default.yellow(`Or, generate a new URL by running the ${_chalk.default.bgYellow('vip import media status')} command.`)} `;
|
|
@@ -260,7 +263,7 @@ Downloading errors details from ${fileErrorsUrl}
|
|
|
260
263
|
await exportFailureDetails(failureDetailsErrors);
|
|
261
264
|
}
|
|
262
265
|
function printFileErrorsReportLinkExpiredError(results) {
|
|
263
|
-
if (results.filesTotal && results.filesProcessed && results.filesTotal !== results.filesProcessed) {
|
|
266
|
+
if (results.filesTotal && typeof results.filesProcessed === 'number' && results.filesTotal !== results.filesProcessed) {
|
|
264
267
|
const errorsFound = results.filesTotal - results.filesProcessed;
|
|
265
268
|
progressTracker.suffix += `${_chalk.default.yellow(`⚠️ ${errorsFound} error(s) were found. File import errors report link expired.`)}`;
|
|
266
269
|
}
|
|
@@ -76,9 +76,6 @@ async function getStatus(api, appId, envId) {
|
|
|
76
76
|
jobs,
|
|
77
77
|
launched
|
|
78
78
|
} = environment;
|
|
79
|
-
if (!environment.isK8sResident && !jobs?.length) {
|
|
80
|
-
return {};
|
|
81
|
-
}
|
|
82
79
|
const [importJob] = jobs ?? [];
|
|
83
80
|
return {
|
|
84
81
|
importStatus,
|
|
@@ -218,7 +215,7 @@ ${maybeExitPrompt}
|
|
|
218
215
|
} = status;
|
|
219
216
|
let jobStatus;
|
|
220
217
|
let jobSteps = [];
|
|
221
|
-
if (
|
|
218
|
+
if (!isMissingImportJobAndShouldReturnFast) {
|
|
222
219
|
// in the future the API may provide this in k8s jobs so account for that.
|
|
223
220
|
// Until then we need to create the importJob from the status object.
|
|
224
221
|
if (!importJob) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.sqlDumpLineIsMultiSite = sqlDumpLineIsMultiSite;
|
|
5
|
-
const SQL_CREATE_TABLE_IS_MULTISITE_REGEX = /^CREATE TABLE `?(wp_\d+_[a-z0-9_]*|wp_blogs)/i;
|
|
5
|
+
const SQL_CREATE_TABLE_IS_MULTISITE_REGEX = /^CREATE TABLE(?: IF NOT EXISTS)? `?(wp_\d+_[a-z0-9_]*|wp_blogs)/i;
|
|
6
6
|
const SQL_CONTAINS_MULTISITE_WP_USERS_REGEX = /`spam` tinyint\(2\)|`deleted` tinyint\(2\)/i;
|
|
7
7
|
function sqlDumpLineIsMultiSite(line) {
|
|
8
8
|
// determine if we're on a CREATE TABLE statement line what has eg. wp_\d_options OR wp_blogs
|
|
@@ -40,7 +40,7 @@ const siteTypeValidations = exports.siteTypeValidations = {
|
|
|
40
40
|
await track('import_sql_command_error', {
|
|
41
41
|
error_type: 'subsite-import-without-subsite-sql-dump'
|
|
42
42
|
});
|
|
43
|
-
throw new Error('You have requested a subsite SQL import but have not provided a subsite
|
|
43
|
+
throw new Error('You have requested a subsite SQL import but have not provided a subsite compatible SQL dump.');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Get Primary Domain
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,52 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
## 3.8.1
|
|
4
|
+
|
|
5
|
+
* fix(dev-env): clean up data after `vip dev-env sync sql`
|
|
6
|
+
* security: fix high severity CVE-2024-39338 in `axios`
|
|
7
|
+
|
|
8
|
+
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.8.0...3.8.1
|
|
9
|
+
|
|
10
|
+
## 3.8.0
|
|
11
|
+
|
|
12
|
+
* build(deps-dev): bump @babel/preset-env from 7.24.8 to 7.25.0 in the babel group
|
|
13
|
+
* build(deps): bump debug from 4.3.5 to 4.3.6
|
|
14
|
+
* SQL Import: Switch to wpSitesSDS query
|
|
15
|
+
* Extract many import-sql functionality to a separate file
|
|
16
|
+
* build(deps-dev): bump the babel group across 1 directory with 2 updates
|
|
17
|
+
* build(deps): bump adm-zip from 0.5.14 to 0.5.15
|
|
18
|
+
* build(deps): bump step-security/harden-runner from 2.9.0 to 2.9.1
|
|
19
|
+
* BB8-11630: Add confirmation for production env vars setting/deleting
|
|
20
|
+
* Remove querying `fileErrors` in Graphql API while fetching Media import status
|
|
21
|
+
* Mydumper integration
|
|
22
|
+
|
|
23
|
+
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.7.1...3.8.0
|
|
24
|
+
|
|
3
25
|
## 3.7.1
|
|
4
26
|
|
|
5
|
-
*
|
|
6
|
-
* build(deps): bump
|
|
7
|
-
* build(deps): bump
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* build(deps): bump
|
|
11
|
-
* build(deps-dev): bump
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* build(deps): bump
|
|
15
|
-
*
|
|
16
|
-
* Gracefully fail when directory is not detected by @ariskataoka in #1947
|
|
17
|
-
* New package release: v3.7.1 by @github-actions in #1966
|
|
27
|
+
* build(deps): bump step-security/harden-runner from 2.8.1 to 2.9.0
|
|
28
|
+
* build(deps): bump semver from 7.6.2 to 7.6.3
|
|
29
|
+
* build(deps-dev): bump @types/node from 18.19.39 to 18.19.41
|
|
30
|
+
* refactor(dev-env): do not load SSH keys
|
|
31
|
+
* build(deps): bump tar from 7.4.0 to 7.4.1
|
|
32
|
+
* build(deps-dev): bump typescript from 5.5.3 to 5.5.4
|
|
33
|
+
* build(deps-dev): bump @types/node from 18.19.41 to 18.19.42
|
|
34
|
+
* Refactor dev-env sync, dev-env import and export-sql to TypeScript
|
|
35
|
+
* build(deps): bump tar from 7.4.1 to 7.4.3
|
|
36
|
+
* build(deps-dev): bump @types/dockerode from 3.3.30 to 3.3.31
|
|
37
|
+
* Gracefully fail when directory is not detected
|
|
18
38
|
|
|
19
39
|
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.7.0...3.7.1
|
|
20
40
|
|
|
21
41
|
## 3.7.0
|
|
22
42
|
|
|
23
|
-
*
|
|
24
|
-
* build(deps-dev): bump
|
|
25
|
-
* build(deps
|
|
26
|
-
* build(deps): bump
|
|
27
|
-
* build(deps): bump
|
|
28
|
-
* build(deps-dev): bump @
|
|
29
|
-
*
|
|
30
|
-
* update: media import validate-files by @ariskataoka in #1919
|
|
31
|
-
* New package release: v3.7.0 by @github-actions in #1943
|
|
43
|
+
* build(deps-dev): bump @automattic/eslint-plugin-wpvip from 0.12.0 to 0.13.0
|
|
44
|
+
* build(deps-dev): bump the babel group with 3 updates
|
|
45
|
+
* build(deps): bump update-notifier from 7.0.0 to 7.1.0
|
|
46
|
+
* build(deps): bump actions/dependency-review-action from 4.3.3 to 4.3.4
|
|
47
|
+
* build(deps-dev): bump @babel/core from 7.24.8 to 7.24.9 in the babel group
|
|
48
|
+
* build(deps-dev): bump @types/dockerode from 3.3.29 to 3.3.30
|
|
49
|
+
* update: media import validate-files
|
|
32
50
|
|
|
33
51
|
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.6.0...3.7.0
|
|
34
52
|
|