rapidrestify
Version:
Create a robust Node.js backend REST API boilerplate integrated seamlessly with MongoDB. This package offers a comprehensive foundation for swiftly developing RESTful APIs. It includes a collection of pre-configured components, aiding in rapid setup and d
28 lines (27 loc) • 1.12 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const child_process_1 = require("child_process");
function checkLocalPackageVersion(packageName) {
(0, child_process_1.exec)(`npm list ${packageName} --depth=0`, (error, stdout, stderr) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
if (stderr) {
console.error(`Error: ${stderr}`);
return;
}
// Extract the version information from the stdout
const versionMatch = stdout.match(new RegExp(`${packageName}@(.*)`, "i"));
if (versionMatch && versionMatch.length > 1) {
const localVersion = versionMatch[1].trim();
console.log(`Local version of ${packageName}: ${localVersion}`);
}
else {
console.log(`Package ${packageName} not found or version information not available.`);
}
});
}
// Replace 'package-name' with the name of the package you want to check
const packageName = "exsp-gen";
checkLocalPackageVersion(packageName);