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

Support alternate tag prefixes #120

Merged
merged 1 commit into from Nov 3, 2022
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Oct 31, 2022

We should support alternate prefixes in version tags. At the moment the project assumes that the prefix v is always used. But some projects use no prefix, or include the package as a prefix to the version (e.g. in monorepos).

All public-facing functions now support a tag prefix option. It is optional, so this is a non-breaking change. The updateChangelog
method accepts an array of tag prefixes instead of a single one, so that we can better support the first release of a monorepo where you might want to compare against a backup tag if the first isn't found.

Fixes #116

@Gudahtt Gudahtt force-pushed the support-alternate-tag-prefixes branch 2 times, most recently from db977ac to c924579 Compare October 31, 2022 22:16
We should support alternate prefixes in version tags. At the moment the
project assumes that the prefix v is always used. But some projects use
no prefix, or include the package as a prefix to the version (e.g. in
monorepos).

All public-facing functions now support a tag prefix option. It is
optional, so this is a non-breaking change. The `updateChangelog`
method accepts an array of tag prefixes instead of a single one,
so that we can better support the first release of a monorepo where
you might want to compare against a backup tag if the first isn't
found.

Fixes #116
@Gudahtt Gudahtt force-pushed the support-alternate-tag-prefixes branch from c924579 to 8212c8e Compare October 31, 2022 22:19
@Gudahtt Gudahtt marked this pull request as ready for review October 31, 2022 22:20
@Gudahtt Gudahtt requested a review from a team as a code owner October 31, 2022 22:20
@Gudahtt
Copy link
Member Author

Gudahtt commented Oct 31, 2022

I will follow up with manual testing steps soon, and do some manual testing myself.

@Gudahtt
Copy link
Member Author

Gudahtt commented Nov 2, 2022

Manual testing steps:

Independent repository (regression testing):

  • Checkout auto-changelog and build the project
  • Add the script `"auto": "[path-to-auto-changelog-project]/dist/cli.js" to some repository for test purposes
    • It can be any of our projects, as long as it's not a monorepo, and as long as it has some changes and some previous git tag.
  • Run yarn auto update --rc
  • See that it correctly identified the changes since the last tag, and it correctly set the release header in the changelog.

Monorepo repository (new functionality):

  • Checkout auto-changelog and build the project
  • Checkout the controllers repository monorepo-poc branch, and build the project
  • Add the script `"auto": "[path-to-auto-changelog-project]/dist/cli.js" to the root of the repository.
  • Set the current base-controller version to 1.0.0
  • Run yarn auto update --rc --root ./packages/base-controller --tag-prefix=base-controller@v --currentVersion 1.0.0
  • See that it correctly identified the changes since the last tag, and it correctly set the release header in the changelog.
  • Update the draft changelog place all changes into the "Changed" category, making it pass validation.
  • Update the current base-controller version to 1.1.0
  • Commit the changelog changes and tag that commit as base-controller@v1.1.0
  • Make some example commits that alter the base controller package
  • Run yarn auto update --rc --root ./packages/base-controller --tag-prefix=base-controller@v --currentVersion 1.1.0
  • See that it correctly identifies just the example commits

@Gudahtt Gudahtt marked this pull request as draft November 2, 2022 21:37
@Gudahtt Gudahtt marked this pull request as ready for review November 2, 2022 21:44
@Gudahtt
Copy link
Member Author

Gudahtt commented Nov 2, 2022

The manual testing steps include setting the --currentVersion flag because the default version used is npm_project_version, which is wrong if the update script is being run from the root of the monorepo.

This seems wrong to me (the version should always match the manifest at the project root), so I have updated how that works here: #121

Copy link
Member

@rickycodes rickycodes left a comment

Choose a reason for hiding this comment

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

This all LGTM

@Gudahtt Gudahtt merged commit 5cc4d22 into main Nov 3, 2022
@Gudahtt Gudahtt deleted the support-alternate-tag-prefixes branch November 3, 2022 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support package-level tags
2 participants