Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this component only in dev environments? #25

Closed
djozsef opened this issue May 16, 2022 · 1 comment
Closed

How to use this component only in dev environments? #25

djozsef opened this issue May 16, 2022 · 1 comment
Labels
Question Further information is requested

Comments

@djozsef
Copy link

djozsef commented May 16, 2022

Bug Report

The config provider of mezzio-tooling installed in development it causes problem during deployment since mezzio-tooling is a development dependency.

Q A
Version(s) ^2.1

Summary

Since mezzio-tooling is mostly a dev dependency when it gets installed configuration is injected into config/config.php via its ConfigProvider. Eg. creating a project the composer create-project mezzio/mezzio-skeleton <project-path> way. This injected config provider then gets committed into code and when deploying the project with composer install --no-dev the mezzio-tooling dependency is not installed since it is defined as development dependency.

Current behavior

Causes project deployments with composer install --no-dev build step to break, sinde \Mezzio\Tooling\ConfigProvider is not available.

How to reproduce

  1. Create a project with composer create-project mezzio/mezzio-skeleton <project-path>
  2. Commit code
  3. Checkout code
  4. Install dependencies with composer install --no-dev

Expected behavior

Not sure about this, how to resolve. The ConfigProvider in injected by laminas-component-installer at post-package-install. Need input on this.

@djozsef djozsef added the Bug Something isn't working label May 16, 2022
@boesing
Copy link
Member

boesing commented May 16, 2022

This is not related to this component directly.

Its all about how you setup your project. But I can give you a quick glance what causes this problem:

  • usually, laminas-component-installer is suggested to be installed in projects as dev-dependency
  • the component installer asks the developer (in case a new or unregistered component is being detected) during composer install where to install the component (either dev or non-dev components)
  • this feature is not available for mezzio projects as they do only have config.php and thus the components are all installed within config.php

So what is missing here, is a feature in the mezzio-skeleton, the documentation, the component-installer, etc. to provide non-production components.


I would first see how to implement that feature in the component-installer to agree on a naming schema.
For example: laminas-mvc uses modules.config.php for a list of production modules (components) and an array in development.config.php (which is dynamically loaded using the laminas-development-mode component).

In mezzio, we have config.php (and there can also be some logic regarding the laminas-development-mode component as it is not MVC specific). But the development.config.php for mezzio projects does not contain another ConfigAggregator as of now (see https://github.com/mezzio/mezzio-skeleton/blob/3.12.x/config/development.config.php.dist).

So we could probably agree on the same format in the development.config.php.dist as in the config.php.
This would make things easier for the regex parsing in the component-installer and thus, not too much stuff has to be done.

Feel free to send feature requests to the mezzio skeleton application.
Afterwards, either you provide a patch against the necessary projects or someone else might take over and implements it.


To make it work as of now:

  • use the laminas-development-mode component
  • create config/development.config.php.dist
  • copy & paste the contents of config/config.php to it
  • remove all config providers you already have in your config/config.php
  • add the config providers you only want to load in development
  • remove all post processors from the config aggregator construct
  • remove the cache directory from the config aggregator construct

(Disclaimer: This is all just written down without too many research)

@boesing boesing closed this as completed May 16, 2022
@boesing boesing added Question Further information is requested and removed Bug Something isn't working labels May 16, 2022
@boesing boesing changed the title --no-dev install problem How to use this component only in dev environments? May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants