UNPKG

ts-bakery

Version:

Baked dependency injection for Typescript.

30 lines 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const fs = require("fs"); const path = require("path"); class Paths { static validate() { if (!fs.existsSync(Paths.BakeryConfig)) { throw new Error('Could not find bakery-config.json in project root.'); } } static resolveProjectRoot() { if (process.env.PWD) { return process.env.PWD; } //TODO: Improve return path.resolve(__dirname, '../../../..'); } static resolveDependencyResolverDeclaration() { const dtsFilePath = path.resolve(__dirname, '../Injection/DependencyResolver.d.ts'); if (fs.existsSync(dtsFilePath)) { return dtsFilePath; } return path.resolve(__dirname, '../Injection/DependencyResolver.ts'); } } exports.default = Paths; Paths.ProjectRoot = Paths.resolveProjectRoot(); Paths.BakeryConfig = path.join(Paths.ProjectRoot, 'bakery-config.json'); Paths.DependencyResolverDeclaration = Paths.resolveDependencyResolverDeclaration(); //# sourceMappingURL=Paths.js.map