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

Change package.json for React Native to allow for optional deps for views #436

Merged
merged 1 commit into from
Jan 31, 2025

Conversation

bjtrounson
Copy link
Collaborator

This is a small PR and related to #425

I've been wondering about a way to properly do this within the package.json and was looking through some other projects and found the way https://github.com/computerjazz/react-native-draggable-flatlist/blob/main/package.json handles this.

It seems peerDependencies seems the way to go, look through the documentation on NPM and it seems we can label some of the peer deps as optional which I think will work well for the view related packages (React Native MapLibre and so on.)

Documentation if anyone else want to have a look in case I've missed something https://docs.npmjs.com/cli/v11/configuring-npm/package-json#peerdependencies

This PR just makes that change. Another way to potential do this is to separate the view and core logic into to two separate package which we upload separately onto NPM

…pendency and mark the MapLibre and other view related libraries as optional
Copy link
Contributor

@ianthetechie ianthetechie left a comment

Choose a reason for hiding this comment

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

This makes sense to me! Seems like a reasonable first step at least.

I haven't had much chance to think through the npm packaging of the React Native module yet, but this is an interesting idea, since you can explicitly denote optional dependencies.

I think the main argument for separating the packages is that users wouldn't need to download code which they won't use. Is that worth the overhead of maintaining multiple npm projects in the workspace? I'm actually not sure, but it does seem to make things significantly more annoying to work with.

@ianthetechie ianthetechie merged commit 8b3b8fa into stadiamaps:main Jan 31, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants