Skip to content

Commit

Permalink
parsePnpmLock: handle files with no packages field (#824)
Browse files Browse the repository at this point in the history
* Add debug message

Signed-off-by: Rogerio Bastos <2397391+rogeriobastos@users.noreply.github.com>

* parsePnpmLock: handle files with no packages field

Signed-off-by: Rogerio Bastos <2397391+rogeriobastos@users.noreply.github.com>

---------

Signed-off-by: Rogerio Bastos <2397391+rogeriobastos@users.noreply.github.com>
  • Loading branch information
rogeriobastos authored Jan 22, 2024
1 parent d995387 commit f38780a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,9 @@ export const parsePnpmLock = async function (pnpmLock, parentComponent = null) {
).toString();
}
if (existsSync(pnpmLock)) {
if (DEBUG_MODE) {
console.log(`Parsing file ${pnpmLock}`);
}
const lockData = readFileSync(pnpmLock, "utf8");
const yamlObj = _load(lockData);
if (!yamlObj) {
Expand Down Expand Up @@ -1295,7 +1298,7 @@ export const parsePnpmLock = async function (pnpmLock, parentComponent = null) {
} catch (e) {
// ignore parse errors
}
const packages = yamlObj.packages;
const packages = yamlObj.packages || {};
const pkgKeys = Object.keys(packages);
for (const k in pkgKeys) {
// Eg: @babel/code-frame/7.10.1
Expand Down

0 comments on commit f38780a

Please sign in to comment.