@roots/bud
Version:
Configurable, extensible build tools for modern single and multi-page web applications
14 lines (13 loc) • 1.22 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "@roots/bud-support/jsx-runtime";
import { LabelBox } from '@roots/bud/cli/components/LabelBox';
import { Box, Text } from '@roots/bud-support/ink';
export const Server = ({ bud }) => {
if (!bud)
return null;
if (!bud.isDevelopment)
return (_jsx(LabelBox, { label: "Development server", children: _jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: ["Not available in ", _jsx(Text, { color: "cyan", children: "`production`" }), " mode."] }), _jsxs(Text, { children: ["Run this command with", ` `, _jsx(Text, { color: "cyan", children: "--mode=development" }), " for server information."] })] }) }));
const showProxy = bud.server?.enabledMiddleware &&
Object.keys(bud.server.enabledMiddleware).includes(`proxy`) &&
bud.server.proxyUrl;
return (_jsxs(LabelBox, { label: "Development server", children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Text, { children: "URL:" }), _jsx(Text, { children: bud.server.url.href })] }), showProxy && (_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Text, { children: "Proxy:" }), _jsx(Text, { children: bud.server.proxyUrl.href })] }))] }));
};