How does Ionic Capacitor treat packages in child app from a monorepo?

Viewed 149

So I setup a monorepo and have a child app with the following structure:

Ionic-App

  • ionic.config.json
  • node_modules
  • package.json
  • apps
    • child-app
      • node_modules
      • ios
      • android
      • package.json

It seems to me that the correct sequence to install a capacitor package is as follows:

  1. Go into child and do my install
  2. Go into root rebuild node_modules (remove then npm i)
  3. Go back into child and run npx cap sync
    • this seems to move the dependency from the child package.json and to the root
    • this also seems to update the podfile with the path to root
    • pod 'CapacitorApp', :path => '../../../../node_modules/@capacitor/app'

If I don't follow these exact steps the package seems to stay in the child package.json and the podfile links to the child: pod 'CapacitorApp', :path => '../../node_modules/@capacitor/app'

My question is, am I doing this right? I haven't found any docs explaining this process. If someone knows where to find that, can you please link to it?

0 Answers
Related