Passer au contenu principal

· 8 minutes de lecture
Lea Anthony

C'est là!

Today marks the release of Wails v2. It's been about 18 months since the first v2 alpha and about a year from the first beta release. I'm truly grateful to everyone involved in the evolution of the project.

Part of the reason it took that long was due to wanting to get to some definition of completeness before officially calling it v2. The truth is, there's never a perfect time to tag a release - there's always outstanding issues or "just one more" feature to squeeze in. What tagging an imperfect major release does do, however, is to provide a bit of stability for users of the project, as well as a bit of a reset for the developers.

This release is more than I'd ever expected it to be. I hope it gives you as much pleasure as it has given us to develop it.

Qu'est-ce Wails?

If you are unfamiliar with Wails, it is a project that enables Go programmers to provide rich frontends for their Go programs using familiar web technologies. It's a lightweight, Go alternative to Electron. Much more information can be found on the official site.

Quelles sont les nouveautés ?

The v2 release is a huge leap forward for the project, addressing many of the pain points of v1. If you have not read any of the blog posts on the Beta releases for macOS, Windows or Linux, then I encourage you to do so as it covers all the major changes in more detail. In summary:

  • Webview2 component for Windows that supports modern web standards and debugging capabilities.
  • Dark / Light theme + custom theming on Windows.
  • Windows now has no CGO requirements.
  • Out-of-the-box support for Svelte, Vue, React, Preact, Lit & Vanilla project templates.
  • Vite integration providing a hot-reload development environment for your application.
  • Native application menus and dialogs.
  • Native window translucency effects for Windows and macOS. Support for Mica & Acrylic backdrops.
  • Easily generate an NSIS installer for Windows deployments.
  • A rich runtime library providing utility methods for window manipulation, eventing, dialogs, menus and logging.
  • Support for obfuscating your application using garble.
  • Support for compressing your application using UPX.
  • Automatic TypeScript generation of Go structs. More info here.
  • No extra libraries or DLLs are required to be shipped with your application. For any platform.
  • No requirement to bundle frontend assets. Just develop your application like any other web application.

Crédits & Remerciements

Getting to v2 has been a huge effort. There have been ~2.2K commits by 89 contributors between the initial alpha and the release today, and many, many more that have provided translations, testing, feedback and help on the discussion forums as well as the issue tracker. I'm so unbelievably grateful to each one of you. I'd also like to give an extra special thank you to all the project sponsors who have provided guidance, advice and feedback. Everything you do is hugely appreciated.

There are a few people I'd like to give special mention to:

Firstly, a huge thank you to @stffabi who has provided so many contributions which we all benefit from, as well as providing a lot of support on many issues. He has provided some key features such as the external dev server support which transformed our dev mode offering by allowing us to hook into Vite's superpowers. It's fair to say that Wails v2 would be a far less exciting release without his incredible contributions. Thank you so much @stffabi!

I'd also like to give a huge shout-out to @misitebao who has tirelessly been maintaining the website, as well as providing Chinese translations, managing Crowdin and helping new translators get up to speed. This is a hugely important task, and I'm extremely grateful for all the time and effort put into this! You rock!

Last, but not least, a huge thank you to Mat Ryer who has provided advice and support during the development of v2. Writing xBar together using an early Alpha of v2 was helpful in shaping the direction of v2, as well as give me an understanding of some design flaws in the early releases. I'm happy to announce that as of today, we will start to port xBar to Wails v2, and it will become the flagship application for the project. Cheers Mat!

Leçons apprises

There are a number of lessons learnt in getting to v2 that will shape development moving forward.

Des versions plus petites, plus rapides et cibl√©es‚Äč

In the course of developing v2, there were many features and bug fixes that were developed on an ad-hoc basis. This led to longer release cycles and were harder to debug. Moving forward, we are going to create releases more often that will include a reduced number of features. A release will involve updates to documentation as well as thorough testing. Hopefully, these smaller, quicker, focussed releases will lead to fewer regressions and better quality documentation.

Encourager l'engagement‚Äč

