Search code examples
phpcomposer-phpsilverstripesilverstripe-4

Composer vendor expose copy not picking up the correct name for my silverstrip module


I am creating a module for silverstripe and I want to expose my assets so I can use images, css and js.

composer of silverstripe module

{
    "name": "poptin/silverstripe",
    "description": "A skeleton for SilverStripe modules.",
    "type": "silverstripe-vendormodule",
    "keywords": [
        "silverstripe",
        "CMS"
    ],
    "license": "BSD-3-Clause",
    "require": {
        "silverstripe/framework": "^4.0",
        "silverstripe/admin": "^1.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^5.7",
        "squizlabs/php_codesniffer": "^3.0"
    },
    "autoload": {
        "psr-4": {
            "Poptin\\SilverStripe\\": "src/",
            "Poptin\\SilverStripe\\Tests\\": "tests/"
        }
    },
    "extra": {
        "expose": [
            "client/dist"
        ]
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

composer of silverstripe

{
    "name": "silverstripe/installer",
    "type": "silverstripe-recipe",
    "description": "The SilverStripe Framework Installer",
    "require": {
        "php": ">=7.1.0",
        "silverstripe/recipe-plugin": "^1.2",
        "silverstripe/recipe-cms": "4.5.2@stable",
        "silverstripe-themes/simple": "~3.2.0",
        "poptin/silverstripe": "dev-master",
        "dnadesign/silverstripe-elemental": "^4",
        "silverstripe/blog": "^3.5"
    },
    "require-dev": {
        "phpunit/phpunit": "^5.7"
    },
    "extra": {
        "resources-dir": "_resources",
        "project-files-installed": [
            "app/.htaccess",
            "app/_config.php",
            "app/_config/mysite.yml",
            "app/src/Page.php",
            "app/src/PageController.php"
        ],
        "public-files-installed": [
            ".htaccess",
            "index.php",
            "web.config"
        ]
    },
    "repositories": [
        {
          "type": "path",
          "url": "../silverstripe-module"
        }
      ],
    "config": {
        "process-timeout": 600
    },
    "prefer-stable": true,
    "minimum-stability": "dev"
}

But when I do composer vendor-expose symlink, I end up with a _resource folder like so:

enter image description here

The files are appearing in a -module folder instead of going in the vendor folder. I am not sure what I am doing wrong.

EDIT: I even tried changing repositories type to vcs

"repositories": [
        {
            "type": "vcs",
            "url": "../silverstripe-module"
        }
    ],

Still no luck


Solution

  • I had mistakenly run composer install inside the module folder, which installed dependancies for SS in the module itself, and that was conflicting when vendor:publish.

    Note to self: Never run composer install inside composer modules, but from the root of the main project where the module is being required.