@automattic/vip 3.19.1 → 3.19.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.
@@ -13,17 +13,14 @@ const exampleUsage = 'vip dev-env info';
13
13
  const usage = 'vip dev-env info';
14
14
  const examples = [{
15
15
  usage: `${exampleUsage} --slug=example-site`,
16
- description: 'Retrieve basic information about the local environment named "example-site".'
17
- }, {
18
- usage: `${exampleUsage} --slug=example-site --extended`,
19
- description: 'Retrieve a larger amount of information about the local environment named "example-site".'
16
+ description: 'Retrieve information about the local environment named "example-site".'
20
17
  }, {
21
18
  usage: `${exampleUsage} --all`,
22
- description: 'Retrieve basic information about all local environments.'
19
+ description: 'Retrieve information about all local environments.'
23
20
  }];
24
21
  (0, _command.default)({
25
22
  usage
26
- }).option('slug', 'A unique name for a local environment. Default is "vip-local".', undefined, _devEnvironmentCli.processSlug).option('all', 'Retrieve information about all local environments.').option('extended', 'Retrieve a larger amount of information.').examples(examples).argv(process.argv, async (arg, opt) => {
23
+ }).option('slug', 'A unique name for a local environment. Default is "vip-local".', undefined, _devEnvironmentCli.processSlug).option('all', 'Retrieve information about all local environments.').option('extended', 'Deprecated, not used.').examples(examples).argv(process.argv, async (arg, opt) => {
27
24
  let trackingInfo;
28
25
  let slug;
29
26
  const lando = await (0, _devEnvironmentLando.bootstrapLando)();
@@ -41,7 +38,7 @@ const examples = [{
41
38
  debug('Args: ', arg, 'Options: ', opt);
42
39
  try {
43
40
  const options = {
44
- extended: Boolean(opt.extended),
41
+ extended: true,
45
42
  suppressWarnings: true
46
43
  };
47
44
  if (opt.all) {
@@ -4,7 +4,6 @@
4
4
  var _devEnvSyncSql = require("../commands/dev-env-sync-sql");
5
5
  var _command = _interopRequireDefault(require("../lib/cli/command"));
6
6
  var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
7
- var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
8
7
  var _devEnvironmentLando = require("../lib/dev-environment/dev-environment-lando");
9
8
  var _tracker = require("../lib/tracker");
10
9
  var _userError = _interopRequireDefault(require("../lib/user-error"));
@@ -58,8 +57,8 @@ const appQuery = `
58
57
  });
59
58
  await trackerFn('execute');
60
59
  const lando = await (0, _devEnvironmentLando.bootstrapLando)();
61
- const envPath = (0, _devEnvironmentCore.getEnvironmentPath)(slug);
62
- if (!(await (0, _devEnvironmentLando.isEnvUp)(lando, envPath)) && !opt.force) {
60
+ const isUp = (await Promise.all([(0, _devEnvironmentLando.isContainerRunning)(lando, slug, 'php'), (0, _devEnvironmentLando.isContainerRunning)(lando, slug, 'database')])).every(Boolean);
61
+ if (!isUp && !opt.force) {
63
62
  await trackerFn('env_not_running_error', {
64
63
  errorMessage: 'Environment was not running'
65
64
  });
@@ -10,6 +10,7 @@ var _socket2 = _interopRequireDefault(require("socket.io-stream"));
10
10
  var _stream = require("stream");
11
11
  var _wpSsh = require("../commands/wp-ssh");
12
12
  var _api = _interopRequireWildcard(require("../lib/api"));
13
+ var _app = require("../lib/app");
13
14
  var _command = _interopRequireWildcard(require("../lib/cli/command"));
14
15
  var exit = _interopRequireWildcard(require("../lib/cli/exit"));
15
16
  var _format = require("../lib/cli/format");
@@ -20,7 +21,7 @@ var _tracker = require("../lib/tracker");
20
21
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
21
22
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
23
  const debug = (0, _debug.default)('@automattic/vip:wp');
23
- const appQuery = `id, name,
24
+ const appQuery = `id, name, typeId,
24
25
  organization {
25
26
  id
26
27
  name
@@ -317,6 +318,7 @@ const examples = [{
317
318
  const {
318
319
  id: appId,
319
320
  name: appName,
321
+ typeId: appTypeId,
320
322
  organization: {
321
323
  id: orgId
322
324
  }
@@ -325,6 +327,9 @@ const examples = [{
325
327
  id: envId,
326
328
  type: envName
327
329
  } = opts.env;
330
+ if ((0, _app.isAppNodejs)(appTypeId)) {
331
+ exit.withError('WP-CLI commands are not supported on Node.js environments.');
332
+ }
328
333
 
329
334
  /* eslint-disable camelcase */
330
335
  const commonTrackingParams = {
@@ -55,7 +55,8 @@ class DevEnvImportSQLCommand {
55
55
  } = this.options;
56
56
  const resolvedPath = await (0, _devEnvironmentCore.resolveImportPath)(this.slug, this.fileName, searchReplace, inPlace);
57
57
  if (!this.options.skipValidate) {
58
- if (!(await (0, _devEnvironmentLando.isEnvUp)(lando, (0, _devEnvironmentCore.getEnvironmentPath)(this.slug)))) {
58
+ const isUp = (await Promise.all([(0, _devEnvironmentLando.isContainerRunning)(lando, this.slug, 'php'), (0, _devEnvironmentLando.isContainerRunning)(lando, this.slug, 'database')])).every(Boolean);
59
+ if (!isUp) {
59
60
  throw new _userError.default('Environment needs to be started first');
60
61
  }
61
62
  const expectedDomain = `${this.slug}.${lando.config.domain}`;
@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  exports.bootstrapLando = bootstrapLando;
5
5
  exports.checkEnvHealth = checkEnvHealth;
6
6
  exports.getProxyContainer = getProxyContainer;
7
+ exports.isContainerRunning = isContainerRunning;
7
8
  exports.isEnvUp = isEnvUp;
8
9
  exports.landoDestroy = landoDestroy;
9
10
  exports.landoExec = landoExec;
@@ -594,4 +595,18 @@ function validateDockerInstalled(lando) {
594
595
  throw new Error(`docker-compose version ${compose} is not supported. Please upgrade to version 2.0.0 or higher - https://docs.docker.com/compose/install/`);
595
596
  }
596
597
  }
598
+ }
599
+ async function isContainerRunning(lando, slug, serviceName) {
600
+ const envPath = (0, _devEnvironmentCore.getEnvironmentPath)(slug);
601
+ const app = await getLandoApplication(lando, envPath);
602
+ const {
603
+ docker
604
+ } = app.engine;
605
+ const containers = await docker.listContainers({
606
+ filters: {
607
+ label: [`com.docker.compose.project=${app.project}`, `com.docker.compose.service=${serviceName}`],
608
+ status: ['running']
609
+ }
610
+ });
611
+ return containers.length > 0;
597
612
  }
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  ## Changelog
2
2
 
3
+ ### 3.19.2
4
+
5
+ * Improve environment checks when importing or syncing local databases to prevent common errors.
6
+ * Remove outdated options and clarify usage instructions for environment info commands.
7
+ * Prevent certain unsupported commands from running in incompatible environments.
8
+ * Upgrade internal components for better compatibility and future support.
9
+
10
+ * refactor(dev-env): deprecate `extended` option in `vip dev-env info`
11
+ * build(deps-dev): bump typescript from 5.8.3 to 5.9.2
12
+ * build(deps): bump @automattic/vip-search-replace from 1.1.3 to 2.0.0
13
+ * Do not allow WP-CLI commands to be run from Node Apps
14
+ * build(deps-dev): bump @types/node from 24.1.0 to 24.2.0
15
+ * refactor(dev-env): use `isContainerRunning` for import and sync commands
16
+
17
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.19.1...3.19.2
18
+
19
+ ### 3.19.1
20
+
21
+ * build(deps-dev): bump @types/node from 24.0.12 to 24.0.13
22
+ * build(deps): bump open from 10.1.2 to 10.2.0
23
+ * build(deps-dev): bump @types/node from 24.0.13 to 24.0.14
24
+ * build(deps): bump step-security/harden-runner from 2.12.2 to 2.13.0
25
+ * ci: add AI Changelog workflow
26
+ * build(deps-dev): bump @types/node from 24.0.14 to 24.0.15
27
+ * build(deps-dev): bump @types/node from 24.0.15 to 24.1.0
28
+ * build(deps-dev): bump the testing group with 3 updates
29
+ * security: update `form-data` to fix CVE-2025-7783
30
+ * fix(wp): resource leak during reconnection
31
+ * fix(wp): EventEmitter memory leak for `error` listeners
32
+ * refactor: remove deprecated `url.parse()` in favor of WHATWG URL API
33
+ * ci: simplify changelog generation workflow
34
+ * chore(deps): replace `socket.io-stream` with a fork
35
+ * fix: code smells detected by SonarCloud
36
+ * chore(deps): update Lando
37
+
38
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.19.0...3.19.1
39
+
3
40
  ### 3.19.0
4
41
 
5
42
  * build(deps-dev): bump the testing group across 1 directory with 4 updates
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.19.1",
3
+ "version": "3.19.2",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@automattic/vip",
9
- "version": "3.19.1",
9
+ "version": "3.19.2",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
13
  "@apollo/client": "3.3.6",
14
- "@automattic/vip-search-replace": "^1.1.1",
14
+ "@automattic/vip-search-replace": "^2.0.0",
15
15
  "@json2csv/plainjs": "^7.0.3",
16
16
  "@wwa/single-line-log": "^1.1.4",
17
17
  "args": "5.0.3",
@@ -253,22 +253,22 @@
253
253
  }
254
254
  },
255
255
  "node_modules/@automattic/vip-search-replace": {
256
- "version": "1.1.3",
257
- "resolved": "https://registry.npmjs.org/@automattic/vip-search-replace/-/vip-search-replace-1.1.3.tgz",
258
- "integrity": "sha512-UnP2cLfegI1sf/LHTemmvkZpC5rrmX29voZEw++DNH9B+nZEZ5BEP/skgvCyfLpag93ghENTRjtiXFy9E+w9Tg==",
256
+ "version": "2.0.0",
257
+ "resolved": "https://registry.npmjs.org/@automattic/vip-search-replace/-/vip-search-replace-2.0.0.tgz",
258
+ "integrity": "sha512-i1d3/KCK0sVgNjsJAV4UlMnC51AypLDfX8iEWTDLBiSR3wEvSWMSftF3f7yK46VdbBXB5zDvnVM48kFvASW9Ig==",
259
259
  "cpu": [
260
260
  "ia32",
261
261
  "x64",
262
262
  "arm64"
263
263
  ],
264
+ "license": "MIT",
264
265
  "os": [
265
266
  "darwin",
266
267
  "linux",
267
268
  "win32"
268
269
  ],
269
270
  "dependencies": {
270
- "debug": "^4.2.0",
271
- "follow-redirects": "^1.15.4"
271
+ "debug": "^4.2.0"
272
272
  }
273
273
  },
274
274
  "node_modules/@babel/cli": {
@@ -3631,12 +3631,12 @@
3631
3631
  "dev": true
3632
3632
  },
3633
3633
  "node_modules/@types/node": {
3634
- "version": "24.1.0",
3635
- "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
3636
- "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
3634
+ "version": "24.2.0",
3635
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.0.tgz",
3636
+ "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
3637
3637
  "license": "MIT",
3638
3638
  "dependencies": {
3639
- "undici-types": "~7.8.0"
3639
+ "undici-types": "~7.10.0"
3640
3640
  }
3641
3641
  },
3642
3642
  "node_modules/@types/node-fetch": {
@@ -12663,9 +12663,9 @@
12663
12663
  }
12664
12664
  },
