Issue
We are trying to wrap all our build into composer packages to comply with best practises.
The problem is there are files that need to be added or modified which do not fit in Magento module structure for various reason, in the case I am just trying to get some sample images for the build, it does seem like we will have to change some files such as dev/tools/grunt/configs/themes.js
Magento overcome this by creating the "magento/magento2-base"
package as type "type": "magento2-component",
.
Attempt
I tried creating a composer file like:
{
"name": "namespace/project-base",
"description": "Project Base Components",
"type": "magento2-component",
"version": "0.0.1",
"require": {
"magento/magento-composer-installer": "*",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/magento2-base": "*"
},
"license": [
"OSL-3.0",
"AFL-3.0"
],
"extra": {
"map": [
[
"pub/media",
"pub/media"
]
]
}
}
And my file structure is:
.
├── composer.json
└── pub
└── media
└── catalog
├── category
│ └── new-arrivals.JPG
└── product
└── p
└── r
├── product-photo1x.jpg
├── product-photo2x.jpg
├── product-photo3x.jpg
├── product-photo4x.jpg
└── product-photo5x.jpg
When I run composer update it doesn't map the files across, I'm not sure what is wrong, does anybody have any insight into how the composer map feature works with the magento-composer-installer
?
Update
I made it work, see my answer below, I still can't work out how to make the declaration work for folders though.