@automattic/vip 2.28.0-dev7 → 2.28.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.
@@ -30,6 +30,7 @@ var _dns = _interopRequireDefault(require("dns"));
30
30
  var _xdgBasedir = _interopRequireDefault(require("xdg-basedir"));
31
31
  var _devEnvironmentCore = require("./dev-environment-core");
32
32
  var _devEnvironment = require("../constants/dev-environment");
33
+ var _dockerUtils = require("./docker-utils");
33
34
  var _userError = _interopRequireDefault(require("../user-error"));
34
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
36
  // @format
@@ -83,13 +84,7 @@ async function getLandoConfig() {
83
84
  subdir: '.',
84
85
  namespace: '@lando'
85
86
  }],
86
- disablePlugins: [
87
- // Plugins we need:
88
- // '@lando/compose',
89
- // '@lando/mailhog',
90
- // '@lando/phpmyadmin',
91
- // The rest we don't need
92
- '@lando/acquia', '@lando/apache', '@lando/argv', '@lando/backdrop', '@lando/dotnet', '@lando/drupal', '@lando/elasticsearch', '@lando/go', '@lando/joomla', '@lando/lagoon', '@lando/lamp', '@lando/laravel', '@lando/lemp', '@lando/mariadb', '@lando/mean', '@lando/memcached', '@lando/mongo', '@lando/mssql', '@lando/mysql', '@lando/nginx', '@lando/node', '@lando/pantheon', '@lando/php', '@lando/platformsh', '@lando/postgres', '@lando/python', '@lando/redis', '@lando/ruby', '@lando/solr', '@lando/symfony', '@lando/tomcat', '@lando/varnish', '@lando/wordpress'],
87
+ disablePlugins: ['@lando/argv', '@lando/mailhog'],
93
88
  proxyName: 'vip-dev-env-proxy',
94
89
  userConfRoot: landoDir,
95
90
  home: fakeHomeDir,
@@ -111,6 +106,7 @@ async function regenerateLandofile(instancePath) {
111
106
  }
112
107
  const slug = _path.default.basename(instancePath);
113
108
  const currentInstanceData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
109
+ currentInstanceData.pullAfter = 0;
114
110
  await (0, _devEnvironmentCore.updateEnvironment)(currentInstanceData);
115
111
  }
116
112
  async function landoRecovery(lando, instancePath, error) {
@@ -133,126 +129,207 @@ async function landoRecovery(lando, instancePath, error) {
133
129
  }
134
130
  }
135
131
  async function getLandoApplication(lando, instancePath) {
136
- if (appMap.has(instancePath)) {
137
- return Promise.resolve(appMap.get(instancePath));
138
- }
139
- if (!(await (0, _devEnvironmentCore.doesEnvironmentExist)(instancePath))) {
140
- throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
141
- }
142
- let app;
132
+ const started = new Date();
143
133
  try {
144
- app = lando.getApp(instancePath);
145
- await app.init();
146
- } catch (error) {
147
- app = await landoRecovery(lando, instancePath, error);
134
+ if (appMap.has(instancePath)) {
135
+ return Promise.resolve(appMap.get(instancePath));
136
+ }
137
+ if (!(await (0, _devEnvironmentCore.doesEnvironmentExist)(instancePath))) {
138
+ throw new Error(_devEnvironment.DEV_ENVIRONMENT_NOT_FOUND);
139
+ }
140
+ let app;
141
+ try {
142
+ app = lando.getApp(instancePath);
143
+ await app.init();
144
+ } catch (error) {
145
+ app = await landoRecovery(lando, instancePath, error);
146
+ }
147
+ appMap.set(instancePath, app);
148
+ return app;
149
+ } finally {
150
+ const duration = new Date().getTime() - started.getTime();
151
+ debug('getLandoApplication() took %d ms', duration);
148
152
  }
149
- appMap.set(instancePath, app);
150
- return app;
151
153
  }
