prisma-trpc-shield-generator
Version:
Prisma +2 generator to emit a tRPC shield from your Prisma schema
21 lines • 906 B
JavaScript
;
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, schemaPath) {
const schemaPathSplit = schemaPath.split(path_1.default.sep);
const schemaPathWithoutFileAndExtension = schemaPathSplit
.slice(0, schemaPathSplit.length - 1)
.join(path_1.default.posix.sep);
const fromPath = outputPath;
const 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