Skip to content

Conversation

@mcmire
Copy link
Contributor

@mcmire mcmire commented May 25, 2023

Description

When creating a new release, it can be helpful to be able to view the changes that have been made to a package since its most recent release. This commit adds a package script, since-latest-release, which can be used to accomplish this.

This script is simply a shortcut for a commit range, so you can plug any Git command that takes a commit range into it. For instance, to view the list of latest commits for @metamask/assets-controllers, you can use log:

yarn workspace @metamask/accounts-controller run since-latest-release log

Or to view all changes, you can use diff:

yarn workspace @metamask/accounts-controller run since-latest-release diff

Or you can leave an argument off to just get the names of commits:

yarn workspace @metamask/accounts-controller run since-latest-release

Testing

Try running the command above, using a package that has new changes. Try to break it.

Changes

(No user-facing changes; this is a developer-only change.)

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation for new or updated code as appropriate (note: this will usually be JSDoc)
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@mcmire mcmire force-pushed the add-changes-since-previous-release branch from ec7aee1 to 2ea22c8 Compare May 25, 2023 20:04
When creating a new release, it can be helpful to be able to view the
changes that have been made to a package since its most recent release.
This commit adds a package script, `since-latest-release`, which can be
used to accomplish this.

This script is simply a shortcut for a commit range, so you can plug any
Git command that takes a commit range into it. For instance, to view the
list of latest commits for `@metamask/assets-controllers`, you can use
`log`:

    yarn workspace @metamask/assets-controllers since-latest-release log

Or to view all changes, you can use `diff`:

    yarn workspace @metamask/assets-controllers since-latest-release diff

Or you can leave an argument off to just get the names of commits:

    yarn workspace @metamask/assets-controllers since-latest-release
@mcmire mcmire force-pushed the add-changes-since-previous-release branch from 2ea22c8 to 76ed164 Compare April 30, 2024 16:06
@mcmire mcmire changed the title Add tool for reviewing per-package changes Add way to view pkg changes since latest release Apr 30, 2024
@mcmire mcmire marked this pull request as ready for review April 30, 2024 16:09
@mcmire mcmire requested a review from a team as a code owner April 30, 2024 16:09
@mcmire mcmire requested a review from a team April 30, 2024 16:09
@mcmire
Copy link
Contributor Author

mcmire commented Apr 30, 2024

Hint: if you stick this in your shell configuration:

yw() {
  local command="workspace"
  if [[ $1 == "focus" || $1 == "foreach" || $1 == "list" ]]; then
    command="workspaces"
  fi

  yarn $command "$@"
}

then you can shorten the above to, e.g.:

yw @metamask/accounts-controller since-latest-release


determine-commit-range() {
if [[ "$1" =~ ^release/ ]]; then
echo "$previous_release_commit..main"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes it so that if you're on a release branch, the list of changes you see don't include any of the commits in the release branch itself.

@desi desi requested a review from a team May 23, 2024 19:19
mikesposito
mikesposito previously approved these changes Jun 20, 2024
Copy link
Member

@mikesposito mikesposito left a comment

Choose a reason for hiding this comment

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

I tried to execute different types of commands, but I was initially confused by the results: it showed 45a2971 as oldest commit for @metamask/keyring-controller, which was released a while ago.

Apparently, for it to work correctly git fetch should be executed first. It makes sense, but perhaps since this is supposed to be a "batteries-included" script we could run it automatically before running the command so that results don't get stale?

This looks good regardless of the above optional suggestion

@mcmire
Copy link
Contributor Author

mcmire commented Jun 20, 2024

@mikesposito Okay, thanks for the review. This command is designed to make creating releases easier, so that gets me thinking: Do you think this utility belongs in create-release-branch instead? Then we can assume that the user is running this from a release branch (which should be up to date) and not from, say, main (which may not be).

@mcmire
Copy link
Contributor Author

mcmire commented Jun 26, 2024

I'll go ahead and merge this as I think this could be useful. I hesitate to run git pull automatically because I expect it to be run on a release branch, but if that changes then we can tweak it a bit further. Or if it ends up being useful we can consider adding it to create-release-branch.

@mcmire
Copy link
Contributor Author

mcmire commented Jun 26, 2024

Resolved a lint failure.

@mcmire mcmire requested a review from a team July 18, 2024 17:59
@cryptodev-2s
Copy link
Contributor

Looks good to me. The branch needs to be rebased. Additionally, there are some typos in the PR description: replace git-since-latest-release with since-latest-release for the diff and no argument commands.

@cryptodev-2s cryptodev-2s requested review from a team as code owners July 29, 2024 17:24
@cryptodev-2s cryptodev-2s requested a review from mikesposito July 29, 2024 17:24
@cryptodev-2s cryptodev-2s merged commit 3ebe982 into main Aug 21, 2024
@cryptodev-2s cryptodev-2s deleted the add-changes-since-previous-release branch August 21, 2024 13:22
Mrtenz added a commit to MetaMask/snaps that referenced this pull request Sep 20, 2024
This adds the `since-latest-release` script, which is a copy of the
script in `MetaMask/core`. See MetaMask/core#1390 for more info.
Gudahtt added a commit that referenced this pull request Jul 16, 2025
Update the template used by the `create-package` script. The previous
template was no longer compatible with our Yarn constraints.

Here are the PRs related to these specific changes:
* #4648
* #3645
* #1390
* #3668
@Gudahtt Gudahtt mentioned this pull request Jul 16, 2025
4 tasks
Gudahtt added a commit that referenced this pull request Jul 17, 2025
Update the template used by the `create-package` script. The previous
template was no longer compatible with our Yarn constraints.

Here are the PRs related to these specific changes:
* #4648
* #3645
* #1390
* #3668
Gudahtt added a commit that referenced this pull request Jul 17, 2025
## Explanation

Update the template used by the `create-package` script. The previous
template was no longer compatible with our Yarn constraints.

## References

Here are the PRs related to these specific changes:
* #4648
* #3645
* #1390
* #3668

## Changelog

N/A

## Checklist

- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants