PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 31, 2022

[FIXED] How can I use gulp to watch for composer package updates?

 January 31, 2022     composer-php, gulp, gulp-watch     No comments   

Issue

Composer is a great tool for dependency management but for local development it can become time consuming to keep running it to update builds. There are ways round this such as symlinking, but with build tools like gulp it seems there should be better ways to monitor changes to local libraries.

Watching a local library makes sense but composer bases it's update decisions on the latest git commit, not on the current state of the working directory. How can I have a gulp watch task update my dependencies?


Solution

Turns out that you can simply watch the git reference, as long as your composer dependency is bound to a specific branch:

gulp.watch([
    '/path/to/local/lib/.git/refs/heads/master',
    '/path/to/other/lib/.git/refs/heads/dev',
],['composer']);

Where the composer task is defined

var composer = require('gulp-composer');
gulp.task('composer',function(){
    composer('update',{bin:'php composer.phar'});
});

Solutions which also watch packagist.org would be greatly appreciated and may even beat out my own!



Answered By - M1ke
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing