appium / appium-inspector

A GUI inspector for mobile apps and more, powered by a (separately installed) Appium server
https://appium.github.io/appium-inspector/
Other
1.06k stars 276 forks source link

chore: replace Parcel with Vite #1453

Closed eglitise closed 3 days ago

eglitise commented 2 months ago

Parcel v1 is greatly outdated and is holding back many important dependency upgrades, like Electron and antd. Several possible replacements for it exist (Parcel v2, Webpack, Vite, etc.), which were examined and tested on a fresh Electron+React project. Vite seemed to be the most viable candidate, though, like the others, it also requires some refactoring beforehand. This issue will be used to track the migration progress.

Related tasks:

eglitise commented 2 months ago

@idebenone about electron-vite: I checked it out, though I'm currently working with the other electron-vite (it's kinda odd how there's two of them). I've managed to get the Inspector's web version working, so now the issue is only with the Electron version. Right now I see two main problems: clear separation of main and renderer process code (see the configs and shared folders), and conditional use of browser or Electron polyfills (not really sure of the best practices here). Ideally, both problems should be resolved with the current Parcel v1, so that the changes are separated from the actual Vite migration PR.

idebenone commented 2 months ago

@eglitise This is officially supported by vite, even I was confused when I saw two different electron-vite.

eglitise commented 2 months ago

The reason why I used the other electron-vite is because the officially supported version reuses Vite's default config file (vite.config.js), whereas the unofficial one has its own file (electron.vite.config.js). What this means is I can use one config file to build the Inspector's browser version, and the other to build the Electron version. I don't know if it's possible to build both formats using the same config file - but if yes, that could be the way forward.

idebenone commented 2 months ago

Could you please share the vite and electron-vite configuration?

eglitise commented 2 months ago

I've been working on it in a separate branch of my fork: https://github.com/eglitise/appium-inspector/tree/move-to-vite

idebenone commented 2 months ago

I tried out with latest Electron version. Still there are errors but I think its a good progress in my opinion.

You could take a look here, https://github.com/idebenone/appium-inspector/tree/vite-electron-migrate

eglitise commented 2 months ago

Awesome, thank you 🙏 does it also work without bumping Electron? We use spectron for running integration tests, and its current version is tied to Electron 13. They can be bumped together after the migration. (Arguably spectron is also deprecated, so another solution will be needed for Electron 17+)

idebenone commented 2 months ago

Here you go electron 13.6.9 https://github.com/idebenone/appium-inspector/tree/vite-migrate

Issues:

I haven't tested out the remaining functionalities, but the electron app is running normally.

eglitise commented 2 months ago

Thanks, I also updated my branch based on your changes. ipcRenderer seems to be working fine if building for CJS, and I also adjusted the i18next asset paths, so the translations are loaded. Currently there's still the following issues: