writeViewsConfig

tcmts.cli.views.writeViewsConfig · #dy7jwxr4 · term · runs on the server

uses node:path

The views' tsconfig.json, so TypeScript (in the editor) reads them as the project does: its options, #codebase (a session's views, through its directory's package.json, its own), its packages.

import type { CodebaseCore } from "#codebase/tcmts/cli/codebase";
import { srcDir } from "#codebase/tcmts/cli/views";
import { writeIfChanged } from "#codebase/tcmts/loader";
import path_1 from "node:path";

export function writeViewsConfig(cb: CodebaseCore) {
  writeIfChanged(
    path_1.join(srcDir(cb), "tsconfig.json"),
    JSON.stringify(
      {
        extends: path_1.relative(srcDir(cb), path_1.join(cb.lay.root, "tsconfig.json")),
        include: ["**/*.ts", "**/*.tsx"],
      },
      null,
      2,
    ) + "\n",
  );
}

uses

used by