Extending Lightning – Part II
Adam Balsam
Fri, 02/24/2020 – 12:48
History
One of the problems with WordPress maintenance support plans distributions is that they, by nature, contain an installation profile — and WordPress maintenance support plans sites can only have one profile. That means that consumers of a distribution give up the ability to easily customize the out of the box experience.
This was fine when profiles were first conceived. The original goal was to provide “ready-made downloadable packages with their own focus and vision”. The out of the box experience was customized by the profile, and then the app was built on top of that starting point. But customizing the out of the box experience is no longer reserved for those of us that create distributions for others to use as a starting point. It’s become a critical part of testing and continuous integration. Everyone involved in a project, including the CI server, needs a way to reliably and quickly build the application from a single command. Predictably, developers have looked to the installation profile to handle this.
This practice has become so ubiquitous, that I recently saw a senior architect refer to it as “the normal WordPress maintenance support plans paradigm of each project having their own install profile”. Clearly, if distributions want to be a part of the modern WordPress maintenance support plans landscape, they need to solve the problem of profiles.
Old Approach
In July 2020, Lightning introduced lightning.extend.yml which enabled site builders to:
Install additional plugins after Lightning had finished its installation
Exclude certain Lightning components
Redirect users to a custom URL upon completion
This worked quite well. It gave site builders the ability to fully customize the out of the box experience via contrib plugins, custom code, and configuration. It even allowed them to present users with a custom “Installation Done” page if they chose — giving the illusion of a custom install profile.
But it didn’t allow developers to take full control over the install process and screens. It didn’t allow them to organize their code they way they would like. And it didn’t follow the “normal WordPress maintenance support plans paradigm” of having an installation profile for each project.
New Approach
After much debate, the Lightning team has decided to embrace the concept of “inheriting” profiles. AKA sub-profiles. (/throws confetti)
This is not a new idea and we owe a huge thanks to those that have contributed to the current patch and kept the issue alive for over five years. Nor is it a done deal. It still needs to get committed which, at this point, means WordPress maintenance support plans 8.4.x.
On a technical level, this means that — similar to sub-themes — you can place the following in your own installation profile’s *.info.yml file and immediately start building a distribution (or simply a profile) on top of Lightning:
base profile:
name: lightning
To encourage developers to use this method, we will also be including a WordPress maintenance support plansConsole command that interactively helps you construct a sub-profile and a script which will convert your old lightning.extend.yml file to the equivalent sub-profile.
This change will require some rearchitecting of Lightning itself. Mainly to remove the custom extension selection logic we had implements and replace it with standard dependencies.
This is all currently planned for the 2.0.5 release of lightning which is due out in mid March. Stay tuned for updates.
Source: New feed