assetFormat

tcmts.cli.mirror.assetFormat · #2ibem2sd · term · runs on the server

uses node:path

A file's format as a file of the codebase: its extension (any, in a directory marked as holding files; none for Dockerfile), after a dot for a hidden file (.gitignore is ".", .mcp.json ".json").

import path from "node:path";

export const assetFormat = (file: string): string =>
  `${path.basename(file).startsWith(".") ? "." : ""}${path.extname(path.basename(file).replace(/^\./, "")).slice(1).toLowerCase()}`

used by