When starting this project, I wanted to immediately help everyone who had a problem. Issues were "personal" and I wanted them resolved as quickly as possible. This is unsustainable and ultimately works against the longevity of the project. Moving forward, I will be giving more space for people to get involved in answering questions and triaging issues. It would be good to get some tooling to help with this so if you have any suggestions, please join in the discussion here.

Apprendre √† dire non‚Äč

The more people that engage with an Open Source project, the more requests there will be for additional features that may or may not be useful to the majority of people. These features will take an initial amount of time to develop and debug, and incur an ongoing maintenance cost from that point on. I myself am the most guilty of this, often wanting to "boil the sea" rather than provide the minimum viable feature. Moving forward, we will need to say "No" a bit more to adding core features and focus our energies on a way to empower developers to provide that functionality themselves. We are looking seriously into plugins for this scenario. This will allow anyone to extend the project as they see fit, as well as providing an easy way to contribute towards the project.

Un regard tourné vers l'avenir

There are so many core features we are looking at to add to Wails in the next major development cycle already. The roadmap is full of interesting ideas, and I'm keen to start work on them. One of the big asks has been for multiple window support. It's a tricky one and to do it right, and we may need to look at providing an alternative API, as the current one was not designed with this in mind. Based on some preliminary ideas and feedback, I think you'll like where we're looking to go with it.

I'm personally very excited at the prospect of getting Wails apps running on mobile. We already have a demo project showing that it is possible to run a Wails app on Android, so I'm really keen to explore where we can go with this!

A final point I'd like to raise is that of feature parity. It has long been a core principle that we wouldn't add anything to the project without there being full cross-platform support for it. Whilst this has proven to be (mainly) achievable so far, it has really held the project back in releasing new features. Moving forward, we will be adopting a slightly different approach: any new feature that cannot be immediately released for all platforms will be released under an experimental configuration or API. This allows early adopters on certain platforms to try the feature and provide feedback that will feed into the final design of the feature. This, of course, means that there are no guarantees of API stability until it is fully supported by all the platforms it can be supported on, but at least it will unblock development.

Derniers Mots

I'm really proud of what we've been able to achieve with the V2 release. It's amazing to see what people have already been able to build using the beta releases so far. Quality applications like Varly, Surge and October. I encourage you to check them out.

This release was achieved through the hard work of many contributors. Whilst it is free to download and use, it has not come about through zero cost. Make no mistakes, this project has come at considerable cost. It has not only been my time and the time of each and every contributor, but also the cost of absence from friends and families of each of those people too. That's why I'm extremely grateful for every second that has been dedicated to making this project happen. The more contributors we have, the more this effort can be spread out and the more we can achieve together. I'd like to encourage you all to pick one thing that you can contribute, whether it is confirming someone's bug, suggesting a fix, making a documentation change or helping out someone who needs it. All of these small things have such a huge impact! It would be so awesome if you too were part of the story in getting to v3.

Profitez bien!

‚Äź Lea

PS : Si vous ou votre entreprise trouvez Wails utile, veuillez envisager de parrainer le projet. Merci !

· 5 minutes de lecture
Lea Anthony

I'm pleased to finally announce that Wails v2 is now in beta for Linux! It is somewhat ironic that the very first experiments with v2 was on Linux and yet it has ended up as the last release. That being said, the v2 we have today is very different from those first experiments. So without further ado, let's go over the new features:

New Features‚Äč


There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.

There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.

No requirement to bundle assets‚Äč

A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an <img> tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.

Wow, that sounds like a webserver...

Yes, it works just like a webserver, except it isn't.

So how do I include my assets?

You just pass a single embed.FS that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.

New Development Experience‚Äč

Now that assets don't need to be bundled, it's enabled a whole new development experience. The new wails dev command will build and run your application, but instead of using the assets in the embed.FS, it loads them directly from disk.

It also provides the additional features:

  • Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
  • Auto rebuild - Any changes to your Go code will rebuild and relaunch your application

In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.

In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.

In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!

Remote Templates‚Äč


Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.

With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!

Cross Compilation to Windows‚Äč

Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.


In Conclusion‚Äč

As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the v2 Beta discussion board.

Linux is hard to support. We expect there to be a number of quirks with the beta. Please help us to help you by filing detailed bug reports!

