-
Notifications
You must be signed in to change notification settings - Fork 23
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
Build counter progress #65
base: main
Are you sure you want to change the base?
Changes from 6 commits
99aa941
2257720
943dd0f
2582bb0
904b210
1c019ed
c7aac8c
3e3b0cc
016a954
bb3faab
daf0653
b94d966
07d283e
8a24627
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,11 +167,20 @@ async function executeDuringPhase( | |
biltin, | ||
dryRun, | ||
) { | ||
return await buildPackages( | ||
finalPackagesToBuild, | ||
makePackageBuild(jobConfiguration, rootDirectory, buildOptions, biltin), | ||
dryRun, | ||
) | ||
/**@return {import('@bilt/build').BuildPackageFunction} */ | ||
const buildCounter = () => { | ||
let pointer = 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of this variable? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
return makePackageBuild( | ||
jobConfiguration, | ||
rootDirectory, | ||
buildOptions, | ||
biltin, | ||
Object.keys(finalPackagesToBuild).length, | ||
pointer, | ||
) | ||
} | ||
|
||
return await buildPackages(finalPackagesToBuild, buildCounter(), dryRun) | ||
} | ||
|
||
/** | ||
|
@@ -274,6 +283,7 @@ async function buildPackages( | |
built: /**@type {Package[]}*/ ([]), | ||
} | ||
debug('starting build') | ||
|
||
for await (const buildPackageResult of build(packageInfosToBuild, buildOrder, buildPackageFunc)) { | ||
debug( | ||
`build of ${buildPackageResult.package.directory} ended. result: ${ | ||
|
@@ -479,6 +489,8 @@ function makePackageBuild( | |
/**@type {import('@bilt/types').Directory}*/ rootDirectory, | ||
/**@type {{[x: string]: string|boolean | undefined}} */ buildOptions, | ||
/**@type {object} */ biltin, | ||
/**@type {(number)} */ packagesLength, | ||
/**@type {(number)} */ pointer, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changing the function |
||
) { | ||
/**@type import('@bilt/build').BuildPackageFunction */ | ||
return async function ({packageInfo}) { | ||
|
@@ -487,11 +499,12 @@ function makePackageBuild( | |
packageInfo.directory, | ||
)) | ||
|
||
packageHeader('building', packageInfo) | ||
packageHeader('building', packageInfo, pointer, packagesLength) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yap - changing |
||
|
||
await executePhase(jobConfiguration, 'during', packageDirectory, buildOptions, biltin, (se) => | ||
packageOperation(se.info().name, packageInfo), | ||
) | ||
|
||
++pointer | ||
return 'success' | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,14 @@ export function globalOperation(msg) { | |
/** | ||
* @param {string} msg | ||
* @param {import('@bilt/types').PackageInfo} packageInfo | ||
* @param {number | null} current | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I usually prefer not putting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok |
||
* @param {number | null} length | ||
*/ | ||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why would a |
||
const counterMessage = current && length ? `${current} of ${length}` : '' | ||
outputFunction( | ||
chalk.greenBright.underline(`**** [${packageInfo.directory}] ${msg} ${counterMessage} `), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Could we make the counter message shorter? And in parenthesis? E.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure! |
||
) | ||
} | ||
|
||
/** | ||
|
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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