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

feat(cli): Add --forwardPorts option to Capacitor CLI #5645

Merged
merged 10 commits into from Mar 15, 2023

Conversation

thomasvidas
Copy link
Contributor

Exposes the --forwardPorts option from native-run to the Capacitor CLI. When an npx cap run android --forwardPorts 8000:8000 is run, the following happens.

  • A Capacitor Sync
  • Device Boot & Connection
  • adb reverse tcp:${port} tcp:${port}
  • Install and run a debug APK

Opening as a Draft PR because

  • changes may be needed in native-run to work properly
  • maybe a --live-reload flag with the port in the config makes more sense?

@bastienlemaitre
Copy link

@thomasvidas any new about this feature ?

@peitschie
Copy link

I'd be keen on this one landing too! Hit an issue today where manual port forwards are cleared by native-run under some circumstances, so having a flag like this would make the whole thing easier to deal with. I ended up needing to use the wait-on package to help work around things.

@markemer markemer changed the base branch from capacitor-4 to main March 9, 2023 20:47
@markemer
Copy link
Contributor

markemer commented Mar 9, 2023

I've updated this to be merged to main and am looking at making sure it works.

@markemer markemer marked this pull request as ready for review March 9, 2023 20:54
@markemer markemer requested review from ItsChaceD, a team, giralte-ionic, IT-MikeS, theproducer and jcesarmobile and removed request for a team March 9, 2023 20:55
@markemer markemer changed the title feat: Add --forwardPorts option to Capacitor CLI feat(cli): Add --forwardPorts option to Capacitor CLI Mar 9, 2023
Copy link
Member

@jcesarmobile jcesarmobile left a comment

Choose a reason for hiding this comment

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

It's not working, the forwardPorts option is not being passed to the runCommand, should look like this:

async (platform, { scheme, flavor, list, target, sync, forwardPorts }) => {
            const { runCommand } = await import('./tasks/run');
            await runCommand(config, platform, {
              scheme,
              flavor,
              list,
              target,
              sync,
              forwardPorts
            });
          },

@markemer markemer self-assigned this Mar 13, 2023
@markemer
Copy link
Contributor

Huh, it worked for @theproducer - I'll take a look

@markemer
Copy link
Contributor

await runCommand

It does seem like that is missing.

@giralte-ionic giralte-ionic self-requested a review March 14, 2023 15:04
@markemer markemer merged commit 2f04d29 into main Mar 15, 2023
6 checks passed
@markemer markemer deleted the feature/cli/auto-adb-reverse branch March 15, 2023 19:03
markemer added a commit that referenced this pull request Apr 17, 2023
Co-authored-by: Mark Anderson <mark@ionic.io>
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.

None yet

8 participants