@automattic/vip 3.3.0 → 3.3.1

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.
@@ -87,8 +87,8 @@ async function appDeployCmd(arg = [], opts = {}) {
87
87
  .replace(/[\-T:\.Z]/g, '').slice(0, 14);
88
88
  fileMeta.basename = `${datePrefix}-${fileMeta.basename}`;
89
89
  const deployMessage = opts.message ?? '';
90
- const forceDeploy = opts.force;
91
- if (!forceDeploy) {
90
+ const skipConfirm = opts.force || opts.skipConfirmation;
91
+ if (!skipConfirm) {
92
92
  const promptParams = {
93
93
  launched: Boolean(validatedArgs.launched),
94
94
  formattedEnvironment: (0, _format.formatEnvironment)(validatedArgs.envType),
@@ -227,9 +227,9 @@ const examples = [
227
227
  usage: 'vip app @mysite.develop deploy file.zip --message "This is a deploy message"',
228
228
  description: 'Deploy the given compressed file to your site'
229
229
  }, {
230
- usage: 'vip app @mysite.develop deploy file.zip --force',
230
+ usage: 'vip app @mysite.develop deploy file.zip --skip-confirmation',
231
231
  description: 'Deploy the given compressed file to your site without prompting'
232
232
  }];
233
233
  void (0, _command.default)({
234
234
  requiredArgs: 1
235
- }).examples(examples).option('message', 'Custom message for deploy').option('force', 'Skip prompt').option('app', 'The application name or ID').option('env', 'The environment name or ID').argv(process.argv, appDeployCmd);
235
+ }).examples(examples).option('message', 'Custom message for deploy').option('skip-confirmation', 'Skip confirmation prompt').option('force', 'Skip confirmation prompt (deprecated)').option('app', 'The application name or ID').option('env', 'The environment name or ID').argv(process.argv, appDeployCmd);
@@ -15,7 +15,7 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
15
15
  await (0, _tracker.trackEvent)('app_command_execute');
16
16
  let res;
17
17
  try {
18
- res = await (0, _app.default)(arg[0], 'id,repo,name,environments{id,appId,name,type,branch,currentCommit,primaryDomain{name},launched}');
18
+ res = await (0, _app.default)(arg[0], 'id,repo,name,environments{id,appId,name,type,branch,currentCommit,primaryDomain{name},launched,deploymentStrategy}');
19
19
  } catch (err) {
20
20
  await (0, _tracker.trackEvent)('app_command_fetch_error', {
21
21
  error: `App ${arg[0]} does not exist`
@@ -53,6 +53,14 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
53
53
 
54
54
  // Flatten object
55
55
  clonedEnv.primaryDomain = clonedEnv.primaryDomain.name;
56
+
57
+ // Set branch to empty for custom deployments
58
+ if (clonedEnv.deploymentStrategy === 'custom-deploy') {
59
+ clonedEnv.branch = '-';
60
+ }
61
+
62
+ // Hide "deployment strategy" column
63
+ delete clonedEnv.deploymentStrategy;
56
64
  return clonedEnv;
57
65
  });
58
66
  return {
@@ -65,7 +65,7 @@ const appQuery = `
65
65
  });
66
66
  throw new _userError.default('Environment needs to be started first');
67
67
  }
68
- const cmd = new _devEnvSyncSql.DevEnvSyncSQLCommand(app, env, slug, trackerFn);
68
+ const cmd = new _devEnvSyncSql.DevEnvSyncSQLCommand(app, env, slug, lando, trackerFn);
69
69
  // TODO: There's a function called handleCLIException for dev-env that handles exceptions but DevEnvSyncSQLCommand has its own implementation.
70
70
  // We should probably use handleCLIException instead?
71
71
  const didCommandRun = await cmd.run();
@@ -56,7 +56,7 @@ class DevEnvImportSQLCommand {
56
56
  if (!(await (0, _devEnvironmentLando.isEnvUp)(lando, (0, _devEnvironmentCore.getEnvironmentPath)(this.slug)))) {
57
57
  throw new _userError.default('Environment needs to be started first');
58
58
  }
59
- const expectedDomain = `${this.slug}.vipdev.lndo.site`;
59
+ const expectedDomain = `${this.slug}.${lando.config.domain}`;
60
60
  await (0, _sql.validate)(resolvedPath, {
61
61
  isImport: false,
62
62
  skipChecks: [],
@@ -89,7 +89,7 @@ class DevEnvImportSQLCommand {
89
89
  if (searchReplace?.length && !inPlace) {
90
90
  _fs.default.unlinkSync(resolvedPath);
91
91
  }
92
- const cacheArg = ['wp', 'cache', 'flush'].concat(this.options.quiet ? '--quiet' : []);
92
+ const cacheArg = ['wp', 'cache', 'flush', '--skip-plugins', '--skip-themes'].concat(this.options.quiet ? '--quiet' : []);
93
93
  await (0, _devEnvironmentCore.exec)(lando, this.slug, cacheArg);
94
94
  if (undefined === this.options.skipReindex || !(0, _devEnvironmentCli.processBooleanOption)(this.options.skipReindex)) {
95
95
  try {
@@ -99,7 +99,7 @@ class DevEnvImportSQLCommand {
99
99
  // Exception means they don't have vip-search enabled.
100
100
  }
101
101
  }
102
- const addUserArg = ['wp', 'dev-env-add-admin', '--username=vipgo', '--password=password'].concat(this.options.quiet ? '--quiet' : []);
102
+ const addUserArg = ['wp', 'dev-env-add-admin', '--username=vipgo', '--password=password', '--skip-plugins', '--skip-themes'].concat(this.options.quiet ? '--quiet' : []);
103
103
  await (0, _devEnvironmentCore.exec)(lando, this.slug, addUserArg);
104
104
  }
105
105
  }
@@ -57,6 +57,7 @@ class DevEnvSyncSQLCommand {
57
57
  app;
58
58
  env;
59
59
  slug;
60
+ lando;
60
61
  tmpDir;
61
62
  siteUrls;
62
63
  searchReplaceMap;
@@ -68,17 +69,19 @@ class DevEnvSyncSQLCommand {
68
69
  * @param {string} app The app object
69
70
  * @param {string} env The environment object
70
71
  * @param {string} slug The site slug
72
+ * @param {Object} lando The lando object
71
73
  * @param {Function} trackerFn Function to call for tracking
72
74
  */
73
- constructor(app, env, slug, trackerFn = () => {}) {
75
+ constructor(app, env, slug, lando, trackerFn = () => {}) {
74
76
  this.app = app;
75
77
  this.env = env;
76
78
  this.slug = slug;
79
+ this.lando = lando;
77
80
  this.track = trackerFn;
78
81
  this.tmpDir = (0, _utils.makeTempDir)();
79
82
  }
80
83
  get landoDomain() {
81
- return `${this.slug}.vipdev.lndo.site`;
84
+ return `${this.slug}.${this.lando.config.domain}`;
82
85
  }
83
86
  get sqlFile() {
84
87
  return `${this.tmpDir}/sql-export.sql`;
@@ -98,9 +98,9 @@ async function handleCLIException(exception, trackKey, trackBaseInfo = {}) {
98
98
  debug(exception);
99
99
  }
100
100
  }
101
- const verifyDNSResolution = async slug => {
101
+ const verifyDNSResolution = async (slug, domain) => {
102
102
  const expectedIP = '127.0.0.1';
103
- const testDomain = `${slug}.vipdev.lndo.site`;
103
+ const testDomain = `${slug}.${domain}`;
104
104
  const advice = `Please add following line to hosts file on your system:\n\n${expectedIP} ${testDomain}\n\nLearn more: https://docs.wpvip.com/vip-local-development-environment/troubleshooting-dev-env/#h-resolve-networking-configuration-issues\n`;
105
105
  debug(`Verifying DNS resolution for ${testDomain}`);
106
106
  try {
@@ -128,7 +128,7 @@ const validateDependencies = async (lando, slug) => {
128
128
  const now = new Date();
129
129
  (0, _devEnvironmentLando.validateDockerInstalled)(lando);
130
130
  if (slug) {
131
- await verifyDNSResolution(slug);
131
+ await verifyDNSResolution(slug, lando.config.domain ?? 'vipdev.lndo.site');
132
132
  }
133
133
  const duration = new Date().getTime() - now.getTime();
134
134
  debug('Validation checks completed in %d ms', duration);
package/docs/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Changelog
2
2
 
3
+ ### 3.3.1
4
+
5
+ * build(deps): bump step-security/harden-runner from 2.8.0 to 2.8.1
6
+ * build(deps): bump uuid from 9.0.1 to 10.0.0
7
+ * fix: CVE-2024-4068 in `braces`
8
+ * [dev-env] Update calls to WP-CLI to include --skip-plugins and --skip-themes
9
+ * fix(dev-env): use correct domain for environments
10
+ * vip app deploy: Deprecate force and add skip-confirmation
11
+ * Hide branch for vip app if Custom Deployment
12
+
13
+ **Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.3.0...3.3.1
14
+
3
15
  ### 3.3.0
4
16
 
5
17
  * fix(dev-env): make sure wildcard subdomains work with SSL/TLS