From 6957845d55e34509ea1be9e103ee5458b93ef133 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 13 Jul 2024 16:55:40 +0200 Subject: [PATCH] Composer: prevent a lock file from being created Composer 1.10.0 introduced a `lock` config option, which, when set to `false` will prevent a `composer.lock` file from being created and will ignore it when one exists. This is a useful option for libraries such as this where the `lock` file has no meaning. It also makes life easier for contributors as they don't have to remember that for this repo they should use `composer update` instead of `composer install`. Both will now work the same. Refs: https://getcomposer.org/doc/06-config.md#lock --- .github/workflows/quicktest.yml | 4 ++++ .github/workflows/test.yml | 8 ++++++++ composer.json | 3 ++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quicktest.yml b/.github/workflows/quicktest.yml index 7ef1a86..7fa6006 100644 --- a/.github/workflows/quicktest.yml +++ b/.github/workflows/quicktest.yml @@ -64,6 +64,10 @@ jobs: phpcsstandards/phpcsutils:"dev-develop" wp-coding-standards/wpcs:"dev-develop as 3.99" # Alias needed to prevent composer conflict with VIPCS. + - name: Enable creation of `composer.lock` file + if: ${{ matrix.dependencies == 'lowest' }} + run: composer config --unset lock + # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: Install Composer dependencies diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5eef5ee..dbbae04 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -93,6 +93,10 @@ jobs: phpcsstandards/phpcsutils:"${{ env.UTILS_HIGHEST }}" wp-coding-standards/wpcs:"${{ env.WPCS_HIGHEST }}" + - name: Enable creation of `composer.lock` file + if: ${{ matrix.dependencies == 'lowest' }} + run: composer config --unset lock + # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: Install Composer dependencies - normal @@ -174,6 +178,10 @@ jobs: phpcsstandards/phpcsutils:"${{ env.UTILS_HIGHEST }}" wp-coding-standards/wpcs:"${{ env.WPCS_HIGHEST }}" + - name: Enable creation of `composer.lock` file + if: ${{ matrix.dependencies == 'lowest' }} + run: composer config --unset lock + # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-php-dependencies-with-composer - name: Install Composer dependencies diff --git a/composer.json b/composer.json index 58ba0da..689d10e 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,8 @@ "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true - } + }, + "lock": false }, "scripts": { "lint": [