mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix: handle npm 12 pack --json object output in local release script
npm 12 returns an object keyed by package name instead of an array, which broke packPackage with a TypeError.
This commit is contained in:
parent
18dee5f0a8
commit
f8746767bc
1 changed files with 3 additions and 1 deletions
|
|
@ -195,7 +195,9 @@ function packPackage(pkg, tarballDirectory) {
|
|||
capture: true,
|
||||
cwd: pkg.directory,
|
||||
});
|
||||
const packed = JSON.parse(output)[0];
|
||||
// npm <11.6 returns an array; newer npm returns an object keyed by package name.
|
||||
const parsed = JSON.parse(output);
|
||||
const packed = Array.isArray(parsed) ? parsed[0] : Object.values(parsed)[0];
|
||||
return join(tarballDirectory, packed.filename);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue