cli: bit of reafactor for clarity in packageExports

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-01-18 21:47:46 +01:00
parent 08d37cf1cc
commit ea99ce2c37
@@ -30,7 +30,10 @@ export async function command() {
await Promise.all(
packages.map(async ({ dir, packageJson }) => {
let { exports: exp } = packageJson;
let changed = false;
let newPackageJson = packageJson;
let { exports: exp } = newPackageJson;
if (!exp) {
return;
}
@@ -38,9 +41,6 @@ export async function command() {
throw new Error('Unexpected array in package.json exports field');
}
let changed = false;
let newPackageJson = packageJson;
// If exports is a string we rewrite it to an object to add package.json
if (typeof exp === 'string') {
changed = true;