Skip to content

Commit

Permalink
feat: migrate to listr2 (#8005)
Browse files Browse the repository at this point in the history
* use listr2

* try custom renderer

* make progress with errors

* remove old listr stuff

* make test happy

* refactor

* improve types

* changeset

* update changeset

* Update .changeset/weak-monkeys-wink.md

Co-authored-by: Laurin Quast <laurinquast@googlemail.com>

Co-authored-by: Laurin Quast <laurinquast@googlemail.com>
  • Loading branch information
saihaj and n1ru4l committed Jul 6, 2022
1 parent 68bb30e commit 2e86ecb
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 742 deletions.
17 changes: 17 additions & 0 deletions .changeset/weak-monkeys-wink.md
@@ -0,0 +1,17 @@
---
'@graphql-codegen/cli': patch
---

### Summary

- Migrate to [`listr2`](https://listr2.kilic.dev)
- Remove custom renderer for `listr`
- Remove unused dependencies

### Why

[`listr`](https://github.com/SamVerschueren/listr) is not actively maintained and we have to maintain our custom renderer for it to display errors. Migrating to `listr2` it just works out of the almost similar to how it was working in past and is a actively maintained.

### Dev notes
Big change for us is how errors were collected. In `listr` errors were thrown and were caught in the `end` function of our custom `listr` Renderer but with `listr2` we don't really get `Error` in `end` function always so instead we use the [context](https://listr2.kilic.dev/getting-started/the-concept-of-context) to collect errors from all the tasks and then show them after all the tasks are finished.

10 changes: 3 additions & 7 deletions packages/graphql-codegen-cli/package.json
Expand Up @@ -54,9 +54,7 @@
"@graphql-tools/utils": "^8.8.0",
"ansi-escapes": "^4.3.1",
"chalk": "^4.1.0",
"change-case-all": "1.0.14",
"chokidar": "^3.5.2",
"common-tags": "^1.8.0",
"cosmiconfig": "^7.0.0",
"cross-undici-fetch": "^0.4.11",
"debounce": "^1.2.0",
Expand All @@ -65,25 +63,23 @@
"inquirer": "^8.0.0",
"is-glob": "^4.0.1",
"json-to-pretty-yaml": "^1.2.2",
"listr": "^0.14.3",
"listr-update-renderer": "^0.5.0",
"listr2": "^4.0.5",
"log-symbols": "^4.0.0",
"mkdirp": "^1.0.4",
"string-env-interpolation": "^1.0.1",
"ts-log": "^2.2.3",
"wrap-ansi": "^7.0.0",
"yaml": "^1.10.0",
"yargs": "^17.0.0"
},
"devDependencies": {
"@graphql-tools/merge": "8.3.0",
"@types/debounce": "1.2.1",
"@types/inquirer": "8.2.1",
"@types/is-glob": "4.0.2",
"@types/js-yaml": "4.0.5",
"@types/listr": "0.14.4",
"@types/mkdirp": "1.0.2",
"@graphql-tools/merge": "8.3.0",
"bdd-stdin": "0.2.0",
"change-case-all": "^1.0.14",
"js-yaml": "4.1.0",
"make-dir": "3.1.0",
"prettier": "2.7.1"
Expand Down

1 comment on commit 2e86ecb

@vercel
Copy link

@vercel vercel bot commented on 2e86ecb Jul 6, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.