How to test if composer.lock is up to date?

后端 未结 4 1469
谎友^
谎友^ 2021-02-20 01:46

During development (multiple people in the team) sometimes composer install returns:

Warning: The lock file is not up to date with the latest change

4条回答
  •  北海茫月
    2021-02-20 01:57

    For composer < 1.3.0

    Extending from @Domster, the solution in pure bash:

    COMPOSER_IN_SYNC=$(expr "`cat composer.lock | grep '"hash":' | cut -d'"' -f4`" = "`md5sum composer.json | cut -d ' ' -f 1`")
    

    $COMPOSER_IN_SYNC will be 0 or 1 respectively.

提交回复
热议问题