core/validators/figure.validator.ts

core/validators/figure.validator.ts is a file in GovLab Docs. 12 lines of code and 2 definitions.

import type { ManifestModule } from "#types/manifest.types";
import { chartsStale } from "#configuration/strings/package.strings";
import { existsSync } from "node:fs";
import { relativePath } from "@ssot/paths";
import { resolve } from "node:path";

export const staleChartsMessages = function staleChartsMessages(module: ManifestModule, hasCharts: boolean): string[] {
    const charts = relativePath("moduleInfo.charts");
    if (hasCharts || !existsSync(resolve(module.dir, charts))) {
        return [];
    }
    return [chartsStale([module.label, charts].join("/"))];
};