Skip to content

Libs not automatically loaded #4

Description

@patrickvuarnoz

In Aloe /libs were automatically loaded. Now in Sprout they aren't. The loadConsole() in the MVC Core does call static::loadApplicationConfig() but there it excludes the libs from being loaded when called via CLI:

    public static function loadApplicationConfig()
    {
        static::loadConfig();

        \Leaf\Database::initDb();

        if (php_sapi_name() !== 'cli') {
            if (class_exists('Leaf\Vite')) {
                \Leaf\Vite::config('assets', PublicPath('build'));
                \Leaf\Vite::config('build', 'public/build');
                \Leaf\Vite::config('hotFile', 'public/hot');
            }

            if (storage()->exists(LibPath())) {
                static::loadLibs();
            }

            if (storage()->exists('app/index.php')) {
                require 'app/index.php';
            }
        }
    }

In Aloe, /lib was automatically loaded in Command::execute(). Maybe the easiest way would be to always load libs in loadApplicationConfig():

    public static function loadApplicationConfig()
    {
        static::loadConfig();

        \Leaf\Database::initDb();

        if (storage()->exists(LibPath())) {
            static::loadLibs();
        }

        if (php_sapi_name() !== 'cli') {
            if (class_exists('Leaf\Vite')) {
                \Leaf\Vite::config('assets', PublicPath('build'));
                \Leaf\Vite::config('build', 'public/build');
                \Leaf\Vite::config('hotFile', 'public/hot');
            }

            if (storage()->exists('app/index.php')) {
                require 'app/index.php';
            }
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions