nxtend-team / nxtend

MIT License
190 stars 41 forks source link

Ionic capsitor live reload #459

Open sultanmyrza opened 3 years ago

sultanmyrza commented 3 years ago

we can run ionic app using this command ionic cap run ios with nx we do nx run {frontend project}:run:ios

question how we can run with live reload?

ionic cli ionic cap run ios -l --external with nx cli? nx run {frontend project}:run:ios ???

https://ionicframework.com/docs/react/your-first-app/7-live-reload#live-reload

sultanmyrza commented 3 years ago

I tried but no luck nx run {frontedn project}:cap --cmd="ios -l --external"

--cmd="--help"

Commands:
  create [options] [directory] [name] [id]  Creates a new Capacitor project
  init [options] [appName] [appId]          Initializes a new Capacitor project in the current directory
  serve                                     Serves a Capacitor Progressive Web App in the browser
  sync [options] [platform]                 copy + update
  update [options] [platform]               updates the native plugins and dependencies based in package.json
  copy [platform]                           copies the web app build into the native app
  open [platform]                           opens the native project workspace (xcode for iOS)
  add [platform]                            add a native platform project
  ls [platform]                             list installed Cordova and Capacitor plugins
  doctor [platform]                         checks the current setup for common errors
  plugin:generate                           start a new Capacitor plugin
devinshoemaker commented 3 years ago

Currently you'll have to use live reload with this: https://capacitorjs.com/docs/guides/live-reload#using-with-framework-clis

The Ionic CLI (which makes live reload much more convenient) does not place nicely with Nx workspaces sadly.

hellokingdom commented 2 years ago

@devinshoemaker what is the current recommended way to run live reload? Is it directly supported now with:

nx {project name}:cap --cmd "run android -l --external"

distante commented 2 years ago

@devinshoemaker what is the current recommended way to run live reload? Is it directly supported now with:

nx {project name}:cap --cmd "run android -l --external"

This does not run live reload, this just deploys the app.

mrambow commented 2 years ago

for me livereload(just tested with android) is currently working with:

"@nrwl/cli": "13.8.7",
"@nxtend/capacitor": "^13.0.0",
"@nxtend/ionic-angular": "^13.0.0",

if you have issues see that the project name is the same in apps/ionic-app/ionic.config.json, apps/ionic-app/package.json like in ./angular.json

Ostromecky commented 2 years ago

for me livereload(just tested with android) is currently working with:

"@nrwl/cli": "13.8.7",
"@nxtend/capacitor": "^13.0.0",
"@nxtend/ionic-angular": "^13.0.0",
  • switch to ionic app path.. cd apps/ionic-app
  • run ionic capacitor run android --project='ionic-app' -l --external
  • depending on the size of the app you have to wait some time

if you have issues see that the project name is the same in apps/ionic-app/ionic.config.json, apps/ionic-app/package.json like in ./angular.json

I'm receiving The run command requires to be run in an Angular project, but a project definition could not be found. but I use workspace.json instead of angular.json

Ostromecky commented 2 years ago

for me livereload(just tested with android) is currently working with:

"@nrwl/cli": "13.8.7",
"@nxtend/capacitor": "^13.0.0",
"@nxtend/ionic-angular": "^13.0.0",
  • switch to ionic app path.. cd apps/ionic-app
  • run ionic capacitor run android --project='ionic-app' -l --external
  • depending on the size of the app you have to wait some time

if you have issues see that the project name is the same in apps/ionic-app/ionic.config.json, apps/ionic-app/package.json like in ./angular.json

I'm receiving The run command requires to be run in an Angular project, but a project definition could not be found. but I use workspace.json instead of angular.json

Fixed with: https://github.com/nxtend-team/nxtend/issues/304#issuecomment-1009684580