registryDir

tcmts.registry.registryDir · #2bh7vikh · term · runs on the server

uses node:path

Where the registry's own codebase is: $TCM_REGISTRY_CODEBASE, else .tcm/data/registry, or .tcm/data/hub where a registry made while it was called the hub keeps it.

import fs from "node:fs";
import path_1 from "node:path";

export const registryDir = (): string => {
  if (process.env.TCM_REGISTRY_CODEBASE) return process.env.TCM_REGISTRY_CODEBASE;
  const data = path_1.join(process.cwd(), ".tcm", "data");
  return fs.existsSync(path_1.join(data, "hub"))
    ? path_1.join(data, "hub")
    : path_1.join(data, "registry");
}

used by