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

feat(build-tools): Add build-infrastructure package #22853

Merged

Conversation

tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Oct 20, 2024

Note

This PR is one of several. This PR creates a new private package and establishes some interfaces only. Future changes will add implementations of those interfaces and additional APIs.

@fluid-tools/build-infrastructure

This change introduces a new package containing types and helper functions that will be used across multiple build-tools packages, including @fluidframework/build-tools and @fluid-tools/build-cli.

The primary purpose of this package is to provide a common way to enumerate Packages, Release Groups, and Workspaces
across a Fluid repo.

The package is private and nothing depends on it yet, so it should cause no problems when merged in its current state.

Important

I have found it easiest to write this as a new package, but I am not fanatical about this. There are practical reasons why a package is a little easier right now (the direction of dependencies between the packages in particular) but for the purposes of this review, if you think this should be organized into modules within an existing package instead, try and ignore that feedback for now and focus on the function and scope of the code.

Background

Today both fluid-build and build-cli (flub) need to understand the layout of the repo - what packages belong to what release groups, what folders are workspace roots vs. independent packages, etc. We have been using the types and classes from fluid-build in the flub code, but the relationship has always been strange because flub has a concept of release groups while fluid-build uses a MonoRepo class which is analogous to a Workspace.

Conceptually, Release Groups and Workspaces are distinct, but in code there is not a strong representation of the "release group" concept. In flub we use the MonoRepo class and a type ReleaseGroup = string together as a stand-in for the ReleaseGroup concept which has meant that release groups and workspaces (the MonoRepo class) are more or less the same thing in practice.

That has always been a very weird situation that has gotten complicated as the repo has grown, and now we find that we want the benefits of interdependencies in between packages provided by workspaces but the flexibility of releasing and versioning groups of packages within those workspaces. These changes are a step towards that future.

The goal

The eventual goal state - far beyond this PR - is to have all the shared types and data about the repo layout and other shared code in the build-infrastructure package, and then have flub and fluid-build be in individual packages. They shouldn't depend on each other - all the shared logic - especially the types - should be in the infra package.

How the API and interfaces were developed

The interfaces exposed by this package were extracted from the uses of packages and release groups in build-tools and build-cli. The minimal set of properties and functions necessary by both of those packages was used. In some cases, duplicative properties or functions were removed. For example, the Package type had dependencies and combinedDependencies; now it just has the latter and the caller can filter out what it doesn't want or extend the shared interface.

Tips for reviewers

I generated API docs for the package using TypeDoc (had problems with api-markdown-documenter that I am following up on). To reivew the APIs in a more readable format, I suggest viewing them directly on my fork:

https://github.com/tylerbutler/FluidFramework/blob/bt-build-infra-interfaces-only-01/build-tools/packages/build-infrastructure/docs/README.md#classes

@github-actions github-actions bot added area: build Build related issues public api change Changes to a public API base: main PRs targeted against main branch labels Oct 20, 2024
Copy link
Collaborator

@msfluid-bot msfluid-bot left a comment

Choose a reason for hiding this comment

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

Code Coverage Summary

No packages impacted by the change.


Baseline commit: 5c17a9c
Baseline build: 301786
Happy Coding!!

Code coverage comparison check passed!!

@msfluid-bot
Copy link
Collaborator

msfluid-bot commented Oct 20, 2024

@fluid-example/bundle-size-tests: +245 Bytes
Metric NameBaseline SizeCompare SizeSize Diff
aqueduct.js 459.85 KB 459.89 KB +35 Bytes
azureClient.js 557 KB 557.04 KB +49 Bytes
connectionState.js 724 Bytes 724 Bytes No change
containerRuntime.js 259.47 KB 259.48 KB +14 Bytes
fluidFramework.js 405.81 KB 405.82 KB +14 Bytes
loader.js 134.16 KB 134.18 KB +14 Bytes
map.js 42.46 KB 42.46 KB +7 Bytes
matrix.js 148.29 KB 148.29 KB +7 Bytes
odspClient.js 523.96 KB 524 KB +49 Bytes
odspDriver.js 97.84 KB 97.86 KB +21 Bytes
odspPrefetchSnapshot.js 42.81 KB 42.82 KB +14 Bytes
sharedString.js 164.48 KB 164.49 KB +7 Bytes
sharedTree.js 396.27 KB 396.28 KB +7 Bytes
Total Size 3.31 MB 3.31 MB +245 Bytes

Baseline commit: 5c17a9c

Generated by 🚫 dangerJS against ea5fc63

@tylerbutler tylerbutler marked this pull request as ready for review October 21, 2024 18:56
@tylerbutler tylerbutler requested a review from a team as a code owner October 21, 2024 18:56
@tylerbutler tylerbutler requested review from zhenmichael and a team October 21, 2024 19:00
@tylerbutler tylerbutler changed the title improvement(build-tools): Add build-infrastructure package feat(build-tools): Add build-infrastructure package Oct 22, 2024
Copy link
Contributor

@jzaffiro jzaffiro left a comment

Choose a reason for hiding this comment

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

Approved for docs!

@tylerbutler tylerbutler merged commit b8e887e into microsoft:main Oct 22, 2024
45 checks passed
@tylerbutler tylerbutler deleted the bt-build-infra-interfaces-only-01 branch October 22, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: build Build related issues base: main PRs targeted against main branch public api change Changes to a public API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants