FluidFramework/build-tools
Tyler Butler 8ae7837bd1
improvement(build-cli): Handle changesets that apply to no packages (#22433)
Contains changes for two flub commands, `generate:releaseNotes` and
`generate:changelog`.

### generate:releaseNotes

The changeset generator no longer fails with an error message when no
changes are detected. Instead, it outputs a prompt:

> No changed packages have been detected. Do you want to create a
changeset associated with no packages?

If the user selects Yes, then the package selection is skipped but the
user can still provide a summary, description, and release notes
section. If they select No, then they can select affected packages from
the complete list.

The prompt chain was simplified by using functions for the "type"
property and returning false when the question should be skipped. This
allows all the questions to be in a single prompt chain and
conditionally ask questions based on previous responses and other input.

The full prompt flow is now:

1. IFF no changed packages are detected, ask "Do you want to create a
changeset associated with no packages?". If YES, go to 3. IF NO, go to
2.
2. Prompt to select affected packages and bump levels.
3. Prompt to select release notes section.
4. Prompt to enter summary.
5. Prompt to enter body.

The code was also reorganized to optimize checking for changes. The
previous code ended up comparing the local to the remote at least twice;
now that check is only done twice if the user is prompted to select a
different target branch - and does. Otherwise, the check is done once
and the results of that check are used where needed. This speeds up the
default case.

### generate:changelog

When generating changelogs, we invoke the `changeset version` command to
apply the changesets to all the packages. This is what actually writes
the changelogs. However, our changesets have additional custom metadata
in a second front-matter section (see
https://github.com/microsoft/FluidFramework/wiki/Changesets#custom-metadata).
To enable the existing tools like
[@changesets/cli](https://www.npmjs.com/package/@changesets/cli) to work
with our changesets, commands like the `generate:changelog` command
first updates all the changesets to be "canonical" changesets by
removing the additional metadata section. We update the changesets to be
canonical, then we invoke `changeset version`, which consumes the
updated changesets, and then do some cleanup on the resulting changes.
2024-09-11 15:01:01 -07:00
..
.vscode
feeds
packages
patches
.czrc
.gitignore
.npmignore
.npmrc
.prettierignore
.releaseGroup
CHANGELOG.md
README.md
RELEASE_NOTES.md
api-extractor-base.json
biome.jsonc
commitlint.config.cjs
lerna.json
package.json
pnpm-lock.yaml
pnpm-workspace.yaml
syncpack.config.cjs

README.md

@fluid-tools/build-tools

This folder contains packages used for building and managing the contents of Fluid Framework repositories and implementing the Fluid Framework release process.

@fluid-tools/build-cli (aka flub)

A build and release tool for the Fluid Framework GitHub repositories. flub is intended to replace the existing fluid build-tools, primarily by reusing existing build-tools functionality and wrapping it in a more consistent, maintainable CLI using oclif.

@fluidframework/build-tools

This package contains both CLI tools and supporting code. This is the home of all the "classic" Fluid build tools, like policy-check, fluid-bump-version, etc.

Note: Don't add new CLI commands to this package. Instead, add a new command to the build-cli package and import the functionality you need from this package.

@fluid-tools/version-tools

This package contains APIs and a CLI for working with semantic versioning version strings and ranges, especially those using Fluid-specific version schemes.

Contribution Guidelines

There are many ways to contribute to Fluid.

Detailed instructions for working in the repo can be found in the Wiki.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services. Use of these trademarks or logos must follow Microsofts Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.

Help

Not finding what you're looking for in this README? Check out fluidframework.com.

Still not finding what you're looking for? Please file an issue.

Thank you!

Trademark

This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.

Use of these trademarks or logos must follow Microsoft's Trademark & Brand Guidelines.

Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.