12665
12665
  "node_modules/typescript": {
12666
- "version": "5.8.3",
12667
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
12668
- "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
12666
+ "version": "5.9.2",
12667
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
12668
+ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
12669
12669
  "dev": true,
12670
12670
  "license": "Apache-2.0",
12671
12671
  "bin": {
@@ -12692,9 +12692,9 @@
12692
12692
  }
12693
12693
  },
12694
12694
  "node_modules/undici-types": {
12695
- "version": "7.8.0",
12696
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
12697
- "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
12695
+ "version": "7.10.0",
12696
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
12697
+ "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
12698
12698
  "license": "MIT"
12699
12699
  },
12700
12700
  "node_modules/unicode-canonical-property-names-ecmascript": {
@@ -13669,12 +13669,11 @@
13669
13669
  }
13670
13670
  },
13671
13671
  "@automattic/vip-search-replace": {
13672
- "version": "1.1.3",
13673
- "resolved": "https://registry.npmjs.org/@automattic/vip-search-replace/-/vip-search-replace-1.1.3.tgz",
13674
- "integrity": "sha512-UnP2cLfegI1sf/LHTemmvkZpC5rrmX29voZEw++DNH9B+nZEZ5BEP/skgvCyfLpag93ghENTRjtiXFy9E+w9Tg==",
13672
+ "version": "2.0.0",
13673
+ "resolved": "https://registry.npmjs.org/@automattic/vip-search-replace/-/vip-search-replace-2.0.0.tgz",
13674
+ "integrity": "sha512-i1d3/KCK0sVgNjsJAV4UlMnC51AypLDfX8iEWTDLBiSR3wEvSWMSftF3f7yK46VdbBXB5zDvnVM48kFvASW9Ig==",
13675
13675
  "requires": {
13676
- "debug": "^4.2.0",
13677
- "follow-redirects": "^1.15.4"
13676
+ "debug": "^4.2.0"
13678
13677
  }
13679
13678
  },
13680
13679
  "@babel/cli": {
@@ -16051,11 +16050,11 @@
16051
16050
  "dev": true
16052
16051
  },
16053
16052
  "@types/node": {
16054
- "version": "24.1.0",
16055
- "resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
16056
- "integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
16053
+ "version": "24.2.0",
16054
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.2.0.tgz",
16055
+ "integrity": "sha512-3xyG3pMCq3oYCNg7/ZP+E1ooTaGB4cG8JWRsqqOYQdbWNY4zbaV0Ennrd7stjiJEFZCaybcIgpTjJWHRfBSIDw==",
16057
16056
  "requires": {
16058
- "undici-types": "~7.8.0"
16057
+ "undici-types": "~7.10.0"
16059
16058
  }
16060
16059
  },
16061
16060
  "@types/node-fetch": {
@@ -22365,9 +22364,9 @@
22365
22364
  }
22366
22365
  },
22367
22366
  "typescript": {
22368
- "version": "5.8.3",
22369
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
22370
- "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
22367
+ "version": "5.9.2",
22368
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
22369
+ "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
22371
22370
  "dev": true
22372
22371
  },
22373
22372
  "unbox-primitive": {
@@ -22383,9 +22382,9 @@
22383
22382
  }
22384
22383
  },
22385
22384
  "undici-types": {
22386
- "version": "7.8.0",
22387
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
22388
- "integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="
22385
+ "version": "7.10.0",
22386
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
22387
+ "integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag=="
22389
22388
  },
22390
22389
  "unicode-canonical-property-names-ecmascript": {
22391
22390
  "version": "2.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/vip",
3
- "version": "3.19.1",
3
+ "version": "3.19.2",
4
4
  "description": "The VIP Javascript library & CLI",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -145,7 +145,7 @@
145
145
  },
146
146
  "dependencies": {
147
147
  "@apollo/client": "3.3.6",
148
- "@automattic/vip-search-replace": "^1.1.1",
148
+ "@automattic/vip-search-replace": "^2.0.0",
149
149
  "@json2csv/plainjs": "^7.0.3",
150
150
  "@wwa/single-line-log": "^1.1.4",
151
151
  "args": "5.0.3",