GithubHelp home page GithubHelp logo

robloach / component-installer Goto Github PK

View Code? Open in Web Editor NEW
280.0 21.0 35.0 303 KB

Install Web Components through Composer

Home Page: https://asset-packagist.org/

License: Other

PHP 47.26% JavaScript 52.71% CSS 0.03%

component-installer's Introduction

DEPRECATED

Component Installer has been deprecated. Use one of the following projects instead:

Example

composer require oomphinc/composer-installers-extender
  "extra": {
    "installer-types": ["component"],
    "installer-paths": {
      "components/{$name}/": ["type:component"]
    }
  }

Component Installer for Composer Build Status

Allows installation of Components via Composer.

Install

composer require robloach/component-installer
{
    "require": {
        "robloach/component-installer": "*"
    }
}

Usage

To install a Component with Composer, add the Component to your composer.json require key. The following will install jQuery and normalize.css:

composer require components/jquery
composer require components/normalize.css
{
    "require": {
        "components/jquery": "2.*",
        "components/normalize.css": "3.*",
        "robloach/component-installer": "*"
    }
}

Using the Component

The easiest approach is to use the Component statically. Just reference the Components manually using a script or link tag:

<script src="components/jquery/jquery.js"></script>
<link href="components/normalize/normalize.css" rel="stylesheet">

For complex projects, a RequireJS configuration is available, which allows autoloading scripts only when needed. A require.css file is also compiled, including all Component stylesheets:

<!DOCTYPE html>
<html>
    <head>
        <link href="components/require.css" rel="stylesheet" type="text/css">
        <script src="components/require.js"></script>
    </head>
    <body>
        <h1>jQuery+RequireJS Component Installer Sample Page</h1>
        <script>
          require(['jquery'], function($) {
            $('body').css('background-color', 'green');
          });
        </script>
    </body>
</html>

Configuration

There are a number of ways to alter how Components are installed and used.

Installation Directory

It is possible to switch where Components are installed by changing the component-dir option in your root composer.json's config. The following will install jQuery to public/jquery rather than components/jquery:

{
    "require": {
        "components/jquery": "*"
    },
    "config": {
        "component-dir": "public"
    }
}

Defaults to components.

Base URL

While component-dir depicts where the Components will be installed, component-baseurl tells RequireJS the base path that will use when attempting to load the scripts in the web browser. It is important to make sure the component-baseurl points to the component-dir when loaded externally. See more about baseUrl in the RequireJS documentation.

{
    "require": {
        "components/jquery": "*"
    },
    "config": {
        "component-dir": "public/assets",
        "component-baseurl": "/assets"
    }
}

Defaults to components.

Assetic filters

{
    "require": {
        "components/jquery": "*"
    },
    "config": {
        "component-dir": "public/assets",
        "component-baseurl": "/assets",
        "component-scriptFilters": {
            "\\Assetic\\Filter\\GoogleClosure\\CompilerApiFilter": []
        },
        "component-styleFilters": {
            "\\Assetic\\Filter\\CssImportFilter": []
        }
    }
}

Creating a Component

To set up a Component to be installed with Component Installer, have it require the package robloach/component-installer and set the type to component, but it is not necessary:

{
    "name": "components/bootstrap",
    "type": "component",
    "require": {
        "robloach/component-installer": "*"
    },
    "extra": {
        "component": {
            "scripts": [
                "js/bootstrap.js"
            ],
            "styles": [
                "css/bootstrap.css"
            ],
            "files": [
                "img/*.png",
                "js/bootstrap.min.js",
                "css/bootstrap.min.css"
            ]
        }
    }
}
  • scripts - List of all the JavaScript files that will be concatenated together and processed when loading the Component.
  • styles - List of all the CSS files that should be concatenated together into the final require.css file.
  • files - Any additional file assets that should be copied into the Component directory.

Component Name

Components can provide their own Component name. The following will install jQuery to components/myownjquery rather than components/jquery:

