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

Add "yarn global outdated" #6488

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Please add one entry in this file for each change in Yarn's behavior. Use the sa

## Master

- Adds `yarn global outdated`

[#6488](https://github.com/yarnpkg/yarn/pull/6485) - [**Matthias Winkelmann**](https://github.com/MatthiasWinkelmann)

- Prints workspace names with `yarn workspaces` (silence with `-s`)

[#7722](https://github.com/yarnpkg/yarn/pull/7722) - [**Orta**](https://twitter.com/orta)
Expand Down
11 changes: 11 additions & 0 deletions __tests__/commands/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,17 @@ test.concurrent('list', async (): Promise<void> => {
});
});

test.concurrent('outdated', async (): Promise<void> => {
const tmpGlobalFolder = await createTempGlobalFolder();
const tmpPrefixFolder = await createTempPrefixFolder();
const flags = {globalFolder: tmpGlobalFolder, prefix: tmpPrefixFolder};
const upgradeFlags = {globalFolder: tmpGlobalFolder, prefix: tmpPrefixFolder, latest: true};
await runGlobal(['add', 'react-native-cli@2.0.0'], flags, 'add-with-prefix-flag', () => {});
return runGlobal(['outdated'], upgradeFlags, 'add-with-prefix-flag', (config, reporter, install, getStdout) => {
expect(getStdout()).toContain('react-native-cli');
});
});

test.concurrent('upgrade', async (): Promise<void> => {
const tmpGlobalFolder = await createTempGlobalFolder();
const tmpPrefixFolder = await createTempPrefixFolder();
Expand Down
8 changes: 8 additions & 0 deletions src/cli/commands/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import buildSubCommands from './_build-sub-commands.js';
import Lockfile from '../../lockfile';
import {Install} from './install.js';
import {Add} from './add.js';
import {run as runOutdated} from './outdated.js';
import {run as runRemove} from './remove.js';
import {run as runUpgrade} from './upgrade.js';
import {run as runUpgradeInteractive} from './upgrade-interactive.js';
Expand Down Expand Up @@ -243,6 +244,13 @@ const {run, setFlags: _setFlags} = buildSubCommands('global', {
await list(config, reporter, flags, args);
},

async outdated(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<void> {
await updateCwd(config);

// upgrade module
await runOutdated(config, reporter, flags, args);
},

async remove(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<void> {
await updateCwd(config);

Expand Down