formatOf

tcmts.cli.files.formatOf · #kkvelvoy · term · runs anywhere

A file definition's format, from its IR: its extension ("" for a file without one, like Dockerfile), without the dot a hidden file's starts with (fileName puts it back).

import type { DefRecord } from "#codebase/tcmts/core/types";

export const formatOf = (rec: DefRecord): string =>
  (JSON.parse(rec.ir) as string[])[1]!.replace(/^\./, "")

uses

used by