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

Function getPackageLockJSONVersion

cli/update-lockfiles.js:32–44  ·  view source on GitHub ↗

* Reads the lockfile, parses it, and returns the lockfile version. If lockfile is not found, returns an error. * @param {string} packageLockJSONPath * @returns

(packageLockJSONPath)

Source from the content-addressed store, hash-verified

30 * @returns
31 */
32function getPackageLockJSONVersion(packageLockJSONPath) {
33 try {
34 const packageLockJSON = fs.readFileSync(packageLockJSONPath, "utf8");
35 const parsedPackageLockJSON = JSON.parse(packageLockJSON);
36 return parsedPackageLockJSON.lockfileVersion;
37 } catch (error) {
38 if (error.code === "ENOENT") {
39 console.log("Lockfile wasn't found. Create new!");
40 return;
41 }
42 throw new Error(error.message);
43 }
44}
45
46/**
47 * Updates the lockfile of one framework

Callers 1

updateFrameworkLockfileFunction · 0.85

Calls 1

parseMethod · 0.45

Tested by

no test coverage detected