event-sourcing-generator
Version:
Utils for generating CQRS + Event Sourcing classes for NestJS
26 lines (25 loc) • 810 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const path_1 = require("path");
function getBinaryPath(binary) {
const subPath = path_1.join('.bin', binary);
for (const path of module.paths) {
const binaryPath = path_1.resolve(path, subPath);
if (fs_1.existsSync(binaryPath)) {
return binaryPath;
}
}
throw new Error(`Could not find the binary ${binary}`);
}
exports.getBinaryPath = getBinaryPath;
function getLibPath(lib) {
for (const path of module.paths) {
const binaryPath = path_1.resolve(path, lib);
if (fs_1.existsSync(binaryPath)) {
return binaryPath;
}
}
throw new Error(`Could not find the library ${lib}`);
}
exports.getLibPath = getLibPath;