Skip to content

👋 yarn@1: align some DCR deps #9565

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2023
Merged

👋 yarn@1: align some DCR deps #9565

merged 1 commit into from
Nov 21, 2023

Conversation

sndrs
Copy link
Member

@sndrs sndrs commented Nov 20, 2023

What does this change?

aligns some root and dcr deps, making the workspace more explicit and apps less dependent on yarn 1's hoisting

edit: a wider discussion about this took place in the comments, including a breakdown of the rationale (which should have been in the description originally really) – see #9565 (review) for more info

Why?

prep for moving away from yarn 1

@sndrs sndrs added the DevX label Nov 20, 2023
@sndrs sndrs requested a review from a team as a code owner November 20, 2023 15:27
@sndrs sndrs changed the title yarn@1: align some DCR deps 👋yarn@1: align some DCR deps Nov 20, 2023
@sndrs sndrs changed the title 👋yarn@1: align some DCR deps 👋 yarn@1: align some DCR deps Nov 20, 2023
Copy link

github-actions bot commented Nov 20, 2023

Size Change: 0 B

Total Size: 700 kB

ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/100.web.********************.js 990 B
dotcom-rendering/dist/1076.web.********************.js 3.08 kB
dotcom-rendering/dist/1136.web.********************.js 884 B
dotcom-rendering/dist/1178.web.********************.js 504 B
dotcom-rendering/dist/1226.web.********************.js 3.66 kB
dotcom-rendering/dist/1294.web.********************.js 5.36 kB
dotcom-rendering/dist/1406.web.********************.js 5.09 kB
dotcom-rendering/dist/1418.web.********************.js 9.98 kB
dotcom-rendering/dist/1465.web.********************.js 3.32 kB
dotcom-rendering/dist/1520.web.********************.js 492 B
dotcom-rendering/dist/1521.web.********************.js 5.48 kB
dotcom-rendering/dist/1659.web.********************.js 518 B
dotcom-rendering/dist/1714.web.********************.js 3.5 kB
dotcom-rendering/dist/1959.web.********************.js 29.5 kB
dotcom-rendering/dist/1987.web.********************.js 3.12 kB
dotcom-rendering/dist/2092.web.********************.js 849 B
dotcom-rendering/dist/2096.web.********************.js 13 kB
dotcom-rendering/dist/2133.web.********************.js 4.46 kB
dotcom-rendering/dist/2186.web.********************.js 916 B
dotcom-rendering/dist/2351.web.********************.js 3.34 kB
dotcom-rendering/dist/2394.web.********************.js 3.22 kB
dotcom-rendering/dist/2467.web.********************.js 2.08 kB
dotcom-rendering/dist/2510.web.********************.js 663 B
dotcom-rendering/dist/2511.web.********************.js 819 B
dotcom-rendering/dist/254.web.********************.js 638 B
dotcom-rendering/dist/2546.web.********************.js 3.72 kB
dotcom-rendering/dist/2879.web.********************.js 910 B
dotcom-rendering/dist/2919.web.********************.js 900 B
dotcom-rendering/dist/2923.web.********************.js 720 B
dotcom-rendering/dist/3030.web.********************.js 957 B
dotcom-rendering/dist/3111.web.********************.js 590 B
dotcom-rendering/dist/3146.web.********************.js 6.53 kB
dotcom-rendering/dist/3149.web.********************.js 636 B
dotcom-rendering/dist/3265.web.********************.js 916 B
dotcom-rendering/dist/3302.web.********************.js 820 B
dotcom-rendering/dist/3389.web.********************.js 884 B
dotcom-rendering/dist/3795.web.********************.js 797 B
dotcom-rendering/dist/3968.web.********************.js 3.79 kB
dotcom-rendering/dist/4012.web.********************.js 783 B
dotcom-rendering/dist/4349.web.********************.js 775 B
dotcom-rendering/dist/4591.web.********************.js 404 B
dotcom-rendering/dist/4593.web.********************.js 1.74 kB
dotcom-rendering/dist/4627.web.********************.js 783 B
dotcom-rendering/dist/4797.web.********************.js 744 B
dotcom-rendering/dist/480.web.********************.js 524 B
dotcom-rendering/dist/489.web.********************.js 5.22 kB
dotcom-rendering/dist/5113.web.********************.js 2.78 kB
dotcom-rendering/dist/5225.web.********************.js 6.67 kB
dotcom-rendering/dist/5332.web.********************.js 820 B
dotcom-rendering/dist/5495.web.********************.js 676 B
dotcom-rendering/dist/5688.web.********************.js 3.79 kB
dotcom-rendering/dist/5744.web.********************.js 720 B
dotcom-rendering/dist/6068.web.********************.js 775 B
dotcom-rendering/dist/6126.web.********************.js 2.23 kB
dotcom-rendering/dist/6295.web.********************.js 999 B
dotcom-rendering/dist/639.web.********************.js 951 B
dotcom-rendering/dist/6428.web.********************.js 741 B
dotcom-rendering/dist/6442.web.********************.js 2.77 kB
dotcom-rendering/dist/657.web.********************.js 2.46 kB
dotcom-rendering/dist/6609.web.********************.js 872 B
dotcom-rendering/dist/6967.web.********************.js 850 B
dotcom-rendering/dist/7569.web.********************.js 4.94 kB
dotcom-rendering/dist/7650.web.********************.js 23 kB
dotcom-rendering/dist/7701.web.********************.js 647 B
dotcom-rendering/dist/8085.web.********************.js 2.59 kB
dotcom-rendering/dist/8112.web.********************.js 3.37 kB
dotcom-rendering/dist/818.web.********************.js 2.85 kB
dotcom-rendering/dist/8268.web.********************.js 5.23 kB
dotcom-rendering/dist/8395.web.********************.js 580 B
dotcom-rendering/dist/8401.web.********************.js 922 B
dotcom-rendering/dist/8414.web.********************.js 4.91 kB
dotcom-rendering/dist/8439.web.********************.js 4.94 kB
dotcom-rendering/dist/9196.web.********************.js 784 B
dotcom-rendering/dist/9251.web.********************.js 2.22 kB
dotcom-rendering/dist/9390.web.********************.js 743 B
dotcom-rendering/dist/9422.web.********************.js 614 B
dotcom-rendering/dist/9581.web.********************.js 797 B
dotcom-rendering/dist/9582.web.********************.js 710 B
dotcom-rendering/dist/9597.web.********************.js 3.25 kB
dotcom-rendering/dist/9617.web.********************.js 1 kB
dotcom-rendering/dist/9724.web.********************.js 5.02 kB
dotcom-rendering/dist/AdPortals-importable.web.********************.js 4.29 kB
dotcom-rendering/dist/AlreadyVisited-importable.web.********************.js 412 B
dotcom-rendering/dist/AppEmailSignUp-importable.web.********************.js 7.21 kB
dotcom-rendering/dist/AppsEpic-importable.web.********************.js 3.96 kB
dotcom-rendering/dist/AppsFooter-importable.web.********************.js 3.44 kB
dotcom-rendering/dist/AppsLightboxImage-importable.web.********************.js 2.82 kB
dotcom-rendering/dist/AudioAtomWrapper-importable.web.********************.js 3.27 kB
dotcom-rendering/dist/AustralianTerritorySwitcher-importable.web.********************.js 4.6 kB
dotcom-rendering/dist/Branding-importable.web.********************.js 2.46 kB
dotcom-rendering/dist/braze-web-sdk-core.web.********************.js 36.9 kB
dotcom-rendering/dist/BrazeMessaging-importable.web.********************.js 5.28 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.web.********************.js 6.47 kB
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.web.********************.js 5.76 kB
dotcom-rendering/dist/CardCommentCount-importable.web.********************.js 2.67 kB
dotcom-rendering/dist/Carousel-importable.web.********************.js 7.62 kB
dotcom-rendering/dist/CarouselForNewsletters-importable.web.********************.js 5.6 kB
dotcom-rendering/dist/ChartAtom-importable.web.********************.js 500 B
dotcom-rendering/dist/CommentCount-importable.web.********************.js 2.85 kB
dotcom-rendering/dist/DiscussionContainer-importable.web.********************.js 23.7 kB
dotcom-rendering/dist/DiscussionMeta-importable.web.********************.js 3.44 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.web.********************.js 3.52 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.web.********************.js 4.05 kB
dotcom-rendering/dist/EnhancePinnedPost-importable.web.********************.js 1.95 kB
dotcom-rendering/dist/FetchOnwardsData-importable.web.********************.js 2.5 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.web.********************.js 3.32 kB
dotcom-rendering/dist/FocusStyles-importable.web.********************.js 607 B
dotcom-rendering/dist/FollowWrapper-importable.web.********************.js 3.9 kB
dotcom-rendering/dist/FooterLabel-importable.web.********************.js 336 B
dotcom-rendering/dist/frameworks.web.********************.js 20.8 kB
dotcom-rendering/dist/GetCricketScoreboard-importable.web.********************.js 3.26 kB
dotcom-rendering/dist/GetMatchNav-importable.web.********************.js 12.5 kB
dotcom-rendering/dist/GetMatchStats-importable.web.********************.js 355 B
dotcom-rendering/dist/GetMatchTabs-importable.web.********************.js 2.31 kB
dotcom-rendering/dist/guardian-braze-components-banner.web.********************.js 13.4 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.web.********************.js 9 kB
dotcom-rendering/dist/GuideAtomWrapper-importable.web.********************.js 790 B
dotcom-rendering/dist/HeaderTopBar-importable.web.********************.js 10.8 kB
dotcom-rendering/dist/index.web.********************.js 45.3 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.web.********************.js 3.59 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.web.********************.js 5.94 kB
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.web.********************.js 3.79 kB
dotcom-rendering/dist/InteractiveSupportButton-importable.web.********************.js 3.83 kB
dotcom-rendering/dist/KeyEventsCarousel-importable.web.********************.js 2.96 kB
dotcom-rendering/dist/KnowledgeQuizAtom-importable.web.********************.js 3.52 kB
dotcom-rendering/dist/LatestLinks-importable.web.********************.js 1.17 kB
dotcom-rendering/dist/LightboxHash-importable.web.********************.js 430 B
dotcom-rendering/dist/LightboxJavascript-importable.web.********************.js 4.43 kB
dotcom-rendering/dist/LiveBlogEpic-importable.web.********************.js 4.79 kB
dotcom-rendering/dist/Liveness-importable.web.********************.js 3.34 kB
dotcom-rendering/dist/ManyNewsletterSignUp-importable.web.********************.js 4.98 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.web.********************.js 5.55 kB
dotcom-rendering/dist/Metrics-importable.web.********************.js 2.27 kB
dotcom-rendering/dist/MostViewedFooter-importable.web.********************.js 5.62 kB
dotcom-rendering/dist/MostViewedFooterData-importable.web.********************.js 7.91 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.web.********************.js 3.9 kB
dotcom-rendering/dist/OnwardsUpper-importable.web.********************.js 4.17 kB
dotcom-rendering/dist/PersonalityQuizAtom-importable.web.********************.js 3.66 kB
dotcom-rendering/dist/ProfileAtom-importable.web.********************.js 547 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.web.********************.js 810 B
dotcom-rendering/dist/PulsingDot-importable.web.********************.js 744 B
dotcom-rendering/dist/QandaAtom-importable.web.********************.js 542 B
dotcom-rendering/dist/ReaderRevenueDev-importable.web.********************.js 466 B
dotcom-rendering/dist/readerRevenueDevUtils.web.********************.js 2.44 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.web.********************.js 4.78 kB
dotcom-rendering/dist/RecipeMultiplier-importable.web.********************.js 3.16 kB
dotcom-rendering/dist/RelativeTime-importable.web.********************.js 1.92 kB
dotcom-rendering/dist/RichLinkComponent-importable.web.********************.js 6.32 kB
dotcom-rendering/dist/SecureSignupIframe-importable.web.********************.js 4.93 kB
dotcom-rendering/dist/SendAMessage-importable.web.********************.js 4.38 kB
dotcom-rendering/dist/SendTargetingParams-importable.web.********************.js 2.04 kB
dotcom-rendering/dist/sentry.web.********************.js 773 B
dotcom-rendering/dist/SetABTests-importable.web.********************.js 3.37 kB
dotcom-rendering/dist/SetAdTargeting-importable.web.********************.js 481 B
dotcom-rendering/dist/shimport.web.********************.js 2.78 kB
dotcom-rendering/dist/ShowHideContainers-importable.web.********************.js 642 B
dotcom-rendering/dist/ShowMore-importable.web.********************.js 5.59 kB
dotcom-rendering/dist/SignInGateMain.web.********************.js 3.86 kB
dotcom-rendering/dist/SignInGateMainCheckoutComplete.web.********************.js 4.93 kB
dotcom-rendering/dist/SignInGateSelector-importable.web.********************.js 5.52 kB
dotcom-rendering/dist/SlotBodyEnd-importable.web.********************.js 6.43 kB
dotcom-rendering/dist/Snow-importable.web.********************.js 3.02 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.web.********************.js 5.39 kB
dotcom-rendering/dist/StickyBottomBanner-importable.web.********************.js 5.74 kB
dotcom-rendering/dist/SubNav-importable.web.********************.js 2.36 kB
dotcom-rendering/dist/SupportTheG-importable.web.********************.js 4.89 kB
dotcom-rendering/dist/TableOfContents-importable.web.********************.js 3.05 kB
dotcom-rendering/dist/TimelineAtom-importable.web.********************.js 1.22 kB
dotcom-rendering/dist/TweetBlockComponent-importable.web.********************.js 1.01 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.web.********************.js 3.6 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.web.********************.js 5.56 kB
dotcom-rendering/dist/VineBlockComponent-importable.web.********************.js 3.46 kB
dotcom-rendering/dist/WeatherWrapper-importable.web.********************.js 5.41 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.web.********************.js 3.73 kB