{
    "name": "components/jquery",
    "type": "component",
    "extra": {
        "component": {
            "name": "myownjquery"
        }
    }
}

Defaults to the package name, without the vendor.

RequireJS Configuration

Components can alter how RequireJS registers and interacts with them by changing some of the configuration options:

{
    "name": "components/backbone",
    "type": "component",
    "require": {
        "components/underscore": "*"
    },
    "extra": {
        "component": {
            "shim": {
                "deps": ["underscore", "jquery"],
                "exports": "Backbone"
            },
            "config": {
                "color": "blue"
            }
        }
    },
    "config": {
        "component": {
            "waitSeconds": 5
        }
    }
}

Current available RequireJS options for individual packages include:

  • shim
  • config
  • Anything that's passed through config.component is sent to Require.js

Packages Without Composer Support

Using repositories in composer.json allows use of Component Installer in packages that don't explicitly provide their own composer.json. In the following example, we define use of html5shiv:

{
    "require": {
        "afarkas/html5shiv": "3.6.*"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "afarkas/html5shiv",
                "type": "component",
                "version": "3.6.2",
                "dist": {
                    "url": "https://github.com/aFarkas/html5shiv/archive/3.6.2.zip",
                    "type": "zip"
                },
                "source": {
                    "url": "https://github.com/aFarkas/html5shiv.git",
                    "type": "git",
                    "reference": "3.6.2"
                },
                "extra": {
                    "component": {
                        "scripts": [
                            "dist/html5shiv.js"
                        ]
                    }
                },
                "require": {
                    "robloach/component-installer": "*"
                }
            }
        }
    ]
}

Packages Without Component Support In composer.json

Using extra in composer.json allows use of Component Installer in packages that don't explicitly provide support for component, but do ship with their own composer.json. Using extra with packages that ship with Component Installer, will override component's settings for that package.

{
    "require": {
        "datatables/datatables": "~1.10"
    },
    "extra": {
        "component": {
            "datatables/datatables": {
                "scripts": [
                    "media/js/jquery.dataTables.js"
                ],
                "styles": [
                    "media/css/jquery.dataTables.css"
                ],
                "files": [
                    "media/js/jquery.dataTables.min.js",
                    "media/css/jquery.dataTables.min.css",
                    "media/images/*.png"
                ]
            }
        }
    }
}

Not Invented Here

There are many other amazing projects from which Component Installer was inspired. It is encouraged to take a look at some of the other great package management systems:

License

Component Installer is licensed under the MIT License - see LICENSE.md for details.

component-installer's People

Contributors

aurelijusrozenas avatar cordoval avatar glensc avatar hjr3 avatar holtkamp avatar inconclusiveimpurity avatar jijoel avatar kelunik avatar marclaporte avatar moro4125 avatar moufmouf avatar nyholm avatar robloach avatar scor avatar staabm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

component-installer's Issues

Component Dir vs Base URL

The component-dir shouldn't be included in the component require.js location. Instead, it should exclusively use the base-url.

"component-baseurl" + CDN URL flexible

nice project @RobLoach,

I didn't found a way to make "component-baseurl" flexible to works on developer machine, staging machines and production at my company. When deployment is running, static files are sent to some CDN servers. CDN hosts change according environment (dev, staging, production). So... baseurl should change as well.

I do not want to change composer.json (or any file else) before run composer install.

PSR-0 Vendor path

PSR-0 asks for a Vendor path in the namespace... Have to prefix "RobLoach" in the PHP namespace?

Moving generated files out of sites/default/files

What would I need to alter in order to move component-installer generated files out of sites/default/files and into some location that is typically managed by git in most projects?

Right now, the Drupal module hard codes public://component_installer into its code in several places. I've experimented with modifying Component Managers' admin screen and adding an additional variable to handle the location of the component_installer directory via hook_form_alter, and using the variable where the setting is currently hard coded. But I'm having difficulty getting drush component-manager from working if I do this.

