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

using zf component installer #3

Open
TiSiE opened this issue Nov 9, 2018 · 6 comments
Open

using zf component installer #3

TiSiE opened this issue Nov 9, 2018 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@TiSiE
Copy link
Member

TiSiE commented Nov 9, 2018

yawik/standard should require the zendframework/zend-component-installer ^2.0

That will enhance / simplify the following:

  • Installing additional modules
    currently, you have to manually edit the modules.config.php or create a name.module.config.php file in the config/autoload folder to activate the module after installing. Using the component installer will inject the module automatically in the modules.config.php, which leads directly to the next point....

  • Assets installation will include a newly installed module
    currently, as the module is not injected, the install assets command run will not know nothing about the new module, so you have to manually run the command after you added the module to the configuration.

  • Core\Application
    Currently, there are three sources where the list of modules to load is merged from:

    • config/modules.php
    • Core\Application::getRequiredModules()
    • any name.module.config.php file in config/autoload via Core\Application::scanAdditionalModules()

    When relying on the component installer, the methods getRequiredModules(), scanAdditionalModules() and generateModuleConfiguration() will be obsolete.


I know, the component installer will display prompts during the installation which is generally bad for automatic build processes - but luckily that can be circumvented by using the no-interactions flag of composer.

@kilip
Copy link
Member

kilip commented Nov 12, 2018

Assets installation will include a newly installed module currently, as the module is not injected, the install assets command run will not know nothing about the new module, so you have to manually run the command after you added the module to the configuration.

Looks like a better way to do this assets is by creating a Composer Plugin. What do you think @TiSiE do you want to add this Composer plugin in Install module, or should we create a new package for this Composer plugin?

@TiSiE
Copy link
Member Author

TiSiE commented Nov 12, 2018

I don't get what you mean. Replace the yawik assets-install command? And how will a plugin work? I'm a little confused at the moment...

@kilip
Copy link
Member

kilip commented Nov 12, 2018

@TiSiE right now assets-install command only detect injected modules in modules.config.php. So it can not detect Yawik modules that are available but not injected yet.

The best way to detect this non injected yawik modules is by creating a composer plugin which can detect type: yawik-module in composer.json

We can use existing code, and create composer plugin that can use that code.

I forget that we can not use existing modules for this plugin. Composer only register plugin that have type: composer-plugin in composer.json. so we need create a new repo: yawik/composer

@kilip
Copy link
Member

kilip commented Nov 13, 2018

@TiSiE I have created new repo: yawik/composer-plugin, and it's already integrated into yawik/standard:
https://travis-ci.org/yawik/standard/jobs/454337856#L1513

This module will install/uninstall assets automatically during composer command, just like zend-component-installer. Unit tests for this plugin still required, I will working on that later.

@TiSiE
Copy link
Member Author

TiSiE commented Nov 13, 2018

@kilip
Yes, I got it now. And the plugin works fine.

But the 'npm install' command is removed from the '@auto-scripts'. Without this command, there will be no public/dist directory

@kilip
Copy link
Member

kilip commented Nov 13, 2018

Yes, i accidentally remove that npm command. I will fix that in my next push

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants