ionic-team / ionic-cli

The Ionic command-line interface
MIT License
2k stars 654 forks source link

ionic cordova prepare --watch flag does not exist #4259

Open shamilovtim opened 4 years ago

shamilovtim commented 4 years ago

Description: when trying to using ionic cordova prepare ios --watch the following error is thrown:

Unknown option: '--watch'

My ionic info:

Ionic:

   Ionic CLI                     : 5.4.13 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.7
   @angular-devkit/build-angular : 0.801.3
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.1.1

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 5 other plugins)

Utility:

   cordova-res                          : 0.8.1
   native-run (update available: 0.3.0) : 0.2.9

System:

   ios-deploy : 1.9.2
   ios-sim    : 8.0.2
   NodeJS     : v12.4.0 (/usr/local/Cellar/node/12.4.0/bin/node)
   npm        : 6.13.2
   OS         : macOS Catalina
   Xcode      : Xcode 11.2.1 Build version 11B53
imhoffd commented 4 years ago

Interesting. Is this a feature request?

With Angular CLI's --watch option, it rebuilds and writes to www, but in order to deploy the app again, devs have to run cordova prepare, which copies app assets from www to platforms/<platform>/app/src/main/assets/www (or whatever Cordova chooses to use).

Do you propose that ionic cordova prepare --watch runs both ng build --watch and then also watches www and runs cordova prepare when the directory changes?

shamilovtim commented 4 years ago

@dwieeb Yes it's very difficult to setup a plugin development environment because of this being missing. I had to create a custom gulp script. Even still, symlinking in Gradle is broken so I was unable to really get a clean env going.

imhoffd commented 4 years ago

@shamilovtim Would you mind sharing the gulp script?

shamilovtim commented 4 years ago

https://github.com/shamilovtim/cordova-plugin-feed-fm/blob/master/example/gulpfile.js

I'm not sure how useful the remove/addback plugin series is because I came to find out that gradle still does not support symlinked files (this is an issue dating back years). That being said the prepare watch worked fine.

imhoffd commented 4 years ago

Yeah, Cordova itself doesn't play well with symlinks. I find I am often just manually rsync-ing. 😂

Thanks for sharing! I just wanted to triple-check that we were talking about the same thing, and we are. This feature would be great. 👌

Just curious, have you tried plugin development with Capacitor?

shamilovtim commented 4 years ago

No this case I was doing it for freelance as a side gig and I'm pretty familiar with the very small API of Cordova. I don't know much about Capacitator but I'm guessing it isn't backwards compatible with Cordova?

imhoffd commented 4 years ago

Many Cordova plugins work with Capacitor. Some don't. A lot of more essential plugins ship with Capacitor core as well. More info: https://capacitor.ionicframework.com/docs/cordova/migrating-from-cordova-to-capacitor

Forgot to make a note: 📝 This feature is dependent on https://github.com/ionic-team/angular-toolkit/issues/138