Problem/Motivation

Per discussion in #3238507: Drupal 10 JavaScript dependency plan, the js-cookie library is unused in core after refactoring elsewhere. It is however used in multiple contrib modules.

We should deprecate it in 10.1.0 for removal in 11.0.0 to have one less external JavaScript dependency. Not sure if this also needs us to create a contrib module for it, but probably.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

The js-cookie library is unused in core after refactoring. js-cookie has therefore been deprecated as a core dependency and there is no replacement. Contributed modules or custom code relying on this library should declare their own dependency on it.

Comments

catch created an issue. See original summary.

catch’s picture

Version: 9.5.x-dev » 10.1.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.26 KB
catch’s picture

StatusFileSize
new388 bytes

err can't deprecate and delete the asset file at the same time...

The last submitted patch, 2: 3296086.patch, failed testing. View results

spokje’s picture

Looks good, but (probably?) needs CR and release notes.

spokje’s picture

Issue tags: -Needs change record, -Needs release note
StatusFileSize
new453 bytes
new431 bytes

Added CR and added that to the deprecation message.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
spokje’s picture

StatusFileSize
new2.5 KB
new3.11 KB

@smustgrave said:

reviewing https://www.drupal.org/project/drupal/issues/3296086 and will this need a test? Don’t think I’ve seen an example of a test for a library

I answered:

Good question, so if we do some looking around, we can find Nightwatch test for libraries that already had one (https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/tests/Drupal...) and for the mass-jQueryUI deprecation we have/had a KernelTest (See https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/tests/Drupal...).
So let's add a KernelTest (very heavily) inspired on the latter and let the Core Committers decide if it's needed/wanted. If not, throwing away code is always easy, if yes, we might want to add all the deprecated IE-shims to it.

(Slack thread: https://drupal.slack.com/archives/C04CHUX484T/p1671032144226969)

INSTA-EDIT: shakes fist in anger at the far to nimble typer smustgrave

spokje’s picture

StatusFileSize
new3.21 KB
new665 bytes

Another angry fist shake at PHPCS

spokje’s picture

Status: Needs work » Needs review
spokje’s picture

Issue tags: -Needs tests
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Tests look good.

Thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 3296086-8.patch, failed testing. View results

spokje’s picture

Status: Needs work » Reviewed & tested by the community

Random Chrome-Broke-Down JS test failure, back to RTBC and ordered a retest to make sure.

xjm’s picture

Issue summary: View changes

Added a proper release note. It still handwaves a bit how contrib should add JS dependencies, but good enough for now.

  • xjm committed b6133d88 on 10.1.x
    Issue #3296086 by Spokje, catch, smustgrave, xjm: Deprecate/remove js-...
xjm’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +10.1.0 release notes

Committed the deprecation to 10.1.x. Thanks! I also published the CR after adding a few words.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

dave reid’s picture

I have added a new module https://www.drupal.org/project/js_cookie for this library dependency. I will work on updating the change record as appropriately with before/after instructions.

darvanen’s picture

It looks to me like we've missed removing core/js-cookie from 11.x so far... what are the steps to get that to happen, or is it too late?