Skip to content

Commit

Permalink
perf(plugin-patch): remove unneeded saveAndClose (#1700)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-soporan authored Aug 14, 2020
1 parent 3c71ffa commit bedc0cf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
22 changes: 22 additions & 0 deletions .yarn/versions/92d834ce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
releases:
"@yarnpkg/cli": prerelease
"@yarnpkg/plugin-patch": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-node-modules"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/core"
- "@yarnpkg/doctor"
13 changes: 3 additions & 10 deletions packages/plugin-patch/sources/PatchFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,18 @@ export class PatchFetcher implements Fetcher {

const libzip = await getLibzipPromise();

const copiedPackage = new ZipFS(tmpFile, {
const patchedPackage = new ZipFS(tmpFile, {
libzip,
create: true,
level: opts.project.configuration.get(`compressionLevel`),
});

await copiedPackage.mkdirpPromise(prefixPath);
await patchedPackage.mkdirpPromise(prefixPath);

await miscUtils.releaseAfterUseAsync(async () => {
await copiedPackage.copyPromise(prefixPath, sourceFetch.prefixPath, {baseFs: sourceFetch.packageFs, stableSort: true});
await patchedPackage.copyPromise(prefixPath, sourceFetch.prefixPath, {baseFs: sourceFetch.packageFs, stableSort: true});
}, sourceFetch.releaseFs);

copiedPackage.saveAndClose();

const patchedPackage = new ZipFS(tmpFile, {
libzip,
level: opts.project.configuration.get(`compressionLevel`),
});

const patchFs = new CwdFS(ppath.resolve(PortablePath.root, prefixPath), {baseFs: patchedPackage});

for (const patchFile of patchFiles) {
Expand Down

0 comments on commit bedc0cf

Please sign in to comment.