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

Tasks list #69

Merged
merged 12 commits into from
May 18, 2021
Merged

Tasks list #69

merged 12 commits into from
May 18, 2021

Conversation

reggev
Copy link
Collaborator

@reggev reggev commented May 6, 2021

No description provided.

Copy link
Owner

@giltayar giltayar left a comment

Choose a reason for hiding this comment

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

Looks good. Besides the small comments I have, I believe the UI needs a bit of improvement. Two things pop in mind:

  1. There's contention between the package headers (the green ones) and the steps. Once we have the steps, I don't see why we need the package headers. We can have the package headers written in the task header.
  2. The collapse happens after the phase ends. I believe it's better that it should happen after each step ends.

}

/** @type {( linesToDisplay?: number) => (payload: string, showAll?: boolean) => string} */
const StreamBuffer = (linesToDisplay = 10) => {
Copy link
Owner

Choose a reason for hiding this comment

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

Bilt style prefers function over arrow function, except for cases where the function is trivial (e.g. x => x * 2), and in this case it isn't trivial. I would prefer you convert this to a function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

/** @type {( linesToDisplay?: number) => (payload: string, showAll?: boolean) => string} */
const StreamBuffer = (linesToDisplay = 10) => {
/** @type {string[]} */
let buffer = []
Copy link
Owner

Choose a reason for hiding this comment

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

The name confused me, because buffer has a very specific meaning in Node.js. Maybe lines? Or lineBuffer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done, It is now LinesBuffer

childProcess.stdout.pipe(process.stdout)
childProcess.stderr.pipe(process.stderr)
const buffer = StreamBuffer()
childProcess.stdout.on('data', (payload) => {
Copy link
Owner

Choose a reason for hiding this comment

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

This part doesn't make sense. Is it true that if an stderr payload arrives, it will clear the existing stdout payload? And vice-versa? (I may be misunderstanding task.output =.

Copy link
Collaborator Author

@reggev reggev May 7, 2021

Choose a reason for hiding this comment

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

task.output = is a complete override of the output, the only thing that "has a memory" is the LinesBuffer.

Because both stdout and stderr share the same buffer, when an error occurs it'll just append it to the buffer(and will not slice it to 10 lines) so you can see the entire process

Copy link
Owner

Choose a reason for hiding this comment

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

Right! One array for both. Missed that. Thanks!

}
},
skip: async () => {
const shouldSkip = !(await stepExecution.shouldSkip())
Copy link
Owner

Choose a reason for hiding this comment

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

Let's also fix shouldSkip()? 😱

@reggev
Copy link
Collaborator Author

reggev commented May 8, 2021

  1. is Done!
    2.is a bit complicated, listr can either persist the output or throw it all together - which is great for success cases, but it'll drop errors as well., Done!

We also have a new issue in line 549, the await is not wrapped in try/catch - which can cause unhandled rejections, I still need to decide how to handle those errors.

@giltayar
Copy link
Owner

@reggev As you can see, the build failed. I cloned your PR, and the cli package doesn't build due to eslint errors, ts errors, and test errors. Could you have a look?

@reggev reggev merged commit 0e178c1 into giltayar:main May 18, 2021
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

Successfully merging this pull request may close these issues.

2 participants