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(release:report): Split release report commands #12850

Merged
merged 24 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-tools/packages/build-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ $ npm install -g @fluid-tools/build-cli
$ flub COMMAND
running command...
$ flub (--version|-V)
@fluid-tools/build-cli/0.5.0
@fluid-tools/build-cli/0.6.0
$ flub --help [COMMAND]
USAGE
$ flub COMMAND
Expand Down
97 changes: 71 additions & 26 deletions build-tools/packages/build-cli/docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Release commands are used to manage the Fluid release process.

* [`flub release`](#flub-release)
* [`flub release report`](#flub-release-report)
* [`flub release report all`](#flub-release-report-all)

## `flub release`

Expand Down Expand Up @@ -52,55 +53,99 @@ Generates a report of Fluid Framework releases.

```
USAGE
$ flub release report [--json] [--days <value>] [-s | -r] [-g client|server|azure|build-tools [--all | -o
<value>]] [-p <value> ] [--limit <value> ] [-v]
$ flub release report [--json] [-i | -r | -s] [-g client|server|azure|build-tools] [-o] [-p <value>] [-v]

FLAGS
-g, --releaseGroup=<option> Name of the release group
<options: client|server|azure|build-tools>
-o, --output=<value> Output JSON report files to this location.
-p, --package=<value> Name of package.
-r, --mostRecent Always pick the most recent version as the latest (ignore semver version sorting).
-s, --highest Always pick the greatest semver version as the latest (ignore dates).
-v, --verbose Verbose logging.
--all List all releases. Useful when you want to see all the releases done for a release group
or package. The number of results can be limited using the --limit argument.
--days=<value> [default: 10] The number of days to look back for releases to report.
--limit=<value> Limits the number of displayed releases for each release group.
-g, --releaseGroup=<option>
Report only on this release group. If also pass --interactive, --highest, or --mostRecent, then the report will only
include this release group at the selected version.

If you pass this flag by itself, the command will use the version of the release group at the current commit in the
repo, but will also include its direct Fluid dependencies.

If you want to report on a particular release, check out the git tag for the release version you want to report on
before running this command.
<options: client|server|azure|build-tools>

-i, --interactive
Choose the version of each release group and package to contain in the release report.

-o, --[no-]output
Output JSON report files.

-p, --path=<value>
[default: working directory] Output JSON report files to this location.

-r, --mostRecent
Always pick the most recent version as the latest (ignore semver version sorting).

-s, --highest
Always pick the greatest semver version as the latest (ignore dates).

-v, --verbose
Verbose logging.

GLOBAL FLAGS
--json Format output as json.

DESCRIPTION
Generates a report of Fluid Framework releases.

The release report command is used to produce a report of all the packages that were released and their current
version. After a release, it is useful to generate this report to provide to customers, so they can update their
dependencies to the most recent version.
The release report command is used to produce a report of all the packages that were released and their version. After
a release, it is useful to generate this report to provide to customers, so they can update their dependencies to the
most recent version.

The command will prompt you to select versions for a package or release group in the event that multiple versions have
recently been released.
The command operates in two modes: "whole repo" or "release group." The default mode is "whole repo." In this mode,
the command will look at the git tags in the repo to determine the versions, and will include all release groups and
packages in the repo. You can control which version of each package and release group is included in the report using
the --interactive, --mostRecent, and --highest flags.

Using the --all flag, you can list all the releases for a given release group or package.
The "release group" mode can be activated by passing a --releaseGroup flag. In this mode, the specified release
group's version will be loaded from the repo, and its immediate Fluid dependencies will be included in the report.
This is useful when we want to include only the dependency versions that the release group depends on in the report.

EXAMPLES
Output all release report files to the current directory.

$ flub release report -o .
$ flub release report

Generate a minimal release report and display it in the terminal.
Generate a release report of the highest semver release for each package and release group and display it in the
terminal only.

$ flub release report
$ flub release report --no-output
tylerbutler marked this conversation as resolved.
Show resolved Hide resolved

Generate a release report for each package and release group in the repo interactively.

Generate a minimal release report and output it to stdout as JSON.
$ flub release report -i
```

## `flub release report all`
tylerbutler marked this conversation as resolved.
Show resolved Hide resolved

$ flub release report --json
Generates a report of all releases of a particular package or release group.
tylerbutler marked this conversation as resolved.
Show resolved Hide resolved

```
USAGE
$ flub release report all [-g client|server|azure|build-tools | -p <value>] [-l <value>] [-v]

FLAGS
-g, --releaseGroup=<option> Name of the release group
<options: client|server|azure|build-tools>
-l, --limit=<value> Limits the number of displayed releases for each release group.
tylerbutler marked this conversation as resolved.
Show resolved Hide resolved
-p, --package=<value> Name of package.
-v, --verbose Verbose logging.

DESCRIPTION
Generates a report of all releases of a particular package or release group.

Useful when you want to see all the releases done for a release group or package. The number of results can be limited
using the --limit argument.

EXAMPLES
List all the releases of the azure release group.

$ flub release report --all -g azure
$ flub release report all -g azure

List the 10 most recent client releases.

$ flub release report --all -g client --limit 10
$ flub release report all -g client --limit 10
```
15 changes: 14 additions & 1 deletion build-tools/packages/build-cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,21 @@ export abstract class BaseCommand<T extends typeof BaseCommand.flags>
private _context: Context | undefined;
private _logger: CommandLogger | undefined;

/**
* Parses the command arguments and stores them in parsedOutput.
*
* @remarks
*
* This function does nothing if parsedOutput is already defined.
*/
protected async parseCmdArgs() {
if (this.parsedOutput === undefined) {
this.parsedOutput = await this.parse(this.ctor);
}
}

async init() {
this.parsedOutput = await this.parse(this.ctor);
await this.parseCmdArgs();
}

async catch(err: any) {
Expand Down
Loading