pattern-lab / patternlab-php-core

This repository provides the core functionality for Pattern Lab. It is meant to be used from within an Edition with a PatternEngine and StarterKit.
http://patternlab.io/
MIT License
43 stars 62 forks source link

Decouple editions from core #155

Open aleksip opened 7 years ago

aleksip commented 7 years ago

Moved from #154:

Drop all code from all the different edition repos, decoupling them from patternlab-php-core.

Currently all editions have identical code for the console launcher, server router and Composer scripts. They are hard to maintain, especially if we want to be able to make changes required by #154. Without this code, the editions would basically consist of a single composer.json file. How could that not be nice! :)

The launcher and and router should be easy to move to patternlab-php-core, but moving out the Composer script code is a bit trickier. Moving it to core causes ugly looking Composer warnings when the first dependencies are installed, because the script code is not yet available to Composer.

However, I thought I had a great idea to move that code to a new Composer plugin ("pattern-lab/composer-plugin"). And it seems that it would work just fine, if not for a possible Composer bug. I opened an issue (composer/composer#6803) about it, let's see what happens. One especially nice thing about using a Composer plugin would be not having to have all those script entries in composer.json, making the single composer.json files even more zen-like!

Update:

I have now pushed feature/decoupled-core branches to edition-php-twig-development and patternlab-php-core. Seems to work nicely!

The new Composer plugin is under my GitHub account until a repo is created under the PL organization. I don't have privileges to do that, and maybe also best to wait until learn more about the Composer issue. That is, the plugin currently only works with Composer < 1.5.0.

aleksip commented 6 years ago

@EvanLovely @sghoweri It seems that the development edition inline alias for core was causing the problem with Composer, and adding an alias for the plugin fixed it. Could you verify if feature/decoupled-core works for you? And if you have the possibility to test on Windows that would be great too.

aleksip commented 6 years ago

Oh well, looks like adding an alias for the plugin didn't fix it after all. Only removing the alias for core seems to work. So it seems that this is a problem only for the development editions with the new alias model. Let's see if this new info helps the Composer folks to identify the cause.

aleksip commented 6 years ago

I've now managed to work around the Composer issue by (temporarily) removing the core version constraint from the plugin. Now the plugin seems to work with "pattern-lab/core": "dev-feature/decoupled-core as 2.8.11" in the development edition's composer.json!