Be API WordPress agency | News | Tech | Composer : Make Stable

Composer : Make Stable

Published on

by

Here's a small script to make versions of dependencies in Compose stable. You're going to save valuable time!

Some explanations before embarking on the sharpness of the subject.

In production phase

When your WordPress project is in production, it is recommended to manage WP versions and plugins frozen. An update composer will have more effect on the dependencies versions. We will therefore seek to transform everything into a stable version with the aim of facilitating maintenance and monitoring of updates.

 

In the development phase

When you use compose to manage the dependencies of your WordPress project during the development phase, the versions are usually « dev-master » or « stable ». Like this, every compose update, you force updates and are on the page. Useful to quickly detect a bug but also benefit from all new updates.

All in video

The birth of a script

During last Friday's R&D, Julien Maury concocted a small script ( compose make stable ) to freeze versions in compose.json. The latter will transform the versions of the composer.json to make them stable. Practical to make a composer update during dan update audit.
This works for all dependencies: themes, mu-plugins, plugins and WordPress core.

This script saved us a lot of time! And since it did not yet exist on the internet, we found it interesting to share with you in open source.

1. Add script to your project

Just add the script as a dependency of your project:

# Ajouter le repository dans les sources :
{ "type": "vcs", "url": "https://github.com/BeAPI/composer-make-stable" }
# Require en require-dev dans votre composer.json
"bea/composer/make-stable": "dev-master" 
# Puis avant usage un :
composer update

2. Use script

Easy as pie!

composer make-stable

3. The little plus

See this article to repeat the manipulation in the other direction,


Did you easily manage to set it up? Is it simple to use? Did you buy time?
Tell us everything in the comments.

Enjoy!