Skip to content

Update the FW composer.json file #293

@unfulvio

Description

@unfulvio

We can probably move plugins implementing the FW to require "composer/installers": "~1.0", to move certain libraries, such as the framework itself, to a custom install path. However, it seems that the FW doesn't work well with composer/installers and we need to stick "mnsami/composer-custom-directory-installer": "1.1.*".

It looks like this may come from how the current FW composer.json looks like. the composer/installers lib works with most library types, but the FW composer.json does not specify one. As a comparison, the Action Scheduler library interacts well with composer/installer, therefore it may be worth importing the entries found on their composer.json file:

{
  "name": "prospress/action-scheduler",
  "version": "1.5.3",
  "description": "Action Scheduler for WordPress and WooCommerce",
  "type": "wordpress-plugin",
  "license": "GPL-3.0",
  "minimum-stability": "dev",
  "require": {}
}

An use case is in the current Memberships repository, which uses the following composer.json:

{
  "name": "skyverge/woocommerce-memberships",
  "version": "1.10.3",
  "description": "WooCommerce Memberships",
  "type": "wordpress-plugin",
  "homepage": "https://woocommerce.com/products/woocommerce-memberships/",
  "license": "GPL 3.0",
  "minimum-stability": "dev",
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/skyverge/wc-plugin-framework"
    },
    {
      "type":"vcs",
      "url": "https://github.com/Prospress/action-scheduler"
    }
  ],
  "require" : {
    "composer/installers": "~1.0",
    "mnsami/composer-custom-directory-installer": "1.1.*",
    "skyverge/wc-plugin-framework": "4.9.1",
    "prospress/action-scheduler" : "1.5.3"
  },
  "require-dev": {
    "lucatume/wp-browser": "^2.0.0"
  },
  "extra": {
    "installer-paths": {
      "./lib/skyverge": ["skyverge/wc-plugin-framework"],
      "./lib/prospress/action-scheduler": ["prospress/action-scheduler"]
    }
  }
}

If "mnsami/composer-custom-directory-installer": "1.1.*", is omitted, then the SkyVerge library won't copy to /lib, however Action Scheduler will. On the way around, if composer/installers is omitted, then Prospress will stay in /vendor. It makes sense to switch over composer/installers which is more "official".

I suppose it doesn't hurt add more fields, as the FW is indeed a public library after all.

See also an interactive composer cheat sheet:
http://composer.json.jolicode.com/

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions