UNPKG

c4dslbuilder

Version:

A CLI tool designed to compile a folder structure of markdowns and mermaid files into a site, pdf, single file markdown or a collection of markdowns with links - inspired by c4builder

17 lines (16 loc) 502 B
import path from 'path'; import { fileURLToPath } from 'url'; import { CliLogger } from './cli-logger.js'; export class Paths { logger; constructor() { this.logger = new CliLogger(Paths.name); } getPathFromMeta(metaUrl) { if (!metaUrl.startsWith('file://')) { this.logger.error(`An invalid path given for getPathFromMeta: ${metaUrl}`); throw new Error('Must be a file URL'); } return path.dirname(fileURLToPath(metaUrl)); } }