Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How do I customize a resource pack installation directory for my framework?


May 25, 2021 Composer


Table of contents


How do I customize a resource pack installation directory for my framework?

Each framework may have one or more different dependency package installation directories. Composer can be configured by using composer/installers to install vendor directories that depend on other directories instead of the vendor

If you are a package author and want your own resource pack to be installed in a custom directory, the simple require composer/installers and set the appropriate type T his is a common way if your resource pack is dedicated to a framework such as CakePHP, Drupal, or WordPress. Here's an example of a WordPress-themed composer.json file:

{
    "name": "you/themename",
    "type": "wordpress-theme",
    "require": {
        "composer/installers": "~1.0"
    }
}

Now when you install this theme with Composer, it is placed wp-content/themes/themename/ The type types that type supported can be viewed at current supported types.

For a package consumer you can set or override the installation path for a package, requires composer/installers, and set the installer-paths extra. D rupal's multisite setup is a good example of where resource packs should be installed in subdirectts of their respective sites. Here we use composer/installers to override the installation path:

{
    "extra": {
        "installer-paths": {
            "sites/example.com/modules/{$name}": ["vendor/package"]
        }
    }
}

The resource pack will now be installed in the directory you specify and replaced $name instead of the default directory.

Note: You cannot use it to change the installation directory for all packages. This applies only to resource composer/installers dependencies and customize the type property.