Skip to content

A simple Composer script to install NPM and/or Bower dependencies

License

Notifications You must be signed in to change notification settings

Nekland/dependency-tools

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install NPM & Bower dependencies with Composer

This simple tools allows you to run npm install and/or bower install each time you run composer install / update.

Note: This is Windows-compatible !

Usage

Basic usage

Add this lines to your composer.json file (only works with root file) :

{
    "require": {
        "yohang/dependency-tools": "1.1.*"
    },
    "scripts": {
        "post-install-cmd": [
            "Yohang\\DependencyTools::installDeps"
        ],
        "post-update-cmd": [
            "Yohang\\DependencyTools::updateDeps"
        ]
    },
    "extra": {
        "dependency-tools": {
            "npm": true,
            "bower": true
        }
    }
}

And that's all, your NPM and Bower dependencies will be installed just after your Composer dependencies.

Advanced usage

If you don't have a global install of bower, you would maybe like to specify a path to bower. If you uses npm to install bower directly in your project here is an example of how you can configure composer:

{
    "extra": {
        "dependency-tools": {
            "npm": true,
            "bower": {
                "path": "node_modules/.bin/bower"
            }
        }
    }
}

Known issue

Bower executable is searching for node, if you installed nodejs on ubuntu, the executable is nodejs, an easy fix is to execute the following command to make a shortcut named node to nodejs.

sudo ln -vs /usr/bin/nodejs /usr/bin/node

About

A simple Composer script to install NPM and/or Bower dependencies

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%