UNPKG

prisma-trpc-generator

Version:

Prisma 2+ generator to emit fully implemented tRPC routers

24 lines 1.08 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getRelativePath; const path_1 = __importDefault(require("path")); function getRelativePath(outputPath, filePath, isOutsideOutputPath, schemaPath) { const fromPath = path_1.default.join(outputPath, 'routers', 'helpers'); let toPath = path_1.default.join(outputPath, filePath); if (isOutsideOutputPath) { const schemaPathSplit = schemaPath.split(path_1.default.sep); const schemaPathWithoutFileAndExtension = schemaPathSplit .slice(0, schemaPathSplit.length - 1) .join(path_1.default.posix.sep); toPath = path_1.default.join(schemaPathWithoutFileAndExtension, filePath); } const newPath = path_1.default .relative(fromPath, toPath) .split(path_1.default.sep) .join(path_1.default.posix.sep); return newPath; } //# sourceMappingURL=getRelativePath.js.map