Skip to content

Build counter progress#65

Open
yanai101 wants to merge 14 commits intogiltayar:mainfrom
yanai101:buildCounterProgress
Open

Build counter progress#65
yanai101 wants to merge 14 commits intogiltayar:mainfrom
yanai101:buildCounterProgress

Conversation

@yanai101
Copy link

@yanai101 yanai101 commented Apr 19, 2021

Adding to the header - # of # counter


This change is Reviewable

@yanai101
Copy link
Author

yanai101 commented May 3, 2021

@giltayar can you check this please. :)

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! Some small comments, plus I'm missing a test or two that checks this functionality...

)
/**@return {import('@bilt/build').BuildPackageFunction} */
const buildCounter = () => {
let pointer = 1
Copy link
Owner

Choose a reason for hiding this comment

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

What is the purpose of this variable?

Copy link
Author

Choose a reason for hiding this comment

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

this is the variable in the closer - for increment it - do you have another suggestion?

))

packageHeader('building', packageInfo)
packageHeader('building', packageInfo, pointer, packagesLength)
Copy link
Owner

Choose a reason for hiding this comment

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

packageIndex would be a better name than pointer. Or maybe buildIndex?

Copy link
Author

Choose a reason for hiding this comment

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

yap - changing

/**
* @param {string} msg
* @param {import('@bilt/types').PackageInfo} packageInfo
* @param {number | null} current
Copy link
Owner

Choose a reason for hiding this comment

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

I usually prefer not putting null in my code. undefined is the only one I use.

Copy link
Author

Choose a reason for hiding this comment

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

ok

*/
export function packageHeader(msg, packageInfo) {
outputFunction(chalk.greenBright.underline(`**** [${packageInfo.directory}] ${msg}`))
export function packageHeader(msg, packageInfo, current = null, length = null) {
Copy link
Owner

Choose a reason for hiding this comment

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

Why would a null/undefined be passed here? All calls to packageHeader will probably pass both current and length.

export function packageHeader(msg, packageInfo, current = null, length = null) {
const counterMessage = current && length ? `${current} of ${length}` : ''
outputFunction(
chalk.greenBright.underline(`**** [${packageInfo.directory}] ${msg} ${counterMessage} `),
Copy link
Owner

Choose a reason for hiding this comment

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

(Could we make the counter message shorter? And in parenthesis? E.g. (#1/10)

Copy link
Author

Choose a reason for hiding this comment

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

sure!

/**@type {{[x: string]: string|boolean | undefined}} */ buildOptions,
/**@type {object} */ biltin,
/**@type {(number)} */ packagesLength,
/**@type {(number)} */ pointer,
Copy link
Owner

Choose a reason for hiding this comment

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

I don't see why this needs to be a parameter. It can be a local variable

Copy link
Author

@yanai101 yanai101 May 20, 2021

Choose a reason for hiding this comment

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

changing the function

dryRun,
)
/**@return {import('@bilt/build').BuildPackageFunction} */
const buildCounter = () => {
Copy link
Owner

Choose a reason for hiding this comment

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

If pointer does not need to be passed (see my other comment below), then there's no real need for this function.

Copy link
Author

Choose a reason for hiding this comment

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

the pointer is passing down - I use closer to increment it

@giltayar
Copy link
Owner

giltayar commented May 5, 2021

@yanai101, please merge main branch because I fixed a test in npm-teskit which fails the CI.

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