From ea99ce2c37b0f7af5e1ccac73195248f5d88bd39 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 18 Jan 2023 21:47:46 +0100 Subject: [PATCH] cli: bit of reafactor for clarity in packageExports Signed-off-by: Patrik Oldsberg --- packages/cli/src/commands/migrate/packageExports.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/src/commands/migrate/packageExports.ts b/packages/cli/src/commands/migrate/packageExports.ts index 9d5c6d6339..51dc5c38bd 100644 --- a/packages/cli/src/commands/migrate/packageExports.ts +++ b/packages/cli/src/commands/migrate/packageExports.ts @@ -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;