Consider hardening upgrade paths by versioning libraries

Created on 27 June 2025, about 9 hours ago

Problem/Motivation

While reviewing the most recent version of this module, it occurred to me that the JS that ships with this module isn't versioned.

The js/decorative-image-widget.js file seems to have undergone some changes between tagged releases 1.0.1 and 1.0.2 (and even in the untagged HEAD of 1.0.x-dev), but the module doesn't have a library version configured. I think this can lead to stale browser caches for some users.

Given the dependencies didn't change between 1.0.1 and 1.0.2, this is probably safe enough for the tagged release, but the dependencies have changed in HEAD. It would be a good idea to start versioning the JS assets to harden the upgrade path.

Proposed resolution

Add a version key to the decorative_image_widget library definition.

decorative_image_widget:
  version: 1.0.3  # <-- not sure if it'd be more appropriate to version it with the module's version or an independent scheme that increments whenever there are changes made to the file?
  js:
    js/decorative-image-widget.js: {}
  dependencies:
    - core/once
    - core/drupal

User interface changes

None

API changes

None

Data model changes

None

πŸ“Œ Task
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States luke.leber Pennsylvania

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

Comments & Activities

Production build 0.71.5 2024