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

fix(upgrade): Fix yarn upgrade when using --scope with exotic deps #7017

Merged
merged 2 commits into from Feb 18, 2019
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

## Master

- Fix yarn `upgrade --scope` when using exotic (github) dependencies.

[#7017](https://github.com/yarnpkg/yarn/pull/7017) - [**Jeff Valore**](https://twitter.com/codingwithspike)

- Fixes occasionally mismatching upper/lowecases of drive letters in win32 pnp check

[#7007](https://github.com/yarnpkg/yarn/pull/7007) - [**Christoph Werner**](https://github.com/codepunkt)
Expand Down
12 changes: 12 additions & 0 deletions __tests__/commands/upgrade.js
Expand Up @@ -248,6 +248,18 @@ test.concurrent('upgrades dependency packages not in registry', (): Promise<void
});
});

test.concurrent('upgrades scoped packages not in registry', (): Promise<void> => {
return runUpgrade([], {scope: '@yarn/'}, 'package-not-in-registry-scoped', async (config): ?Promise<void> => {
const lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock')));
const gitRemote = 'https://github.com/yarnpkg/e2e-test-repo';

const lockFileIncludes = sha => lockfile.indexOf(` resolved "${gitRemote}#${sha}"`) > -1;
expect(lockfile.indexOf(`"@yarn/test-git-repo@${gitRemote}#master":`)).toBeGreaterThan(-1);
expect(lockFileIncludes('5c57959f3c55a6cd6004e3855ca59ba98bfff56c')).toEqual(false);
expect(lockFileIncludes('64ed9468f0636a76fbadde0960ed321cc2c2cab0')).toEqual(true);
});
});

test.concurrent('upgrades dev dependency packages not in registry', (): Promise<void> => {
const packages = ['yarn-test-git-repo', 'e2e-test-repo'];
return runUpgrade(packages, {}, 'package-not-in-registry-dev', async (config): ?Promise<void> => {
Expand Down
@@ -0,0 +1,5 @@
{
"dependencies": {
"@yarn/test-git-repo": "https://github.com/yarnpkg/e2e-test-repo#master"
}
}
@@ -0,0 +1,7 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


"@yarn/test-git-repo@https://github.com/yarnpkg/e2e-test-repo#master":
version "1.0.0"
resolved "https://github.com/yarnpkg/e2e-test-repo#5c57959f3c55a6cd6004e3855ca59ba98bfff56c"
Expand Up @@ -8,4 +8,4 @@

"yarn-test-git-repo@https://github.com/yarnpkg/e2e-test-repo#master":
version "1.0.0"
resolved "https://github.com/yarnpkg/e2e-test-repo#64ed9468f0636a76fbadde0960ed321cc2c2cab0"
resolved "https://github.com/yarnpkg/e2e-test-repo#5c57959f3c55a6cd6004e3855ca59ba98bfff56c"
2 changes: 1 addition & 1 deletion src/cli/commands/upgrade.js
Expand Up @@ -85,7 +85,7 @@ function getRangeOperator(version): string {
// If an explicit operator was specified using --exact, --tilde, --caret, then that will take precedence.
function buildPatternToUpgradeTo(dep, flags): string {
if (dep.latest === 'exotic') {
return dep.url;
return `${dep.name}@${dep.url}`;
}

const toLatest = flags.latest;
Expand Down