Skip to content

Commit

Permalink
refactor: reorder logic
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Jul 10, 2019
1 parent a24b31c commit 3e905c1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions lib/private/setup-dependency/install-external/prepare/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ module.exports = memoizee(
recursive: true,
force: true
});
if (versionCachePath) {
await rename(packageTmpDir, versionCachePath, { intermediate: true });
const packageJson = getPackageJson(versionCachePath) || {};
packageJson._npmCrossLinkCacheName = versionCacheName;
await updatePackageJson(versionCachePath, packageJson);
return versionCachePath;
}
return packageTmpDir;
if (!versionCachePath) return packageTmpDir;

await rename(packageTmpDir, versionCachePath, { intermediate: true });
const packageJson = getPackageJson(versionCachePath) || {};
packageJson._npmCrossLinkCacheName = versionCacheName;
await updatePackageJson(versionCachePath, packageJson);
return versionCachePath;
},
{ promise: true, length: 2 }
);

0 comments on commit 3e905c1

Please sign in to comment.