richardmiller-zz / BehatSpec

Extensions to integrate Behat and PhpSpec
MIT License
51 stars 6 forks source link

Switch BehatSpec to monorepo #8

Closed pocky closed 7 years ago

pocky commented 7 years ago

Hello,

This PR is the first step to monorepo for BehatSpec and related to #5 . This PR does not provide any new feature except the monorepo structure and namespaces update for BehatSpec (now know as BehatSpecExtension).

Next steps (I think... This is my first time :D):

Then, merge needed code for PhpSpec 3 compatiblity, update composer.json and tag it as 0.6 (or 1.0?).

I have duplicated all files in BehatSpec to src/Extension/BehatSpecExtension including doc but I am not sure it's a good idea. I think BehatSpecExtension does not need documention with monorepo. What's your opinion?

Again, this is my first time with monorepo so... Hope I don't make any mistake. Test project could be find here.

pocky commented 7 years ago

Based on my issues, we should add some tests before 1.0 💃

richardmiller-zz commented 7 years ago

@pocky Thank you for sorting this! I'll take a look a proper look at it this week.

richardmiller-zz commented 7 years ago

So is the idea that this repo is used for all the code and that each other repo can be updated from this with the individual extensions?

The current contents on this repo then goes into BehatSpecExtension when published as a separate repo?

Can all this be done without breaking any existing installs? Particularly thinking of needing to change this package to point at a new repo for some releases only.

pocky commented 7 years ago

So is the idea that this repo is used for all the code and that each other repo can be updated from this with the individual extensions?

One main repository with many sub-repositories for users who don't care about the main one (like symfony/symfony and components). Monorepo will represent "more" work for us because we need to split the main repo with a tool like splitsh/lite but it's not big deal.

The current contents on this repo then goes into BehatSpecExtension when published as a separate repo?

Yep, because of many users use rmiller/behat-spec, this repository will be the main one and existing code will need a new one (will be simpler for us and subsplit)

Can all this be done without breaking any existing installs? Particularly thinking of needing to change this package to point at a new repo for some releases only.

Yes and no because BehatSpec is not stable so ~0.3 will be updated to ~0.4 and ~0.5... But we can fix this with our dependencies (phspec ~2.0 for current and 0.4 and 0.5, phpspec ~3.0 for 0.6) and composer will fail because of dependencies constraint. We can also fix this in the "last phpspec ~2.0" version in our composer.json with semver:

"require": {
        "php": ">=5.4",
        "rmiller/error-extension": "~0.5.0",
        "rmiller/phpspec-extension": "~0.5.0",
        "rmiller/exemplify-extension": "~0.5.0",
        "rmiller/phpspec-run-extension": "~0.5.0"
}

instead of:

"require": {
        "php": ">=5.4",
        "rmiller/error-extension": "~0.5",
        "rmiller/phpspec-extension": "~0.5",
        "rmiller/exemplify-extension": "~0.5",
        "rmiller/phpspec-run-extension": "~0.5"
}

https://getcomposer.org/doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md - For example instead of using >=3.4 you should use ~3.4 which allows all versions up to 3.999 but does not include 4.0 and above.

I currently use my fork with custom repository (one with phpspec 2 and one with phpspec 3) and it's cool. To be honest, I'm not 100% sure how it's going to happen. I would like to have the opinion of another persons before beginning the transition.

Hope that I am quite clear and you will understand my explanation despite my lack in English.

richardmiller-zz commented 7 years ago

Thank you, I think I understand it all now.

This might help with the maintenance of the individual repos - https://www.subtreesplit.com/

richardmiller-zz commented 7 years ago

I've not been through this process before so I'm still not sure if there is anything we are missing. @ciaranmcnulty do you have any input it to this?

richardmiller-zz commented 7 years ago

I'm happy to merge this in the absence of any of any other feedback. Ok with you @pocky?

pocky commented 7 years ago

@richardmiller 👍