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.
- package/LICENSE.md +257 -0
- package/README.md +87 -0
- package/dist/cli/_events-BeOo0LuG.js +116 -0
- package/dist/cli/appdata-07CF2rhg.js +21090 -0
- package/dist/cli/archive-xDmkN4wb.js +15942 -0
- package/dist/cli/browser-CgWK-yoe.js +44 -0
- package/dist/cli/certificate-manager-DdBumKZp.js +250 -0
- package/dist/cli/create-BHVhkvTx.js +80 -0
- package/dist/cli/create-ZS29BDDi.js +40999 -0
- package/dist/cli/delete-BgQn-elT.js +56 -0
- package/dist/cli/delete-g8pgaLna.js +132 -0
- package/dist/cli/get-wordpress-version-BwSCJujO.js +18 -0
- package/dist/cli/index-7pbG_s_U.js +434 -0
- package/dist/cli/index-BXRYeCYG.js +1393 -0
- package/dist/cli/index-T3F1GwxX.js +2668 -0
- package/dist/cli/is-errno-exception-t38xF2pB.js +6 -0
- package/dist/cli/list-BE_UBjL5.js +105 -0
- package/dist/cli/list-DKz0XxM7.js +1032 -0
- package/dist/cli/logger-actions-OaIvl-ai.js +45 -0
- package/dist/cli/login-B4PkfKOu.js +82 -0
- package/dist/cli/logout-BC9gKlTj.js +48 -0
- package/dist/cli/main.js +5 -0
- package/dist/cli/mu-plugins-GEfKsl5U.js +530 -0
- package/dist/cli/passwords-DyzWd9Xi.js +80 -0
- package/dist/cli/process-manager-daemon.js +327 -0
- package/dist/cli/process-manager-ipc-AUZeYYDT.js +454 -0
- package/dist/cli/proxy-daemon.js +197 -0
- package/dist/cli/run-wp-cli-command-BctnMDWG.js +88 -0
- package/dist/cli/sequential-BQFuixXz.js +46 -0
- package/dist/cli/server-files-C_oy-mnI.js +26 -0
- package/dist/cli/set-DknhAZpw.js +327 -0
- package/dist/cli/site-utils-CfsabjUn.js +243 -0
- package/dist/cli/snapshots-6XE53y_F.js +874 -0
- package/dist/cli/sqlite-integration-H4OwSlwR.js +83 -0
- package/dist/cli/start-CRJqm09_.js +90 -0
- package/dist/cli/status-CWNHIOaY.js +44 -0
- package/dist/cli/status-CWWx9jYF.js +110 -0
- package/dist/cli/stop-CQosmjqA.js +117 -0
- package/dist/cli/update-BgL2HKHW.js +101 -0
- package/dist/cli/validation-error-DqLxqQuA.js +40 -0
- package/dist/cli/wordpress-server-child.js +514 -0
- package/dist/cli/wordpress-server-ipc-Dwsg9jSb.js +140 -0
- package/dist/cli/wordpress-server-manager-CtiuJqEb.js +566 -0
- package/dist/cli/wordpress-version-utils-B6UVeTh_.js +51 -0
- package/dist/cli/wp-UGSnlkN0.js +103 -0
- package/package.json +73 -0
- package/patches/@wp-playground+wordpress+3.1.12.patch +28 -0
- package/scripts/postinstall-npm.mjs +38 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
function isErrnoException(value) {
|
|
2
|
+
return value instanceof Error && (!("errno" in value) || typeof value["errno"] === "number" || typeof value["errno"] === "undefined") && (!("code" in value) || typeof value["code"] === "string" || typeof value["code"] === "undefined") && (!("path" in value) || typeof value["path"] === "string" || typeof value["path"] === "undefined") && (!("syscall" in value) || typeof value["syscall"] === "string" || typeof value["syscall"] === "undefined");
|
|
3
|
+
}
|
|
4
|
+
export {
|
|
5
|
+
isErrnoException as i
|
|
6
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { S as SiteCommandLoggerAction } from "./logger-actions-OaIvl-ai.js";
|
|
2
|
+
import { __, sprintf, _n } from "@wordpress/i18n";
|
|
3
|
+
import CliTable3 from "cli-table3";
|
|
4
|
+
import { L as LoggerError, a as Logger, r as readAppdata, A as getSiteUrl } from "./appdata-07CF2rhg.js";
|
|
5
|
+
import { c as connectToDaemon, d as disconnectFromDaemon } from "./wordpress-server-manager-CtiuJqEb.js";
|
|
6
|
+
import { i as isSiteRunning } from "./site-utils-CfsabjUn.js";
|
|
7
|
+
import { c as getPrettyPath, b as getColumnWidths } from "./index-7pbG_s_U.js";
|
|
8
|
+
async function getSiteListData(sites) {
|
|
9
|
+
const result = [];
|
|
10
|
+
for await (const site of sites) {
|
|
11
|
+
const isReady = await isSiteRunning(site);
|
|
12
|
+
const status = isReady ? `🟢 ${__("Online")}` : `🔴 ${__("Offline")}`;
|
|
13
|
+
const url = getSiteUrl(site);
|
|
14
|
+
result.push({
|
|
15
|
+
id: site.id,
|
|
16
|
+
status,
|
|
17
|
+
name: site.name,
|
|
18
|
+
path: getPrettyPath(site.path),
|
|
19
|
+
url
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
function displaySiteList(sitesData, format) {
|
|
25
|
+
if (format === "table") {
|
|
26
|
+
const colWidths = getColumnWidths([0.1, 0.2, 0.3, 0.4]);
|
|
27
|
+
const table = new CliTable3({
|
|
28
|
+
head: [__("Status"), __("Name"), __("Path"), __("URL")],
|
|
29
|
+
wordWrap: true,
|
|
30
|
+
wrapOnWordBoundary: false,
|
|
31
|
+
colWidths,
|
|
32
|
+
style: {
|
|
33
|
+
head: [],
|
|
34
|
+
border: []
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
table.push(
|
|
38
|
+
...sitesData.map((site) => [
|
|
39
|
+
site.status,
|
|
40
|
+
site.name,
|
|
41
|
+
site.path,
|
|
42
|
+
{ href: new URL(site.url).toString(), content: site.url }
|
|
43
|
+
])
|
|
44
|
+
);
|
|
45
|
+
console.log(table.toString());
|
|
46
|
+
} else {
|
|
47
|
+
console.log(JSON.stringify(sitesData, null, 2));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const logger = new Logger();
|
|
51
|
+
async function runCommand(format) {
|
|
52
|
+
try {
|
|
53
|
+
logger.reportStart(SiteCommandLoggerAction.LOAD_SITES, __("Loading sites…"));
|
|
54
|
+
const appdata = await readAppdata();
|
|
55
|
+
if (appdata.sites.length === 0) {
|
|
56
|
+
logger.reportSuccess(__("No sites found"));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const sitesMessage = sprintf(
|
|
60
|
+
_n("Found %d site", "Found %d sites", appdata.sites.length),
|
|
61
|
+
appdata.sites.length
|
|
62
|
+
);
|
|
63
|
+
logger.reportSuccess(sitesMessage);
|
|
64
|
+
logger.reportStart(SiteCommandLoggerAction.START_DAEMON, __("Connecting to process daemon…"));
|
|
65
|
+
await connectToDaemon();
|
|
66
|
+
logger.reportSuccess(__("Connected to process daemon"));
|
|
67
|
+
const sitesData = await getSiteListData(appdata.sites);
|
|
68
|
+
displaySiteList(sitesData, format);
|
|
69
|
+
} finally {
|
|
70
|
+
await disconnectFromDaemon();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const registerCommand = (yargs) => {
|
|
74
|
+
return yargs.command({
|
|
75
|
+
command: "list",
|
|
76
|
+
describe: __("List sites"),
|
|
77
|
+
builder: (yargs2) => {
|
|
78
|
+
return yargs2.option("format", {
|
|
79
|
+
type: "string",
|
|
80
|
+
choices: ["table", "json"],
|
|
81
|
+
default: "table",
|
|
82
|
+
// translators: Refers to the output format of the `studio site list` CLI command ("table" or "json")
|
|
83
|
+
description: __("Output format")
|
|
84
|
+
}).option("path", {
|
|
85
|
+
hidden: true
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
handler: async (argv) => {
|
|
89
|
+
try {
|
|
90
|
+
await runCommand(argv.format);
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (error instanceof LoggerError) {
|
|
93
|
+
logger.reportError(error);
|
|
94
|
+
} else {
|
|
95
|
+
const loggerError = new LoggerError(__("Failed to list sites"), error);
|
|
96
|
+
logger.reportError(loggerError);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
registerCommand,
|
|
104
|
+
runCommand
|
|
105
|
+
};
|