wp-studio 1.7.7-alpha1

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.
Files changed (48) hide show
  1. package/LICENSE.md +257 -0
  2. package/README.md +87 -0
  3. package/dist/cli/_events-BeOo0LuG.js +116 -0
  4. package/dist/cli/appdata-07CF2rhg.js +21090 -0
  5. package/dist/cli/archive-xDmkN4wb.js +15942 -0
  6. package/dist/cli/browser-CgWK-yoe.js +44 -0
  7. package/dist/cli/certificate-manager-DdBumKZp.js +250 -0
  8. package/dist/cli/create-BHVhkvTx.js +80 -0
  9. package/dist/cli/create-ZS29BDDi.js +40999 -0
  10. package/dist/cli/delete-BgQn-elT.js +56 -0
  11. package/dist/cli/delete-g8pgaLna.js +132 -0
  12. package/dist/cli/get-wordpress-version-BwSCJujO.js +18 -0
  13. package/dist/cli/index-7pbG_s_U.js +434 -0
  14. package/dist/cli/index-BXRYeCYG.js +1393 -0
  15. package/dist/cli/index-T3F1GwxX.js +2668 -0
  16. package/dist/cli/is-errno-exception-t38xF2pB.js +6 -0
  17. package/dist/cli/list-BE_UBjL5.js +105 -0
  18. package/dist/cli/list-DKz0XxM7.js +1032 -0
  19. package/dist/cli/logger-actions-OaIvl-ai.js +45 -0
  20. package/dist/cli/login-B4PkfKOu.js +82 -0
  21. package/dist/cli/logout-BC9gKlTj.js +48 -0
  22. package/dist/cli/main.js +5 -0
  23. package/dist/cli/mu-plugins-GEfKsl5U.js +530 -0
  24. package/dist/cli/passwords-DyzWd9Xi.js +80 -0
  25. package/dist/cli/process-manager-daemon.js +327 -0
  26. package/dist/cli/process-manager-ipc-AUZeYYDT.js +454 -0
  27. package/dist/cli/proxy-daemon.js +197 -0
  28. package/dist/cli/run-wp-cli-command-BctnMDWG.js +88 -0
  29. package/dist/cli/sequential-BQFuixXz.js +46 -0
  30. package/dist/cli/server-files-C_oy-mnI.js +26 -0
  31. package/dist/cli/set-DknhAZpw.js +327 -0
  32. package/dist/cli/site-utils-CfsabjUn.js +243 -0
  33. package/dist/cli/snapshots-6XE53y_F.js +874 -0
  34. package/dist/cli/sqlite-integration-H4OwSlwR.js +83 -0
  35. package/dist/cli/start-CRJqm09_.js +90 -0
  36. package/dist/cli/status-CWNHIOaY.js +44 -0
  37. package/dist/cli/status-CWWx9jYF.js +110 -0
  38. package/dist/cli/stop-CQosmjqA.js +117 -0
  39. package/dist/cli/update-BgL2HKHW.js +101 -0
  40. package/dist/cli/validation-error-DqLxqQuA.js +40 -0
  41. package/dist/cli/wordpress-server-child.js +514 -0
  42. package/dist/cli/wordpress-server-ipc-Dwsg9jSb.js +140 -0
  43. package/dist/cli/wordpress-server-manager-CtiuJqEb.js +566 -0
  44. package/dist/cli/wordpress-version-utils-B6UVeTh_.js +51 -0
  45. package/dist/cli/wp-UGSnlkN0.js +103 -0
  46. package/package.json +73 -0
  47. package/patches/@wp-playground+wordpress+3.1.12.patch +28 -0
  48. package/scripts/postinstall-npm.mjs +38 -0
@@ -0,0 +1,88 @@
1
+ import { rootCertificates } from "node:tls";
2
+ import { loadNodeRuntime, createNodeFsMountHandler } from "@php-wasm/node";
3
+ import { ProcessIdAllocator, PHP, setPhpIniEntries } from "@php-wasm/universal";
4
+ import { createSpawnHandler } from "@php-wasm/util";
5
+ import { c as cleanupLegacyMuPlugins, g as getMuPlugins } from "./mu-plugins-GEfKsl5U.js";
6
+ import { P as LatestSupportedPHPVersion } from "./appdata-07CF2rhg.js";
7
+ import { __ } from "@wordpress/i18n";
8
+ import { setupPlatformLevelMuPlugins } from "@wp-playground/wordpress";
9
+ import { g as getWpCliPharPath, a as getSqliteCommandPath } from "./server-files-C_oy-mnI.js";
10
+ const processIdAllocator = new ProcessIdAllocator();
11
+ const PLAYGROUND_INTERNAL_SHARED_FOLDER = "/internal/shared";
12
+ function createNoopSpawnHandler() {
13
+ return createSpawnHandler(async (args, processApi) => {
14
+ await new Promise((resolve) => setTimeout(resolve, 1));
15
+ processApi.exit(1);
16
+ });
17
+ }
18
+ async function runWpCliCommand(siteFolder, phpVersion, args) {
19
+ const id = await loadNodeRuntime(phpVersion, {
20
+ followSymlinks: true,
21
+ withRedis: true,
22
+ withMemcached: true,
23
+ emscriptenOptions: {
24
+ processId: processIdAllocator.claim()
25
+ }
26
+ });
27
+ const php = new PHP(id);
28
+ try {
29
+ await php.setSapiName("cli");
30
+ php.mkdir("/wordpress");
31
+ await php.mount("/wordpress", createNodeFsMountHandler(siteFolder));
32
+ php.writeFile("/tmp/ca-bundle.crt", rootCertificates.join("\n"));
33
+ await setPhpIniEntries(php, {
34
+ "openssl.cafile": "/tmp/ca-bundle.crt",
35
+ allow_url_fopen: 1
36
+ });
37
+ await php.setSpawnHandler(createNoopSpawnHandler());
38
+ await cleanupLegacyMuPlugins(siteFolder);
39
+ const [studioMuPluginsHostPath, loaderMuPluginHostPath] = await getMuPlugins({
40
+ isWpAutoUpdating: false
41
+ });
42
+ await php.mount(
43
+ "/internal/studio/mu-plugins",
44
+ createNodeFsMountHandler(studioMuPluginsHostPath)
45
+ );
46
+ await php.mount(
47
+ PLAYGROUND_INTERNAL_SHARED_FOLDER + "/mu-plugins/99-studio-loader.php",
48
+ createNodeFsMountHandler(loaderMuPluginHostPath)
49
+ );
50
+ await php.mount("/tmp/wp-cli.phar", createNodeFsMountHandler(getWpCliPharPath()));
51
+ await php.mount("/tmp/sqlite-command", createNodeFsMountHandler(getSqliteCommandPath()));
52
+ await setupPlatformLevelMuPlugins(php);
53
+ return [
54
+ await php.cli(["php", "/tmp/wp-cli.phar", "--path=/wordpress", ...args]),
55
+ () => php.exit()
56
+ ];
57
+ } catch (error) {
58
+ throw new Error(__("An error occurred while running the WP-CLI command."));
59
+ }
60
+ }
61
+ async function runGlobalWpCliCommand(args) {
62
+ const id = await loadNodeRuntime(LatestSupportedPHPVersion, {
63
+ followSymlinks: true,
64
+ withRedis: true,
65
+ withMemcached: true,
66
+ emscriptenOptions: {
67
+ processId: processIdAllocator.claim()
68
+ }
69
+ });
70
+ const php = new PHP(id);
71
+ try {
72
+ await php.setSapiName("cli");
73
+ php.writeFile("/tmp/ca-bundle.crt", rootCertificates.join("\n"));
74
+ await setPhpIniEntries(php, {
75
+ "openssl.cafile": "/tmp/ca-bundle.crt",
76
+ allow_url_fopen: 1
77
+ });
78
+ await php.setSpawnHandler(createNoopSpawnHandler());
79
+ await php.mount("/tmp/wp-cli.phar", createNodeFsMountHandler(getWpCliPharPath()));
80
+ return [await php.cli(["php", "/tmp/wp-cli.phar", ...args]), () => php.exit()];
81
+ } catch (error) {
82
+ throw new Error(__("An error occurred while running the WP-CLI command."));
83
+ }
84
+ }
85
+ export {
86
+ runGlobalWpCliCommand as a,
87
+ runWpCliCommand as r
88
+ };
@@ -0,0 +1,46 @@
1
+ function sequential(fn, options) {
2
+ const concurrentCount = options?.concurrent ?? 1;
3
+ const maxQueueSize = options?.max;
4
+ const deduplicateKey = options?.deduplicateKey;
5
+ const locks = /* @__PURE__ */ new Set();
6
+ const inFlightByKey = /* @__PURE__ */ new Map();
7
+ let queueCount = 0;
8
+ return async (...args) => {
9
+ const key = deduplicateKey?.(...args);
10
+ if (key) {
11
+ const existing = inFlightByKey.get(key);
12
+ if (existing) {
13
+ return existing;
14
+ }
15
+ }
16
+ const execute = async () => {
17
+ if (maxQueueSize !== void 0 && queueCount >= maxQueueSize) {
18
+ throw new Error(
19
+ `Queue is full (${maxQueueSize} pending commands). Please try again later.`
20
+ );
21
+ }
22
+ while (locks.size >= concurrentCount) {
23
+ queueCount++;
24
+ await Promise.allSettled([...locks]);
25
+ queueCount--;
26
+ }
27
+ const fnPromise = fn(...args);
28
+ try {
29
+ locks.add(fnPromise);
30
+ return await fnPromise;
31
+ } finally {
32
+ locks.delete(fnPromise);
33
+ }
34
+ };
35
+ const resultPromise = execute();
36
+ if (key) {
37
+ inFlightByKey.set(key, resultPromise);
38
+ const cleanup = () => inFlightByKey.delete(key);
39
+ resultPromise.then(cleanup, cleanup);
40
+ }
41
+ return resultPromise;
42
+ };
43
+ }
44
+ export {
45
+ sequential as s
46
+ };
@@ -0,0 +1,26 @@
1
+ import path from "path";
2
+ import { Q as getAppdataDirectory } from "./appdata-07CF2rhg.js";
3
+ const WP_CLI_PHAR_FILENAME = "wp-cli.phar";
4
+ const SQLITE_COMMAND_FOLDER = "sqlite-command";
5
+ function getServerFilesPath() {
6
+ return path.join(getAppdataDirectory(), "server-files");
7
+ }
8
+ function getWpCliPharPath() {
9
+ return path.join(getServerFilesPath(), WP_CLI_PHAR_FILENAME);
10
+ }
11
+ function getSqliteCommandPath() {
12
+ return path.join(getServerFilesPath(), SQLITE_COMMAND_FOLDER);
13
+ }
14
+ function getLanguagePacksPath() {
15
+ return path.join(getServerFilesPath(), "language-packs");
16
+ }
17
+ function getAiInstructionsPath() {
18
+ return path.join(getServerFilesPath(), "skills");
19
+ }
20
+ export {
21
+ getSqliteCommandPath as a,
22
+ getLanguagePacksPath as b,
23
+ getServerFilesPath as c,
24
+ getAiInstructionsPath as d,
25
+ getWpCliPharPath as g
26
+ };
@@ -0,0 +1,327 @@
1
+ import { SupportedPHPVersions } from "@php-wasm/universal";
2
+ import { L as LoggerError, a as Logger, M as MINIMUM_WORDPRESS_VERSION, k as getSiteByFolder, r as readAppdata, l as lockAppdata, G as arePathsEqual, s as saveAppdata, u as unlockAppdata, F as DEFAULT_WORDPRESS_VERSION, H as updateSiteLatestCliPid, S as SITE_EVENTS } from "./appdata-07CF2rhg.js";
3
+ import { V as ValidationError, g as getDomainNameValidationError } from "./validation-error-DqLxqQuA.js";
4
+ import { v as validateAdminUsername, a as validateAdminEmail, e as encodePassword } from "./passwords-DyzWd9Xi.js";
5
+ import { b as isValidWordPressVersion, c as isWordPressVersionAtLeast, g as getWordPressVersionUrl } from "./wordpress-version-utils-B6UVeTh_.js";
6
+ import { S as SiteCommandLoggerAction } from "./logger-actions-OaIvl-ai.js";
7
+ import { __, sprintf } from "@wordpress/i18n";
8
+ import { c as connectToDaemon, i as isServerRunning, a as stopWordPressServer, s as startWordPressServer, e as emitSiteEvent, d as disconnectFromDaemon } from "./wordpress-server-manager-CtiuJqEb.js";
9
+ import { u as updateDomainInHosts, s as setupCustomDomain } from "./site-utils-CfsabjUn.js";
10
+ import { r as runWpCliCommand } from "./run-wp-cli-command-BctnMDWG.js";
11
+ import { v as validatePhpVersion } from "./index-7pbG_s_U.js";
12
+ function siteNeedsRestart(changes) {
13
+ const {
14
+ domainChanged,
15
+ httpsChanged,
16
+ phpChanged,
17
+ wpChanged,
18
+ xdebugChanged,
19
+ credentialsChanged,
20
+ debugLogChanged,
21
+ debugDisplayChanged
22
+ } = changes;
23
+ return !!(domainChanged || httpsChanged || phpChanged || wpChanged || xdebugChanged || credentialsChanged || debugLogChanged || debugDisplayChanged);
24
+ }
25
+ const ALLOWED_PHP_VERSIONS = [...SupportedPHPVersions];
26
+ const logger = new Logger();
27
+ async function runCommand(sitePath, options) {
28
+ const {
29
+ name,
30
+ domain,
31
+ https,
32
+ php,
33
+ wp,
34
+ xdebug,
35
+ adminUsername,
36
+ adminPassword,
37
+ debugLog,
38
+ debugDisplay
39
+ } = options;
40
+ let { adminEmail } = options;
41
+ if (name === void 0 && domain === void 0 && https === void 0 && php === void 0 && wp === void 0 && xdebug === void 0 && adminUsername === void 0 && adminPassword === void 0 && adminEmail === void 0 && debugLog === void 0 && debugDisplay === void 0) {
42
+ throw new LoggerError(
43
+ __(
44
+ "At least one option (--name, --domain, --https, --php, --wp, --xdebug, --admin-username, --admin-password, --admin-email, --debug-log, --debug-display) is required."
45
+ )
46
+ );
47
+ }
48
+ if (name !== void 0 && !name.trim()) {
49
+ throw new LoggerError(__("Site name cannot be empty."));
50
+ }
51
+ if (adminUsername !== void 0) {
52
+ const usernameError = validateAdminUsername(adminUsername);
53
+ if (usernameError) {
54
+ throw new LoggerError(usernameError);
55
+ }
56
+ }
57
+ if (adminPassword !== void 0 && !adminPassword.trim()) {
58
+ throw new LoggerError(__("Admin password cannot be empty."));
59
+ }
60
+ if (adminEmail !== void 0) {
61
+ if (!adminEmail.trim()) {
62
+ adminEmail = void 0;
63
+ } else {
64
+ const emailError = validateAdminEmail(adminEmail);
65
+ if (emailError) {
66
+ throw new LoggerError(emailError);
67
+ }
68
+ }
69
+ }
70
+ try {
71
+ logger.reportStart(SiteCommandLoggerAction.LOAD_SITES, __("Loading site…"));
72
+ let site = await getSiteByFolder(sitePath);
73
+ logger.reportSuccess(__("Site loaded"));
74
+ const initialAppdata = await readAppdata();
75
+ if (domain) {
76
+ const existingDomainNames = initialAppdata.sites.filter((s) => s.id !== site.id).map((s) => s.customDomain).filter((d) => Boolean(d));
77
+ const domainError = getDomainNameValidationError(true, domain, existingDomainNames);
78
+ if (domainError) {
79
+ throw new LoggerError(domainError);
80
+ }
81
+ }
82
+ if (https === true) {
83
+ const effectiveDomain = domain ?? site.customDomain;
84
+ if (!effectiveDomain) {
85
+ throw new LoggerError(__("HTTPS requires a custom domain. Use --domain to set one."));
86
+ }
87
+ }
88
+ if (xdebug === true) {
89
+ const otherXdebugSite = initialAppdata.sites.find(
90
+ (s) => s.enableXdebug && s.id !== site.id
91
+ );
92
+ if (otherXdebugSite) {
93
+ throw new LoggerError(
94
+ sprintf(
95
+ /* translators: %s: site name */
96
+ __('Only one site can have Xdebug enabled at a time. Disable Xdebug on "%s" first.'),
97
+ otherXdebugSite.name
98
+ )
99
+ );
100
+ }
101
+ }
102
+ const nameChanged = name !== void 0 && name !== site.name;
103
+ const domainChanged = domain !== void 0 && domain !== site.customDomain;
104
+ const httpsChanged = https !== void 0 && https !== site.enableHttps;
105
+ const phpChanged = php !== void 0 && php !== site.phpVersion;
106
+ const wpChanged = wp !== void 0;
107
+ const xdebugChanged = xdebug !== void 0 && xdebug !== site.enableXdebug;
108
+ const adminUsernameChanged = adminUsername !== void 0 && adminUsername !== (site.adminUsername ?? "admin");
109
+ const adminPasswordChanged = adminPassword !== void 0;
110
+ const adminEmailChanged = adminEmail !== void 0 && adminEmail !== (site.adminEmail ?? "");
111
+ const credentialsChanged = adminUsernameChanged || adminPasswordChanged || adminEmailChanged;
112
+ const debugLogChanged = debugLog !== void 0 && debugLog !== site.enableDebugLog;
113
+ const debugDisplayChanged = debugDisplay !== void 0 && debugDisplay !== site.enableDebugDisplay;
114
+ const hasChanges = nameChanged || domainChanged || httpsChanged || phpChanged || wpChanged || xdebugChanged || credentialsChanged || debugLogChanged || debugDisplayChanged;
115
+ if (!hasChanges) {
116
+ throw new LoggerError(
117
+ __("No changes to apply. The site already has the specified settings.")
118
+ );
119
+ }
120
+ const needsRestart = siteNeedsRestart({
121
+ domainChanged,
122
+ httpsChanged,
123
+ phpChanged,
124
+ wpChanged,
125
+ xdebugChanged,
126
+ credentialsChanged,
127
+ debugLogChanged,
128
+ debugDisplayChanged
129
+ });
130
+ const oldDomain = site.customDomain;
131
+ try {
132
+ await lockAppdata();
133
+ const appdata = await readAppdata();
134
+ const foundSite = appdata.sites.find((s) => arePathsEqual(s.path, sitePath));
135
+ if (!foundSite) {
136
+ throw new LoggerError(__("The specified directory is not added to Studio."));
137
+ }
138
+ if (nameChanged) {
139
+ foundSite.name = name;
140
+ }
141
+ if (domainChanged) {
142
+ foundSite.customDomain = domain || void 0;
143
+ }
144
+ if (httpsChanged) {
145
+ foundSite.enableHttps = https;
146
+ }
147
+ if (phpChanged) {
148
+ foundSite.phpVersion = php;
149
+ }
150
+ if (xdebugChanged) {
151
+ foundSite.enableXdebug = xdebug;
152
+ }
153
+ if (adminUsernameChanged) {
154
+ foundSite.adminUsername = adminUsername;
155
+ }
156
+ if (adminPasswordChanged) {
157
+ foundSite.adminPassword = encodePassword(adminPassword);
158
+ }
159
+ if (adminEmailChanged) {
160
+ foundSite.adminEmail = adminEmail;
161
+ }
162
+ if (debugLogChanged) {
163
+ foundSite.enableDebugLog = debugLog;
164
+ }
165
+ if (debugDisplayChanged) {
166
+ foundSite.enableDebugDisplay = debugDisplay;
167
+ }
168
+ await saveAppdata(appdata);
169
+ site = foundSite;
170
+ } finally {
171
+ await unlockAppdata();
172
+ }
173
+ if (domainChanged) {
174
+ logger.reportStart(SiteCommandLoggerAction.ADD_DOMAIN_TO_HOSTS, __("Updating hosts file…"));
175
+ await updateDomainInHosts(oldDomain, domain, site.port);
176
+ logger.reportSuccess(__("Hosts file updated"));
177
+ }
178
+ logger.reportStart(SiteCommandLoggerAction.START_DAEMON, __("Starting process daemon…"));
179
+ await connectToDaemon();
180
+ logger.reportSuccess(__("Process daemon started"));
181
+ const wasRunning = await isServerRunning(site.id);
182
+ if (needsRestart && wasRunning) {
183
+ logger.reportStart(SiteCommandLoggerAction.STOP_SITE, __("Stopping WordPress server…"));
184
+ await stopWordPressServer(site.id);
185
+ logger.reportSuccess(__("WordPress server stopped"));
186
+ }
187
+ if (wpChanged) {
188
+ logger.reportStart(SiteCommandLoggerAction.SET_WP_VERSION, __("Updating WordPress version…"));
189
+ const phpVersion = validatePhpVersion(site.phpVersion);
190
+ const zipUrl = getWordPressVersionUrl(wp);
191
+ const [response, exitPhp] = await runWpCliCommand(sitePath, phpVersion, [
192
+ "core",
193
+ "update",
194
+ zipUrl,
195
+ "--force",
196
+ "--skip-plugins",
197
+ "--skip-themes"
198
+ ]);
199
+ const exitCode = await response.exitCode;
200
+ if (exitCode !== 0) {
201
+ exitPhp();
202
+ throw new LoggerError(sprintf(__("Failed to update WordPress version to %s"), wp));
203
+ }
204
+ logger.reportSuccess(__("WordPress version updated"));
205
+ try {
206
+ await lockAppdata();
207
+ const appdata = await readAppdata();
208
+ const updatedSite = appdata.sites.find((s) => s.id === site.id);
209
+ if (updatedSite) {
210
+ updatedSite.isWpAutoUpdating = wp === DEFAULT_WORDPRESS_VERSION;
211
+ await saveAppdata(appdata);
212
+ site = updatedSite;
213
+ }
214
+ } finally {
215
+ await unlockAppdata();
216
+ }
217
+ exitPhp();
218
+ }
219
+ if (needsRestart && wasRunning) {
220
+ if (site.customDomain) {
221
+ await setupCustomDomain(site, logger, { skipHostsUpdate: true });
222
+ }
223
+ logger.reportStart(SiteCommandLoggerAction.START_SITE, __("Starting WordPress server…"));
224
+ const processDesc = await startWordPressServer(site, logger);
225
+ if (processDesc.status === "online") {
226
+ await updateSiteLatestCliPid(site.id, processDesc.pid);
227
+ }
228
+ logger.reportSuccess(__("WordPress server started"));
229
+ }
230
+ logger.reportSuccess(__("Site configuration updated"));
231
+ await emitSiteEvent(SITE_EVENTS.UPDATED, { siteId: site.id });
232
+ return;
233
+ } finally {
234
+ await disconnectFromDaemon();
235
+ }
236
+ }
237
+ const registerCommand = (yargs) => {
238
+ return yargs.command({
239
+ command: "set",
240
+ describe: __("Configure site settings"),
241
+ builder: (yargs2) => {
242
+ return yargs2.option("name", {
243
+ type: "string",
244
+ description: __("Site name")
245
+ }).option("domain", {
246
+ type: "string",
247
+ description: __("Custom domain (must end with .local)")
248
+ }).option("https", {
249
+ type: "boolean",
250
+ description: __("Enable HTTPS (requires custom domain)")
251
+ }).option("php", {
252
+ type: "string",
253
+ description: __("PHP version"),
254
+ choices: ALLOWED_PHP_VERSIONS
255
+ }).option("wp", {
256
+ type: "string",
257
+ description: __("WordPress version"),
258
+ coerce: (value) => {
259
+ if (!isValidWordPressVersion(value)) {
260
+ throw new ValidationError(
261
+ "wp",
262
+ value,
263
+ __(
264
+ 'Must be: "latest", "nightly", or a valid version number (e.g., "6.4", "6.4.1", "6.4-beta1")'
265
+ )
266
+ );
267
+ }
268
+ if (!isWordPressVersionAtLeast(value, MINIMUM_WORDPRESS_VERSION)) {
269
+ throw new ValidationError(
270
+ "wp",
271
+ value,
272
+ sprintf(__("Must be: at least %s"), MINIMUM_WORDPRESS_VERSION)
273
+ );
274
+ }
275
+ return value;
276
+ }
277
+ }).option("xdebug", {
278
+ type: "boolean",
279
+ description: __("Enable Xdebug")
280
+ }).option("admin-username", {
281
+ type: "string",
282
+ description: __("Admin username")
283
+ }).option("admin-password", {
284
+ type: "string",
285
+ description: __("Admin password")
286
+ }).option("admin-email", {
287
+ type: "string",
288
+ description: __("Admin email")
289
+ }).option("debug-log", {
290
+ type: "boolean",
291
+ description: __("Enable WP_DEBUG_LOG")
292
+ }).option("debug-display", {
293
+ type: "boolean",
294
+ description: __("Enable WP_DEBUG_DISPLAY")
295
+ });
296
+ },
297
+ handler: async (argv) => {
298
+ try {
299
+ await runCommand(argv.path, {
300
+ name: argv.name,
301
+ domain: argv.domain,
302
+ https: argv.https,
303
+ php: argv.php,
304
+ wp: argv.wp,
305
+ xdebug: argv.xdebug,
306
+ adminUsername: argv.adminUsername,
307
+ adminPassword: argv.adminPassword,
308
+ adminEmail: argv.adminEmail,
309
+ debugLog: argv.debugLog,
310
+ debugDisplay: argv.debugDisplay
311
+ });
312
+ } catch (error) {
313
+ if (error instanceof LoggerError) {
314
+ logger.reportError(error);
315
+ } else {
316
+ const loggerError = new LoggerError(__("Failed to configure site"), error);
317
+ logger.reportError(loggerError);
318
+ }
319
+ process.exit(1);
320
+ }
321
+ }
322
+ });
323
+ };
324
+ export {
325
+ registerCommand,
326
+ runCommand
327
+ };