-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
chore(site): rename and merge utilities #7853
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR renames several utility files and updates their import paths to improve clarity and consistency in the utility folder. The changes remove redundant naming patterns and merge similar utility functions under consolidated names.
- Updated import paths to remove "Utils" suffixes.
- Renamed modules (e.g., stringUtils to string, authorUtils to author, dateUtils to date, downloadUtils to download, etc.) for clarity.
- Updated internal references in components and pages accordingly.
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
apps/site/components/withBreadcrumbs.tsx | Updated import for dashToCamelCase from stringUtils to string |
apps/site/components/withBlogCategories.tsx | Updated import for mapAuthorToCardAuthors from authorUtils to author |
apps/site/components/withBanner.tsx | Updated import for dateIsBetween from dateUtils to date |
apps/site/components/withBadgeGroup.tsx | Updated import for dateIsBetween from dateUtils to date |
apps/site/components/withAvatarGroup.tsx | Updated import for getAuthors from authorUtils to author |
apps/site/components/Downloads/Release/ReleaseCodeBox.tsx | Updated import for INSTALL_METHODS from downloadUtils to download |
apps/site/components/Downloads/Release/PrebuiltDownloadButtons.tsx | Updated imports from downloadUtils to download for getNodeDownloadUrl and others |
apps/site/components/Downloads/Release/PlatformDropdown.tsx | Updated imports for download utilities including getUserPlatform from downloadUtils to ua |
apps/site/components/Downloads/Release/PackageManagerDropdown.tsx | Updated imports from downloadUtils to download |
apps/site/components/Downloads/Release/OperatingSystemDropdown.tsx | Updated imports from downloadUtils to download |
apps/site/components/Downloads/Release/InstallationMethodDropdown.tsx | Updated imports from downloadUtils to download |
apps/site/components/Downloads/Release/DownloadLink.tsx | Updated import for DownloadKind from getNodeDownloadUrl to download |
apps/site/components/Downloads/MinorReleasesTable/index.tsx | Updated import for getNodeApiLink from getNodeApiLink to api |
apps/site/components/Downloads/DownloadLink.tsx | Updated imports for getNodeDownloadUrl and getUserPlatform from legacy paths to new ones |
apps/site/components/Downloads/DownloadButton/index.tsx | Updated imports for getNodeDownloadUrl and getUserPlatform from legacy paths to new ones |
apps/site/components/Blog/BlogPostCard/index.tsx | Updated import for mapBlogCategoryToPreviewType from blogUtils to blog |
apps/site/client-context.ts | Updated import for assignClientContext from assignClientContext to context |
apps/site/app/[locale]/next-data/page-data/route.ts | Updated import for parseRichTextIntoPlainText from stringUtils to string |
apps/site/app/[locale]/next-data/og/[category]/[title]/route.tsx | Updated variable naming and removed hexToRGBA conversion to use rgb() strings directly |
apps/site/app/[locale]/next-data/api-data/route.ts | Updated imports for getGitHubApiDocsUrl, parseRichTextIntoPlainText from legacy paths to github and string respectively |
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #7853 +/- ##
==========================================
- Coverage 75.46% 75.34% -0.12%
==========================================
Files 101 96 -5
Lines 8305 8316 +11
Branches 218 218
==========================================
- Hits 6267 6266 -1
- Misses 2036 2048 +12
Partials 2 2 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodeApiLink
is better because it's apiLink related. API alone it's explicit. Is it a rest api ? A client ? you don't know with api
so it's why we need to have a better name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense, it's the API utilities.
|
||
// This is the Route Handler for the `GET` method which handles the request | ||
// for generating OpenGraph images for Blog Posts and Pages | ||
// @see https://nextjs.org/docs/app/building-your-application/routing/router-handlers | ||
export const GET = async (_: Request, props: StaticParams) => { | ||
const params = await props.params; | ||
|
||
const categoryColour = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive by nit: i've never seen us have an authoritative stance on English or American spellings, and as such allow both personally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe name it objects
?
|
||
export type DownloadKind = 'installer' | 'binary' | 'source'; | ||
|
||
export const getNodeDownloadUrl = ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be in another file IMO
@@ -149,3 +150,76 @@ export const PLATFORMS = Object.fromEntries( | |||
})), | |||
]) | |||
) as Record<UserOS | 'LOADING', Array<DownloadDropdownItem<UserPlatform>>>; | |||
|
|||
export type DownloadKind = 'installer' | 'binary' | 'source'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to types folder
Description
All of our utility files are either: suffixed with
Utils
(Why? We are already in a utility folder), or named after a single-function that the contain. This PR updates those files to have names based on what functions they contain, rather than the function names themselves (i.e.download
overdownloadUtils
, andapi
overgetNodeApiLink
)Validation
Nothing should change