How is component-installer and composer_manager interacting when the master composer.json is rebuilt?

Install into Vendor Directory?

Instead of installing directory into the components directory, possibly install into the vendor directory, and symlink the CSS/JavaScript/file assets.

Rename the project

Possibly rename the project from Component Installer at robloach/component-installer to...

  • Composer Components: components/composer-components
  • Component Installer: components/composer-installer

uninstall needed

Hello,

Since you implements the "getInstallPath" method, you need to (re)implement the "uninstall" method (or only the part of removing files from the uninstall method). This is because of a little malformation of the code of Composer (it should ask the getInstallPath but it didn't).

Bye

Scripts not being executed?

No setScripts()?

{
    "name": "praxis/portal",
    "license": "MIT",
    "type": "project",
    "description": "The Praxis Portal application",
    "autoload": {
        "psr-0": { "": "src/" }
    },
    "require": {
        "php": ">=5.3.3",
        "components/bootstrap": "3.0.*",
        "robloach/component-installer": "*@dev",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "friendsofsymfony/user-bundle": "~2.0@dev",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "fkr/cssurlrewrite-bundle": "*",
        "stof/doctrine-extensions-bundle": "~1.1@dev"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

Build all.js

Build an all.js that is just concatenated all built libraries.

Might run into JavaScript ordering issues due to dependencies not being included in the right order, but worth a shot. Require.js fixes that, but sometimes require.js isn't quite needed.

cc @renanbr #41

Write a require.js configuration

Setting up AMD makes Component Installer actually useful. Can trigger completion script hooks by injecting into scripts:

At the end of ComponentInstaller\Installer::getInstallPath()

// Register the post-install script.
$root = $this->composer->getPackage();
$scripts = $root->getScripts();
$scripts['post-install-cmd']['component-installer'] = 'ComponentInstaller\\Installer::postInstall';
$root->setScripts($scripts);

ComponentInstaller\Installer::postInstall()

public static function postInstall(Event $event) {
    $io = $event->getIO();
    $composer = $event->getComposer();
    $io->write('<info>Setting up require.js configuration</info>');
}

Nothing works (with using only update)

It seems that a newer release of composer fix a possibility to use a bad practice (as is using the current project as main feature load door) : using the hooks to add the installer process.

So anything work (any process launch !). Here is the documentation to remake it: https://github.com/composer/composer/blob/master/doc/articles/custom-installers.md

I needed to change the folder of my components, so I wrote some code working (maybe not as you expect !). But I think it's a greet brain wave.

/**
 * Component Installer for Composer.
 */
class Installer extends LibraryInstaller
{

    /**
     * {@inheritDoc}
     *
     * This method can be so simple without the declaration of the hook
     */
    public function supports($packageType)
    {
        // Aw.. I deleted the (bool) because .. why ?
        return $packageType === 'component';
    }

    /**
     * {@inheritDoc}
     *
     * Return the path to the installation
     *
     * In my project I use Symfony2, so I want to have an install path like that:
     * -> /home/me/website/app/Resources/public/js/components/jquery/jquery.js
     *
     * With defining "component-dir": "app/Resources/public/js" it works.
     */
    public function getInstallPath(PackageInterface $package)
    {
        // Getting the configuration object
        $config = $this->composer->getConfig();

        // Making the path from with data retrieved
        $path = '';
        if($config->has('component-dir')) {
            $path = realpath('.') . '/' . $config->get('component-dir') . '/' . $package->getPrettyName();
        } else {

            // To be sure to be compatible
            $path = parent::getInstallPath($package);
        }


        return $path;
    }
}

I changed all comments for helping you to see changes.

Of course this is not enough... But this is a base.

Hope to be helpful, see you !

Compile the require.js file

Enable the ability to compile the require.js configuration into one require.js file so that additional HTTP requests are not needed.

Apply to not just Components

  1. Change install path
    • Install all projects to their normal vendor path
    • This allows files like README.md not to be accessed publicly
  2. Copy file assets
    • Copy/symlink all styles/scripts/files to components/[name]/[file]
  3. Aggregate Component files
    • Put all scripts in components/[name]/build.js?
    • Put all styles in components/[name]/build.css?
  4. Build Require.js file
    • Change main definition to build.js so it'll use [name]/build.js

Using jQuery with the requirejs-built file

How can you use the jQuery component with the requirejs-built file??

<script type="text/javascript">
    var require = {
        deps: ['jquery'],
        callback: function ($) {
            $(document).ready(function () {
                // $ = an object here. != jquery
            });
        }
    };
</script>

<script src="assets/require-built.js"></script>

$ keeps ending up in the global scope for me

This all works fine when I just use "assets/require.js" and let the jquery library load separately.

(Not sure if this is a straight up RequireJS question, or a question for your package)

Composer Autoload

Hi!

I'm trying to dump composer autoload files in production and getting this error:

Plugin robloach/component-installer is missing a require statement for a version of the composer-plugin-api package.

Please help - what's going on?

Symfony2 bundle idea

I'm currently working on a project that uses multiple AppKernels but use the same composer.json, and I need to be able load in assets with ease (using the AsseticBundle), so I created a bundle to make the loading easier and just install the 'components' in the Resources/public folder of this bundle.

This works but has a few drawbacks, the directory location of the bundle needs to be known for composer, I know this can properly be fixed using a composer plugin.

But it did not stop there, require.js gets build and configured with a base-url.
For Symfony users it actually makes sense to use the assets hostname configured in the application, but this can only be done after the cache is generated.

So to make this possible, we should create a separate Symfony2 bundle which provides this. The only problem I'm currently having is that require.js is always generated (adding up to the time it takes to run composer) while in the bundle's case it should generated during the cache warming.

But before I start working on something I'd like to have some feedback from the community first.

Components not copied over to component-dir in a symfony install

When I try to require the a component in a symfony framework standard project, the components are not copied to the destination component-dir.

I end up with no built files and no require.js files, but I do get the component-dir created.

What I think is happening is the component installer is not finding it's required resources since things are a bit moved around as compared to a regular composer project... But I don't get any error messages.

{
    "name": "symfony/framework-standard-edition",
    "license": "MIT",
    "type": "project",
    "description": "The \"Symfony Standard Edition\" distribution",
    "autoload": {
        "psr-0": {
            "": "src/"
        }
    },
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/swiftmailer-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "incenteev/composer-parameter-handler": "~2.0",
        "symfony/intl": "v2.3.3",
        "friendsofsymfony/rest-bundle": "0.13.*",
        "friendsofsymfony/user-bundle": "2.0.x-dev",
        "components/backbone": "1.0.0",
        "components/jquery": "1.8.3",
        "robloach/component-installer": "dev-master"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
        ]
    },
    "config": {
        "bin-dir": "bin",
        "component-dir": "web/components",
        "component-baseurl": "/components"
    },
    "minimum-stability": "stable",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

Component name overiding

Components shouldn't be able to override their name completely.

{
    "name": "components/jquery",
    "type": "component",
    "extra": {
        "component-name": "myownjquery"
    }
}

That currently installs to components/myownjquery , but it really should only go to components/components-myownjquery.

Fails on removing: PHP Fatal error: Class 'ComponentInstaller\Process\CopyProcess' not found

$ ls -1
composer.json
$ cat composer.json 
{
    "require": {
        "components/jquery": "1.9.*",
        "components/normalize.css": "2.*"
    }
}
$ composer install
# ... everything ok ...
$ cat composer.json 
{
}
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Removing components/normalize.css (2.1.1)
  - Removing components/jquery (1.9.1)
  - Removing robloach/component-installer (0.0.12)
  - Removing kriswallsmith/assetic (v1.1.2)
  - Removing symfony/process (v2.3.5)
Generating autoload files
Compiling component files
PHP Fatal error:  Class 'ComponentInstaller\Process\CopyProcess' not found in /.../vendor/robloach/component-installer/src/ComponentInstaller/Installer.php on line 160
PHP Stack trace:
PHP   1. {main}() /usr/local/bin/composer:0
PHP   2. require() /usr/local/bin/composer:15
PHP   3. Composer\Console\Application->run() phar:///usr/local/bin/composer/bin/composer:43
PHP   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:83
PHP   5. Composer\Console\Application->doRun() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
PHP   6. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:117
PHP   7. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
PHP   8. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:897
PHP   9. Composer\Command\UpdateCommand->execute() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
PHP  10. Composer\Installer->run() phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:116
PHP  11. Composer\Autoload\AutoloadGenerator->dump() phar:///usr/local/bin/composer/src/Composer/Installer.php:283
PHP  12. Composer\EventDispatcher\EventDispatcher->dispatchScript() phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:194
PHP  13. Composer\EventDispatcher\EventDispatcher->doDispatch() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:84
PHP  14. Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:138
PHP  15. ComponentInstaller\Installer::postAutoloadDump() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:165

Fatal error: Class 'ComponentInstaller\Process\CopyProcess' not found in /.../vendor/robloach/component-installer/src/ComponentInstaller/Installer.php on line 160

Call Stack:
    0.0001     640320   1. {main}() /usr/local/bin/composer:0
    0.0053     842136   2. require('phar:///usr/local/bin/composer/bin/composer') /usr/local/bin/composer:15
    0.0375    5582176   3. Composer\Console\Application->run() phar:///usr/local/bin/composer/bin/composer:43
    0.0411    6181232   4. Symfony\Component\Console\Application->run() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:83
    0.0425    6433296   5. Composer\Console\Application->doRun() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:121
    0.0435    6592480   6. Symfony\Component\Console\Application->doRun() phar:///usr/local/bin/composer/src/Composer/Console/Application.php:117
    0.0444    6592480   7. Symfony\Component\Console\Application->doRunCommand() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:191
    0.0444    6592480   8. Symfony\Component\Console\Command\Command->run() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Application.php:897
    0.0450    6590776   9. Composer\Command\UpdateCommand->execute() phar:///usr/local/bin/composer/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
    0.1494   13029480  10. Composer\Installer->run() phar:///usr/local/bin/composer/src/Composer/Command/UpdateCommand.php:116
   10.3450   84349920  11. Composer\Autoload\AutoloadGenerator->dump() phar:///usr/local/bin/composer/src/Composer/Installer.php:283
   10.3464   84359800  12. Composer\EventDispatcher\EventDispatcher->dispatchScript() phar:///usr/local/bin/composer/src/Composer/Autoload/AutoloadGenerator.php:194
   10.3464   84361024  13. Composer\EventDispatcher\EventDispatcher->doDispatch() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:84
   10.3466   84363968  14. Composer\EventDispatcher\EventDispatcher->executeEventPhpScript() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:138
   10.3466   84363968  15. ComponentInstaller\Installer::postAutoloadDump() phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php:165

$ ls -1 components/
require-built.js
require.config.js
require.css
require.js

Redefine require.js use?

This might be possible, but might require a bit more architecture thought. The benefit is that the built libraries would still support require('componentname/mycustomscript') and require('componentname')...

In componentname-built.js, stick each script in a define('componentname/mycustomscript') for mycustomscript.js, along with a require() each script at the end.

Fatal error after composer update

After updating composer with composer.phar self-update to the current version (29fcca8595c8c19ebb4d01ae993fa868d53f181d) in a Symfony 2 project the installation of robloach/component-installer (0.0.6) as dependency of components/modernizr (2.6.2) over composer.phar update crashes with the following error:

PHP Fatal error:  Call to undefined method Composer\Package\RootAliasPackage::setScripts() in /.../vendor/robloach/component-installer/src/ComponentInstaller/Installer.php on line 39

Moving back to composer version 1.0.0-alpha6 resolves the problem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.