Finally, I'd like to give a special thank you to all the project sponsors whose support drive the project in many ways behind the scenes.

I look forward to seeing what people build with Wails in this next exciting phase of the project!

Lea.

PS: The v2 release isn't far off now!

PPS: If you or your company find Wails useful, please consider sponsoring the project. Thanks!

· 6 minutes de lecture
Lea Anthony

Today marks the first beta release of Wails v2 for Mac! It's taken quite a while to get to this point and I'm hoping that today's release will give you something that's reasonably useful. There have been a number of twists and turns to get to this point and I'm hoping, with your help, to iron out the crinkles and get the Mac port polished for the final v2 release.

You mean this isn't ready for production? For your use case, it may well be ready, but there are still a number of known issues so keep your eye on this project board and if you would like to contribute, you'd be very welcome!

So what's new for Wails v2 for Mac vs v1? Hint: It's pretty similar to the Windows Beta ūüėČ

New Features‚Äč


There were a lot of requests for native menu support. Wails has finally got you covered. Application menus are now available and include support for most native menu features. This includes standard menu items, checkboxes, radio groups, submenus and separators.

There were a huge number of requests in v1 for the ability to have greater control of the window itself. I'm happy to announce that there's new runtime APIs specifically for this. It's feature-rich and supports multi-monitor configurations. There is also an improved dialogs API: Now, you can have modern, native dialogs with rich configuration to cater for all your dialog needs.

Mac Specific Options‚Äč

In addition to the normal application options, Wails v2 for Mac also brings some Mac extras:

  • Make your window all funky and translucent, like all the pretty swift apps!
  • Highly customisable titlebar
  • We support the NSAppearance options for the application
  • Simple config to auto-create an "About" menu

No requirement to bundle assets‚Äč

A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an <img> tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.

Wow, that sounds like a webserver...

Yes, it works just like a webserver, except it isn't.

So how do I include my assets?

You just pass a single embed.FS that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.

New Development Experience‚Äč

Now that assets don't need to be bundled, it's enabled a whole new development experience. The new wails dev command will build and run your application, but instead of using the assets in the embed.FS, it loads them directly from disk.

It also provides the additional features:

  • Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
  • Auto rebuild - Any changes to your Go code will rebuild and relaunch your application

In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.

In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.

In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!

Remote Templates‚Äč


Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.

With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!

Native M1 Support‚Äč

Thanks to the amazing support of Mat Ryer, the Wails project now supports M1 native builds:


You can also specify darwin/amd64 as a target too:


Oh, I almost forgot.... you can also do darwin/universal.... ūüėČ


Cross Compilation to Windows‚Äč

Because Wails v2 for Windows is pure Go, you can target Windows builds without docker.


WKWebView Renderer‚Äč

V1 relied on a (now deprecated) WebView component. V2 uses the most recent WKWebKit component so expect the latest and greatest from Apple.

In Conclusion‚Äč

As I'd said in the Windows release notes, Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome! Please direct any feedback to the v2 Beta discussion board.

And finally, I'd like to give a special thank you to all the project sponsors, including JetBrains, whose support drive the project in many ways behind the scenes.

I look forward to seeing what people build with Wails in this next exciting phase of the project!

Lea.

PS: Linux users, you're next!

PPS: If you or your company find Wails useful, please consider sponsoring the project. Thanks!

· 9 minutes de lecture
Lea Anthony

Quand j'ai annonc√© Wails pour la premi√®re fois sur Reddit, il y a deux ans depuis un train √† Sydney, je n'esp√©rais pas autant d'attention. Quelques jours plus tard, un tech vlogger populaire a publi√© un tutoriel vid√©o, a effectu√© une revue positive et √† partir de √ßa, l'int√©r√™t du projet n'a fait que cro√ģtre.

Il était clair que des gens étaient excités au fait de pouvoir ajouter des frontends web à leurs projets en Go, et presque immédiatement ça a poussé le projet bien plus loin que la preuve de concept que j'avais créé. A ce moment, Wails utilisait le projet webview pour gérer le frontend, et la seule option pour Windows était le moteur de rendu IE11. Beaucoup de bugs ont été ouverts à cause de cette limitation : support faible du JavaScript/CSS et accès à aucun outil de développement pour le déboguer. C'était une expérience de développement frustrante, mais il n'y avait pas grand-chose qui pouvait être fait pour le rectifier.

