Skip to content
This repository has been archived by the owner on Mar 29, 2020. It is now read-only.

Destructure correct items in outdated json #83

Merged
merged 5 commits into from
Jul 17, 2018
Merged

Destructure correct items in outdated json #83

merged 5 commits into from
Jul 17, 2018

Conversation

remotezygote
Copy link
Contributor

Fixes #79

@remotezygote remotezygote changed the title Destructure correct items in outdated son Destructure correct items in outdated json Jul 13, 2018
Copy link
Owner

@Leko Leko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution.

I think these changes are incorrect.
Please tell me the output of yarn -v and yarn outdated --json.

$ yarn -v
1.5.1
$ yarn outdated --json
{"type":"info","data":"Color legend : \n \"<red>\"    : Major Update backward-incompatible updates \n \"<yellow>\" : Minor Update backward-compatible features \n \"<green>\"  : Patch Update backward-compatible bug fixes"}
{"type":"table","data":{"head":["Package","Current","Wanted","Latest","Package Type","URL"],"body":[["babel","6.0.15","6.0.15","6.23.0","dependencies","https://babeljs.io/"],["babel-cli","6.0.15","6.0.15","6.26.0","devDependencies","https://babeljs.io/"],["hothouse","0.4.0","exotic","exotic","devDependencies","file:../../../../../hothouse"],["is-yarn","1.0.0","exotic","exotic","devDependencies","file:../is-yarn-workspaces"],["is-yarn","1.0.0","exotic","exotic","dependencies","file:../is-yarn"]]}}

In my environment, all table items are [name, current, wanted, latest, packageType, url].

@remotezygote
Copy link
Contributor Author

I'm on 1.7.0. I believe in a Yarn workspace you also get the package the dependency came from...

Here's my output:

yarn -v
1.7.0
yarn outdated --json | jq
{
  "type": "info",
  "data": "Color legend : \n \"<red>\"    : Major Update backward-incompatible updates \n \"<yellow>\" : Minor Update backward-compatible features \n \"<green>\"  : Patch Update backward-compatible bug fixes"
}
{
  "type": "table",
  "data": {
    "head": [
      "Package",
      "Current",
      "Wanted",
      "Latest",
      "Workspace",
      "Package Type",
      "URL"
    ],
    "body": [
      [
        "babel-eslint",
        "7.2.3",
        "7.2.3",
        "8.2.6",
        "<redacted>",
        "devDependencies",
        "https://github.com/babel/babel-eslint"
      ],
      [
        "deepmerge",
        "1.5.2",
        "1.5.2",
        "2.1.1",
        "<redacted>",
        "devDependencies",
        "https://github.com/KyleAMathews/deepmerge"
      ],
      [
        "lolex",
        "2.7.0",
        "2.7.0",
        "2.7.1",
        "",
        "resolutionDependencies",
        "http://github.com/sinonjs/lolex"
      ],
      [
        "popover.js",
        "0.2.16",
        "0.2.16",
        "0.2.36",
        "<redacted>",
        "devDependencies",
        ""
      ],
      [
        "react-split-pane",
        "0.1.77",
        "0.1.77",
        "0.1.82",
        "",
        "resolutionDependencies",
        "https://github.com/tomkp/react-split-pane"
      ],
      [
        "react-textarea-autosize",
        "6.1.0",
        "6.1.0",
        "7.0.3",
        "<redacted>",
        "devDependencies",
        "https://github.com/andreypopp/react-textarea-autosize#readme"
      ],
      [
        "react-textarea-autosize",
        "6.1.0",
        "6.1.0",
        "7.0.3",
        "<redacted>",
        "dependencies",
        "https://github.com/andreypopp/react-textarea-autosize#readme"
      ],
      [
        "react-transition-group",
        "1.2.1",
        "1.2.1",
        "2.4.0",
        "<redacted>",
        "dependencies",
        "https://github.com/reactjs/react-transition-group#readme"
      ],
      [
        "twitter-text",
        "1.9.4",
        "1.9.4",
        "2.0.4",
        "<redacted>",
        "dependencies",
        "https://github.com/twitter/twitter-text"
      ],
      [
        "video.js",
        "6.11.0",
        "6.11.0",
        "7.0.5",
        "<redacted>",
        "devDependencies",
        "http://videojs.com"
      ],
      [
        "wavesurfer.js",
        "1.4.0",
        "1.4.0",
        "2.0.6",
        "<redacted>",
        "dependencies",
        "https://github.com/katspaugh/wavesurfer.js"
      ],
      [
        "wavesurfer.js",
        "1.4.0",
        "1.4.0",
        "2.0.6",
        "<redacted>",
        "dependencies",
        "https://github.com/katspaugh/wavesurfer.js"
      ],
      [
        "wdio",
        "1.0.3",
        "1.0.3",
        "2.0.2",
        "<redacted>",
        "dependencies",
        "https://github.com/ziolko/wdio"
      ],
      [
        "wdio-mocha-framework",
        "0.5.13",
        "0.5.13",
        "0.6.2",
        "<redacted>",
        "devDependencies",
        "https://github.com/webdriverio/wdio-mocha-framework#readme"
      ]
    ]
  }
}

@remotezygote
Copy link
Contributor Author

Might need to parse the head array to determine the indices needed.

This uses the `head` of the table to map fields properly and reference them by name rather than index in the array of output, since the indices can change depending on how the command is run.
@remotezygote
Copy link
Contributor Author

I changed it so it uses the head to map fields, and this works for me in both workspaces and non-workspaces.

@Leko
Copy link
Owner

Leko commented Jul 14, 2018

@remotezygote Hm... Workspace column appear only workspaces.

Might need to parse the head array to determine the indices needed.

I agree with your approach.

And now, I enabled CircleCI for your pull request.
Please push empty commit(ex. git commit --allow-empty -m 'Trigger CI').

@codecov-io
Copy link

Codecov Report

Merging #83 into master will decrease coverage by 0.16%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
- Coverage   33.33%   33.17%   -0.17%     
==========================================
  Files          21       21              
  Lines         417      416       -1     
  Branches       44       43       -1     
==========================================
- Hits          139      138       -1     
  Misses        252      252              
  Partials       26       26
Impacted Files Coverage Δ
packages/@hothouse/client-yarn/src/index.js 72.5% <100%> (-0.68%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f7f51a...92cd17a. Read the comment docs.

Copy link
Owner

@Leko Leko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Leko
Copy link
Owner

Leko commented Jul 17, 2018

@remotezygote Many thanks for your contribution.
I'll release a new version with #92.

@Leko Leko merged commit 8cc90e2 into Leko:master Jul 17, 2018
@Leko Leko added the Type: Bug Something isn't working label Jul 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants