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

chore: Add meta-data to core to ensure it is always released #13526

Merged
merged 3 commits into from
Jun 21, 2024

Conversation

jimblanc
Copy link
Contributor

@jimblanc jimblanc commented Jun 20, 2024

Description of changes

This change introduces a meta-data file to @aws-amplify/core which will be automatically updated and committed before releases are run to ensure that a new version of core is published with a correct version.ts file (even if there were no other changes in @aws-amplify/core). Resolves an issue where particular releases of Amplify would use the wrong version in the user-agent headers if there were no changes to core in that release. This issue started happening when we fixed conventional commits in #13228. Before this change, all packages were getting published every time which obfuscated the problem.

Downsides:

  • More noisy release process as 1 more commit will be generated automatically
  • As core will receive a version bump every release, pretty much every other package in the repo will release as most depend on core (although this is technically more correct given the current UA versioning logic)

Alternatives considered:

  • Force publish @aws-amplify/core using --force-publish
    • Problem: Disables conventional commits as per Lerna docs & testing.
  • Force commit updated version.ts before release runs
    • Problem: Off-by-one error as Lerna hasn't updated the version of aws-amplify yet.
  • Use a Lerna life-cycle hook to update version.ts before release runs
    • Problem: Chicken and egg problem. There is no hook that runs before Lerna determines which packages have changed (and should be released), so even if we update version.ts it's too late in the process and core would be skipped.
  • Import aws-amplify version directly from package.json
    • Problem: Bundle bloat and security concerns as package.json would be exposed in customer bundles. Also implicit circular dependency.
  • Refactor version logic into aws-amplify
    • Problem: This logic is used in packages that are outside of the umbrella package, so this approach would not work universally

PR that introduced original version.ts logic: #11301

Issue #, if available

Description of how you validated changes

Tested release workflow on Verdaccio. Confirmed that version.ts was published with the correct version.

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jimblanc jimblanc marked this pull request as ready for review June 20, 2024 17:50
@jimblanc jimblanc requested review from a team as code owners June 20, 2024 17:50
Copy link
Member

@ashwinkumar6 ashwinkumar6 left a comment

Choose a reason for hiding this comment

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

Thanks for getting this in !!

@jimblanc jimblanc merged commit 90bc0e3 into aws-amplify:main Jun 21, 2024
30 checks passed
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.

3 participants