Conversation
|
@giltayar can you check this please. :) |
giltayar
left a comment
There was a problem hiding this comment.
Looks good! Some small comments, plus I'm missing a test or two that checks this functionality...
packages/cli/src/command-build.js
Outdated
| ) | ||
| /**@return {import('@bilt/build').BuildPackageFunction} */ | ||
| const buildCounter = () => { | ||
| let pointer = 1 |
There was a problem hiding this comment.
What is the purpose of this variable?
There was a problem hiding this comment.
this is the variable in the closer - for increment it - do you have another suggestion?
packages/cli/src/command-build.js
Outdated
| )) | ||
|
|
||
| packageHeader('building', packageInfo) | ||
| packageHeader('building', packageInfo, pointer, packagesLength) |
There was a problem hiding this comment.
packageIndex would be a better name than pointer. Or maybe buildIndex?
packages/cli/src/outputting.js
Outdated
| /** | ||
| * @param {string} msg | ||
| * @param {import('@bilt/types').PackageInfo} packageInfo | ||
| * @param {number | null} current |
There was a problem hiding this comment.
I usually prefer not putting null in my code. undefined is the only one I use.
packages/cli/src/outputting.js
Outdated
| */ | ||
| export function packageHeader(msg, packageInfo) { | ||
| outputFunction(chalk.greenBright.underline(`**** [${packageInfo.directory}] ${msg}`)) | ||
| export function packageHeader(msg, packageInfo, current = null, length = null) { |
There was a problem hiding this comment.
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} `), |
There was a problem hiding this comment.
(Could we make the counter message shorter? And in parenthesis? E.g. (#1/10)
packages/cli/src/command-build.js
Outdated
| /**@type {{[x: string]: string|boolean | undefined}} */ buildOptions, | ||
| /**@type {object} */ biltin, | ||
| /**@type {(number)} */ packagesLength, | ||
| /**@type {(number)} */ pointer, |
There was a problem hiding this comment.
I don't see why this needs to be a parameter. It can be a local variable
packages/cli/src/command-build.js
Outdated
| dryRun, | ||
| ) | ||
| /**@return {import('@bilt/build').BuildPackageFunction} */ | ||
| const buildCounter = () => { |
There was a problem hiding this comment.
If pointer does not need to be passed (see my other comment below), then there's no real need for this function.
There was a problem hiding this comment.
the pointer is passing down - I use closer to increment it
|
@yanai101, please merge main branch because I fixed a test in |
Adding to the header - # of # counter
This change is