Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed concurrent unpacks into the same folder #3090

Merged
merged 1 commit into from Apr 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/package-fetcher.js
Expand Up @@ -76,7 +76,19 @@ export default class PackageFetcher {
}

async init(): Promise<void> {
const pkgs = this.resolver.getPackageReferences();
let pkgs = this.resolver.getPackageReferences();
const pkgsPerDest: Map<string, PackageReference> = new Map();
pkgs = pkgs.filter((ref) => {
const dest = this.config.generateHardModulePath(ref);
const otherPkg = pkgsPerDest.get(dest);
if (otherPkg) {
this.reporter.warn(this.reporter.lang('multiplePackagesCantUnpackInSameDestination',
ref.patterns, dest, otherPkg.patterns));
return false;
}
pkgsPerDest.set(dest, ref);
return true;
});
const tick = this.reporter.progress(pkgs.length);

await promise.queue(pkgs, async (ref) => {
Expand Down
1 change: 1 addition & 0 deletions src/reporters/lang/en.js
Expand Up @@ -93,6 +93,7 @@ const messages = {
allDependenciesUpToDate: 'All of your dependencies are up to date.',
frozenLockfileError: 'Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.',
fileWriteError: 'Could not write file $0: $1',
multiplePackagesCantUnpackInSameDestination: 'Pattern $0 is trying to unpack in the same destination $1 as pattern $2. This could result in a non deterministic behavior, skipping.',

yarnOutdated: "Your current version of Yarn is out of date. The latest version is $0 while you're on $1.",
yarnOutdatedInstaller: 'To upgrade, download the latest installer at $0.',
Expand Down