@automattic/vip 4.0.11 → 4.0.13
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-sql.js +4 -46
- package/docs/COMMANDER-MIGRATION.md +1 -1
- package/helpers/generate-docs.js +17 -6
- package/package.json +2 -2
- package/npm-shrinkwrap.json +0 -15470
|
@@ -48,12 +48,6 @@ const appQuery = `
|
|
|
48
48
|
dbOperationInProgress
|
|
49
49
|
importInProgress
|
|
50
50
|
}
|
|
51
|
-
wpSitesSDS {
|
|
52
|
-
nodes {
|
|
53
|
-
homeUrl
|
|
54
|
-
id
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
51
|
}
|
|
58
52
|
`;
|
|
59
53
|
const START_IMPORT_MUTATION = (0, _graphqlTag.default)`
|
|
@@ -403,7 +397,6 @@ const displayPlaybook = ({
|
|
|
403
397
|
fileName,
|
|
404
398
|
domain,
|
|
405
399
|
formattedEnvironment,
|
|
406
|
-
unformattedEnvironment,
|
|
407
400
|
isMultiSite,
|
|
408
401
|
app
|
|
409
402
|
}) => {
|
|
@@ -418,53 +411,19 @@ const displayPlaybook = ({
|
|
|
418
411
|
};
|
|
419
412
|
(0, _format.formatSearchReplaceValues)(searchReplace, output);
|
|
420
413
|
}
|
|
421
|
-
let siteArray = [];
|
|
422
414
|
if (isMultiSite) {
|
|
423
415
|
console.log(` multisite: ${isMultiSite.toString()}`);
|
|
424
|
-
const selectedEnvironmentObj = app?.environments?.find(env => unformattedEnvironment === env.type);
|
|
425
|
-
siteArray = selectedEnvironmentObj?.wpSitesSDS?.nodes;
|
|
426
416
|
}
|
|
427
417
|
if (!tableNames.length) {
|
|
428
418
|
debug('Validation was skipped. No playbook information will be displayed.');
|
|
429
419
|
} else {
|
|
430
420
|
// output the table names
|
|
431
421
|
console.log();
|
|
432
|
-
if (
|
|
433
|
-
console.log('
|
|
434
|
-
console.log((0, _cliColumns.default)(tableNames));
|
|
435
|
-
} else {
|
|
436
|
-
// we have siteArray from the API, use it and the table names together
|
|
437
|
-
if (siteArray === 'undefined' || !siteArray) {
|
|
438
|
-
console.log(_chalk.default.yellowBright('Unable to determine the network sites affected by this import. Please proceed only if you are confident that the contents of the file are valid for import.'));
|
|
439
|
-
return;
|
|
440
|
-
} else if (!siteArray?.length) {
|
|
441
|
-
throw new Error('There were no sites in your multisite installation.');
|
|
442
|
-
}
|
|
443
|
-
const multiSiteBreakdown = siteArray.map(wpSite => {
|
|
444
|
-
let siteRegex;
|
|
445
|
-
if (wpSite.id === 1) {
|
|
446
|
-
siteRegex = /^wp_[a-z]+/i;
|
|
447
|
-
} else {
|
|
448
|
-
// eslint-disable-next-line security/detect-non-literal-regexp
|
|
449
|
-
siteRegex = new RegExp(`^wp_${parseInt(wpSite.id, 10)}_[a-z]+`, 'i');
|
|
450
|
-
}
|
|
451
|
-
const tableNamesInGroup = tableNames.filter(name => siteRegex.test(name));
|
|
452
|
-
return {
|
|
453
|
-
id: wpSite.id,
|
|
454
|
-
url: wpSite.homeUrl,
|
|
455
|
-
tables: tableNamesInGroup
|
|
456
|
-
};
|
|
457
|
-
});
|
|
458
|
-
if (launched) {
|
|
459
|
-
console.log(_chalk.default.yellowBright('You are updating tables in a launched multisite environment. The performance of sites on the network might be impacted by this operation.'));
|
|
460
|
-
}
|
|
461
|
-
console.log(_chalk.default.yellow('The following sites will be affected by the import:'));
|
|
462
|
-
multiSiteBreakdown.forEach(siteObject => {
|
|
463
|
-
console.log();
|
|
464
|
-
console.log(_chalk.default.blueBright(`Blog with ID ${siteObject.id} and URL ${siteObject.url} will import the following tables:`));
|
|
465
|
-
console.log((0, _cliColumns.default)(siteObject.tables));
|
|
466
|
-
});
|
|
422
|
+
if (isMultiSite && launched) {
|
|
423
|
+
console.log(_chalk.default.yellowBright('You are updating tables in a launched multisite environment. The performance of sites on the network might be impacted by this operation.'));
|
|
467
424
|
}
|
|
425
|
+
console.log('Tables that will be imported by this process:');
|
|
426
|
+
console.log((0, _cliColumns.default)(tableNames));
|
|
468
427
|
}
|
|
469
428
|
};
|
|
470
429
|
(0, _command.default)({
|
|
@@ -546,7 +505,6 @@ const displayPlaybook = ({
|
|
|
546
505
|
fileName: fileNameOrURL,
|
|
547
506
|
domain,
|
|
548
507
|
formattedEnvironment,
|
|
549
|
-
unformattedEnvironment: opts.env.type,
|
|
550
508
|
isMultiSite,
|
|
551
509
|
app
|
|
552
510
|
});
|
|
@@ -5,7 +5,7 @@ Goal: remove the abandoned `args` package, keep CLI behavior stable, and support
|
|
|
5
5
|
## Migration Outcome
|
|
6
6
|
|
|
7
7
|
- `src/lib/cli/command.js` is the active Commander-backed compatibility wrapper for all bins that call `command()`.
|
|
8
|
-
- `args` has been removed from `package.json` and `
|
|
8
|
+
- `args` has been removed from `package.json` and `package-lock.json`.
|
|
9
9
|
- Root command flow (`src/bin/vip.js`) now dispatches via the shared Commander wrapper again, preserving login gating and subcommand chaining.
|
|
10
10
|
- Temporary side-path wrapper work has been removed (`src/lib/cli/command-commander.ts` deleted).
|
|
11
11
|
|
package/helpers/generate-docs.js
CHANGED
|
@@ -65,11 +65,19 @@ const parseOutput = output => {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
if ( currentSection === SECTION_COMMAND ) {
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
command,
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
const match = line.match( COMMAND_REGEXP );
|
|
69
|
+
if ( match ) {
|
|
70
|
+
const [ , command, description ] = match;
|
|
71
|
+
result.commands.push( {
|
|
72
|
+
command,
|
|
73
|
+
description,
|
|
74
|
+
} );
|
|
75
|
+
} else if ( result.commands.length ) {
|
|
76
|
+
// Continuation of a wrapped command description.
|
|
77
|
+
result.commands[ result.commands.length - 1 ].description += ' ' + line;
|
|
78
|
+
} else {
|
|
79
|
+
console.error( 'Unknown command line', line );
|
|
80
|
+
}
|
|
73
81
|
continue;
|
|
74
82
|
}
|
|
75
83
|
if ( currentSection === SECTION_OPTIONS ) {
|
|
@@ -79,8 +87,11 @@ const parseOutput = output => {
|
|
|
79
87
|
option,
|
|
80
88
|
description,
|
|
81
89
|
} );
|
|
90
|
+
} else if ( result.options.length ) {
|
|
91
|
+
// Continuation of a wrapped option description.
|
|
92
|
+
result.options[ result.options.length - 1 ].description += ' ' + line;
|
|
82
93
|
} else {
|
|
83
|
-
console.
|
|
94
|
+
console.error( 'Unknown option', line );
|
|
84
95
|
}
|
|
85
96
|
continue;
|
|
86
97
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automattic/vip",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.13",
|
|
4
4
|
"description": "The VIP Javascript library & CLI",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"enquirer": "2.4.1",
|
|
161
161
|
"esbuild": "^0.28.0",
|
|
162
162
|
"fetch-retry": "^6.0.0",
|
|
163
|
-
"graphql": "17.0.
|
|
163
|
+
"graphql": "17.0.2",
|
|
164
164
|
"graphql-tag": "2.12.7",
|
|
165
165
|
"https-proxy-agent": "^9.0.0",
|
|
166
166
|
"js-yaml": "^5.0.0",
|