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: Clean up dependencies of apps dependent on the common-app #6923

Merged
merged 17 commits into from
Jan 24, 2025

Conversation

MatiPl01
Copy link
Member

@MatiPl01 MatiPl01 commented Jan 22, 2025

Summary

This PR moves common-app dependencies to the common-app package.json and removes all of duplicate dependencies from fabric-example, web-example and macos-example apps. We can do this thanks to react-native.config.js which reads all dependencies from the common-app/package.json and adds them to the dependency list from the current app's package.json file (if they weren't specified in the app's package.json).

Some dependencies, which are used in package.json scripts to e.g. start the app, such as react-native, must be added explicitly in each app's package.json.

Motivation

I think it is a bit cumbersome to repeat dependencies needed by the common-app in every app that imports application from the common-app sources. Since every app would need dependencies that common-app needs to work, we don't have to repeat them in every app dependent on the common-app.

If we will have to use a different dependency version or mock a dependency, we can always add another dep e.g. in the fabric-example package.json or exclude/include it in the react-native.config.js.

Test plan

Build the fabric-example / web-example / macos-example to see that everything still works.

@MatiPl01 MatiPl01 self-assigned this Jan 22, 2025
@MatiPl01 MatiPl01 changed the title chore: Clean up fabric and web example apps dependencies chore: Remove paper example, clean up fabric and web example apps dependencies Jan 22, 2025
@MatiPl01 MatiPl01 changed the title chore: Remove paper example, clean up fabric and web example apps dependencies chore: Clean up fabric and web example apps dependencies Jan 22, 2025
@MatiPl01 MatiPl01 changed the title chore: Clean up fabric and web example apps dependencies [WIP] chore: Clean up fabric and web example apps dependencies Jan 22, 2025
@MatiPl01 MatiPl01 force-pushed the @matipl01/example-apps-setup-cleanup branch from 8292814 to 6956ba4 Compare January 22, 2025 18:02
@MatiPl01 MatiPl01 changed the base branch from main to @matipl01/remove-paper-example January 22, 2025 18:03
Base automatically changed from @matipl01/remove-paper-example to main January 23, 2025 10:41
@MatiPl01 MatiPl01 changed the title [WIP] chore: Clean up fabric and web example apps dependencies chore: Clean up fabric and web example apps dependencies Jan 23, 2025
@MatiPl01 MatiPl01 force-pushed the @matipl01/example-apps-setup-cleanup branch 2 times, most recently from 78efad7 to 6498278 Compare January 23, 2025 11:45
@MatiPl01 MatiPl01 changed the base branch from main to @matipl01/fix-cocoapods-version-in-examples January 23, 2025 11:45
Base automatically changed from @matipl01/fix-cocoapods-version-in-examples to main January 23, 2025 13:55
@MatiPl01 MatiPl01 force-pushed the @matipl01/example-apps-setup-cleanup branch from 03fafb8 to 7a13441 Compare January 23, 2025 13:56
Copy link
Collaborator

@tjzel tjzel left a comment

Choose a reason for hiding this comment

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

I like the idea but I'm not certain if this is going to work with macos-example (and possible tvos-example in the future) since they might need to be behind in versions etc.

Does it work with macos-example?

apps/fabric-example/package.json Outdated Show resolved Hide resolved
apps/fabric-example/react-native.config.js Outdated Show resolved Hide resolved
@MatiPl01
Copy link
Member Author

I like the idea but I'm not certain if this is going to work with macos-example (and possible tvos-example in the future) since they might need to be behind in versions etc.

Does it work with macos-example?

I updated the macos-example as well. I also implemented your suggestions and added a possibility to override dependencies specified in common-app - this was needed for the macos-example where we use different version of react-native.

The final implementation works in this way:

  • if the dependency is not specified in the package.json of the current example app, the dependency from the common-app will be used instead,
  • if the same dependency is specified in the current app and the common-app, the current app dep has higher priority and this dependency will override the one specified in the common-app

@MatiPl01 MatiPl01 requested a review from tjzel January 23, 2025 18:02
@MatiPl01 MatiPl01 changed the title chore: Clean up fabric and web example apps dependencies chore: Clean up dependencies of apps dependent on the common-app Jan 24, 2025
Copy link
Collaborator

@tjzel tjzel left a comment

Choose a reason for hiding this comment

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

Looks good now!

apps/common-app/.eslintignore Outdated Show resolved Hide resolved
@MatiPl01 MatiPl01 force-pushed the @matipl01/example-apps-setup-cleanup branch from cae829d to 6fddb59 Compare January 24, 2025 14:54
@MatiPl01 MatiPl01 added this pull request to the merge queue Jan 24, 2025
Merged via the queue into main with commit f74c825 Jan 24, 2025
12 checks passed
@MatiPl01 MatiPl01 deleted the @matipl01/example-apps-setup-cleanup branch January 24, 2025 15:23
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.

2 participants