yawik/standard

using zf component installer

Opened this issue · 6 comments

TiSiE commented

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 commented

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 commented

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 commented

@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 commented

@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 commented

@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 commented

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