* Reads the lockfile, parses it, and returns the lockfile version. If lockfile is not found, returns an error. * @param {string} packageLockJSONPath * @returns
(packageLockJSONPath)
| 30 | * @returns |
| 31 | */ |
| 32 | function 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 |
no test coverage detected