Skip to content
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

Ensure Node versions are aligned #7959

Closed
wants to merge 1 commit into from
Closed

Ensure Node versions are aligned #7959

wants to merge 1 commit into from

Conversation

mxdvl
Copy link
Contributor

@mxdvl mxdvl commented Jun 16, 2023

What does this change?

Compare node versions in .nvmrc, riff-raff.yaml and Containerfile to ensure that they are aligned.

Why?

Helps with updates such as #7948

Left as an exercise to the reader

Implement a check for @types/node 😉

@github-actions
Copy link

github-actions bot commented Jun 16, 2023

Size Change: 0 B

Total Size: 532 kB

ℹ️ View Unchanged
Filename Size
dotcom-rendering/dist/1813.modern.********************.js 6.52 kB
dotcom-rendering/dist/2006.modern.********************.js 3.84 kB
dotcom-rendering/dist/2136.modern.********************.js 3.11 kB
dotcom-rendering/dist/2216.modern.********************.js 3.07 kB
dotcom-rendering/dist/2626.modern.********************.js 3.55 kB
dotcom-rendering/dist/2854.modern.********************.js 3.3 kB
dotcom-rendering/dist/3398.modern.********************.js 20 kB
dotcom-rendering/dist/3577.modern.********************.js 4.33 kB
dotcom-rendering/dist/3993.modern.********************.js 6.21 kB
dotcom-rendering/dist/5153.modern.********************.js 2.28 kB
dotcom-rendering/dist/516.modern.********************.js 17.3 kB
dotcom-rendering/dist/5384.modern.********************.js 3.04 kB
dotcom-rendering/dist/5474.modern.********************.js 2.53 kB
dotcom-rendering/dist/6130.modern.********************.js 2.95 kB
dotcom-rendering/dist/6297.modern.********************.js 21.3 kB
dotcom-rendering/dist/6345.modern.********************.js 4.71 kB
dotcom-rendering/dist/6633.modern.********************.js 3.22 kB
dotcom-rendering/dist/6814.modern.********************.js 5.41 kB
dotcom-rendering/dist/6939.modern.********************.js 5.35 kB
dotcom-rendering/dist/7184.modern.********************.js 10.7 kB
dotcom-rendering/dist/7392.modern.********************.js 2.49 kB
dotcom-rendering/dist/7872.modern.********************.js 1.89 kB
dotcom-rendering/dist/8326.modern.********************.js 2.55 kB
dotcom-rendering/dist/8452.modern.********************.js 4.28 kB
dotcom-rendering/dist/8888.modern.********************.js 2.75 kB
dotcom-rendering/dist/9704.modern.********************.js 2.59 kB
dotcom-rendering/dist/9861.modern.********************.js 3.5 kB
dotcom-rendering/dist/9874.modern.********************.js 4.76 kB
dotcom-rendering/dist/9977.modern.********************.js 3.81 kB
dotcom-rendering/dist/AlreadyVisited-importable.modern.********************.js 410 B
dotcom-rendering/dist/AnimatePulsingDots-importable.modern.********************.js 389 B
dotcom-rendering/dist/atomIframe.modern.********************.js 516 B
dotcom-rendering/dist/AudioAtomWrapper-importable.modern.********************.js 463 B
dotcom-rendering/dist/Branding-importable.modern.********************.js 2.18 kB
dotcom-rendering/dist/braze-web-sdk-core.modern.********************.js 36.9 kB
dotcom-rendering/dist/BrazeMessaging-importable.modern.********************.js 5.03 kB
dotcom-rendering/dist/CalloutBlockComponent-importable.modern.********************.js 6.46 kB
dotcom-rendering/dist/CalloutEmbedBlockComponent-importable.modern.********************.js 6.59 kB
dotcom-rendering/dist/Carousel-importable.modern.********************.js 5.27 kB
dotcom-rendering/dist/ChartAtomWrapper-importable.modern.********************.js 474 B
dotcom-rendering/dist/CommentCount-importable.modern.********************.js 2.77 kB
dotcom-rendering/dist/discussion.modern.********************.js 393 B
dotcom-rendering/dist/DiscussionContainer-importable.modern.********************.js 4.08 kB
dotcom-rendering/dist/DiscussionMeta-importable.modern.********************.js 3.35 kB
dotcom-rendering/dist/DocumentBlockComponent-importable.modern.********************.js 2.72 kB
dotcom-rendering/dist/EmbedBlockComponent-importable.modern.********************.js 3.25 kB
dotcom-rendering/dist/embedIframe.modern.********************.js 520 B
dotcom-rendering/dist/EnhancePinnedPost-importable.modern.********************.js 1.93 kB
dotcom-rendering/dist/FetchCommentCounts-importable.modern.********************.js 2.97 kB
dotcom-rendering/dist/FetchOnwardsData-importable.modern.********************.js 1.89 kB
dotcom-rendering/dist/FilterKeyEventsToggle-importable.modern.********************.js 3.41 kB
dotcom-rendering/dist/FocusStyles-importable.modern.********************.js 511 B
dotcom-rendering/dist/frameworks.modern.********************.js 20.5 kB
dotcom-rendering/dist/GetCricketScoreboard-importable.modern.********************.js 3.36 kB
dotcom-rendering/dist/GetMatchNav-importable.modern.********************.js 11.4 kB
dotcom-rendering/dist/GetMatchStats-importable.modern.********************.js 6.32 kB
dotcom-rendering/dist/GetMatchTabs-importable.modern.********************.js 2.42 kB
dotcom-rendering/dist/guardian-braze-components-banner.modern.********************.js 13.3 kB
dotcom-rendering/dist/guardian-braze-components-end-of-article.modern.********************.js 10.3 kB
dotcom-rendering/dist/GuideAtomWrapper-importable.modern.********************.js 476 B
dotcom-rendering/dist/HeaderTopBar-importable.modern.********************.js 13.6 kB
dotcom-rendering/dist/index.modern.********************.js 33.1 kB
dotcom-rendering/dist/InstagramBlockComponent-importable.modern.********************.js 2.79 kB
dotcom-rendering/dist/InteractiveBlockComponent-importable.modern.********************.js 5.8 kB
dotcom-rendering/dist/InteractiveContentsBlockComponent-importable.modern.********************.js 4.09 kB
dotcom-rendering/dist/InteractiveSupportButton-importable.modern.********************.js 3.82 kB
dotcom-rendering/dist/KeyEventsCarousel-importable.modern.********************.js 3.44 kB
dotcom-rendering/dist/KnowledgeQuizAtomWrapper-importable.modern.********************.js 481 B
dotcom-rendering/dist/LatestLinks-importable.modern.********************.js 1.5 kB
dotcom-rendering/dist/LiveBlogEpic-importable.modern.********************.js 4.9 kB
dotcom-rendering/dist/Liveness-importable.modern.********************.js 5.52 kB
dotcom-rendering/dist/ManyNewsletterSignUp-importable.modern.********************.js 5.59 kB
dotcom-rendering/dist/MapEmbedBlockComponent-importable.modern.********************.js 5.32 kB
dotcom-rendering/dist/Metrics-importable.modern.********************.js 2.46 kB
dotcom-rendering/dist/MostViewedFooter-importable.modern.********************.js 5.21 kB
dotcom-rendering/dist/MostViewedFooterData-importable.modern.********************.js 7.38 kB
dotcom-rendering/dist/MostViewedRightWrapper-importable.modern.********************.js 3.76 kB
dotcom-rendering/dist/newsletterEmbedIframe.modern.********************.js 621 B
dotcom-rendering/dist/OnwardsUpper-importable.modern.********************.js 3.77 kB
dotcom-rendering/dist/PersonalityQuizAtomWrapper-importable.modern.********************.js 483 B
dotcom-rendering/dist/ProfileAtomWrapper-importable.modern.********************.js 478 B
dotcom-rendering/dist/QandaAtomWrapper-importable.modern.********************.js 475 B
dotcom-rendering/dist/ReaderRevenueDev-importable.modern.********************.js 460 B
dotcom-rendering/dist/readerRevenueDevUtils.modern.********************.js 2.7 kB
dotcom-rendering/dist/ReaderRevenueLinks-importable.modern.********************.js 5.4 kB
dotcom-rendering/dist/RecipeMultiplier-importable.modern.********************.js 3.23 kB
dotcom-rendering/dist/relativeTime.modern.********************.js 976 B
dotcom-rendering/dist/RichLinkComponent-importable.modern.********************.js 5.05 kB
dotcom-rendering/dist/SecureSignupIframe-importable.modern.********************.js 2.54 kB
dotcom-rendering/dist/SendAMessage-importable.modern.********************.js 4.37 kB
dotcom-rendering/dist/sentry.modern.********************.js 766 B
dotcom-rendering/dist/SetABTests-importable.modern.********************.js 3.88 kB
dotcom-rendering/dist/ShareCount-importable.modern.********************.js 2.91 kB
dotcom-rendering/dist/shimport.modern.********************.js 2.78 kB
dotcom-rendering/dist/ShowHideContainers-importable.modern.********************.js 719 B
dotcom-rendering/dist/ShowMore-importable.modern.********************.js 5.04 kB
dotcom-rendering/dist/SignInGateMain.modern.********************.js 2.93 kB
dotcom-rendering/dist/SignInGateMainCheckoutComplete.modern.********************.js 3.84 kB
dotcom-rendering/dist/SignInGateSelector-importable.modern.********************.js 3.45 kB
dotcom-rendering/dist/SlotBodyEnd-importable.modern.********************.js 2.82 kB
dotcom-rendering/dist/Snow-importable.modern.********************.js 4.26 kB
dotcom-rendering/dist/SpotifyBlockComponent-importable.modern.********************.js 5.17 kB
dotcom-rendering/dist/StickyBottomBanner-importable.modern.********************.js 3.94 kB
dotcom-rendering/dist/SubNav-importable.modern.********************.js 2.85 kB
dotcom-rendering/dist/SupportTheG-importable.modern.********************.js 5.43 kB
dotcom-rendering/dist/TableOfContents-importable.modern.********************.js 3.08 kB
dotcom-rendering/dist/TimelineAtomWrapper-importable.modern.********************.js 476 B
dotcom-rendering/dist/TopRightAdSlot-importable.modern.********************.js 631 B
dotcom-rendering/dist/TweetBlockComponent-importable.modern.********************.js 1 kB
dotcom-rendering/dist/UnsafeEmbedBlockComponent-importable.modern.********************.js 2.8 kB
dotcom-rendering/dist/VideoFacebookBlockComponent-importable.modern.********************.js 5.33 kB
dotcom-rendering/dist/VineBlockComponent-importable.modern.********************.js 2.64 kB
dotcom-rendering/dist/YoutubeBlockComponent-importable.modern.********************.js 4.05 kB

compressed-size-action

check the following places:
- .nvmrc
- riff-raff.yaml
- Containerfile
@mxdvl mxdvl added the Health label Jun 16, 2023
@mxdvl mxdvl marked this pull request as ready for review June 16, 2023 15:21
@mxdvl mxdvl requested a review from a team as a code owner June 16, 2023 15:21
@sndrs
Copy link
Member

sndrs commented Jun 16, 2023

would this work better as a commit hook that checks all those files if any of them appear in the list of changed files?

@mxdvl
Copy link
Contributor Author

mxdvl commented Jun 20, 2023

would this work better as a commit hook that checks all those files if any of them appear in the list of changed files?

What’s the benefit of a commit hook over a CI check? Is it only about how quickly the developer is informed of the error? Is there any risk that it could be disabled in certain contexts?

@sndrs
Copy link
Member

sndrs commented Jun 20, 2023

What’s the benefit of a commit hook over a CI check? Is it only about how quickly the developer is informed of the error?

yes, basically. if we're going to check something, why wait until last possible moment to check it?

Is there any risk that it could be disabled in certain contexts?

not really, you'd have to work quite hard to get round husky while still finding a way to install NPM packages.

that said, would it work better as part of make validate? maybe a lint-project target that's also run as part of validate?

@mxdvl
Copy link
Contributor Author

