@squareboat/nest-cache
Version:
The cache package for your NestJS Applications
15 lines (14 loc) • 586 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadPackage = void 0;
const MISSING_REQUIRED_DEPENDENCY = (name, reason) => `The "${name}" package is missing. Please, make sure to install this library ($ npm install ${name}) to take advantage of ${reason}.`;
function loadPackage(packageName, context, loaderFn) {
try {
return loaderFn ? loaderFn() : require(packageName);
}
catch (e) {
console.error(MISSING_REQUIRED_DEPENDENCY(packageName, context));
process.exit(1);
}
}
exports.loadPackage = loadPackage;