152
154
  async function bootstrapLando() {
153
- const lando = new _lando.default(await getLandoConfig());
154
- lando.events.once('pre-engine-build', async data => {
155
- const instanceData = (0, _devEnvironmentCore.readEnvironmentData)(data.name);
156
- let registryResolvable = false;
157
- try {
158
- registryResolvable = (await _dns.default.promises.lookup('ghcr.io')).address || false;
159
- debug('Registry ghcr.io is resolvable');
160
- } catch (err) {
161
- debug('Registry ghcr.io is not resolvable, image pull might be broken.');
162
- registryResolvable = false;
163
- }
164
- const pull = registryResolvable && (instanceData.pullAfter || 0) < Date.now();
165
- if (Array.isArray(data.opts.pullable) && Array.isArray(data.opts.local) && data.opts.local.length === 0 && !pull) {
166
- // Setting `data.opts.pullable` to an empty array prevents Lando from pulling images with `docker pull`.
167
- // Note that if some of the images are not available, they will still be pulled by `docker-compose`.
168
- data.opts.local = data.opts.pullable;
169
- data.opts.pullable = [];
170
- }
171
- if (pull || !instanceData.pullAfter) {
172
- instanceData.pullAfter = Date.now() + 7 * 24 * 60 * 60 * 1000;
173
- (0, _devEnvironmentCore.writeEnvironmentData)(data.name, instanceData);
155
+ const started = new Date();
156
+ try {
157
+ const socket = await (0, _dockerUtils.getDockerSocket)();
158
+ const config = await getLandoConfig();
159
+ if (socket) {
160
+ config.engineConfig = await (0, _dockerUtils.getEngineConfig)(socket);
174
161
  }
175
- });
176
- await lando.bootstrap();
177
- return lando;
162
+ const lando = new _lando.default(config);
163
+ lando.events.once('pre-engine-build', async data => {
164
+ const instanceData = (0, _devEnvironmentCore.readEnvironmentData)(data.name);
165
+ let registryResolvable = false;
166
+ try {
167
+ registryResolvable = (await _dns.default.promises.lookup('ghcr.io')).address || false;
168
+ debug('Registry ghcr.io is resolvable');
169
+ } catch (err) {
170
+ debug('Registry ghcr.io is not resolvable, image pull might be broken.');
171
+ registryResolvable = false;
172
+ }
173
+ const pull = registryResolvable && (instanceData.pullAfter || 0) < Date.now();
174
+ if (Array.isArray(data.opts.pullable) && Array.isArray(data.opts.local) && data.opts.local.length === 0 && !pull) {
175
+ // Setting `data.opts.pullable` to an empty array prevents Lando from pulling images with `docker pull`.
176
+ // Note that if some of the images are not available, they will still be pulled by `docker-compose`.
177
+ data.opts.local = data.opts.pullable;
178
+ data.opts.pullable = [];
179
+ }
180
+ if (pull || !instanceData.pullAfter) {
181
+ instanceData.pullAfter = Date.now() + 7 * 24 * 60 * 60 * 1000;
182
+ (0, _devEnvironmentCore.writeEnvironmentData)(data.name, instanceData);
183
+ }
184
+ });
185
+ await lando.bootstrap();
186
+ return lando;
187
+ } finally {
188
+ const duration = new Date().getTime() - started.getTime();
189
+ debug('bootstrapLando() took %d ms', duration);
190
+ }
178
191
  }
179
192
  async function landoStart(lando, instancePath) {
180
- debug('Will start lando app on path:', instancePath);
181
- const app = await getLandoApplication(lando, instancePath);
182
- await app.start();
193
+ const started = new Date();
194
+ try {
195
+ debug('Will start lando app on path:', instancePath);
196
+ const app = await getLandoApplication(lando, instancePath);
197
+ await app.start();
198
+ } finally {
199
+ const duration = new Date().getTime() - started.getTime();
200
+ debug('landoStart() took %d ms', duration);
201
+ }
183
202
  }
184
203
  async function landoLogs(lando, instancePath, options) {
185
- debug('Will show lando logs on path:', instancePath, ' with options: ', options);
186
- const app = await getLandoApplication(lando, instancePath);
187
- const logTask = lando.tasks.find(task => task.command === 'logs');
188
- await logTask.run({
189
- follow: options.follow,
190
- service: options.service,
191
- timestamps: options.timestamps,
192
- _app: app
193
- });
204
+ const started = new Date();
205
+ try {
206
+ debug('Will show lando logs on path:', instancePath, ' with options: ', options);
207
+ const app = await getLandoApplication(lando, instancePath);
208
+ const logTask = lando.tasks.find(task => task.command === 'logs');
209
+ await logTask.run({
210
+ follow: options.follow,
211
+ service: options.service,
212
+ timestamps: options.timestamps,
213
+ _app: app
214
+ });
215
+ } finally {
216
+ const duration = new Date().getTime() - started.getTime();
217
+ debug('landoLogs() took %d ms', duration);
218
+ }
194
219
  }
195
220
  async function landoRebuild(lando, instancePath) {
196
- debug('Will rebuild lando app on path:', instancePath);
197
- const app = await getLandoApplication(lando, instancePath);
198
- await ensureNoOrphantProxyContainer(lando);
199
- await app.rebuild();
221
+ const started = new Date();
222
+ try {
223
+ debug('Will rebuild lando app on path:', instancePath);
224
+ const app = await getLandoApplication(lando, instancePath);
225
+ await ensureNoOrphantProxyContainer(lando);
226
+ await app.rebuild();
227
+ } finally {
228
+ const duration = new Date().getTime() - started.getTime();
229
+ debug('landoRebuild() took %d ms', duration);
230
+ }
231
+ }
232
+
233
+ /**
234
+ * @return {Promise<import('dockerode').NetworkInspectInfo | null>}
235
+ */
236
+ async function getBridgeNetwork(lando) {
237
+ const networkName = lando.config.networkBridge || 'lando_bridge_network';
238
+ try {
239
+ return await lando.engine.getNetwork(networkName).inspect();
240
+ } catch (err) {
241
+ debug('Error getting network %s: %s', networkName, err.message);
242
+ return null;
243
+ }
244
+ }
245
+ async function cleanUpLandoProxy(lando) {
246
+ const network = await getBridgeNetwork(lando);
247
+ if (network && network.Containers && !Object.keys(network.Containers).length) {
248
+ const proxy = lando.engine.docker.getContainer(lando.config.proxyContainer);
249
+ try {
250
+ await proxy.remove({
251
+ force: true
252
+ });
253
+ } catch (err) {
254
+ debug('Error removing proxy container: %s', err.message);
255
+ }
256
+ }
200
257
  }
201
258
  async function landoStop(lando, instancePath) {
202
- debug('Will stop lando app on path:', instancePath);
203
- const app = await getLandoApplication(lando, instancePath);
204
- await app.stop();
259
+ const started = new Date();
260
+ try {
261
+ debug('Will stop lando app on path:', instancePath);
262
+ const app = await getLandoApplication(lando, instancePath);
263
+ app.events.once('post-stop', () => cleanUpLandoProxy(lando));
264
+ await app.stop();
265
+ } finally {
266
+ const duration = new Date().getTime() - started.getTime();
267
+ debug('landoStop() took %d ms', duration);
268
+ }
205
269
  }
206
270
  async function landoDestroy(lando, instancePath) {
207
- debug('Will destroy lando app on path:', instancePath);
208
- const app = await getLandoApplication(lando, instancePath);
209
- await app.destroy();
271
+ const started = new Date();
272
+ try {
273
+ debug('Will destroy lando app on path:', instancePath);
274
+ const app = await getLandoApplication(lando, instancePath);
275
+ app.events.once('post-stop', () => cleanUpLandoProxy(lando));
276
+ await app.destroy();
277
+ } finally {
278
+ const duration = new Date().getTime() - started.getTime();
279
+ debug('landoDestroy() took %d ms', duration);
280
+ }
210
281
  }
211
282
  async function landoInfo(lando, instancePath, suppressWarnings) {
212
- var _app$info$find;
213
- const app = await getLandoApplication(lando, instancePath);
214
- let appInfo = _utils.default.startTable(app);
215
- const reachableServices = app.info.filter(service => service.urls.length);
216
- reachableServices.forEach(service => appInfo[`${service.service} urls`] = service.urls);
217
- const health = await checkEnvHealth(lando, instancePath);
218
- const frontEndUrl = (_app$info$find = app.info.find(service => 'nginx' === service.service)) === null || _app$info$find === void 0 ? void 0 : _app$info$find.urls[0];
219
- const extraService = await getExtraServicesConnections(lando, app);
220
- appInfo = {
221
- slug: appInfo.name.replace(/^vipdev/, ''),
222
- ...appInfo,
223
- ...extraService
224
- };
225
- delete appInfo.name;
226
- const hasResults = Object.values(health).length > 0;
227
- const hasWarnings = Object.values(health).some(status => !status);
228
- if (hasResults && !hasWarnings) {
229
- appInfo.status = _chalk.default.green('UP');
230
- } else if (health.nginx) {
231
- appInfo.status = _chalk.default.yellow('PARTIALLY UP');
232
- } else {
233
- appInfo.status = _chalk.default.red('DOWN');
234
- }
283
+ const started = new Date();
284
+ try {
285
+ var _app$info$find;
286
+ const app = await getLandoApplication(lando, instancePath);
287
+ let appInfo = _utils.default.startTable(app);
288
+ const reachableServices = app.info.filter(service => service.urls.length);
289
+ reachableServices.forEach(service => appInfo[`${service.service} urls`] = service.urls);
290
+ const health = await checkEnvHealth(lando, instancePath);
291
+ const frontEndUrl = (_app$info$find = app.info.find(service => 'nginx' === service.service)) === null || _app$info$find === void 0 ? void 0 : _app$info$find.urls[0];
292
+ const extraService = await getExtraServicesConnections(lando, app);
293
+ appInfo = {
294
+ slug: appInfo.name.replace(/^vipdev/, ''),
295
+ ...appInfo,
296
+ ...extraService
297
+ };
298
+ delete appInfo.name;
299
+ const hasResults = Object.values(health).length > 0;
300
+ const hasWarnings = Object.values(health).some(status => !status);
301
+ if (hasResults && !hasWarnings) {
302
+ appInfo.status = _chalk.default.green('UP');
303
+ } else if (health.nginx) {
304
+ appInfo.status = _chalk.default.yellow('PARTIALLY UP');
305
+ } else {
306
+ appInfo.status = _chalk.default.red('DOWN');
307
+ }
235
308
 
236
- // Add login information
237
- if (frontEndUrl) {
238
- const loginUrl = `${frontEndUrl}wp-admin/`;
239
- appInfo['Login URL'] = loginUrl;
240
- appInfo['Default username'] = 'vipgo';
241
- appInfo['Default password'] = 'password';
242
- }
243
- if (!suppressWarnings && hasWarnings) {
244
- let message = _chalk.default.bold.yellow('The following services have failed health checks:\n');
245
- Object.keys(health).forEach(service => {
246
- if (!health[service]) {
247
- message += `${_chalk.default.red(service)}\n`;
248
- }
249
- });
250
- appInfo['Health warnings'] = message;
251
- }
309
+ // Add login information
310
+ if (frontEndUrl) {
311
+ const loginUrl = `${frontEndUrl}wp-admin/`;
312
+ appInfo['Login URL'] = loginUrl;
313
+ appInfo['Default username'] = 'vipgo';
314
+ appInfo['Default password'] = 'password';
315
+ }
316
+ if (!suppressWarnings && hasWarnings) {
317
+ let message = _chalk.default.bold.yellow('The following services have failed health checks:\n');
318
+ Object.keys(health).forEach(service => {
319
+ if (!health[service]) {
320
+ message += `${_chalk.default.red(service)}\n`;
321
+ }
322
+ });
323
+ appInfo['Health warnings'] = message;
324
+ }
252
325
 
253
- // Add documentation link
254
- appInfo.Documentation = 'https://docs.wpvip.com/technical-references/vip-local-development-environment/';
255
- return appInfo;
326
+ // Add documentation link
327
+ appInfo.Documentation = 'https://docs.wpvip.com/technical-references/vip-local-development-environment/';
328
+ return appInfo;
329
+ } finally {
330
+ const duration = new Date().getTime() - started.getTime();
331
+ debug('landoInfo() took %d ms', duration);
332
+ }
256
333
  }
257
334
  const extraServiceDisplayConfiguration = [{
258
335
  name: 'elasticsearch',
@@ -265,6 +342,9 @@ const extraServiceDisplayConfiguration = [{
265
342
  }, {
266
343
  name: 'mailhog',
267
344
  skip: true
345
+ }, {
346
+ name: 'mailpit',
347
+ skip: true
268
348
  }];
269
349
  async function getExtraServicesConnections(lando, app) {
270
350
  const extraServices = {};
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getDockerSocket = getDockerSocket;
7
+ exports.getEngineConfig = getEngineConfig;
8
+ exports.splitca = splitca;
9
+ var _nodeFs = require("node:fs");
10
+ var _promises = require("node:fs/promises");
11
+ var _nodeOs = require("node:os");
12
+ var _nodePath = _interopRequireDefault(require("node:path"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ /* eslint-disable no-await-in-loop */
15
+ /**
16
+ * External dependencies
17
+ */
18
+ /**
19
+ * Reads a Certificate Authority file and returns it as an array of certificates
20
+ *
21
+ * @param {string} filepath Path to the file
22
+ * @return {string[]} Array of certificates
23
+ */
24
+ async function splitca(filepath) {
25
+ const ca = [];
26
+ const data = await (0, _promises.readFile)(filepath, 'utf-8');
27
+ if (data.indexOf('-END CERTIFICATE-') < 0 || data.indexOf('-BEGIN CERTIFICATE-') < 0) {
28
+ throw new Error("File does not contain 'BEGIN CERTIFICATE' or 'END CERTIFICATE'");
29
+ }
30
+ const chain = data.split('\n');
31
+ let cert = [];
32
+ for (const line of chain) {
33
+ if (line) {
34
+ cert.push(line);
35
+ if (line.match(/-END CERTIFICATE-/)) {
36
+ ca.push(cert.join('\n'));
37
+ cert = [];
38
+ }
39
+ }
40
+ }
41
+ return ca;
42
+ }
43
+ async function canReadWrite(what) {
44
+ try {
45
+ // eslint-disable-next-line no-bitwise
46
+ await (0, _promises.access)(what, _nodeFs.constants.R_OK | _nodeFs.constants.W_OK);
47
+ return true;
48
+ } catch (err) {
49
+ return false;
50
+ }
51
+ }
52
+ async function getDockerSocket() {
53
+ if ((0, _nodeOs.platform)() !== 'win32') {
54
+ var _process$env$DOCKER_H;
55
+ const possibleSocket = (_process$env$DOCKER_H = process.env.DOCKER_HOST) !== null && _process$env$DOCKER_H !== void 0 ? _process$env$DOCKER_H : '';
56
+ // If `DOCKER_HOST` is set and not empty, and if it does not point to a unix socket, return - not much that we can do here.
57
+ if (possibleSocket && !/^unix:\/\//.test(possibleSocket)) {
58
+ return possibleSocket;
59
+ }
60
+ const paths = [];
61
+ if (possibleSocket) {
62
+ // This is a UNIX socket, strip the leading `unix://` prefix and make sure the path starts with a slash.
63
+ // (there are cases when the path is prefixed with two or three slashes)
64
+ paths.push(possibleSocket.replace(/^unix:\/+/, '/'));
65
+ }
66
+
67
+ // Try the default location
68
+ paths.push('/var/run/docker.sock');
69
+ // Try an alternative location
70
+ paths.push(_nodePath.default.join((0, _nodeOs.homedir)(), '.docker', 'run', 'docker.sock'));
71
+ for (const socketPath of paths) {
72
+ try {
73
+ const stats = await (0, _promises.stat)(socketPath);
74
+ if (stats.isSocket() && (await canReadWrite(socketPath))) {
75
+ process.env.DOCKER_HOST = `unix://${socketPath}`;
76
+ return socketPath;
77
+ }
78
+ } catch (err) {
79
+ // Do nothing
80
+ }
81
+ }
82
+ }
83
+ return null;
84
+ }
85
+ async function getEngineConfig(dockerHost) {
86
+ const opts = {};
87
+ if (dockerHost.startsWith('tcp://')) {
88
+ const split = /(?:tcp:\/\/)?(.*?):(\d+)/g.exec(dockerHost);
89
+ if (split && split.length === 3) {
90
+ opts.host = split[1];
91
+ opts.port = split[2];
92
+ } else {
93
+ throw new Error('Invalid DOCKER_HOST format');
94
+ }
95
+ } else {
96
+ opts.socketPath = dockerHost;
97
+ }
98
+ if (process.env.DOCKER_TLS_VERIFY === '1' || opts.port === '2376') {
99
+ opts.protocol = 'https';
100
+ } else {
101
+ opts.protocol = 'http';
102
+ }
103
+ const certPath = process.env.DOCKER_CERT_PATH;
104
+ if (certPath) {
105
+ const [ca, cert, key] = await Promise.all([splitca(_nodePath.default.join(certPath, 'ca.pem')), (0, _promises.readFile)(_nodePath.default.join(certPath, 'cert.pem'), 'utf-8'), (0, _promises.readFile)(_nodePath.default.join(certPath, 'key.pem'), 'utf-8')]);
106
+ opts.ca = ca;
107
+ opts.cert = cert;
108
+ opts.key = key;
109
+ }
110
+ if (process.env.DOCKER_CLIENT_TIMEOUT) {
111
+ opts.timeout = parseInt(process.env.DOCKER_CLIENT_TIMEOUT, 10);
112
+ }
113
+ return opts;
114
+ }
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ /* global window */
7
8
  /**
8
9
  * Internal dependencies
9
10
  */
@@ -9,6 +9,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
9
9
  /**
10
10
  * External dependencies
11
11
  */
12
+ /**
13
+ * Internal dependencies
14
+ */
12
15
  class Secure {
13
16
  getPassword(service) {
14
17
  return _keytar.default.getPassword(service, service);
@@ -7,6 +7,7 @@ exports.default = void 0;
7
7
  var _insecure = _interopRequireDefault(require("./keychain/insecure"));
8
8
  var _browser = _interopRequireDefault(require("./keychain/browser"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ /* global window */
10
11
  /**
11
12
  * External dependencies
12
13
  */
@@ -234,8 +234,8 @@ ${maybeExitPrompt}
234
234
  let {
235
235
  importJob
236
236
  } = status;
237
- let jobStatus,
238
- jobSteps = [];
237
+ let jobStatus;
238
+ let jobSteps = [];
239
239
  if (env.isK8sResident) {
240
240
  // in the future the API may provide this in k8s jobs so account for that.
241
241
  // Until then we need to create the importJob from the status object.
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.aliasUser = aliasUser;
7
- exports.makeCommandTracker = makeCommandTracker;
8
7
  exports.trackEvent = trackEvent;
9
8
  exports.trackEventWithEnv = trackEventWithEnv;
10
9
  var _index = _interopRequireDefault(require("./analytics/index"));
@@ -78,13 +77,4 @@ async function trackEventWithEnv(appId, envId, eventName, eventProps = {}) {
78
77
  app_id: appId,
79
78
  env_id: envId
80
79
  });
81
- }
82
- function makeCommandTracker(command, trackingInfo = {}) {
83
- const trackerFn = async (type, data = {}) => {
84
- await trackEvent(`${command}_command_${type}`, {
85
- ...trackingInfo,
86
- ...data
87
- });
88
- };
89
- return trackerFn;
90
80
  }
@@ -25,6 +25,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
25
25
  * Internal dependencies
26
26
  */
27
27
 
28
+ // eslint-disable-next-line no-duplicate-imports
29
+
28
30
  let problemsFound = 0;
29
31
  let lineNum = 1;
30
32
  const tableNames = [];
@@ -118,9 +120,9 @@ const infoCheckFormatter = check => {
118
120
  };
119
121
  };
120
122
  function checkTablePrefixes(results, errors, infos) {
121
- const wpTables = [],
122
- notWPTables = [],
123
- wpMultisiteTables = [];
123
+ const wpTables = [];
124
+ const notWPTables = [];
125
+ const wpMultisiteTables = [];
124
126
  results.forEach(result => {
125
127
  const tableName = result.text || '';
126
128
  if (tableName.match(/^wp_(\d+_)/)) {
@@ -118,7 +118,10 @@ const findNestedDirectories = directory => {
118
118
  */
119
119
  exports.findNestedDirectories = findNestedDirectories;
120
120
  const getIndexPositionOfFolders = (folderPath, sites) => {
121
- let sitesIndex, siteIDIndex, yearIndex, monthIndex;
121
+ let sitesIndex;
122
+ let siteIDIndex;
123
+ let yearIndex;
124
+ let monthIndex;
122
125
  let pathMutate = folderPath; // Mutate `path` for multisites
123
126
 
124
127
  // Turn the path into an array to determine index position