melos icon indicating copy to clipboard operation
melos copied to clipboard

Question: Project structure for white label apps with overrides

Open sebastianbuechler opened this issue 2 years ago • 3 comments

I have a general question regarding the intended project structure with melos when using it for white labeling Flutter apps.

We currently have the following project structure

/
pubspec.yaml // name: workspace, with melos and lint dependencies
  /core
  pubspec.yaml // name: core, with dependency to local flavor package
      /flavor
      pubspec.yaml // name: flavor, with dependency to base package
  /whitelabel1
  pubspec.yaml // name: whitelabel1, with dependency to base package and dependency override of the flavor package with local flavor folder
      /flavor
      pubspec.yaml // name: flavor, with dependency to base and whitelabel1 package
  /whitelabel2
  pubspec.yaml // name: whitelabel2, with dependency to base package and dependency override of the flavor package with local flavor folder
      /flavor
      pubspec.yaml // name: flavor, with dependency to base and whitelabel2 package

Obviously, this is not very optimal because of cross dependencies between the base, flavor and white label packages, but it seems to work. The reason for the local flavor packages is to have an override possibility for the white label variant. I.e. if a contact form should be tailored to the whitelabel variant I would pack it into the local flavor and override it that way in the base package.

Another challenge is using melos with this approach as all flavor packages have the same name (and need to have the same name in this approach) and thus can not be configured together in the melos.yaml file.

What's the intended way of using melos for white label apps with such flavor overrides? Is there even an example?

sebastianbuechler avatar Oct 07 '23 08:10 sebastianbuechler

Hey, @sebastianbuechler, did you manage to find a more optimal solution to your question? Also, is there any guide on how to organize the project structure for white labels with Melos? Do your Whitelabels folders contain separated Flutter iOS and Android folders? Sorry for this probably unrelated questions, but not sure where to ask and we facing the same problems with whitelabels which we currently managing with flavors and XCode schemes

anatoliisudor avatar Mar 01 '24 14:03 anatoliisudor

@anatoliisudor there is no recommended way from melos, as white labelling is not their primary focus. We moved away from flavors, as we needed more control for each app version. We put everything shared in a base package and consume that locally in each white label app. So yes, each has its own ios and android folders.

sebastianbuechler avatar Mar 13 '24 06:03 sebastianbuechler