@automattic/vip 3.14.1-dev.0 → 3.16.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.
- package/assets/dev-env.lando.template.yml.ejs +2 -1
- package/dist/bin/vip-dev-env-create.js +3 -0
- package/dist/bin/vip-dev-env-update.js +3 -1
- package/dist/bin/vip-wp.js +19 -13
- package/dist/lib/constants/dev-environment.js +1 -1
- package/dist/lib/dev-environment/dev-environment-cli.js +22 -2
- package/dist/lib/dev-environment/dev-environment-core.js +20 -38
- package/dist/lib/dev-environment/dev-environment-database.js +2 -1
- package/dist/lib/dev-environment/dev-environment-lando.js +2 -2
- package/docs/CHANGELOG.md +35 -0
- package/npm-shrinkwrap.json +406 -379
- package/package.json +7 -7
|
@@ -93,6 +93,7 @@ services:
|
|
|
93
93
|
--user root
|
|
94
94
|
--domain "http://<%= siteSlug %>.<%= domain %>/"
|
|
95
95
|
--title "<%= wpTitle %>"
|
|
96
|
+
--wpadmin_password "<%= adminPassword %>"
|
|
96
97
|
<% if ( multisite ) { %>--ms-domain "<%= siteSlug %>.<%= domain %>" <% if ( multisite === true || multisite === 'subdomain' ) { %>--subdomain <% } %> <% } %>
|
|
97
98
|
|
|
98
99
|
database:
|
|
@@ -157,7 +158,7 @@ services:
|
|
|
157
158
|
elasticsearch:
|
|
158
159
|
type: compose
|
|
159
160
|
services:
|
|
160
|
-
image: elasticsearch:
|
|
161
|
+
image: elasticsearch:8.18.1
|
|
161
162
|
command: /usr/local/bin/docker-entrypoint.sh
|
|
162
163
|
environment:
|
|
163
164
|
ELASTICSEARCH_IS_DEDICATED_NODE: 'no'
|
|
@@ -8,6 +8,7 @@ var exit = _interopRequireWildcard(require("../lib/cli/exit"));
|
|
|
8
8
|
var _devEnvironmentCli = require("../lib/dev-environment/dev-environment-cli");
|
|
9
9
|
var _devEnvironmentConfigurationFile = require("../lib/dev-environment/dev-environment-configuration-file");
|
|
10
10
|
var _devEnvironmentCore = require("../lib/dev-environment/dev-environment-core");
|
|
11
|
+
var _devEnvironmentDatabase = require("../lib/dev-environment/dev-environment-database");
|
|
11
12
|
var _devEnvironmentLando = require("../lib/dev-environment/dev-environment-lando");
|
|
12
13
|
var _tracker = require("../lib/tracker");
|
|
13
14
|
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); }
|
|
@@ -82,6 +83,7 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
82
83
|
debug(`WARNING: ${message}`, error.message);
|
|
83
84
|
console.log(_chalk.default.yellow('Warning:'), message);
|
|
84
85
|
}
|
|
86
|
+
(0, _devEnvironmentCli.ensureValidPathsInOptions)(opt);
|
|
85
87
|
let preselectedOptions = opt;
|
|
86
88
|
let suppressPrompts = false;
|
|
87
89
|
if (Object.keys(configurationFileOptions).length > 0) {
|
|
@@ -91,6 +93,7 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
91
93
|
}
|
|
92
94
|
const instanceData = await (0, _devEnvironmentCli.promptForArguments)(preselectedOptions, defaultOptions, suppressPrompts, true);
|
|
93
95
|
instanceData.siteSlug = slug;
|
|
96
|
+
instanceData.adminPassword = (0, _devEnvironmentDatabase.generatePassword)();
|
|
94
97
|
try {
|
|
95
98
|
await (0, _devEnvironmentCore.createEnvironment)(lando, instanceData, integrationsConfig, envVars);
|
|
96
99
|
await (0, _devEnvironmentCore.printEnvironmentInfo)(lando, slug, {
|
|
@@ -42,6 +42,7 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
42
42
|
}
|
|
43
43
|
const currentInstanceData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
|
|
44
44
|
debug('Read instance data', currentInstanceData);
|
|
45
|
+
(0, _devEnvironmentCli.ensureValidPathsInOptions)(opt);
|
|
45
46
|
|
|
46
47
|
/** @type {InstanceOptions} */
|
|
47
48
|
const preselectedOptions = {
|
|
@@ -68,7 +69,8 @@ cmd.argv(process.argv, async (arg, opt) => {
|
|
|
68
69
|
mediaRedirectDomain: currentInstanceData.mediaRedirectDomain,
|
|
69
70
|
multisite: false,
|
|
70
71
|
title: '',
|
|
71
|
-
cron: currentInstanceData.cron
|
|
72
|
+
cron: currentInstanceData.cron,
|
|
73
|
+
adminPassword: currentInstanceData.adminPassword
|
|
72
74
|
};
|
|
73
75
|
const providedOptions = Object.keys(opt).filter(option => option.length > 1) // Filter out single letter aliases
|
|
74
76
|
.filter(option => !['debug', 'help', 'slug'].includes(option)); // Filter out options that are not related to instance configuration
|
package/dist/bin/vip-wp.js
CHANGED
|
@@ -41,18 +41,33 @@ const cancelCommandChar = '\x03';
|
|
|
41
41
|
let currentJob = null;
|
|
42
42
|
let currentOffset = 0;
|
|
43
43
|
let commandRunning = false;
|
|
44
|
+
const isStdinTty = process.stdin.isTTY;
|
|
45
|
+
const normalizeNewlineStream = new _stream.Transform({
|
|
46
|
+
transform(chunk, encoding, callback) {
|
|
47
|
+
callback(null, chunk.toString().replace(/\r/g, '\n'));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
44
50
|
const pipeStreamsToProcess = ({
|
|
45
51
|
stdin,
|
|
46
52
|
stdout: outStream
|
|
47
53
|
}) => {
|
|
48
|
-
|
|
54
|
+
if (isStdinTty) {
|
|
55
|
+
process.stdin.pipe(normalizeNewlineStream).pipe(stdin);
|
|
56
|
+
} else {
|
|
57
|
+
process.stdin.pipe(stdin);
|
|
58
|
+
}
|
|
49
59
|
outStream.pipe(process.stdout);
|
|
50
60
|
};
|
|
51
61
|
const unpipeStreamsFromProcess = ({
|
|
52
62
|
stdin,
|
|
53
63
|
stdout: outStream
|
|
54
64
|
}) => {
|
|
55
|
-
|
|
65
|
+
if (isStdinTty) {
|
|
66
|
+
process.stdin.unpipe(normalizeNewlineStream);
|
|
67
|
+
normalizeNewlineStream.unpipe(stdin);
|
|
68
|
+
} else {
|
|
69
|
+
process.stdin.unpipe(stdin);
|
|
70
|
+
}
|
|
56
71
|
outStream.unpipe(process.stdout);
|
|
57
72
|
};
|
|
58
73
|
const bindStreamEvents = ({
|
|
@@ -352,7 +367,8 @@ const examples = [{
|
|
|
352
367
|
output: mutableStdout,
|
|
353
368
|
terminal: true,
|
|
354
369
|
prompt: '',
|
|
355
|
-
historySize: 0
|
|
370
|
+
historySize: 0,
|
|
371
|
+
crlfDelay: Infinity
|
|
356
372
|
};
|
|
357
373
|
if (isSubShell) {
|
|
358
374
|
subShellSettings.prompt = (0, _chalk.default)`{bold.yellowBright ${promptIdentifier}:}{blue ~}$ `;
|
|
@@ -451,16 +467,6 @@ const examples = [{
|
|
|
451
467
|
isSubShell
|
|
452
468
|
});
|
|
453
469
|
});
|
|
454
|
-
|
|
455
|
-
// Fix to re-add the \n character that readline strips when terminal == true
|
|
456
|
-
process.stdin.on('data', data => {
|
|
457
|
-
// only run this in interactive mode for prompts from WP commands
|
|
458
|
-
if (commandRunning && 0 === Buffer.compare(data, Buffer.from('\r'))) {
|
|
459
|
-
if (currentJob?.stdinStream) {
|
|
460
|
-
currentJob.stdinStream.write('\n');
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
470
|
subShellRl.on('SIGINT', async () => {
|
|
465
471
|
// if we have a 2nd SIGINT, exit immediately
|
|
466
472
|
if (countSIGINT >= 1) {
|
|
@@ -36,4 +36,4 @@ const DEV_ENVIRONMENT_DEFAULTS = exports.DEV_ENVIRONMENT_DEFAULTS = {
|
|
|
36
36
|
multisite: false,
|
|
37
37
|
phpVersion: Object.keys(DEV_ENVIRONMENT_PHP_VERSIONS)[0]
|
|
38
38
|
};
|
|
39
|
-
const DEV_ENVIRONMENT_VERSION = exports.DEV_ENVIRONMENT_VERSION = '2.
|
|
39
|
+
const DEV_ENVIRONMENT_VERSION = exports.DEV_ENVIRONMENT_VERSION = '2.3.0';
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DEFAULT_SLUG = exports.CONFIGURATION_FOLDER = void 0;
|
|
5
5
|
exports.addDevEnvConfigurationOptions = addDevEnvConfigurationOptions;
|
|
6
|
+
exports.ensureValidPathsInOptions = ensureValidPathsInOptions;
|
|
6
7
|
exports.getEnvTrackingInfo = getEnvTrackingInfo;
|
|
7
8
|
exports.getEnvironmentName = getEnvironmentName;
|
|
8
9
|
exports.getEnvironmentStartCommand = getEnvironmentStartCommand;
|
|
@@ -195,7 +196,7 @@ async function promptForArguments(preselectedOptions, defaultOptions, suppressPr
|
|
|
195
196
|
try {
|
|
196
197
|
const currentUser = await (0, _user.getCurrentUserInfo)(true);
|
|
197
198
|
isVIPUser = currentUser?.isVIP ?? false;
|
|
198
|
-
} catch
|
|
199
|
+
} catch {
|
|
199
200
|
isVIPUser = false;
|
|
200
201
|
}
|
|
201
202
|
if (suppressPrompts) {
|
|
@@ -234,7 +235,8 @@ async function promptForArguments(preselectedOptions, defaultOptions, suppressPr
|
|
|
234
235
|
mailpit: false,
|
|
235
236
|
photon: false,
|
|
236
237
|
cron: false,
|
|
237
|
-
overrides: preselectedOptions.overrides
|
|
238
|
+
overrides: preselectedOptions.overrides,
|
|
239
|
+
adminPassword: preselectedOptions.adminPassword
|
|
238
240
|
};
|
|
239
241
|
const promptLabels = {
|
|
240
242
|
xdebug: 'XDebug',
|
|
@@ -320,6 +322,24 @@ async function processComponent(componentType, preselectedValue, defaultValue, s
|
|
|
320
322
|
debug(result);
|
|
321
323
|
return result;
|
|
322
324
|
}
|
|
325
|
+
function ensureValidPathsInOptions(opt) {
|
|
326
|
+
if (opt.appCode) {
|
|
327
|
+
const result = validateAppCodeLocalPath(`${opt.appCode}`);
|
|
328
|
+
if (!result.result) {
|
|
329
|
+
console.warn(_chalk.default.yellow('Warning:'), result.message);
|
|
330
|
+
delete opt.appCode;
|
|
331
|
+
delete opt.a;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (opt.muPlugins) {
|
|
335
|
+
const result = validateMuPluginsLocalPath(`${opt.muPlugins}`);
|
|
336
|
+
if (!result.result) {
|
|
337
|
+
console.warn(_chalk.default.yellow('Warning:'), result.message);
|
|
338
|
+
delete opt.muPlugins;
|
|
339
|
+
delete opt.m;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
323
343
|
async function validateLocalPath(config, validator, componentName, defaultObject) {
|
|
324
344
|
while (config.mode === 'local') {
|
|
325
345
|
const resolvedPath = resolvePath(config.dir ?? '');
|
|
@@ -101,7 +101,7 @@ async function stopEnvironment(lando, slug) {
|
|
|
101
101
|
}
|
|
102
102
|
await (0, _devEnvironmentLando.landoStop)(lando, instancePath);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
function createEnvironment(lando, instanceData, integrationsConfig, envVars) {
|
|
105
105
|
const slug = instanceData.siteSlug;
|
|
106
106
|
integrationsConfig ??= {};
|
|
107
107
|
debug('Will process an environment', slug, 'with instanceData for creation: ', instanceData);
|
|
@@ -109,11 +109,11 @@ async function createEnvironment(lando, instanceData, integrationsConfig, envVar
|
|
|
109
109
|
debug('Instance path for', slug, 'is:', instancePath);
|
|
110
110
|
const alreadyExists = _nodeFs.default.existsSync(instancePath);
|
|
111
111
|
if (alreadyExists) {
|
|
112
|
-
|
|
112
|
+
return Promise.reject(new Error('Environment already exists.'));
|
|
113
113
|
}
|
|
114
114
|
const preProcessedInstanceData = preProcessInstanceData(instanceData);
|
|
115
115
|
debug('Will create an environment', slug, 'with instanceData: ', preProcessedInstanceData);
|
|
116
|
-
|
|
116
|
+
return prepareLandoEnv(lando, preProcessedInstanceData, instancePath, integrationsConfig, envVars);
|
|
117
117
|
}
|
|
118
118
|
async function updateEnvironment(lando, instanceData) {
|
|
119
119
|
const slug = instanceData.siteSlug;
|
|
@@ -130,50 +130,32 @@ async function updateEnvironment(lando, instanceData) {
|
|
|
130
130
|
}
|
|
131
131
|
function preProcessInstanceData(instanceData) {
|
|
132
132
|
const newInstanceData = {
|
|
133
|
-
...instanceData
|
|
133
|
+
...instanceData,
|
|
134
|
+
xdebugConfig: instanceData.xdebugConfig ?? '',
|
|
135
|
+
mariadb: instanceData.mariadb ?? '',
|
|
136
|
+
elasticsearch: instanceData.elasticsearch || false,
|
|
137
|
+
// NOSONAR
|
|
138
|
+
php: instanceData.php ?? _devEnvironment.DEV_ENVIRONMENT_PHP_VERSIONS[Object.keys(_devEnvironment.DEV_ENVIRONMENT_PHP_VERSIONS)[0]].image,
|
|
139
|
+
xdebug: Boolean(instanceData.xdebug),
|
|
140
|
+
phpmyadmin: Boolean(instanceData.phpmyadmin),
|
|
141
|
+
photon: Boolean(instanceData.photon),
|
|
142
|
+
cron: Boolean(instanceData.cron),
|
|
143
|
+
mailpit: Boolean(instanceData.mailpit),
|
|
144
|
+
pullAfter: instanceData.pullAfter ?? 0,
|
|
145
|
+
autologinKey: (0, _uuid.v4)(),
|
|
146
|
+
adminPassword: instanceData.adminPassword ?? 'password',
|
|
147
|
+
version: _devEnvironment.DEV_ENVIRONMENT_VERSION,
|
|
148
|
+
overrides: instanceData.overrides ?? ''
|
|
134
149
|
};
|
|
135
150
|
if (instanceData.mediaRedirectDomain && !/^http/.exec(instanceData.mediaRedirectDomain)) {
|
|
136
151
|
// We need to make sure the redirect is an absolute path
|
|
137
152
|
newInstanceData.mediaRedirectDomain = `https://${instanceData.mediaRedirectDomain}`;
|
|
138
153
|
}
|
|
139
154
|
|
|
140
|
-
//
|
|
141
|
-
newInstanceData.elasticsearch = instanceData.elasticsearch || false; // NOSONAR
|
|
142
|
-
|
|
143
|
-
newInstanceData.php = instanceData.php || _devEnvironment.DEV_ENVIRONMENT_PHP_VERSIONS[Object.keys(_devEnvironment.DEV_ENVIRONMENT_PHP_VERSIONS)[0]].image;
|
|
144
|
-
|
|
145
|
-
// FIXME: isNaN supports only number in TypeScript, actually, because isNaN('123') returns false despite being a string
|
|
155
|
+
// isNaN supports only number in TypeScript, actually, because isNaN('123') returns false despite being a string
|
|
146
156
|
if (isNaN(instanceData.wordpress.tag)) {
|
|
147
157
|
newInstanceData.wordpress.tag = 'trunk';
|
|
148
158
|
}
|
|
149
|
-
if (!newInstanceData.xdebugConfig) {
|
|
150
|
-
newInstanceData.xdebugConfig = '';
|
|
151
|
-
}
|
|
152
|
-
if (!newInstanceData.xdebug) {
|
|
153
|
-
newInstanceData.xdebug = false;
|
|
154
|
-
}
|
|
155
|
-
if (!newInstanceData.phpmyadmin) {
|
|
156
|
-
newInstanceData.phpmyadmin = false;
|
|
157
|
-
}
|
|
158
|
-
if (!newInstanceData.photon) {
|
|
159
|
-
newInstanceData.photon = false;
|
|
160
|
-
}
|
|
161
|
-
if (!newInstanceData.cron) {
|
|
162
|
-
newInstanceData.cron = false;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Mailpit migration
|
|
166
|
-
newInstanceData.mailpit ??= false;
|
|
167
|
-
|
|
168
|
-
// MariaDB migration
|
|
169
|
-
if (!newInstanceData.mariadb) {
|
|
170
|
-
newInstanceData.mariadb = undefined;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// newInstanceData
|
|
174
|
-
newInstanceData.autologinKey = (0, _uuid.v4)();
|
|
175
|
-
newInstanceData.version = _devEnvironment.DEV_ENVIRONMENT_VERSION;
|
|
176
|
-
newInstanceData.overrides = instanceData.overrides ?? '';
|
|
177
159
|
return newInstanceData;
|
|
178
160
|
}
|
|
179
161
|
async function destroyEnvironment(lando, slug, removeFiles) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.reIndexSearch = exports.flushCache = exports.executeQuery = exports.dataCleanup = exports.addAdminUser = void 0;
|
|
4
|
+
exports.reIndexSearch = exports.generatePassword = exports.flushCache = exports.executeQuery = exports.dataCleanup = exports.addAdminUser = void 0;
|
|
5
5
|
var _nodeCrypto = require("node:crypto");
|
|
6
6
|
var _devEnvironmentCore = require("./dev-environment-core");
|
|
7
7
|
const generatePassword = () => {
|
|
@@ -14,6 +14,7 @@ const generatePassword = () => {
|
|
|
14
14
|
}
|
|
15
15
|
return password;
|
|
16
16
|
};
|
|
17
|
+
exports.generatePassword = generatePassword;
|
|
17
18
|
const addAdminUser = async (lando, slug, quiet) => {
|
|
18
19
|
const instanceData = (0, _devEnvironmentCore.readEnvironmentData)(slug);
|
|
19
20
|
const password = !instanceData.adminPassword || instanceData.adminPassword === 'password' ? generatePassword() : instanceData.adminPassword;
|
|
@@ -174,8 +174,8 @@ async function bootstrapLando() {
|
|
|
174
174
|
try {
|
|
175
175
|
registryResolvable = (await (0, _promises.lookup)('ghcr.io')).address.length > 0 || false;
|
|
176
176
|
debug('Registry ghcr.io is resolvable');
|
|
177
|
-
} catch {
|
|
178
|
-
debug('Registry ghcr.io is not resolvable, image pull might be broken.');
|
|
177
|
+
} catch (err) {
|
|
178
|
+
debug('Registry ghcr.io is not resolvable, image pull might be broken. Error: %O', err);
|
|
179
179
|
registryResolvable = false;
|
|
180
180
|
}
|
|
181
181
|
const pull = registryResolvable && (instanceData.pullAfter ?? 0) < Date.now();
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
### 3.15.0
|
|
4
|
+
|
|
5
|
+
* chore(deps): update `lando`
|
|
6
|
+
* Add query name to the GraphQL endpoint as a query string by @abdullah
|
|
7
|
+
* build(deps): bump open from 10.1.1 to 10.1.2
|
|
8
|
+
* build(deps-dev): bump the babel group with 4 updates
|
|
9
|
+
* feat(dev-env) randomize vipgo password post-import
|
|
10
|
+
* chore(dev-env): add more Docker-related logging
|
|
11
|
+
* build(deps-dev): bump @types/node from 22.14.1 to 22.15.14
|
|
12
|
+
* build(deps-dev): bump the babel group with 2 updates
|
|
13
|
+
* chore: address Dependabot deprecations
|
|
14
|
+
* feat(dev-env): set random password for `vipgo` user
|
|
15
|
+
* build(deps-dev): bump @types/node from 22.15.14 to 22.15.16
|
|
16
|
+
* fix(wp): handling of CR characters
|
|
17
|
+
* fix(dev-env): validation of `--app-code` and `--mu-plugins` options
|
|
18
|
+
* fix(dev-env): ensure all required peroperties are present for rebuild
|
|
19
|
+
* build(deps): bump actions/dependency-review-action from 4.6.0 to 4.7.0
|
|
20
|
+
* build(deps-dev): bump @types/shelljs from 0.8.15 to 0.8.16
|
|
21
|
+
* build(deps-dev): bump @types/node from 22.15.16 to 22.15.17
|
|
22
|
+
* build(deps): bump actions/dependency-review-action from 4.7.0 to 4.7.1
|
|
23
|
+
* build(deps): bump debug from 4.4.0 to 4.4.1
|
|
24
|
+
* build(deps): bump semver from 7.7.1 to 7.7.2
|
|
25
|
+
* build(deps): bump shelljs from 0.9.2 to 0.10.0
|
|
26
|
+
* build(deps-dev): bump @types/node from 22.15.17 to 22.15.18
|
|
27
|
+
|
|
28
|
+
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.14.0...3.15.0
|
|
29
|
+
|
|
30
|
+
### 3.14.0
|
|
31
|
+
|
|
32
|
+
* build(deps): bump step-security/harden-runner from 2.11.1 to 2.12.0
|
|
33
|
+
* build(deps-dev): bump dockerode from 4.0.5 to 4.0.6
|
|
34
|
+
* Add ability to run WP-CLI commands over SSH
|
|
35
|
+
|
|
36
|
+
**Full Changelog**: https://github.com/Automattic/vip-cli/compare/3.13.0...3.14.0
|
|
37
|
+
|
|
3
38
|
### 3.13.0
|
|
4
39
|
|
|
5
40
|
* build(deps): bump Automattic/vip-actions from dbd477b39f2122bf594da2d65dc0ea8ab5fc9bf0 to bb2853ecb6cd7dba2efe589ebb10cf930759fe69
|