compressed-size-action

@sndrs sndrs force-pushed the sndrs/remove-yarn@1-pt3 branch from 049da2f to 5fb9102 Compare November 20, 2023 16:26
@sndrs sndrs force-pushed the sndrs/remove-yarn@1-pt3 branch from 5fb9102 to 94761fa Compare November 20, 2023 16:32
@sndrs sndrs mentioned this pull request Nov 20, 2023
@sndrs sndrs self-assigned this Nov 20, 2023
@@ -41,8 +41,7 @@
"lint-staged": "13.2.1",
"npm-run-all": "^4.1.5",
"prettier": "3.0.3",
"tslib": "2.5.3",
"typescript": "5.1.3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does TypeScript need to be removed from the top-level package? Does this not increase the risk of mismatched TS versions? And why would tslib be left there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does TypeScript need to be removed from the top-level package? Does this not increase the risk of mismatched TS versions?

So nothing in the root actually uses TypeScript.

Right now, this root dependency is only there to provide DCR with TypeScript (because DCR doesn't declare a dependency on it), but not AR (which has a declared dependency an earlier version and is not part of the workspace).

As you suggest, there are two ways of providing common deps like this - installing them once in the root, or by requiring projects in the workspace to be explicit.

In csnx, we've found it a lot more straightforward to have projects declare their own dependencies (the ones declared here are for deps that are also used by the root, so we know are present – this set up also feels a bit weird to me).

But if you chose to provide them all from the root, then you need to know exactly which dependencies all projects have, manually decide which of those make sense to pull up to the root, and then keep on top of whether those projects continue to need them (since they're not declared anywhere, how do you know?).

You are also bound to change all projects simultaneously, which can make a simple bump in one package a far more complicated change as you fix a load of issues in unrelated packages.

The trade off is needing to manually keep common dependencies in sync (note these are not peerDeps, just common deps – as long as packages declare peerDependencies, this should be safe).

Moving common dependency declarations to the root does guarantee version parity across projects, but at the cost of flexibility and an increased maintenance overhead (are the assumptions in the root still correct?).

It's also worth considering that AR and DCR currently use different versions of TypeScript without issue. In CSNX we have linting scripts, for example, in the root that run across all projects that we therefore want to only use the root version of eslint.

I think it's tempting to think that version parity is always preferable over drift, but the cost of forcing it is high and where it's not a direct a benefit (i.e. the code can run) it's not proven to be worth it, at least in our experience of CSNX.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why would tslib be left there?

it's a peer dep of @guardian/prettier

Copy link
Contributor

@mxdvl mxdvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for a very clearly explained rationale in https://github.com/guardian/dotcom-rendering/pull/9565/files#r1400398584

I’d suggest bringing this up in the PR description, as it’s one of the best writeup on the distinction between root and workspace dependencies I’ve seen! 👏

@sndrs sndrs added this to the 👋 Yarn v1 milestone Nov 21, 2023
@sndrs sndrs merged commit 8bc38b5 into main Nov 21, 2023
@sndrs sndrs deleted the sndrs/remove-yarn@1-pt3 branch November 21, 2023 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants