Bug 283004 - www/yarn-node24: Update yarn to 1.22.22
Summary: www/yarn-node24: Update yarn to 1.22.22
Status: New
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Luca Pizzamiglio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-27 14:04 UTC by Matt Kempe
Modified: 2025-11-30 18:15 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (pizzamig)


Attachments
Patch to update yarn-node20 to 1.22.22 (3.56 KB, patch)
2024-11-27 14:04 UTC, Matt Kempe
no flags Details | Diff
Patch to update yarn-node20 to 1.22.22 (3.56 KB, patch)
2024-11-27 14:05 UTC, Matt Kempe
no flags Details | Diff
Patch to update yarn-node22 to 1.22.22, add option for patch (4.39 KB, patch)
2025-01-08 20:09 UTC, Matt Kempe
no flags Details | Diff
Updated patch (1.80 KB, patch)
2025-11-11 19:53 UTC, Matt Kempe
no flags Details | Diff
Latest version of patch (3.04 KB, patch)
2025-11-30 18:15 UTC, Matt Kempe
fsbruva: maintainer-approval? (pizzamig)
fsbruva: maintainer-approval? (vvd)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Kempe 2024-11-27 14:04:39 UTC
Created attachment 255489 [details]
Patch to update yarn-node20 to 1.22.22

Update to 1.22.22, which is the latest available upstream.

Project changelog is out of date, but this update:
Fixes the lockfile hydration of the npm: protocol
Fixes the punycode deprecation warning
Fixes the projectRoot detection
Prevents crashes when reading from an empty .yarnrc.yml file
Generates nonzero exit code when yarn 2 process is killed
Updates child.js
Comment 1 Matt Kempe 2024-11-27 14:05:31 UTC
Created attachment 255490 [details]
Patch to update yarn-node20 to 1.22.22
Comment 2 Matt Kempe 2025-01-08 20:09:46 UTC
Created attachment 256555 [details]
Patch to update yarn-node22 to 1.22.22, add option for patch

New patch to:
1. Reflect change to use yarn-node22 as master port
2. Upgrade yarn to 1.22.22
3. Move/rename lingering yarn-node20 patch files
4. Add new option to support conditional patching

According to the discussion in Bug# 245425, the patch was necessary to permit yarn global operations. However, even without the patch, I was able to perform numerous yarn global operations using yarn 1.22.22 with node22 without the patch. Rather than completely get rid of it, I updated the patch so it would apply cleanly to 1.22.22, and then made it optional so those users who still need it can do it. I added the note that the option isn't recommended because of the yarn documentation which states:

"If you have used a package manager like npm previously, you may be looking for how to add global dependencies.

For the vast majority of packages it is considered a bad practice to have global dependencies because they are implicit. It is much better to add all of your dependencies locally so that they are explicit and anyone else using your project gets the same set of dependencies."
Comment 3 Matt Kempe 2025-04-22 23:56:19 UTC
Maintainer timeout?
Comment 4 Matt Kempe 2025-05-15 00:35:12 UTC
Ping - maintainer timeout.
Comment 5 Vladimir Druzenko freebsd_committer freebsd_triage 2025-05-19 16:06:42 UTC
Do you know why www/yarn-node20/files/patch-lib_cli.js was not moved to the www/yarn-node22 in commit https://cgit.freebsd.org/ports/commit/www/yarn-node20?id=ef17b830d649cd5c0c4e659015e47bc934b8ced3 ?
Comment 6 Matt Kempe 2025-05-19 18:12:09 UTC
(In reply to Vladimir Druzenko from comment #5)
I do not know. Unless the thought was to only patch yarn when used with node20, and wait for a bug report to materialize for the other node versions. And then the patch would not be carried forward unnecessarily.
Comment 8 Matt Kempe 2025-11-30 18:15:19 UTC
Created attachment 265733 [details]
Latest version of patch

This is an updated patch that:

- Makes the global patch optional (but default enabled)
- Updates yarn to latest version

Although, there have been 0 bugs filed for yarn in the 11 months since sunpoet's commit https://cgit.freebsd.org/ports/commit/?id=ef17b830d649cd5c0c4e659015e47bc934b8ced3 in Dec 2024 that changed the "default" ports/pkg behavior by not applying the global patch. Nevertheless, my revised patch applies the global patch by default while allowing users opt-out.

The upstream changelog is out of date, but the bugs fixed:
Fix the lockfile hydration of the npm: protocol
Fix the punycode deprecation warning
Fix the projectRoot detection
Prevent crashes when reading from an empty .yarnrc.yml file
Generate nonzero exit code when yarn 2 process is killed
Update child.js

Build logs:
https://pkg.compasses.xyz/data/143Ramd64-default-baseSSL/2025-11-30_12h34m21s/logs/yarn-node25-1.22.22.log
https://pkg.compasses.xyz/data/143Ramd64-default-baseSSL/2025-11-30_12h12m02s/logs/yarn-node24-1.22.22.log
https://pkg.compasses.xyz/data/143Ramd64-default-baseSSL/2025-11-30_12h20m35s/logs/yarn-node22-1.22.22.log
https://pkg.compasses.xyz/data/143Ramd64-default-baseSSL/2025-11-30_12h30m23s/logs/yarn-node20-1.22.22.log
https://pkg.compasses.xyz/data/143Ramd64-default-baseSSL/2025-11-30_12h12m02s/logs/yarn-1.22.22.log