RobLoach / component-installer

Install Web Components through Composer
https://asset-packagist.org/
Other
280 stars 35 forks source link

Adding custom modules configuration into generated require.js file #97

Open tboloo opened 8 years ago

tboloo commented 8 years ago

Here is my scenario:

Now when I add following section to composer.json

   "extra": {
        "component": {
            "mbostock/d3": {
                "files": [
                    "d3.min.js"
                ],
                "shim": {
                    "deps": ["jquery"]
                }
            },
            "semantic/ui": {
                "files": [
                    "dist/semantic.min.css",
                    "dist/semantic.min.js"
                ]
            },
            "shim": {
                "modules/bar_chart" : ["d3/d3.min"]
            }
        }
    }

I get following code in require.js

var components = {
    "packages": [
        {
            "name": "jquery",
            "main": "jquery-built.js"
        }
    ],
    "shim": {
        "d3": {
            "deps": [
                "jquery"
            ]
        },
        "data-visualization": {
            "modules/bar_chart": [
                "d3/d3.min"
            ]
        }
    },
    "baseUrl": "/assets"
};

what I really need is

 "shim": {
        "d3": {
            "deps": [
                "jquery"
            ]
        },
            "modules/bar_chart": [
                "d3/d3.min"
            ]
    },

that is without "data-visualization", which happens to be project name. Is there any way to achieve this result with component-installer?