mxdvl commented Jun 20, 2023

I appreciate the suggestions, but the main issue is that would make Deno a hard requirement for contributors to commit on this codebase, which is not currently the case.

Considering that at the current cadence LTS versions of Node are released at most once a year in late October, this proposal attempts to catch a bug which can only happen on very rare occasions. Ideally, I would leave further tweaks and refinements for @guardian/dotcom-platform to implement.

@sndrs
Copy link
Member

sndrs commented Jun 20, 2023

that would make Deno a hard requirement for contributors to commit

if the idea is to catch a mistake, and mistakes are best caught as early as possible, then is deno the right technology to use here?

our choice of technology should be guided by our requirements – this could be written in Node or bash without adding any new dependencies.

i reckon we could also get away with a regex check in all 3 files, that should be enough? that way we can remove the dependencies of the current deno script too

@mxdvl
Copy link
Contributor Author

mxdvl commented Jun 20, 2023

I implemented this quickly as a reaction to a chat thread that asked whether it would be technically feasible, but have little time to implement a different approach. If this PR is deemed unsatisfactory for any reason I’ll simply close it and let the team figure out a solution by end of April 2025.

i reckon we could also get away with a regex check in all 3 files, that should be enough? that way we can remove the dependencies of the current deno script too

My aim here was to maximise safety by using a strongly-typed and fully parsed approach. The issues with alternatives are as follows:

  • Node: need would need to add depdencies by add the parsing libraries to our package.json, giving them implicit acceptability–here that would be zod.
  • Bash: I do not have enoug familiarity to produce something that behaves consistently
  • Regular expressions: hard to maintain and would require a reimplementation of SemVer parsing, which is a solved problem

@mxdvl
Copy link
Contributor Author

mxdvl commented Jun 21, 2023

Closing in favour of an incoming pre-commit hook using a RegExp

@mxdvl mxdvl closed this Jun 21, 2023
@mxdvl mxdvl deleted the mxdvl/node-versions branch June 21, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants