@roots/bud
Version:
Configurable, extensible build tools for modern single and multi-page web applications
26 lines (25 loc) • 1.3 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "@roots/bud-support/jsx-runtime";
import { LabelBox } from '@roots/bud/cli/components/LabelBox';
import figures from '@roots/bud-support/figures';
import { Box, Text } from '@roots/bud-support/ink';
const color = {
fail: `red`,
success: `green`,
warn: `yellow`,
};
const figure = {
fail: figures.cross,
success: figures.tick,
warn: figures.warning,
};
const getColor = (state) => color[state];
const getFigure = (state) => figure[state];
export const Node = () => {
let nodeState = `success`;
const major = Number(process.version.match(/^v(\d\d)/)?.[1] ?? 0);
if (major < 18)
nodeState = `fail`;
if (major < 20)
nodeState = `warn`;
return (_jsxs(LabelBox, { flexDirection: "row", label: "Node", children: [_jsxs(Box, { flexDirection: "row", gap: 1, children: [_jsx(Text, { color: getColor(nodeState), children: getFigure(nodeState) }), _jsx(Text, { children: process.version })] }), nodeState === `warn` && (_jsxs(Text, { children: ["Please upgrade to Node v20 for long-term support. You are running node ", process.version, "."] })), nodeState === `fail` && (_jsxs(Text, { children: ["Please upgrade to Node v20 for long-term support. You are running node ", process.version, "."] }))] }));
};