Remove composer.lock from the codebase

Created on 15 December 2021, almost 3 years ago
Updated 9 November 2023, 11 months ago

Modules and other contributed projects should not include a composer.lock file, it is not used by Composer when the module is added to a codebase and it could cause confusion for site builders.

πŸ“Œ Task
Status

Postponed: needs info

Version

1.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France prudloff Lille

    Is there a Drupal policy stating that modules should not include a composer.lock file?

  • πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

    Not specifically a policy, more the fact that when the project is added by Composer to a site the contents of this file are ignored.

    From the point of view of contributing to the module, how does the composer.lock file help? I'm genuinely curious.

  • πŸ‡«πŸ‡·France prudloff Lille

    From the point of view of contributing to the module, how does the composer.lock file help? I'm genuinely curious.

    This is more a general practice I have than something specific to this module.

    Running composer install in the module folder installs a pre-commit hook that runs checks on the code.
    For example, the composer.lock file includes drupal/coder and different versions of this package sometimes enforce different rules.
    On other projects, I have seen contributors going back and forth on code style changes because they had different versions of the rule installed depending on when they installed the dev dependencies for the first time, so I took the habit of versioning the lock file.
    (In some cases, it can also help CI pipelines run the exact same checks as the pre-commit hook.)

    But on a small module like this one, it probably does not make that much of a difference.

Production build 0.71.5 2024