koala-framework / composer-extra-assets

Composer Plugin for installing Assets using native npm/bower
BSD 2-Clause "Simplified" License
42 stars 11 forks source link

Delaying npm installation check #5

Closed moufmouf closed 9 years ago

moufmouf commented 9 years ago

This is directly related to #4 .

In order to add the opportunity to install npm by other plugins (namely mouf/nodejs-installer), I moved the check on npm installation from the activate method to the onPostUpdateInstall method.

This is my test composer.json file:

{
    "require": {
        "koala-framework/composer-extra-assets": "dev-master",
        "mouf/nodejs-installer": "~1.0",
        "composer/composer": "*"
    },
    "autoload": {
        "psr-0": {"Test": ["src/", "src-dev/", "tests/"]}
    },
    "minimum-stability": "dev",
    "extra": {
        "require-npm": {
            "grunt": "0.4.*"
        },
        "require-bower": {
            "jquery": "*"
        },
        "require-dev-bower": {
            "qunit": "*"
        }
    }
}

With the changes in this PR, this works nicely, even on a machine with no nodejs installed.

Note: I updated the "mouf/nodejs-installer" so that it prepends vendor/bin to the PATH. Therefore, when composer-extra-assets is triggered, it loads node / npm from the vendor/bin directory automatically.

nsams commented 9 years ago

6 removes the check completely. If that is merge we can close this PR.

moufmouf commented 9 years ago

I'm closing this pull-request since it is replace #6 seems the way to go :)