@automattic/vip 4.0.11 → 4.1.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.
@@ -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 (!isMultiSite) {
433
- console.log('Tables that will be imported by this process:');
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 `npm-shrinkwrap.json`.
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/docs/RELEASING.md CHANGED
@@ -76,6 +76,12 @@ You can release either using GitHub Actions or locally.
76
76
 
77
77
  This is the preferred method for pushing out the latest release. The workflow runs a bunch of validations, generates a build, bump versions + tags, pushes out to npm, and bumps to the next dev version.
78
78
 
79
+ The repository uses `package-lock.json` for npm 12 development and CI installs. An identical
80
+ `npm-shrinkwrap.json` is published with npm 11 so npm 11 and older consumers retain a locked CLI
81
+ dependency tree. Run `npm run sync:shrinkwrap` after changing `package-lock.json`; CI rejects drift
82
+ between the two files. The publish workflows intentionally use npm 11 because npm 12 excludes
83
+ `npm-shrinkwrap.json` from package tarballs.
84
+
79
85
  Please keep in mind internal guidelines before releasing.
80
86
 
81
87
  To release, follow these steps:
@@ -119,7 +125,7 @@ To publish locally, follow these steps:
119
125
  1. Push the tag to GitHub (`git push --tags`)
120
126
  1. Push the trunk branch `git push`
121
127
  1. Make sure you're part of the Automattic organization in npm
122
- 1. Publish the release to npm (`npm publish --access public`) the script will do some extra checks (
128
+ 1. Use npm 11 and publish the release (`npx --yes --package=npm@11 npm publish --access public`). The script will do some extra checks (
123
129
  node version, branch, etc) to ensure everything is correct. If all looks good, the new version
124
130
  will be published and you can proceed.
125
131
  1. Edit [the release on GitHub](https://github.com/Automattic/vip-cli/releases) to include a description
@@ -137,8 +143,8 @@ In order to do that, please follow this:
137
143
 
138
144
  <summary><details>
139
145
 
140
- 1. Manually change the version in `package.json` and `package-lock.json` to a dev version. Example: `1.4.0-dev1`
141
- 1. Run `npm publish --tag next` (When `--tag` is specified, we bypass the usual branch protection that doesn't allow you to publish form a brunch other than `trunk`).
146
+ 1. Set the dev version with npm 11 so both lockfiles remain synchronized. Example: `npx --yes --package=npm@11 npm version --no-git-tag-version 1.4.0-dev1`.
147
+ 1. Run `npx --yes --package=npm@11 npm publish --tag next` (When `--tag` is specified, we bypass the usual branch protection that doesn't allow you to publish form a brunch other than `trunk`).
142
148
 
143
149
  You can repeat this with every new version until you're happy with your version and ready to a public release. We currently don't support multiple branches for multiple versions. When it's the case, this process needs to be done for every version in every branch.
144
150
 
@@ -65,11 +65,19 @@ const parseOutput = output => {
65
65
  }
66
66
 
67
67
  if ( currentSection === SECTION_COMMAND ) {
68
- const [ , command, description ] = line.match( COMMAND_REGEXP );
69
- result.commands.push( {
70
- command,
71
- description,
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.log( 'Unknown option', line );
94
+ console.error( 'Unknown option', line );
84
95
  }
85
96
  continue;
86
97
  }
@@ -0,0 +1,32 @@
1
+ const { copyFileSync, readFileSync } = require( 'node:fs' );
2
+ const path = require( 'node:path' );
3
+
4
+ const PACKAGE_LOCK = 'package-lock.json';
5
+ const NPM_SHRINKWRAP = 'npm-shrinkwrap.json';
6
+
7
+ function syncShrinkwrap( { cwd = process.cwd(), check = false } = {} ) {
8
+ const packageLockPath = path.join( cwd, PACKAGE_LOCK );
9
+ const shrinkwrapPath = path.join( cwd, NPM_SHRINKWRAP );
10
+
11
+ if ( check ) {
12
+ const packageLock = readFileSync( packageLockPath );
13
+ const shrinkwrap = readFileSync( shrinkwrapPath );
14
+ if ( ! packageLock.equals( shrinkwrap ) ) {
15
+ throw new Error( `${ NPM_SHRINKWRAP } is out of sync with ${ PACKAGE_LOCK }` );
16
+ }
17
+ return;
18
+ }
19
+
20
+ copyFileSync( packageLockPath, shrinkwrapPath );
21
+ }
22
+
23
+ if ( require.main === module ) {
24
+ try {
25
+ syncShrinkwrap( { check: process.argv.includes( '--check' ) } );
26
+ } catch ( error ) {
27
+ console.error( error.message );
28
+ process.exitCode = 1;
29
+ }
30
+ }
31
+
32
+ module.exports = { syncShrinkwrap };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "4.0.11",
3
+ "version": "4.1.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "4.0.11",
9
+ "version": "4.1.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -25,7 +25,7 @@
25
25
  "enquirer": "2.4.1",
26
26
  "esbuild": "^0.28.0",
27
27
  "fetch-retry": "^6.0.0",
28
- "graphql": "17.0.1",
28
+ "graphql": "17.0.2",
29
29
  "graphql-tag": "2.12.7",
30
30
  "https-proxy-agent": "^9.0.0",
31
31
  "js-yaml": "^5.0.0",
@@ -8886,9 +8886,9 @@
8886
8886
  "license": "ISC"
8887
8887
  },
8888
8888
  "node_modules/graphql": {
8889
- "version": "17.0.1",
8890
- "resolved": "https://registry.npmjs.org/graphql/-/graphql-17.0.1.tgz",
8891
- "integrity": "sha512-8eWbg5Zcv/8o20nzEjHUGPTj20MLFJjc5kagbIPxbaeGxvFwpitJhemEC/k17n5+UD4M/9ea5rTuce78mELujQ==",
8889
+ "version": "17.0.2",
8890
+ "resolved": "https://registry.npmjs.org/graphql/-/graphql-17.0.2.tgz",
8891
+ "integrity": "sha512-FRWbddMxfkjiB7z+aQDWIR+E34xo9I8c9mtK2RPv8PmMzKRvrdsreHL/Ui/TmwHJfhHChEtsFPyMHKI+xuarQQ==",
8892
8892
  "license": "MIT",
8893
8893
  "engines": {
8894
8894
  "node": "^22.0.0 || ^24.0.0 || ^25.0.0 || >=26.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "4.0.11",
3
+ "version": "4.1.0",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -88,13 +88,16 @@
88
88
  "build:watch": "babel src -d dist --watch --source-maps --extensions=\".js,.ts\"",
89
89
  "format": "npm run cmd:format -- --write",
90
90
  "format:check": "npm run cmd:format -- --check",
91
+ "check:shrinkwrap": "node ./helpers/sync-shrinkwrap.js --check",
92
+ "sync:shrinkwrap": "node ./helpers/sync-shrinkwrap.js",
91
93
  "jest": "jest --testPathIgnorePatterns __tests__/devenv-e2e/",
92
94
  "jest:debug": "NODE_ENV=test node --inspect-brk=0.0.0.0:9252 ./node_modules/.bin/jest --forceExit --runInBand --testTimeout=100000000",
93
95
  "lint": "npm run cmd:lint .",
94
96
  "lint:fix": "npm run cmd:lint . -- --fix",
95
97
  "publish-please": "publish-please",
96
98
  "prepublishOnly": "node ./helpers/prepublishOnly.js",
97
- "smoke:release": "node ./helpers/release-smoke-test.js"
99
+ "smoke:release": "node ./helpers/release-smoke-test.js",
100
+ "version": "npm run sync:shrinkwrap"
98
101
  },
99
102
  "repository": {
100
103
  "type": "git",
@@ -160,7 +163,7 @@
160
163
  "enquirer": "2.4.1",
161
164
  "esbuild": "^0.28.0",
162
165
  "fetch-retry": "^6.0.0",
163
- "graphql": "17.0.1",
166
+ "graphql": "17.0.2",
164
167
  "graphql-tag": "2.12.7",
165
168
  "https-proxy-agent": "^9.0.0",
166
169
  "js-yaml": "^5.0.0",