nx-extensions
nx-extensions copied to clipboard
Capacitor: update to version 4
Is your feature request related to a problem? Please describe.
in a sense, perhaps.. new apps generated with @nxext/ionic-angular
install @ionic/capacitor@3
. whereas @ionic/capacitor@4
was released back in July, and has already since been updated to 4.2.0
.
Describe the solution you'd like
I would like all the latest tools to use all the latest tools... (:
but for this specific case, considering Capacitor 4 is stable, it seems like a good idea to use it.
Describe alternatives you've considered
Cord... nah, not really.
FWIW: I am trying to bump capacitorVersion
locally, just to see how much is involved in this upgrade... I'll report back here if/when I discover anything interesting.
@ZaLiTHkA for sure a good idea to update it. Right now we hadn’t any free time to try yet😅
quick note: between work deadlines and our severe power issues here in South Africa, I have not had a chance to look into this one yet..
unfortunately, the work projects that I'm refreshing at the moment will need to stick with Cordova for now.. once I get back to my personal projects I'll be working with Capacitor again, so I'll get to dig into this one at that point. FWIW, this tab is pinned in browser, so I can't forget it. 🖖🏼
@DominikPieper Quick question, is this as simple as bumping the capacitorVersion
as @ZaLiTHkA is experimenting with? Does the nx-extensions team plan on Nx 15 and Capacitor 4 upgrades in near future or do you think this feature request will stay open for a while?
Looking forward to hearing from you, Cheers!
@samratarmas, just bumping the versions won't be enough, I fear. That's why we haven't had an update yet. The nx 15 update is worth in progress and will arrive soon
@DominikPieper is there a way I can be of help testing/developing the MR? ☺️
@Abildtoft, unfortunately, the generated configs need to be checked and changed (if something changes). All versions are updated, generating a plain capacitor project and keeping track of all changes, and working them in. That's what to do right now :-)
FWIW: I am currently still busy with the work projects mentioned in my previous comment, and unfortunately "Life"(tm) has had other plans for my personal time lately.. but I should get a chance to dig into this one more next week.
from the little bit I have looked at so far, it doesn't seem like this upgrade will require too many explicit changes, but there may be some implicit changes as a result of the new dependencies' dependencies.. another plus-point here is that the Capacitor 4 upgrade path is apparently quite simple.
I must point out one thing though: I do not have access to any local macOS environments, so I can make the code changes, but I can't debug any iOS builds at the moment.. still, I'll see what I can do. :)
@ZaLiTHkA all fine. I know that quite well. The same reason why I haven't had that much time lately. Life sometimes is quite busy as well
Hi @DominikPieper ,
Capacitor and React Native are two of the most popular ways to ship mobile apps for web developers and smaller dev teams. The Nx team maintains a React Native plugin officially for Nx, and it gets regular updates to newer versions in timely manner, but Capacitor has been left to the sidelines.
Nxext is currently the best way to get running with capacitor in an Nx environment. The awesome work you have done is offsetting a lot of the troubles that Nx core team chose to leave it up to the community for capacitor based developers. Nxext and previously @devinshoemaker have single handedly improved lives of many teams that chose to use Capacitor over React Native with Nx.
Since this is a community effort, I am definitely very happy that atleast Capacitor 3.6 is supported, however if you start shipping production Apks to app stores with the currently supported older Capacitor versions you will run into many hardware specific bugs (particularly for older devices) that newer versions of capacitor has solved. It has been very hard to debug specially for smaller teams.
I hope I was able to convey the significance of Nxext team and the capacitor plugin that you are maintaining. Is there a possibility that you reconsider/allocate maintaining capacitor support as part of your core goals with nxext?
Hey @samratarmas,
Thanks for your message. I understand it's frustrating if you use the plugin and deal with the Capacitor 3 problems. We moved Devins plugins over here cause unfortunately, he doesn't have any time to maintain them anymore. He did great work, put a lot of time into them, and wanted to let them die completely. I try not to let them die, but it's hard to bring in new features fast for me. I maintain everything after work in my spare time between work, chores at home, and my family. Dependent on how my interest that day is, I work on this and that plugin, but I can't keep up with the effort e.g. the Nx team can put into their plugins. With the founding and Nrwlians working full time on Nx it's even more complicated to keep up with everything a whole team develops vs 1-2 persons. I'd love to be able to align everything and ship updates as they go for the frameworks and Nx compatibility. Prepare Major updates like Capacitor 3 to 4 are even more work cause you have to consider adding migration scripts to make the update as smooth as possible.
I know my answer isn't really what you'd like to see, but that's what I can say so far. I'll try to update everything, but I can't say when I'll find enough time to get everything done and tested. If everyone wants to jump on, I'm more than open to that. I can try to explain what and how needs to be done. If you share your post and maybe someone reading this and want to help, reach out to me here, on Twitter, on Discord, or everywhere you see me and we can talk about it.
If someone stumbles upon this issue here is a manual way to run capacitor scripts as described in this medium post under solution number two. Side benefit is you also get live reload.
[https://medium.com/@oleksandr.k/how-to-run-ionic-capacitor-app-from-nx-monorerepo-in-live-reload-mode-ec894ed71c24](Link to medium post)
The capacitor plugin is doing the same thing under the hood using Nx plugin executors, which is definitely more of a streamlined solution. But one can manually access the nx:run-commands
executor by modifying project.json as explained in the article. Wiring up capacitor init, copy, sync, and build was pretty easy and you get to control which version of capacitor to use.
We are looking at using nx for splitting up a nextjs app that also has capacitor into 2 projects, but we are on the latest 4 of capacitor already there so can't really downgrade to 3 to get nx up and running.
Any pointers at what files to look at to get this working with the nxext plugins? Given the comments it seems there has not been a PR yet for any cap4 work, right?
FYI, we upgraded our project from capacitor 3 to 4 following the capacitor upgrade guide. You cannot use the capacitor CLI for the migration as it will not work in a Nx workspace. But if you follow all manual steps, everything is working flawlessly, at least for our project. Didn't take more than an hour to implement and verify everything.
as I've just created a new Nx workspace with a @nxext/ionic-angular
app that uses Capacitor 5, I think it's safe to close this issue...
🖖🏼