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

fix(deps): fix more implicit deps and add linting #14137

Merged
merged 12 commits into from
Jan 28, 2025

Conversation

pranavosu
Copy link
Member

@pranavosu pranavosu commented Jan 13, 2025

Description of changes

Fix implicit dependencies for packages (except adapter-nextjs1, and react-native adjacent2) to better support Yarn Pnp and pnpm.

  1. adapter-nextjs ( waiting on chore(aws-amplify/adapter-nextjs): remove extraneous deps #14141 merge into main)
  2. RN code needs to be separated from core to make native dependencies explicit. We can't have all consumers of the core package install native deps. Additionaly, RN doesn't support yarn PnP or pnpm so there's less upside

Issue #, if available

Description of how you validated changes

yarn && yarn lint

Checklist

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

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

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

@pranavosu pranavosu requested review from a team as code owners January 13, 2025 21:58
AllanZhengYP
AllanZhengYP previously approved these changes Jan 23, 2025
ashika112
ashika112 previously approved these changes Jan 23, 2025
@ashika112 ashika112 dismissed stale reviews from AllanZhengYP and themself via 840ade7 January 27, 2025 18:38
joon-won
joon-won previously approved these changes Jan 27, 2025
stocaaro
stocaaro previously approved these changes Jan 27, 2025
AllanZhengYP
AllanZhengYP previously approved these changes Jan 27, 2025
Comment on lines +34 to +36
"peerDependencies": {
"react-native": ">=0.70"
},
Copy link
Member

Choose a reason for hiding this comment

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

Is this strictly necessary?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's not strictly necessary because the @aws-amplify/react-native package has a peer dependency on "react-native": ">=0.70" but it is correct in isolation because this package uses react-native

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we have this in the web browser package either. Hesitant to use peer deps given the inconsistent behavior we sometimes see with different package managers and it gives us more places to update this when none of the rtn- packages really work in isolation anyway. Just a little scared

Copy link
Member Author

Choose a reason for hiding this comment

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

For some reason I though rtn-web-browser had a peer dep but it's just a dev dep 🤦🏽 I can create a separate PR for that. If these are truly meant to be used with the @amplify-aws/react-native package then there should be no issues adding these peer deps. I haven't seen any in testing 🤞🏽

"tslib": "^2.5.0"
},
"peerDependencies": {
Copy link
Member

Choose a reason for hiding this comment

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

Could this cause issues with duplicate cores - e.g. during a MV bump this is forgotten?

Copy link
Member

Choose a reason for hiding this comment

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

we do this in all our packages already. I dont see how this addition would be any different? 👀

Copy link
Member

Choose a reason for hiding this comment

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

But answer the actual question, yes. If we miss updating anywhere it will cause duplicate dependencies but i think that is caught in our tests

Copy link
Member

Choose a reason for hiding this comment

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

I'm a little concerned about adding peer deps in general given their behavior at times but it's a little extra daunting when we have two deps on core here and they're already "mismatched". Should be fine, but I'm jut wondering if we're adding some baggage needlessly.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's fair but it's useful for modern package managers like pnpm, so there is some benefit. I think it's better to not rely on implicit dependencies which could stop working with future versions of npm

@pranavosu pranavosu dismissed stale reviews from AllanZhengYP, joon-won, and stocaaro via 3143d35 January 27, 2025 22:29
@pranavosu pranavosu merged commit 22ca811 into main Jan 28, 2025
30 checks passed
@pranavosu pranavosu deleted the fix/missed-package-dependencies branch January 28, 2025 16:37
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.

6 participants