Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Chalk could be updated from 4.1.2 to 5.0.0
The main problem is that chalk is now a js module, and can only be used in the context of js modules (not the commonjs environement we're currently using in core). To keep using it we need to update all our scripts to use js modules.
Proposed resolution
Update chalk to latest releases and backport to 9.4.x
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3266274
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3266274-remove-chalk-as changes, plain diff MR !2461
Comments
Comment #2
lauriiiComment #3
nod_Or removing the dependency altogether. there are 4 uses and it's not mission critial.
Comment #4
xjmWhat is this postponed on?
Comment #5
nod_And there is no plan to do that anywhere. In theory it's not too hard, but in practice we're very likely to run into incompatibilities given how many deps we have.
Comment #6
xjmCan we get an issue for #5 to make this actionable?
Comment #7
longwaveThe note on the chalk project page does say
and we are using it in our custom build tool.
As we only use
chalk.red()
we could perhaps switch to https://github.com/medikoo/cli-colorComment #8
SpokjeI like pretty colors!
Do we want to add a dependency on a module/package/thingamajig just for 4 instances of a red color when things go wrong? Not too sure.
I think removal of chalk altogether without a replacement could also be an option.
Comment #9
xjmThe current plan (per discussion between @nod_, @lauriii, @bnjmnm, and myself) is to simply remove the dependency. I also like pretty colors, but not well enough to attempt to justify retaining the dependency. ;)
Comment #10
xjmThus, actionable now.
Not even sure we actually need to replace it with anything.
Comment #12
SpokjeAlso did a
yarn install
, but since chalk is included in a few other packages as dependency, that didn't change anything.Comment #13
nod_Got the same result, all good for me.
It's not out of the yarn.lock file but it doesn't show up when running
yarn outdated
anymore.Comment #14
alexpottI guess that cli colouring is less important that outdated dependencies. FWIW I'm not sure that we have to remove chalk since chalk 4 is not unsupported and is actually recommended for our use-case. That said, we're planning to retire the build step so chalk becomes even less useful.
Also I think at some point we'll have to update to use es6 modules because more of our dependencies will make the same move. But as @nod_ has pointed out we have other priorities at the moment.
Committed and pushed 445ea0fe35 to 10.1.x and e4e25769a4 to 10.0.x. Thanks!
Comment #18
xjmDependency removals always go in the release notes.