All files / apps/developer-portal/tools/lib paths.ts

100% Statements 9/9
100% Branches 0/0
100% Functions 0/0
100% Lines 9/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27          10x     10x 10x     10x     10x           10x 10x 10x   10x  
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
 
// `import.meta.dirname` is undefined once Nitro bundles this module, and these paths are read from
// both a plain `node tools/…` process and a server route. `import.meta.url` survives both.
const here = dirname(fileURLToPath(import.meta.url));
 
/** `apps/developer-portal` — every other path is derived from these two so nothing hard-codes a depth. */
const PROJECT_ROOT = resolve(here, "../..");
export const WORKSPACE_ROOT = resolve(PROJECT_ROOT, "../..");
 
/** Derived and gitignored. Deleting it costs one `pnpm exec nx collect @joinery/developer-portal`. */
export const SNAPSHOT_DIR = resolve(PROJECT_ROOT, ".report");
 
/** Written by `pnpm test:coverage`: one merged report over every project. */
export const MERGED_COVERAGE_DIR = resolve(WORKSPACE_ROOT, "coverage");
 
/**
 * Under `embed/` because Nitro serves `public/` ahead of the page routes — a tree at
 * `public/coverage/` silently shadows the `/coverage` page with somebody else's `index.html`.
 */
const PUBLIC_DIR = resolve(PROJECT_ROOT, "public");
const EMBED_DIR = resolve(PUBLIC_DIR, "embed");
export const COVERAGE_DIR = resolve(EMBED_DIR, "coverage");
 
export const SCHEMA_VERSION = 1;