MCPcopy Create free account
hub / github.com/krausest/js-framework-benchmark / shouldUpdate

Function shouldUpdate

cli/update-frameworks.js:82–105  ·  view source on GitHub ↗
(packageJSONLockPath, packageNames, DEBUG)

Source from the content-addressed store, hash-verified

80}
81
82function shouldUpdate(packageJSONLockPath, packageNames, DEBUG) {
83 let versions = getVersionFromPackageLock(packageJSONLockPath, packageNames);
84 console.log(versions);
85
86 for (let packageName of packageNames) {
87 const npmCmd = `npm view ${packageName} version`;
88
89
90 let newestVersion = execSync(npmCmd, {
91 stdio: ["ignore", "pipe", "ignore"],
92 }).toString();
93 newestVersion = newestVersion.replace(/\n/g, "");
94
95 let res = semver.diff(versions[packageName], newestVersion);
96 console.log(`Latest version for ${packageName} is ${newestVersion} and the installed version is ${versions[packageName]}. Comparison result is ${res}.`);
97 if (res === 'major' || res === 'minor') {
98 if (DEBUG) {
99 console.log(`Update required for ${packageName}`);
100 }
101 return true;
102 }
103 }
104 return false;
105}
106
107function maybeObsolete(packageName) {
108 try {

Callers 1

updateOneFrameworkFunction · 0.70

Calls 2

toStringMethod · 0.45

Tested by

no test coverage detected