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

Create @wordpress-mobile/components package #15475

Closed
wants to merge 1 commit into from

Conversation

koke
Copy link
Contributor

@koke koke commented May 6, 2019

Description

This creates a new @wordpress-mobile/components package in packages/mobile/.

Some things I'm still considering about this one:

  • Should Lerna also pick this up and publish to npm on each Gutenberg release, or should we handle mobile packages separately? We can still publish versions manually and Lerna will only publish on release if there have been changes since the last version. I think this would work for us.
  • One idea I have about this folder structure is that we would eventually move the other things from the gutenberg-mobile repo and have a @wordpress-mobile/block-editor package that would include all the editor initialization.
  • The idea behind the different @wordpress-mobile prefix is to signal that those packages are React Native code. I don't know if we can also make that more know in the package.json to avoid accidental imports.
  • Each component needs some documentation.

@koke koke added the Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) label May 6, 2019
@gziolo gziolo added npm Packages Related to npm packages Needs Technical Feedback Needs testing from a developer perspective. labels May 10, 2019
@gziolo
Copy link
Member

gziolo commented May 10, 2019

Should Lerna also pick this up and publish to npm on each Gutenberg release, or should we handle mobile packages separately? We can still publish versions manually and Lerna will only publish on release if there have been changes since the last version. I think this would work for us.

If any of the existing packages depend on this package it must be published to npm. In the current implementation @wordpress/block-library uses this package but it isn't reflected in package.json file. Managing native dependencies in packages it's something which was never solved. Is there at least an issue which tracks it?

The idea behind the different @wordpress-mobile prefix is to signal that those packages are React Native code. I don't know if we can also make that more know in the package.json to avoid accidental imports.

Do you think those packages should be published to npm? If yes, then using a different organization will cause issues as all folks doing npm packages release will need to have access sorted out for both wordpress and wordpress-mobile on npm.

There is also this broader discussion, why those components exist on native mobile and don't have a matching behavior on the web with the mobile viewport?

@gziolo gziolo added the [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible label May 10, 2019
@gziolo gziolo requested review from youknowriad, aduth, mtias and mapk May 10, 2019 07:07
@koke
Copy link
Contributor Author

koke commented May 10, 2019

In the current implementation @wordpress/block-library uses this package but it isn't reflected in package.json file.

You're right, I missed that bit. They probably need to be published with the rest.

There is also this broader discussion, why those components exist on native mobile and don't have a matching behavior on the web with the mobile viewport?

That's a good point. I'm not sure if all of the native components would have a web counterpart, and I definitely see us building things for native that would eventually be ported to mobile web, but not right away.

I see this as an intermediate step to bring more of the code currently living in gutenberg-mobile to Gutenberg, and then refactor as much of it as possible to use the same components/APIs that Gutenberg defines. See wordpress-mobile/gutenberg-mobile#958 for some of the next steps on this front.

That said, it seems sensible that all these would just go to @wordpress/components directly, but I'm not entirely sure what are the implications of having native-only components there, and start adding react-native dependencies to Gutenberg packages. I guess this is what you mean by:

Managing native dependencies in packages it's something which was never solved. Is there at least an issue which tracks it?

What would you say are the challenges on adding react-native as a dependency of @wordpress/components?

@gziolo
Copy link
Member

gziolo commented May 13, 2019

What would you say are the challenges on adding react-native as a dependency of @wordpress/components?

I think it would be perfectly fine to define it as a peerDependency which means it won't get installed by default but it would give feedback that it's missing when using with projects. Unfortunately, there is no way to mark the dependency as optional and loaded only in the given context :(

It has to be finally explored and fixed to ensure that packages published to npm can be used with 3rd party projects.

@koke
Copy link
Contributor Author

koke commented May 13, 2019

But since the code is actually importing from react native, shouldn’t it be a regular dependency?

Edit: I just read the docs on peer dependencies and it makes more sense, I guess the concept wasn't intuitive to me 😁

@koke
Copy link
Contributor Author

koke commented May 16, 2019

I'm closing this for now, and we'll do a new PR to put these components in @wordpress/components instead.

@koke koke closed this May 16, 2019
@koke koke deleted the rnmobile/components-package branch May 16, 2019 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mobile App - i.e. Android or iOS Native mobile impl of the block editor. (Note: used in scripts, ping mobile folks to change) Needs Technical Feedback Needs testing from a developer perspective. npm Packages Related to npm packages [Type] Technical Prototype Offers a technical exploration into an idea as an example of what's possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants