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

v1.22.0: --json flag ignored in yarn workspaces info command #7881

Open
spalger opened this issue Feb 5, 2020 · 3 comments
Open

v1.22.0: --json flag ignored in yarn workspaces info command #7881

spalger opened this issue Feb 5, 2020 · 3 comments

Comments

@spalger
Copy link

spalger commented Feb 5, 2020

Bug description

yarn workspaces info --json no longer works as of the v1.22.0 release. The --json flag seems to be ignored and the output is JSON wrapped in plain text. In v1.21.1 this produced a single JSON encoded object on stdout.

Command

yarn workspace info --json

What is the current behavior?

Output:

yarn workspaces v1.22.0
{
  ...
}
✨  Done in 0.08s.

What is the expected behavior?

Output:

{"type":"log","data":"{...}"}

Environment

  • Node Version: 10.18.0
  • Yarn v1 Version: 1.22.0
  • OS and version: macOS 10.15.3
@brianseeders
Copy link

I think that this was an unintended effect of this: 1b334e6

It still works if you move the --json flag earlier, e.g. yarn --json workspaces info

nalejandroveron added a commit to nalejandroveron/rescripts-use-yarn-workspaces that referenced this issue Mar 5, 2020
IjzerenHein added a commit to expo/expo that referenced this issue Apr 24, 2020
`yarn workspaces info —json` results an additional header and therefore invalid json, when using the latest version of yarn (tested with 1.22.4).
This caused the publish-packages script to fail. Fix:
yarnpkg/yarn#7881
umireon pushed a commit to umireon/aws-cdk that referenced this issue Jun 17, 2021
mergify bot pushed a commit to aws/aws-cdk that referenced this issue Jun 21, 2021
## Overview

The `--silent` flag in `yarn workspaces info` does not works.
The `--json` flag is suggested in yarnpkg/yarn#7881.

The output of `yarn workspaces --json info` is as follows and requires `JSON.parse()` twice:

```
{"type":"log","data":"{\n  \"aws-cdk-lib\": {\n    \"location\" --- snip --- \"workspaceDependencies\": [],\n    \"mismatchedWorkspaceDependencies\": []\n  }\n}"}
```

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
matthewsvu pushed a commit to matthewsvu/aws-cdk that referenced this issue Jun 22, 2021
## Overview

The `--silent` flag in `yarn workspaces info` does not works.
The `--json` flag is suggested in yarnpkg/yarn#7881.

The output of `yarn workspaces --json info` is as follows and requires `JSON.parse()` twice:

```
{"type":"log","data":"{\n  \"aws-cdk-lib\": {\n    \"location\" --- snip --- \"workspaceDependencies\": [],\n    \"mismatchedWorkspaceDependencies\": []\n  }\n}"}
```

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
## Overview

The `--silent` flag in `yarn workspaces info` does not works.
The `--json` flag is suggested in yarnpkg/yarn#7881.

The output of `yarn workspaces --json info` is as follows and requires `JSON.parse()` twice:

```
{"type":"log","data":"{\n  \"aws-cdk-lib\": {\n    \"location\" --- snip --- \"workspaceDependencies\": [],\n    \"mismatchedWorkspaceDependencies\": []\n  }\n}"}
```

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@mljsimone
Copy link

this also affect the workspace cmd when running scripts.

@mashpie
Copy link

mashpie commented Sep 22, 2022

double stringified?

const result = shell.exec(`yarn --json workspaces info`, {
  silent: true
}).stdout

const workspaceInfo = JSON.parse(JSON.parse(result).data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants