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

Isolate renderer options. #18

Closed
cenk1cenk2 opened this issue May 5, 2020 · 2 comments
Closed

Isolate renderer options. #18

cenk1cenk2 opened this issue May 5, 2020 · 2 comments
Labels
enhancement New feature or request released

Comments

@cenk1cenk2
Copy link
Collaborator

Isolate renderer options.

@cenk1cenk2 I want to extract the rendering options to their own key as well. Shortly after I did it like it is now, I already had regret that I did it this way. So that would definitely be an improvement.

Originally posted by @SamVerschueren in SamVerschueren/listr#143 (comment)

@cenk1cenk2 cenk1cenk2 changed the title @cenk1cenk2 I want to extract the rendering options to their own key as well. Shortly after I did it like it is now, I already had regret that I did it this way. So that would definitely be an improvement. https://github.com/SamVerschueren/listr/issues/143#issuecomment-623094930 May 5, 2020
@cenk1cenk2 cenk1cenk2 changed the title https://github.com/SamVerschueren/listr/issues/143#issuecomment-623094930 Isolate renderer options. May 5, 2020
@cenk1cenk2 cenk1cenk2 added the enhancement New feature or request label May 5, 2020
cenk1cenk2 added a commit that referenced this issue May 6, 2020
BREAKING CHANGE:
- Renderer Options
  - Reason: *This was changed because of having all the renderer options that are mangled together and not respecting which renderer has been choosen. It also allows for custom renderers to have their own logic by exposing their options in a single class file rather than expecting that functionality from the project itself.*
  - Before <v1.3.12:
  ```typescript
    new Listr<Ctx>([
    {
      task: async (ctx, task): Promise<void> => {
      },
      persistentOutput: true
    }
  ], {
    concurrent: false,
    collapse: true
  ```
  - After <v1.3.12:
  ```typescript
    new Listr<Ctx>([
    {
      task: async (ctx, task): Promise<void> => {
      },
      options: { persistentOutput: true } // per task based options are moved to their own key
    }
  ], {
    concurrent: false,
    rendererOptions: { collapse: false }
     // global renderer options moved to their own key
    })
  ```
- Some of the types has been changed.
  - Reason: *Some of the types had to be changed due to compatability reasons with new autocomplete functionality of the dynamic renderer options.*
  - Before <v1.3.12:
  ```typescript
  let task: Listr<Ctx>

  task = new Listr(..., { renderer: 'verbose' })
  ```
  - After <v1.3.12:
  ```typescript
  // this without the indication of verbose will now fail due to default renderer being 'default' for autocompleting goodness of the IDEs.
  // So you have to overwrite it manually to 'verbose'.
  // If it does not have a default you had to explicitly write { renderer: 'default' } everytime to have the auto complete feature
  let task: Listr<Ctx, 'verbose'>

  task = new Listr(..., { renderer: 'verbose' })
  ```
- Test renderer removed.
  - Reason: *On non-tty environments that the verbose renderer is intended for there is no need to show icons. Since icons are now optional with the default being disabled for the verbose renderer, there is no need for a renderer that does have the same functionality since verbose and test are now basically the same thing. Verbose seemed a better name then test, so I had to remove test from the equation.*
  - Before <v1.3.12:
  ```typescript
  const task = new Listr(..., { renderer: 'test' })
  ```
  - After <v1.3.12:
  ```typescript
  const task = new Listr(..., { renderer: 'verbose' })
  ```

fix #19, fix #18
@cenk1cenk2
Copy link
Collaborator Author

Closed with #21

cenk1cenk2 pushed a commit that referenced this issue May 6, 2020
# [2.0.0](v1.3.12...v2.0.0) (2020-05-06)

### Bug Fixes

* **default-renderer:** added back cli truncate ([22132a5](22132a5))
* **error-collection:** fixed error collection on non-failing tasks ([4239094](4239094))
* **manager:** added error context ([4f8f387](4f8f387))
* **manager:** fixed manager ([57dcd7f](57dcd7f))
* **types:** fix ([b3ee9be](b3ee9be))
* fixed types for isolated renderer options ([4521832](4521832))

### Features

* **release:** ready to update to new version ([50fb773](50fb773)), closes [#19](#19) [#18](#18)
* **renderer-options:** started to isolate the renderer options instead of writing them directly ([95f7f87](95f7f87))

### BREAKING CHANGES

* **release:** - Renderer Options
  - Reason: *This was changed because of having all the renderer options that are mangled together and not respecting which renderer has been choosen. It also allows for custom renderers to have their own logic by exposing their options in a single class file rather than expecting that functionality from the project itself.*
  - Before <v1.3.12:
  ```typescript
    new Listr<Ctx>([
    {
      task: async (ctx, task): Promise<void> => {
      },
      persistentOutput: true
    }
  ], {
    concurrent: [secure],
    collapse: true
  ```
  - After <v1.3.12:
  ```typescript
    new Listr<Ctx>([
    {
      task: async (ctx, task): Promise<void> => {
      },
      options: { persistentOutput: true } // per task based options are moved to their own key
    }
  ], {
    concurrent: [secure],
    rendererOptions: { collapse: [secure] }
     // global renderer options moved to their own key
    })
  ```
- Some of the types has been changed.
  - Reason: *Some of the types had to be changed due to compatability reasons with new autocomplete functionality of the dynamic renderer options.*
  - Before <v1.3.12:
  ```typescript
  let task: Listr<Ctx>

  task = new Listr(..., { renderer: 'verbose' })
  ```
  - After <v1.3.12:
  ```typescript
  // this without the indication of verbose will now fail due to default renderer being 'default' for autocompleting goodness of the IDEs.
  // So you have to overwrite it manually to 'verbose'.
  // If it does not have a default you had to explicitly write { renderer: 'default' } everytime to have the auto complete feature
  let task: Listr<Ctx, 'verbose'>

  task = new Listr(..., { renderer: 'verbose' })
  ```
- Test renderer removed.
  - Reason: *On non-tty environments that the verbose renderer is intended for there is no need to show icons. Since icons are now optional with the default being disabled for the verbose renderer, there is no need for a renderer that does have the same functionality since verbose and test are now basically the same thing. Verbose seemed a better name then test, so I had to remove test from the equation.*
  - Before <v1.3.12:
  ```typescript
  const task = new Listr(..., { renderer: 'test' })
  ```
  - After <v1.3.12:
  ```typescript
  const task = new Listr(..., { renderer: 'verbose' })
  ```
@cenk1cenk2
Copy link
Collaborator Author

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
Development

No branches or pull requests

1 participant