Durant un long moment, je croyais fermement que Microsoft allait devoir faire quelque chose pour améliorer la situation de leur navigateur. Le monde avançait, le développement frontend était en plein boom, mais IE n'était pas à la hauteur. Lorsque Microsoft a annoncé le passage à l'utilisation de Chromium comme nouvelle base pour leur navigateur, je savais que ce n'était qu'une question de de temps avant que Wails ne puisse l'utiliser, et que l'expérience du développeur Windows ne passe au niveau supérieur.

Aujourd'hui, j'ai le plaisir d'annoncer : Wails v2 Beta pour Windows! Il y a énormément de stock dans cette version, donc attrape une boisson, prend un siège et nous allons commencer...

Pas de d√©pendance CGO !‚Äč

Non, je ne plaisante pas : Pas de d√©pendance CGO ūü§Į! La chose √† propos de Windows est que, contrairement √† MacOS et Linux, il n'est pas livr√© avec un compilateur par d√©faut. De plus, CGO a besoin d'un compilateur mingw et il y a une tonne d'options d'installation diff√©rentes. La suppression de CGO comme pr√©requis a simplifi√© consid√©rablement la configuration et facilite grandement le d√©bogage. Pendant que j'ai fait un effort raisonnable pour que cela fonctionne, la majorit√© du cr√©dit devrait aller √† John Chadwick pour non seulement d√©marrer quelques projets pour rendre ceci possible, mais aussi √™tre ouvert √† quelqu'un qui prend ces projets et qui en cr√©e d'autres √† partir des siens. Cr√©dit √©galement √† Tad Vizbaras dont le projet winc m'a lanc√© dans cette direction.

Moteur de rendu WebView2 Chromium‚Äč


Enfin, les développeurs de Windows obtiennent un moteur de rendu de première classe pour leurs applications ! Les jours à tordre votre code frontend pour le faire fonctionner sur Windows sont terminés. En plus de cela, vous obtenez une expérience avec des outils de développement de première classe !

Le composant WebView2 a toutefois besoin d'avoir le WebView2Loader.dll de présent avec le binaire. Cela rend la distribution juste un peu plus douloureuse que ce à quoi nous sommes habitués. Toutes les solutions et bibliothèques (que je connais) qui utilisent WebView2 ont cette dépendance.

Cependant, je suis vraiment heureuse d'annoncer que les applications Wails n'ont pas de telles exigences! Merci √† la sorcellerie de John Chadwick, gr√Ęce √† qui nous sommes en mesure de regrouper cette dll √† l'int√©rieur du binaire et d'obtenir que Windows la charge comme si elle √©tait pr√©sente sur le disque.

Les Gophers se réjouissent! Le rêve d'un binaire unique vit !

Nouvelles fonctionnalit√©s‚Äč


Il y avait beaucoup de demandes pour le support des menus natifs. Wails a enfin ce qu'il vous faut. Les menus des applications sont maintenant disponibles et incluent la prise en charge de la plupart des fonctions natives de menu. Cela inclut les éléments de menu standard, les cases à cocher, les groupes radio, les sous-menus et les séparateurs.

Il y avait un grand nombre de demandes dans la v1 pour avoir un plus grand contr√īle de la fen√™tre elle-m√™me. Je suis heureux d'annoncer qu'il y a de nouvelles API runtime sp√©cifiquement pour cela. Il est riche en fonctionnalit√©s et supporte les configurations multi-moniteurs. Il y a aussi une API de boite de dialogues am√©lior√©e : maintenant, vous pouvez avoir des boites de dialogues modernes et natives avec une configuration enrichie pour r√©pondre √† tous vos besoins.

There is now the option to generate IDE configuration along with your project. This means that if you open your project in a supported IDE, it will already be configured for building and debugging your application. Currently VSCode is supported but we hope to support other IDEs such as Goland soon.


No requirement to bundle assets‚Äč

A huge pain-point of v1 was the need to condense your entire application down to single JS & CSS files. I'm happy to announce that for v2, there is no requirement to bundle assets, in any way, shape or form. Want to load a local image? Use an <img> tag with a local src path. Want to use a cool font? Copy it in and add the path to it in your CSS.

Wow, that sounds like a webserver...

Yes, it works just like a webserver, except it isn't.

So how do I include my assets?

You just pass a single embed.FS that contains all your assets into your application configuration. They don't even need to be in the top directory - Wails will just work it out for you.

Nouvelle exp√©rience de d√©veloppement‚Äč


Now that assets don't need to be bundled, it's enabled a whole new development experience. The new wails dev command will build and run your application, but instead of using the assets in the embed.FS, it loads them directly from disk.

It also provides the additional features:

  • Hot reload - Any changes to frontend assets will trigger and auto reload of the application frontend
  • Auto rebuild - Any changes to your Go code will rebuild and relaunch your application

In addition to this, a webserver will start on port 34115. This will serve your application to any browser that connects to it. All connected web browsers will respond to system events like hot reload on asset change.

In Go, we are used to dealing with structs in our applications. It's often useful to send structs to our frontend and use them as state in our application. In v1, this was a very manual process and a bit of a burden on the developer. I'm happy to announce that in v2, any application run in dev mode will automatically generate TypeScript models for all structs that are input or output parameters to bound methods. This enables seamless interchange of data models between the two worlds.

In addition to this, another JS module is dynamically generated wrapping all your bound methods. This provides JSDoc for your methods, providing code completion and hinting in your IDE. It's really cool when you get data models auto-imported when hitting tab in an auto-generated module wrapping your Go code!

Remote Templates‚Äč


Getting an application up and running quickly was always a key goal for the Wails project. When we launched, we tried to cover a lot of the modern frameworks at the time: react, vue and angular. The world of frontend development is very opinionated, fast moving and hard to keep on top of! As a result, we found our base templates getting out of date pretty quickly and this caused a maintenance headache. It also meant that we didn't have cool modern templates for the latest and greatest tech stacks.

With v2, I wanted to empower the community by giving you the ability to create and host templates yourselves, rather than rely on the Wails project. So now you can create projects using community supported templates! I hope this will inspire developers to create a vibrant ecosystem of project templates. I'm really quite excited about what our developer community can create!

En conclusion‚Äč

Wails v2 represents a new foundation for the project. The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release. Your input would be most welcome. Please direct any feedback to the v2 Beta discussion board.

There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions that needed changing, and partly because some core problems we had spent time building workarounds for were fixed upstream: Go’s embed feature is a good example. Fortunately, everything came together at the right time, and today we have the very best solution that we can have. I believe the wait has been worth it - this would not have been possible even 2 months ago.

J'ai √©galement besoin de remercier √©norm√©ment les personnes suivantes ūüôŹ parce que sans elles, cette version n'existerait tout simplement pas:

  • Misite Bao - Un bourreau de travail absolu sur les traductions chinoises et un chercheur de bugs incroyable.
  • John Chadwick - Pour son travail incroyable sur go-webview2 et go-winloader qui a permis aujourd'hui d'avoir une version Windows.
  • Tad Vizbaras - Exp√©rimenter avec son projet winc a √©t√© le premier pas vers un pur Wails en Go.
  • Mat Ryer - Son soutien, ses encouragements et ses commentaires ont vraiment contribu√© √† faire avancer le projet.

Enfin, je voudrais remercier tout particulièrement tous les sponsors du projet, y compris JetBrains, dont le soutien anime le projet de plusieurs manières en coulisses.

J'ai h√Ęte de voir ce que les gens construisent avec Wails dans cette prochaine phase excitante du projet!

Lea.

PS: Les utilisateurs de MacOS et de Linux n'ont pas besoin de se sentir laiss√©s de c√īt√©. Le portage vers ces OS est en cours et la majeure partie du travail a d√©j√† √©t√© faite. Tenez bon !

PPS : Si vous ou votre entreprise trouvez Wails utile, veuillez envisager de parrainer le projet. Merci !