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

Refactor bundle buddy to be more re-usable in fluidframework #3207

Merged
merged 16 commits into from
Sep 4, 2020

Conversation

heliocliu
Copy link
Contributor

@heliocliu heliocliu commented Aug 14, 2020

Refactor our copy of bundle buddy to be reusable in fluidframework. This change is a minimal set of changes needed for us to write a wrapper around it to achieve our goals around package size reporting (in a follow up review, added to a different package). This package will be further refactored after so that bohemia can consume it in a similar way.

@heliocliu
Copy link
Contributor Author

@fluidframework/base-host: +1.25 KB
Metric NameBaseline SizeCompare SizeSize Diff
main.js 193.95 KB 195.2 KB +1.25 KB
Total Size 193.95 KB 195.2 KB +1.25 KB

Baseline commit: 2bed571

Generated by 🚫 dangerJS against 4a68320

this will be added back later in a different location (bundle-size-tools should be reusable; build-tools/bundleSizeAnalysis is fluidframework's wrapper for our own uses)
@heliocliu heliocliu changed the title add danger dep Refactor bundle buddy to be more re-usable in fluidframework Aug 18, 2020
@heliocliu heliocliu marked this pull request as ready for review August 18, 2020 02:22
@ghost ghost added the triage label Aug 18, 2020
@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main August 19, 2020 02:18
@ghost ghost added the triage label Aug 20, 2020
make the fallback optional and allow it to be user defined
* prior to the previous commit.
*/
public static * naiveFallbackCommitGenerator(previousCommit: string): Generator<string> {
for (let i = 0; i < 5; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this limited to 5?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no real reason, seemed like a reasonable number that would catch most cases for us without going overboard

Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like it shouldn't be limited, except until getPriorCommit does not have a prior commit.

@@ -11,3 +11,7 @@ import { execSync } from 'child_process';
export function getBaselineCommit(): string {
return execSync('git merge-base origin/main HEAD').toString().trim();
}

export function getPriorCommit(baseCommit: string): string {
return execSync(`git log --pretty=format:"%H" -1 ${baseCommit}~1`).toString().trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

It will fail if baseCommit does not have a parent commit. Maybe that's fine? But it feels like it should be a handled case or return undefined or something.

The way it is used in the generator function, I would expect it to make the Generator be done() as true once this case is hit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think it's probably fine for the usage here. if the command fails this function will still return a (garbage) string which should manifest later as being unable to find a build for a garbage commit (which is logged to console)

@ghost ghost added the triage label Sep 3, 2020
fix generator usage
add option to change defualt number of builds to search. potentially useful for us because we have a high number of builds (especially if you haven't merged master very recently).  also change it to only pull builds once so we don't hit the ado api a bunch when doing fallback
@heliocliu heliocliu merged commit ec1514e into microsoft:main Sep 4, 2020
@heliocliu heliocliu deleted the BundleBuddy branch September 4, 2020 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants