diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index 4552a5a2057..9899e7d5611 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -14,6 +14,7 @@ import users from './showcase.json'; import versions from './versions.json'; import prismThemeDark from './core/PrismThemeDark'; import prismThemeLight from './core/PrismThemeLight'; +import releaseDatesPlugin from './plugins/releaseDates'; import remarkSnackPlayer from '@react-native-website/remark-snackplayer'; import remarkCodeblockLanguageTitle from '@react-native-website/remark-codeblock-language-as-title'; @@ -223,6 +224,7 @@ const config: Config = { ], plugins: [ 'docusaurus-plugin-sass', + releaseDatesPlugin, function disableExpensiveBundlerOptimizationPlugin() { return { name: 'disable-expensive-bundler-optimizations', diff --git a/website/plugins/releaseDates.ts b/website/plugins/releaseDates.ts new file mode 100644 index 00000000000..a214ccd7e1b --- /dev/null +++ b/website/plugins/releaseDates.ts @@ -0,0 +1,86 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import type {Plugin} from '@docusaurus/types'; + +import {RELEASES} from '../src/components/releases/releasesData'; + +export type ReleaseDates = Record; + +const API_URL = 'https://api.github.com/repos/react/react-native/releases'; +const TAG_PATTERN = /^v(\d+\.\d+)\.\d+(-rc\.\d+)?$/; +const REQUEST_TIMEOUT_MS = 15_000; + +interface GitHubRelease { + tag_name: string; + created_at: string | null; + draft: boolean; +} + +/** + * Fetches every React Native GitHub release at build time and exposes the RC, + * .0 and patch dates for the series in `releasesData.ts` as global data, so + * the Release Calendar renders accurate historical dates without a runtime + * GitHub API call. Set `GITHUB_TOKEN` to avoid unauthenticated rate limits. + */ +export default function releaseDatesPlugin(): Plugin { + return { + name: 'release-dates', + + async loadContent() { + const trackedSeries = new Set(RELEASES.map(r => r.version)); + const headers: Record = { + Accept: 'application/vnd.github+json', + }; + if (process.env.GITHUB_TOKEN) { + headers.Authorization = `Bearer ${process.env.GITHUB_TOKEN}`; + } + + const dates: ReleaseDates = {}; + try { + for (let page = 1; ; page++) { + const response = await fetch(`${API_URL}?per_page=100&page=${page}`, { + headers, + signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS), + }); + if (!response.ok) { + throw new Error(`GitHub API responded ${response.status}`); + } + const releases = (await response.json()) as GitHubRelease[]; + for (const release of releases) { + const series = TAG_PATTERN.exec(release.tag_name)?.[1]; + if ( + release.draft || + !release.created_at || + !series || + !trackedSeries.has(series) + ) { + continue; + } + // `created_at` is the date of the release commit, which matches + // when the version shipped more closely than `published_at`. + dates[release.tag_name] = release.created_at.slice(0, 10); + } + if (releases.length < 100) { + break; + } + } + } catch (error) { + // Don't fail the build: the calendar falls back to its live fetch. + console.warn( + `[release-dates] Could not load GitHub release dates: ${String(error)}` + ); + return {}; + } + return dates; + }, + + async contentLoaded({content, actions}) { + actions.setGlobalData(content); + }, + }; +} diff --git a/website/releases/schedule.mdx b/website/releases/schedule.mdx new file mode 100644 index 00000000000..90aa5ccab84 --- /dev/null +++ b/website/releases/schedule.mdx @@ -0,0 +1,17 @@ +--- +title: Release Calendar +sidebar_label: Release Calendar +hide_table_of_contents: true +--- + +import ReleaseScheduleCalendar from '@site/src/components/releases/ReleaseScheduleCalendar'; + +View upcoming and recent React Native releases, release candidate milestones, and support windows. For support level definitions and release channels, see the [Releases Overview](/releases/overview). + + + +:::note + +Release dates are shared with the [Releases Overview](/releases/overview) table and enriched with published release candidate tags from [GitHub Releases](https://github.com/react/react-native/releases). Actual dates may shift for stabilization blockers. + +::: diff --git a/website/sidebarsReleases.ts b/website/sidebarsReleases.ts index 5ccef8a3cab..c30aeed47f8 100644 --- a/website/sidebarsReleases.ts +++ b/website/sidebarsReleases.ts @@ -3,6 +3,7 @@ import type {SidebarsConfig} from '@docusaurus/plugin-content-docs'; export default { releases: [ 'overview', + 'schedule', 'branches', 'versioning-policy', { diff --git a/website/src/components/releases/ReleaseScheduleCalendar.module.css b/website/src/components/releases/ReleaseScheduleCalendar.module.css new file mode 100644 index 00000000000..ffd04d7d0bb --- /dev/null +++ b/website/src/components/releases/ReleaseScheduleCalendar.module.css @@ -0,0 +1,1090 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +.root { + --rn-cal-dot-cut: var(--home-button-primary); + --rn-cal-dot-rc: var(--home-code-purple); + --rn-cal-dot-golden: #c87400; + --rn-cal-dot-stable: var(--home-code-green); + --rn-cal-dot-patch: #0f8b8d; + --rn-cal-now: var(--home-code-red); + --rn-cal-seg-rc-bg: var(--home-feature-background-1); + --rn-cal-seg-rc-fg: #5930a3; + --rn-cal-seg-rc-border: rgb(111 66 193 / 0.35); + --rn-cal-seg-active-bg: var(--home-feature-background-3); + --rn-cal-seg-active-fg: #155d27; + --rn-cal-seg-active-border: rgb(34 134 58 / 0.35); + --rn-cal-seg-eoc-bg: rgb(255 229 100 / 0.35); + --rn-cal-seg-eoc-fg: #7c4a00; + --rn-cal-seg-eoc-border: rgb(200 116 0 / 0.38); + --ifm-tabs-color-active: var(--home-button-primary); + --ifm-tabs-color-active-border: var(--home-button-primary); + + display: flex; + flex-direction: column; + gap: 1.25rem; + margin-bottom: 1.5rem; +} + +[data-theme="dark"] .root { + --rn-cal-dot-golden: #fb923c; + --rn-cal-dot-patch: #2dd4bf; + --rn-cal-seg-rc-bg: var(--home-feature-background-1); + --rn-cal-seg-rc-fg: #d4bfff; + --rn-cal-seg-rc-border: rgb(167 124 247 / 0.4); + --rn-cal-seg-active-bg: var(--home-feature-background-3); + --rn-cal-seg-active-fg: #8df0a5; + --rn-cal-seg-active-border: rgb(116 230 143 / 0.38); + --rn-cal-seg-eoc-bg: rgb(251 146 60 / 0.16); + --rn-cal-seg-eoc-fg: #fdba74; + --rn-cal-seg-eoc-border: rgb(251 146 60 / 0.38); +} + +/* Summary KPIs */ +.kpiGrid { + display: grid; + grid-template-columns: repeat(4, minmax(0, 1fr)); + gap: 0.75rem; +} + +.kpiCard { + background-color: var(--home-background); + border: 1px solid var(--home-border); + border-radius: var(--ifm-global-radius); + box-shadow: var(--ifm-table-box-shadow); + padding: 0.85rem 1rem; + display: flex; + flex-direction: column; + gap: 0.2rem; +} + +.kpiLabel { + font-size: 0.78rem; + font-weight: 500; + color: var(--subtle); +} + +.kpiValue { + font-size: 1.05rem; + font-weight: 700; + color: var(--ifm-font-color-base); +} + +.kpiSub { + font-size: 0.78rem; + color: var(--subtle); +} + +/* Buttons — match Home page "Get Started" & "Learn the Basics" shades */ +.btn { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 0.35rem; + height: 32px; + padding: 0 0.75rem; + border-radius: 7px; + border: 1px solid var(--home-button-secondary-border); + background-color: var(--home-button-secondary); + color: var(--home-button-secondary-text); + font-family: inherit; + font-size: 0.82rem; + font-weight: 500; + line-height: 1; + cursor: pointer; + white-space: nowrap; + transition: + background-color 150ms ease, + border-color 150ms ease, + color 150ms ease; +} + +.btn:hover:not(:disabled) { + background-color: var(--home-button-secondary-hover); + border-color: var(--ifm-color-emphasis-500); +} + +.btn:disabled { + opacity: 0.42; + cursor: not-allowed; +} + +.btnIcon { + padding: 0 0.5rem; +} + +.btnPrimary { + background-color: var(--home-button-primary); + border-color: var(--home-button-primary); + color: var(--home-button-primary-text); + font-weight: 600; +} + +.btnPrimary:hover:not(:disabled) { + background-color: var(--home-button-primary-hover); + border-color: var(--home-button-primary-hover); + color: var(--home-button-primary-text); +} + +.btnGroup { + display: inline-flex; + align-items: center; +} + +.btnGroup .btn { + border-radius: 0; + margin-left: -1px; +} + +.btnGroup .btn:first-child { + border-top-left-radius: 7px; + border-bottom-left-radius: 7px; + margin-left: 0; +} + +.btnGroup .btn:last-child { + border-top-right-radius: 7px; + border-bottom-right-radius: 7px; +} + +.btnGroup .btnPrimary { + position: relative; + z-index: 1; +} + +.filterChip { + display: inline-flex; + align-items: center; + gap: 0.38rem; + height: 30px; + padding: 0 0.65rem; + border-radius: 999px; + border: 1px solid var(--home-button-secondary-border); + background-color: var(--home-button-secondary); + color: var(--subtle); + font-family: inherit; + font-size: 0.78rem; + font-weight: 500; + cursor: pointer; + white-space: nowrap; + transition: + background-color 150ms ease, + border-color 150ms ease, + color 150ms ease; +} + +.filterChip:hover { + background-color: var(--home-button-secondary-hover); + color: var(--ifm-font-color-base); +} + +.filterChipActive { + background-color: var(--sidebar-active-item-background); + border-color: var(--home-button-primary); + color: var(--ifm-font-color-base); + font-weight: 600; +} + +.filterChipActive:hover { + background-color: var(--sidebar-active-item-background); + border-color: var(--home-button-primary-hover); +} + +/* Tabs header */ +.tabsHeader { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 1rem; + border-bottom: 1px solid var(--ifm-table-border-color); +} + +.tabsList { + display: flex; + flex-wrap: wrap; + align-items: stretch; + margin: 0; + padding: 0; + border-bottom: 0; +} + +.tabButton { + background: transparent; + border-top: 0; + border-right: 0; + border-left: 0; + font-family: inherit; + font-size: 0.9rem; + margin: 0; + line-height: 1.4; +} + +.tabsRight { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.85rem; + padding-bottom: 0.4rem; +} + +.checkboxLabel { + display: inline-flex; + align-items: center; + gap: 0.4rem; + font-size: 0.82rem; + color: var(--subtle); + cursor: pointer; + user-select: none; +} + +.syncBar { + display: inline-flex; + align-items: center; + gap: 0.45rem; + font-size: 0.8rem; + color: var(--subtle); +} + +.syncDot { + width: 7px; + height: 7px; + border-radius: 999px; + display: inline-block; + background: var(--rn-cal-dot-stable); +} + +.syncDotPending { + background: var(--rn-cal-dot-golden); +} + +.syncDotOffline { + background: var(--subtle); +} + +.mono { + font-family: var(--ifm-font-family-monospace); + font-size: 0.84rem; +} + +/* Table */ +.releaseRow { + cursor: pointer; +} + +.releaseRow:hover td { + background-color: var(--ifm-menu-color-background-hover); +} + +.versionCell { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.versionStack { + display: flex; + flex-direction: column; + gap: 0.1rem; + line-height: 1.25; +} + +.chevron { + display: inline-flex; + align-items: center; + justify-content: center; + width: 14px; + height: 14px; + flex-shrink: 0; + color: var(--subtle); + transition: transform 0.15s ease; +} + +.chevronOpen { + transform: rotate(90deg); +} + +.externalIcon { + display: inline-block; + width: 12px; + height: 12px; + margin-left: 0.2rem; + vertical-align: -0.1em; + flex-shrink: 0; +} + +.navIcon { + display: block; + width: 14px; + height: 14px; +} + +.inlineLinks { + display: inline-flex; + align-items: center; + gap: 0.35rem; + font-size: 0.75rem; + font-weight: 400; + color: var(--subtle); +} + +.dateCellStack { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 0.2rem; +} + +.supportCellStack { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 0.2rem; +} + +.supportDates { + font-size: 0.74rem; + color: var(--subtle); + line-height: 1.3; +} + +/* Pills — aligned with website light & dark palette */ +.pill { + display: inline-flex; + align-items: center; + justify-content: center; + font-family: var(--ifm-font-family-base); + font-size: 0.74rem; + font-weight: 600; + line-height: 1.2; + padding: 0.2rem 0.55rem; + border-radius: 999px; + white-space: nowrap; + border: 1px solid transparent; + vertical-align: middle; +} + +.pillSuccess { + background: var(--home-feature-background-3); + color: #155d27; + border-color: rgb(34 134 58 / 0.25); +} + +.pillInfo { + background: var(--sidebar-active-item-background); + color: var(--home-button-primary); + border-color: rgb(8 126 164 / 0.25); +} + +.pillPrimary { + background: var(--home-feature-background-1); + color: var(--home-code-purple); + border-color: rgb(111 66 193 / 0.25); +} + +.pillWarning { + background: var(--rn-note-background); + color: #8a5300; + border-color: rgb(200 116 0 / 0.3); +} + +.pillSecondary { + background: var(--home-secondary-background); + color: var(--subtle); + border-color: var(--home-border); +} + +[data-theme="dark"] .pillSuccess { + background: var(--home-feature-background-3); + color: var(--home-code-green); + border-color: rgb(116 230 143 / 0.3); +} + +[data-theme="dark"] .pillInfo { + background: var(--home-feature-background-2); + color: var(--home-button-primary); + border-color: rgb(88 196 220 / 0.32); +} + +[data-theme="dark"] .pillPrimary { + background: var(--home-feature-background-1); + color: #c4a7fb; + border-color: rgb(167 124 247 / 0.32); +} + +[data-theme="dark"] .pillWarning { + background: rgb(251 146 60 / 0.14); + color: #fdba74; + border-color: rgb(251 146 60 / 0.32); +} + +[data-theme="dark"] .pillSecondary { + background: var(--deepdark); + color: var(--subtle); + border-color: var(--home-border); +} + +.infoPill { + cursor: help; +} + +.tooltip { + position: fixed; + z-index: 1000; + transform: translate(-50%, calc(-100% - 8px)); + padding: 0.38rem 0.65rem; + border-radius: 6px; + background: var(--deepdark); + color: #fff; + border: 1px solid var(--dark); + font-family: var(--ifm-font-family-base); + font-size: 0.75rem; + font-weight: 500; + line-height: 1.35; + max-width: 280px; + white-space: normal; + pointer-events: none; + box-shadow: 0 4px 14px rgb(0 0 0 / 0.25); +} + +[data-theme="dark"] .tooltip { + background: #2b2f3a; + color: #f6f7f9; + border-color: var(--home-border); +} + +/* Expanded release timeline */ +.detailCell { + padding: 0; +} + +.detailInner { + white-space: normal; + font-weight: 400; + text-align: left; + padding: 0.9rem 1.15rem; + width: 100%; + display: flex; + flex-direction: column; + gap: 0.55rem; +} + +.detailInnerFlush { + padding: 0; +} + +.detailSummary { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.5rem; + font-size: 0.8rem; + color: var(--subtle); +} + +.milestoneTimeline { + display: flex; + flex-direction: column; +} + +.milestoneRow { + display: grid; + grid-template-columns: 18px 156px 104px 116px minmax(0, 1fr); + align-items: center; + gap: 0.5rem; + padding: 0.42rem 0; + position: relative; +} + +.milestoneRow + .milestoneRow { + border-top: 1px solid var(--ifm-table-border-color); +} + +.milestoneRail { + position: relative; + display: flex; + align-items: center; + justify-content: center; + align-self: stretch; +} + +.milestoneRail:before { + content: ""; + position: absolute; + top: -0.45rem; + bottom: -0.45rem; + left: 50%; + width: 2px; + transform: translateX(-50%); + background: var(--ifm-table-border-color); +} + +.milestoneRow:first-child .milestoneRail:before { + top: 50%; +} + +.milestoneRow:last-child .milestoneRail:before { + bottom: 50%; +} + +.milestoneDot { + position: relative; + z-index: 1; + width: 9px; + height: 9px; + border-radius: 999px; +} + +.milestoneLabel { + font-size: 0.84rem; + font-weight: 600; + line-height: 1.3; +} + +.milestoneDate { + font-size: 0.82rem; + color: var(--ifm-font-color-base); + white-space: nowrap; +} + +.milestoneCode { + font-family: var(--ifm-font-family-monospace); + font-size: 0.76rem; + color: var(--subtle); + white-space: nowrap; +} + +.milestoneMeta { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.35rem; +} + +/* Calendar */ +.calToolbar { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.75rem; + margin-bottom: 0.85rem; +} + +.calNav { + display: inline-flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem; +} + +.calTitle { + font-size: 1rem; + font-weight: 700; + min-width: 140px; + text-align: center; +} + +.calFilters { + display: flex; + flex-wrap: wrap; + gap: 0.4rem; +} + +.dot { + width: 8px; + height: 8px; + border-radius: 999px; + display: inline-block; + flex-shrink: 0; +} + +.dotCut { + background: var(--rn-cal-dot-cut); +} + +.dotRc { + background: var(--rn-cal-dot-rc); +} + +.dotGolden { + background: var(--rn-cal-dot-golden); +} + +.dotStable { + background: var(--rn-cal-dot-stable); +} + +.dotPatch { + background: var(--rn-cal-dot-patch); +} + +.monthGrid { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + background-color: var(--home-background); + border-top: 1px solid var(--home-border); + border-left: 1px solid var(--home-border); + border-radius: var(--ifm-global-radius); + box-shadow: var(--ifm-table-box-shadow); + overflow: hidden; +} + +.monthDow { + padding: 0.45rem; + font-size: 0.78rem; + font-weight: 600; + color: var(--subtle); + background: var(--ifm-table-head-background); + border-right: 1px solid var(--home-border); + border-bottom: 1px solid var(--home-border); + text-align: center; +} + +.dayCell { + min-height: 88px; + padding: 0.35rem; + border-right: 1px solid var(--home-border); + border-bottom: 1px solid var(--home-border); + display: flex; + flex-direction: column; + gap: 0.25rem; +} + +.dayOutside { + background: var(--home-secondary-background); + opacity: 0.65; +} + +[data-theme="dark"] .dayOutside { + background: var(--deepdark); +} + +.dayToday { + box-shadow: inset 0 0 0 1.5px var(--home-button-primary); +} + +.dayHeader { + display: flex; + justify-content: space-between; + align-items: center; + font-size: 0.78rem; + font-weight: 600; +} + +.todayPip { + font-size: 0.68rem; + color: var(--home-button-primary); +} + +.evPill { + display: flex; + align-items: center; + gap: 0.3rem; + padding: 0.18rem 0.4rem; + border-radius: 5px; + border: 1px solid var(--home-border); + background: var(--home-secondary-background); + color: var(--ifm-font-color-base); + font-family: inherit; + font-size: 0.72rem; + font-weight: 500; + text-align: left; + width: 100%; + cursor: pointer; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + transition: + background-color 150ms ease, + border-color 150ms ease; +} + +[data-theme="dark"] .evPill { + background: var(--deepdark); +} + +.evPill:hover { + background: var(--sidebar-active-item-background); + border-color: var(--home-button-primary); +} + +.yearGrid { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 0.75rem; +} + +.miniMonth { + background-color: var(--home-background); + border: 1px solid var(--home-border); + border-radius: var(--ifm-global-radius); + box-shadow: var(--ifm-table-box-shadow); + padding: 0.7rem; + display: flex; + flex-direction: column; + gap: 0.45rem; +} + +.miniMonthHeader { + display: flex; + justify-content: space-between; + align-items: center; +} + +.miniMonthTitle { + font-family: inherit; + font-weight: 600; + font-size: 0.88rem; + background: transparent; + border: 0; + padding: 0; + color: var(--ifm-font-color-base); + cursor: pointer; +} + +.miniMonthTitle:hover { + color: var(--home-button-primary); +} + +.miniGrid { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + gap: 2px; + text-align: center; + font-size: 0.72rem; +} + +.miniDow { + color: var(--subtle); + font-weight: 500; + padding-bottom: 2px; +} + +.miniDay { + height: 24px; + display: flex; + align-items: center; + justify-content: center; + padding: 0; + border: 1px solid transparent; + border-radius: 5px; + line-height: 1; + width: 100%; + box-sizing: border-box; +} + +.miniDayEmpty { + visibility: hidden; +} + +.miniDayToday { + box-shadow: inset 0 0 0 1.5px var(--home-button-primary); + font-weight: 700; +} + +.miniDayEv { + font-weight: 700; + cursor: pointer; + border-color: rgb(8 126 164 / 0.3); + background: var(--sidebar-active-item-background); + color: var(--ifm-font-color-base); + font-family: inherit; + font-size: inherit; + transition: + background-color 150ms ease, + border-color 150ms ease; +} + +[data-theme="dark"] .miniDayEv { + border-color: rgb(88 196 220 / 0.32); +} + +.miniDayEv:hover { + border-color: var(--home-button-primary); +} + +.miniEvents { + display: flex; + flex-direction: column; + gap: 0.2rem; + padding-top: 0.4rem; + border-top: 1px solid var(--ifm-table-border-color); +} + +.miniEvRow { + display: flex; + align-items: center; + justify-content: space-between; + gap: 0.4rem; + font-family: inherit; + font-size: 0.72rem; + color: var(--ifm-font-color-base); + background: transparent; + border: 0; + padding: 0.18rem 0.3rem; + border-radius: 5px; + cursor: pointer; + width: 100%; + text-align: left; +} + +.miniEvRow:hover { + background: var(--ifm-menu-color-background-hover); +} + +.miniEvLeft { + display: inline-flex; + align-items: center; + gap: 0.35rem; + min-width: 0; +} + +.inspector { + margin-top: 0.9rem; + padding: 0.95rem 1.1rem; + border-radius: var(--ifm-global-radius); + background: var(--home-secondary-background); + border: 1px solid var(--home-border); +} + +[data-theme="dark"] .inspector { + background: var(--deepdark); +} + +.inspectorHeader { + display: flex; + flex-wrap: wrap; + justify-content: space-between; + align-items: center; + gap: 0.5rem; + margin-bottom: 0.75rem; +} + +.inspectorTitle { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.5rem; + font-size: 1rem; + font-weight: 700; + line-height: 1.2; +} + +/* Support Timeline */ +.timelineLegend { + display: flex; + flex-wrap: wrap; + gap: 1rem; + margin-bottom: 0.85rem; + font-size: 0.8rem; + color: var(--subtle); +} + +.legendItem { + display: inline-flex; + align-items: center; + gap: 0.4rem; +} + +.legendSwatch { + width: 12px; + height: 12px; + border-radius: 3px; + border: 1px solid transparent; + display: inline-block; +} + +.timelineContainer { + overflow-x: auto; + padding-bottom: 0.5rem; +} + +.timelineInner { + min-width: 640px; +} + +.timelineAxis { + display: grid; + grid-template-columns: 88px 1fr; + margin-bottom: 0.45rem; + border-bottom: 1px solid var(--ifm-table-border-color); + padding-bottom: 0.35rem; +} + +.timelineTicks { + position: relative; + height: 22px; +} + +.timelineTick { + position: absolute; + top: 0; + font-size: 0.72rem; + color: var(--subtle); + transform: translateX(-50%); + white-space: nowrap; +} + +.timelineRow { + display: grid; + grid-template-columns: 88px 1fr; + align-items: center; + height: 32px; + border-bottom: 1px solid var(--ifm-table-border-color); +} + +.timelineLabel { + font-family: var(--ifm-font-family-monospace); + font-size: 0.8rem; + font-weight: 600; + padding-right: 0.5rem; +} + +.timelineTrack { + position: relative; + height: 100%; +} + +.timelineSeg { + position: absolute; + top: 6px; + height: 20px; + border-radius: 5px; + border: 1px solid transparent; + font-size: 0.68rem; + font-weight: 600; + line-height: 18px; + padding: 0 0.4rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.segRc { + background: var(--rn-cal-seg-rc-bg); + color: var(--rn-cal-seg-rc-fg); + border-color: var(--rn-cal-seg-rc-border); +} + +.segActive { + background: var(--rn-cal-seg-active-bg); + color: var(--rn-cal-seg-active-fg); + border-color: var(--rn-cal-seg-active-border); +} + +.segEoc { + background: var(--rn-cal-seg-eoc-bg); + color: var(--rn-cal-seg-eoc-fg); + border-color: var(--rn-cal-seg-eoc-border); +} + +.timelineNow { + position: absolute; + top: 0; + bottom: 0; + width: 2px; + background: var(--rn-cal-now); + pointer-events: none; + z-index: 2; +} + +.timelineNowLabel { + position: absolute; + top: -2px; + transform: translateX(-50%); + background: var(--rn-cal-now); + color: #fff; + font-size: 0.68rem; + font-weight: 600; + padding: 1px 0.45rem; + border-radius: 4px; + white-space: nowrap; +} + +[data-theme="dark"] .timelineNowLabel { + color: #1b1b1d; +} + +/* Export */ +.exportToolbar { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 0.65rem; + margin-bottom: 0.75rem; +} + +.exportActions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 0.45rem; +} + +.exportOptions { + display: flex; + flex-wrap: wrap; + gap: 0.85rem; + margin-bottom: 0.75rem; + padding: 0.6rem 0.85rem; + background: var(--home-secondary-background); + border: 1px solid var(--home-border); + border-radius: var(--ifm-global-radius); +} + +[data-theme="dark"] .exportOptions { + background: var(--deepdark); +} + +.exportPreview { + max-height: 420px; + overflow: auto; + margin: 0; + padding: 0.9rem 1rem; + background: var(--rn-prism-background-color); + color: var(--rn-prism-color); + border: 1px solid var(--home-border); + border-radius: var(--ifm-global-radius); +} + +@media (max-width: 996px) { + .kpiGrid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + + .yearGrid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (max-width: 600px) { + .kpiGrid { + grid-template-columns: 1fr; + } + + .yearGrid { + grid-template-columns: 1fr; + } + + .dayCell { + min-height: 66px; + padding: 0.2rem; + } + + .milestoneRow { + grid-template-columns: 18px 1fr; + gap: 0.2rem 0.55rem; + } + + .milestoneRail { + grid-row: 1 / span 3; + } +} diff --git a/website/src/components/releases/ReleaseScheduleCalendar.tsx b/website/src/components/releases/ReleaseScheduleCalendar.tsx new file mode 100644 index 00000000000..f2f9170826e --- /dev/null +++ b/website/src/components/releases/ReleaseScheduleCalendar.tsx @@ -0,0 +1,1626 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import Link from '@docusaurus/Link'; +import {usePluginData} from '@docusaurus/useGlobalData'; +import { + Fragment, + useEffect, + useMemo, + useRef, + useState, + type ReactNode, +} from 'react'; + +import { + DOW_SHORT, + GITHUB_RELEASES_API_URL, + GITHUB_RELEASES_PAGE_URL, + MONTH_NAMES, + SSR_DEFAULT_TODAY, + addDays, + buildCSV, + buildICS, + buildJSON, + buildOverviewMarkdown, + buildRcMarkdown, + buildReleaseSchedule, + diffDays, + formatPrettyDate, + formatShortDate, + getLocalTodayISO, + mergeGitHubReleases, + parseGitHubReleases, + parseISO, + releaseDatesToGitHubReleases, + type GitHubReleaseApiItem, + type GitHubSeriesData, + type IcsOptions, + type MilestoneKind, + type ReleaseMilestone, + type ReleaseType, + type ScheduleResult, + type ScheduledRelease, +} from './releaseSchedule'; +import styles from './ReleaseScheduleCalendar.module.css'; + +type ActiveTab = 'schedule' | 'calendar' | 'timeline' | 'export'; +type CalendarMode = 'year' | 'month'; +type ExportFormat = 'overview-md' | 'rc-md' | 'ics' | 'csv' | 'json'; +type GitHubSyncState = 'idle' | 'loading' | 'synced' | 'error'; + +interface CalendarEvent { + version: string; + kind: MilestoneKind; + label: string; + code: string; + date: string; +} + +const GITHUB_CACHE_KEY = 'rn-release-schedule-gh-v1'; +const GITHUB_CACHE_TTL_MS = 15 * 60 * 1000; + +function countTags(bySeries: Map): number { + let count = 0; + for (const s of bySeries.values()) { + count += s.rcs.length + (s.stable ? 1 : 0) + s.patches.length; + } + return count; +} + +const RELEASE_CREW_QA_TOOLTIP = + 'Release Crew runs manual verification on RC0, RC1, and the Golden RC before publishing.'; + +function pillVariantClass( + variant: 'success' | 'info' | 'primary' | 'warning' | 'secondary' +): string { + switch (variant) { + case 'success': + return styles.pillSuccess; + case 'info': + return styles.pillInfo; + case 'primary': + return styles.pillPrimary; + case 'warning': + return styles.pillWarning; + case 'secondary': + return styles.pillSecondary; + } +} + +function supportBadge(r: ScheduledRelease): ReactNode { + if (r.support === 'Future') { + if (r.inRC) { + return ( + + Future · In RC + + ); + } + return Future; + } + if (r.support === 'Active') { + return ( + + {r.isLatestStable ? 'Active · Latest' : 'Active'} + + ); + } + if (r.support === 'End of Cycle') { + return ( + + End of Cycle + + ); + } + return ( + + Unsupported + + ); +} + +function typeBadge(releaseType: ReleaseType): ReactNode { + if (releaseType === 'Breaking') { + return ( + Breaking + ); + } + return ( + Non-breaking + ); +} + +function dotClassForKind(kind: MilestoneKind): string { + switch (kind) { + case 'cut': + return styles.dotCut; + case 'rc': + return styles.dotRc; + case 'golden': + return styles.dotGolden; + case 'stable': + return styles.dotStable; + case 'patch': + return styles.dotPatch; + } +} + +function eventShortLabel(ev: CalendarEvent): string { + if (ev.kind === 'cut') { + return `${ev.version} RC0 Cut`; + } + if (ev.kind === 'golden') { + return `${ev.version} Golden`; + } + if (ev.kind === 'stable') { + return `${ev.version}.0 Stable`; + } + if (ev.kind === 'patch') { + return `${ev.version}.1 Patch`; + } + return `${ev.version} ${ev.label}`; +} + +function ExternalArrowIcon() { + return ( + + ); +} + +function ChevronIcon({direction = 'right'}: {direction?: 'left' | 'right'}) { + return ( + + ); +} + +function TooltipBadge({ + tooltip, + label, + variant = 'secondary', +}: { + tooltip: string; + label?: string; + variant?: 'warning' | 'secondary' | 'info' | 'success'; +}) { + const [tipPos, setTipPos] = useState<{x: number; y: number} | null>(null); + + function showTooltip(el: HTMLElement): void { + const rect = el.getBoundingClientRect(); + setTipPos({x: rect.left + rect.width / 2, y: rect.top}); + } + + return ( + <> + e.stopPropagation()} + onMouseEnter={e => showTooltip(e.currentTarget)} + onMouseLeave={() => setTipPos(null)} + onFocus={e => showTooltip(e.currentTarget)} + onBlur={() => setTipPos(null)}> + {label ?? tooltip} + + {tipPos ? ( + + {tooltip} + + ) : null} + + ); +} + +function MilestoneStrip({ + version, + milestones, + locale, + flush = false, +}: { + version: string; + milestones: ReleaseMilestone[]; + locale: string | undefined; + flush?: boolean; +}) { + const actualCount = milestones.filter(m => m.isActual).length; + const scheduledCount = milestones.length - actualCount; + + return ( +
+
+ + {version}.x release timeline + + + {actualCount > 0 && scheduledCount > 0 + ? `${actualCount} published on GitHub · ${scheduledCount} scheduled` + : actualCount > 0 + ? `${actualCount} published on GitHub` + : `${scheduledCount} scheduled milestones`} + +
+ +
+ {milestones.map(m => ( +
+
+ +
+ +
+ {m.url ? ( + + {m.label} + + + ) : ( + {m.label} + )} +
+ + + {formatPrettyDate(m.date, locale)} + + + {m.code} + +
+ {m.isActual ? ( + + Published + + ) : null} + {m.manualTest ? ( + + ) : null} +
+
+ ))} +
+
+ ); +} + +function DateCell({ + iso, + locale, + linkHref, + linkLabel, +}: { + iso: string | null; + locale: string | undefined; + linkHref?: string | null; + linkLabel?: string; +}) { + if (!iso) { + return —; + } + const formatted = formatPrettyDate(iso, locale); + return ( +
+ {linkHref && !linkLabel ? ( + e.stopPropagation()}> + {formatted} + + + ) : ( + {formatted} + )} + {linkHref && linkLabel ? ( + e.stopPropagation()}> + {linkLabel} + + + ) : null} +
+ ); +} + +export default function ReleaseScheduleCalendar(): ReactNode { + // RC, .0 and patch dates fetched from GitHub Releases at build time by the + // `release-dates` plugin, so past milestones render with actual dates + // during SSR and even when the live GitHub fetch below fails. + const buildTimeDates = usePluginData('release-dates') as + Readonly> | undefined; + const buildTimeItems = useMemo( + () => releaseDatesToGitHubReleases(buildTimeDates ?? {}), + [buildTimeDates] + ); + const [today, setToday] = useState(SSR_DEFAULT_TODAY); + const [locale, setLocale] = useState('en-US'); + const [showUnsupported, setShowUnsupported] = useState(true); + + const [activeTab, setActiveTab] = useState('schedule'); + const [expandedVersions, setExpandedVersions] = useState< + Record + >({}); + + const [calMode, setCalMode] = useState('year'); + const [calYear, setCalYear] = useState(2026); + const [calMonth, setCalMonth] = useState(11); + const [calFilters, setCalFilters] = useState>({ + cut: true, + rc: true, + golden: true, + stable: true, + patch: false, + }); + const [selectedVersion, setSelectedVersion] = useState(null); + const [inspectSeq, setInspectSeq] = useState(0); + const inspectorRef = useRef(null); + + const [exportFormat, setExportFormat] = useState('overview-md'); + const [icsOptions, setIcsOptions] = useState({ + cut: true, + rc: false, + golden: true, + stable: true, + patch: false, + upcomingOnly: true, + }); + const [copyToast, setCopyToast] = useState(''); + const [githubBySeries, setGithubBySeries] = useState< + Map + >(() => parseGitHubReleases(buildTimeItems)); + const [githubSync, setGithubSync] = useState('idle'); + const [githubTagCount, setGithubTagCount] = useState(() => + countTags(parseGitHubReleases(buildTimeItems)) + ); + + // Sync to the visitor's local date and locale after hydration to avoid SSR mismatch. + useEffect(() => { + const localToday = getLocalTodayISO(); + setToday(localToday); + setLocale(undefined); + const dt = parseISO(localToday); + setCalYear(dt.getUTCFullYear()); + setCalMonth(dt.getUTCMonth()); + }, []); + + useEffect(() => { + if (selectedVersion && inspectSeq > 0) { + inspectorRef.current?.scrollIntoView({ + behavior: 'smooth', + block: 'nearest', + }); + } + }, [selectedVersion, inspectSeq]); + + // Fetch actual RC, stable, and patch tags from GitHub Releases (cached 15m). + useEffect(() => { + const controller = new AbortController(); + + const applyItems = (items: GitHubReleaseApiItem[]) => { + // Live rows win over build-time rows for the same tag, and build-time + // rows fill in older series that fall outside the live page. + const parsed = parseGitHubReleases( + mergeGitHubReleases(buildTimeItems, items) + ); + setGithubBySeries(parsed); + setGithubTagCount(countTags(parsed)); + setGithubSync('synced'); + }; + + try { + const cachedRaw = window.sessionStorage.getItem(GITHUB_CACHE_KEY); + if (cachedRaw) { + const cached = JSON.parse(cachedRaw) as { + ts: number; + items: GitHubReleaseApiItem[]; + }; + if ( + Array.isArray(cached.items) && + Date.now() - cached.ts < GITHUB_CACHE_TTL_MS + ) { + applyItems(cached.items); + return () => controller.abort(); + } + } + } catch { + // Ignore storage access errors in restricted browser contexts. + } + + setGithubSync('loading'); + fetch(GITHUB_RELEASES_API_URL, { + signal: controller.signal, + headers: {Accept: 'application/vnd.github+json'}, + }) + .then(res => { + if (!res.ok) { + throw new Error(`GitHub API ${res.status}`); + } + return res.json() as Promise; + }) + .then(items => { + if (!Array.isArray(items)) { + throw new Error('Unexpected GitHub response'); + } + try { + window.sessionStorage.setItem( + GITHUB_CACHE_KEY, + JSON.stringify({ts: Date.now(), items}) + ); + } catch { + // Ignore storage quota/privacy errors. + } + applyItems(items); + }) + .catch(err => { + if (err instanceof Error && err.name === 'AbortError') { + return; + } + setGithubSync('error'); + }); + + return () => controller.abort(); + }, [buildTimeItems]); + + const data: ScheduleResult = useMemo( + () => buildReleaseSchedule(today, githubBySeries, showUnsupported), + [today, githubBySeries, showUnsupported] + ); + + const kpis = useMemo(() => { + const nextRelease = data.allAsc.find(r => !r.released) ?? null; + const nextCut = + data.allAsc.find(r => !r.released && r.branchCut > today) ?? null; + const supported = data.allAsc + .filter(r => r.support === 'Active' || r.support === 'End of Cycle') + .reverse(); + const prevCut = + data.allAsc.filter(r => r.branchCut <= today).slice(-1)[0] ?? null; + + return { + nextRelease, + nextCut, + supported, + prevCut, + activeVersions: supported + .filter(r => r.support === 'Active') + .map(r => r.version), + eocVersions: supported + .filter(r => r.support === 'End of Cycle') + .map(r => r.version), + }; + }, [data.allAsc, today]); + + const eventsByDate = useMemo(() => { + const byDate = new Map(); + for (const r of data.visibleAsc) { + for (const m of r.milestones) { + if (!calFilters[m.kind]) { + continue; + } + const existing = byDate.get(m.date) ?? []; + existing.push({ + version: r.version, + kind: m.kind, + label: m.label, + code: m.code, + date: m.date, + }); + byDate.set(m.date, existing); + } + } + return byDate; + }, [data.visibleAsc, calFilters]); + + const exportText = useMemo(() => { + switch (exportFormat) { + case 'overview-md': + return buildOverviewMarkdown(data); + case 'rc-md': + return buildRcMarkdown(data, icsOptions.upcomingOnly); + case 'ics': + return buildICS(data, today, icsOptions); + case 'csv': + return buildCSV(data); + case 'json': + return buildJSON(data); + } + }, [exportFormat, data, today, icsOptions]); + + const inspectedRelease = useMemo( + () => + selectedVersion + ? (data.allAsc.find(r => r.version === selectedVersion) ?? null) + : null, + [data.allAsc, selectedVersion] + ); + + const calendarBounds = useMemo(() => { + let minIso = ''; + let maxIso = ''; + for (const r of data.visibleAsc) { + for (const m of r.milestones) { + if (!minIso || m.date < minIso) { + minIso = m.date; + } + if (!maxIso || m.date > maxIso) { + maxIso = m.date; + } + } + } + const minDt = parseISO(minIso || today); + const maxDt = parseISO(maxIso || today); + const minYear = minDt.getUTCFullYear(); + const minMonth = minDt.getUTCMonth(); + const maxYear = maxDt.getUTCFullYear(); + const maxMonth = maxDt.getUTCMonth(); + return { + minYear, + minMonth, + maxYear, + maxMonth, + minTotal: minYear * 12 + minMonth, + maxTotal: maxYear * 12 + maxMonth, + }; + }, [data.visibleAsc, today]); + + useEffect(() => { + const currentTotal = calYear * 12 + calMonth; + if (currentTotal < calendarBounds.minTotal) { + setCalYear(calendarBounds.minYear); + setCalMonth(calendarBounds.minMonth); + } else if (currentTotal > calendarBounds.maxTotal) { + setCalYear(calendarBounds.maxYear); + setCalMonth(calendarBounds.maxMonth); + } + }, [calYear, calMonth, calendarBounds]); + + const canGoPrev = + calMode === 'year' + ? calYear > calendarBounds.minYear + : calYear * 12 + calMonth > calendarBounds.minTotal; + + const canGoNext = + calMode === 'year' + ? calYear < calendarBounds.maxYear + : calYear * 12 + calMonth < calendarBounds.maxTotal; + + function handleInspectVersion(version: string): void { + setSelectedVersion(version); + setInspectSeq(n => n + 1); + } + + function toggleRow(version: string): void { + setExpandedVersions(prev => ({...prev, [version]: !prev[version]})); + } + + function toggleFilter(kind: MilestoneKind): void { + setCalFilters(prev => ({...prev, [kind]: !prev[kind]})); + } + + function stepCalendar(delta: number): void { + if (calMode === 'year') { + const nextYear = Math.max( + calendarBounds.minYear, + Math.min(calendarBounds.maxYear, calYear + delta) + ); + setCalYear(nextYear); + const nextTotal = nextYear * 12 + calMonth; + if (nextTotal < calendarBounds.minTotal) { + setCalMonth(calendarBounds.minMonth); + } else if (nextTotal > calendarBounds.maxTotal) { + setCalMonth(calendarBounds.maxMonth); + } + return; + } + const nextTotal = Math.max( + calendarBounds.minTotal, + Math.min(calendarBounds.maxTotal, calYear * 12 + calMonth + delta) + ); + setCalYear(Math.floor(nextTotal / 12)); + setCalMonth(nextTotal % 12); + } + + function jumpToToday(): void { + const dt = parseISO(today); + const targetTotal = Math.max( + calendarBounds.minTotal, + Math.min( + calendarBounds.maxTotal, + dt.getUTCFullYear() * 12 + dt.getUTCMonth() + ) + ); + setCalYear(Math.floor(targetTotal / 12)); + setCalMonth(targetTotal % 12); + } + + async function handleCopy(): Promise { + let copied = false; + try { + if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) { + await navigator.clipboard.writeText(exportText); + copied = true; + } + } catch { + copied = false; + } + if (!copied && typeof document !== 'undefined') { + const ta = document.createElement('textarea'); + ta.value = exportText; + ta.setAttribute('readonly', ''); + ta.style.position = 'fixed'; + ta.style.top = '-9999px'; + document.body.appendChild(ta); + ta.select(); + try { + copied = document.execCommand('copy'); + } catch { + copied = false; + } + document.body.removeChild(ta); + } + setCopyToast(copied ? 'Copied to clipboard' : 'Select text below to copy'); + setTimeout(() => setCopyToast(''), 2200); + } + + function handleDownload(): void { + const metaByFormat: Record = { + 'overview-md': {ext: 'md', mime: 'text/markdown;charset=utf-8'}, + 'rc-md': {ext: 'md', mime: 'text/markdown;charset=utf-8'}, + ics: {ext: 'ics', mime: 'text/calendar;charset=utf-8'}, + csv: {ext: 'csv', mime: 'text/csv;charset=utf-8'}, + json: {ext: 'json', mime: 'application/json;charset=utf-8'}, + }; + const meta = metaByFormat[exportFormat]; + const blob = new Blob([exportText], {type: meta.mime}); + const url = URL.createObjectURL(blob); + const link = document.createElement('a'); + link.href = url; + link.download = `react-native-release-schedule.${meta.ext}`; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + URL.revokeObjectURL(url); + } + + const nextReleaseDays = kpis.nextRelease + ? diffDays(today, kpis.nextRelease.releaseDate) + : null; + const nextCutDays = kpis.nextCut + ? diffDays(today, kpis.nextCut.branchCut) + : null; + + return ( +
+ {/* Summary KPIs */} +
+
+ Next Stable Release + + {kpis.nextRelease ? `${kpis.nextRelease.version}.0` : '—'} + + + {kpis.nextRelease + ? `${formatPrettyDate(kpis.nextRelease.releaseDate, locale)}${ + nextReleaseDays !== null && nextReleaseDays >= 0 + ? ` (in ${nextReleaseDays}d)` + : '' + }` + : '—'} + + {kpis.nextRelease?.latestRc ? ( + + Latest RC:{' '} + + {kpis.nextRelease.latestRc.tag} + + {' '} + ({formatPrettyDate(kpis.nextRelease.latestRc.date, locale)}) + + ) : null} +
+ +
+ Next Branch Cut (RC0) + + {kpis.nextCut ? `${kpis.nextCut.version}.0-rc.0` : '—'} + + + {kpis.nextCut + ? `${formatPrettyDate(kpis.nextCut.branchCut, locale)}${ + nextCutDays !== null && nextCutDays >= 0 + ? ` (in ${nextCutDays}d)` + : '' + }` + : '—'} + +
+ +
+ Supported Series (3) + + {kpis.supported.length > 0 + ? kpis.supported.map(r => r.version).join(' · ') + : '—'} + + + {kpis.activeVersions.length > 0 + ? `${kpis.activeVersions.join(', ')} Active` + : ''} + {kpis.eocVersions.length > 0 + ? ` · ${kpis.eocVersions.join(', ')} EoC` + : ''} + +
+ +
+ Current Window on main + + {kpis.nextCut?.releaseType || 'Active development'} + + + {kpis.prevCut && kpis.nextCut + ? `${formatShortDate(kpis.prevCut.branchCut, locale)} → ${formatShortDate(kpis.nextCut.branchCut, locale)} (for ${kpis.nextCut.version}.x)` + : '—'} + +
+
+ + {/* Main Tabbed Surface */} +
+
+
+ {( + [ + ['schedule', 'Schedule Table'], + ['calendar', 'Calendar'], + ['timeline', 'Support Timeline'], + ['export', 'Export / Copy'], + ] as const + ).map(([id, label]) => ( + + ))} +
+ +
+ + +
+ + {githubSync === 'synced' ? ( + + GitHub Releases synced ({githubTagCount} tags) + + + ) : githubSync === 'loading' ? ( + Syncing GitHub Releases… + ) : ( + + GitHub Releases + + + )} +
+
+
+ + {/* View 1: Schedule Table */} + {activeTab === 'schedule' ? ( +
+
+ + + + + + + + + + + + + {data.visibleDesc.map(r => { + const isExpanded = Boolean(expandedVersions[r.version]); + return ( + + toggleRow(r.version)}> + + + + + + + + {isExpanded ? ( + + + + ) : null} + + ); + })} + +
VersionTypeBranch CutLatest / Golden RCRelease (.0)Support
+
+ + + +
+ + {r.version}.x + + + {r.released ? ( + <> + {r.blog ? ( + e.stopPropagation()}> + Blog + + ) : ( + Published + )} + · + e.stopPropagation()}> + GitHub + + + + ) : r.inRC || r.latestRc ? ( + e.stopPropagation()}> + GitHub RCs + + + ) : ( + Scheduled + )} + +
+
+
{typeBadge(r.releaseType)} + m.kind === 'cut' && m.isActual + )?.url + } + /> + + {r.latestRc ? ( + + ) : r.released ? ( + — + ) : ( + + )} + + + +
+ {supportBadge(r)} + {r.eocDate || r.eolDate ? ( + + {r.eocDate + ? `EoC ${formatPrettyDate(r.eocDate, locale)}` + : ''} + {r.eocDate && r.eolDate ? ' · ' : ''} + {r.eolDate + ? `EOL ${formatPrettyDate(r.eolDate, locale)}` + : ''} + + ) : null} +
+
+ +
+
+
+ ) : null} + + {/* View 2: Calendar */} + {activeTab === 'calendar' ? ( +
+
+
+ + + {calMode === 'month' + ? `${MONTH_NAMES[calMonth]} ${calYear}` + : String(calYear)} + + + +
+ + +
+
+ +
+ {( + [ + ['cut', 'Branch Cut (RC0)'], + ['rc', 'RC1–RC3'], + ['golden', 'Golden RC'], + ['stable', 'Stable (.0)'], + ['patch', 'Patch (.1+)'], + ] as const + ).map(([kind, label]) => ( + + ))} +
+
+ + {calMode === 'year' ? ( + { + setCalMonth(m); + setCalMode('month'); + }} + onInspectVersion={handleInspectVersion} + /> + ) : ( + + )} + + {inspectedRelease ? ( +
+
+ + React Native {inspectedRelease.version}.x + {typeBadge(inspectedRelease.releaseType)} + {supportBadge(inspectedRelease)} + + +
+ +
+ ) : null} +
+ ) : null} + + {/* View 3: Support Timeline */} + {activeTab === 'timeline' ? ( + + ) : null} + + {/* View 4: Export / Copy */} + {activeTab === 'export' ? ( +
+
+
+ {( + [ + ['overview-md', 'reactnative.dev MD'], + ['rc-md', 'Full RC Schedule MD'], + ['ics', 'iCalendar (.ics)'], + ['csv', 'CSV'], + ['json', 'JSON'], + ] as const + ).map(([fmt, label]) => ( + + ))} +
+ +
+ {copyToast ? ( + + {copyToast} + + ) : null} + + +
+
+ + {exportFormat === 'ics' || exportFormat === 'rc-md' ? ( +
+ {exportFormat === 'ics' ? ( + <> + {( + [ + ['cut', 'Branch Cuts (RC0)'], + ['rc', 'Intermediate RCs'], + ['golden', 'Golden RC'], + ['stable', 'Stable Releases (.0)'], + ['patch', 'Patches (.1+)'], + ] as const + ).map(([key, label]) => ( + + ))} + + ) : null} + +
+ ) : null} + +
+              {exportText}
+            
+
+ ) : null} +
+
+ ); +} + +function YearGrid({ + year, + today, + locale, + minTotal, + maxTotal, + eventsByDate, + onOpenMonth, + onInspectVersion, +}: { + year: number; + today: string; + locale: string | undefined; + minTotal: number; + maxTotal: number; + eventsByDate: Map; + onOpenMonth: (month0: number) => void; + onInspectVersion: (version: string) => void; +}) { + const priority: MilestoneKind[] = ['stable', 'cut', 'golden', 'rc', 'patch']; + + return ( +
+ {MONTH_NAMES.map((monthName, month0) => { + const monthTotal = year * 12 + month0; + if (monthTotal < minTotal || monthTotal > maxTotal) { + return null; + } + const firstDay = new Date(Date.UTC(year, month0, 1)); + const startDow = firstDay.getUTCDay(); + const daysInMonth = new Date( + Date.UTC(year, month0 + 1, 0) + ).getUTCDate(); + const monthEvents: CalendarEvent[] = []; + + const cells: ReactNode[] = []; + for (const d of DOW_SHORT) { + cells.push( +
+ {d.charAt(0)} +
+ ); + } + for (let i = 0; i < startDow; i++) { + cells.push( +
+ . +
+ ); + } + + for (let day = 1; day <= daysInMonth; day++) { + const iso = `${year}-${String(month0 + 1).padStart(2, '0')}-${String(day).padStart(2, '0')}`; + const evs = eventsByDate.get(iso) ?? []; + const isToday = iso === today; + + if (evs.length > 0) { + const top = + priority + .map(k => evs.find(e => e.kind === k)) + .find((x): x is CalendarEvent => Boolean(x)) ?? evs[0]; + monthEvents.push(...evs); + cells.push( + + ); + } else { + cells.push( +
+ {day} +
+ ); + } + } + + return ( +
+
+ + {monthEvents.length > 0 ? ( + + {monthEvents.length} event + {monthEvents.length === 1 ? '' : 's'} + + ) : null} +
+
{cells}
+ {monthEvents.length > 0 ? ( +
+ {monthEvents.map(ev => ( + + ))} +
+ ) : null} +
+ ); + })} +
+ ); +} + +function MonthGrid({ + year, + month0, + today, + eventsByDate, + onInspectVersion, +}: { + year: number; + month0: number; + today: string; + eventsByDate: Map; + onInspectVersion: (version: string) => void; +}) { + const firstDay = new Date(Date.UTC(year, month0, 1)); + const startDow = firstDay.getUTCDay(); + const daysInMonth = new Date(Date.UTC(year, month0 + 1, 0)).getUTCDate(); + const prevMonthDays = new Date(Date.UTC(year, month0, 0)).getUTCDate(); + const totalCells = Math.ceil((startDow + daysInMonth) / 7) * 7; + + const cells: ReactNode[] = []; + for (let c = 0; c < totalCells; c++) { + let cellYear = year; + let cellMonth0 = month0; + let dayNum: number; + let isOutside = false; + + if (c < startDow) { + dayNum = prevMonthDays - startDow + 1 + c; + cellMonth0 = month0 - 1; + if (cellMonth0 < 0) { + cellMonth0 = 11; + cellYear -= 1; + } + isOutside = true; + } else if (c >= startDow + daysInMonth) { + dayNum = c - (startDow + daysInMonth) + 1; + cellMonth0 = month0 + 1; + if (cellMonth0 > 11) { + cellMonth0 = 0; + cellYear += 1; + } + isOutside = true; + } else { + dayNum = c - startDow + 1; + } + + const iso = `${cellYear}-${String(cellMonth0 + 1).padStart(2, '0')}-${String(dayNum).padStart(2, '0')}`; + const isToday = iso === today; + const evs = eventsByDate.get(iso) ?? []; + + cells.push( +
+
+ {dayNum} + {isToday ? Today : null} +
+ {evs.map(ev => ( + + ))} +
+ ); + } + + return ( +
+ {DOW_SHORT.map(d => ( +
+ {d} +
+ ))} + {cells} +
+ ); +} + +function SupportTimeline({ + rows, + today, + locale, +}: { + rows: ScheduledRelease[]; + today: string; + locale: string | undefined; +}) { + if (rows.length === 0) { + return

No releases to display.

; + } + + const minDate = rows[0].branchCut; + const lastRow = rows[rows.length - 1]; + const maxDate = addDays(lastRow.releaseDate, 45); + const totalSpan = Math.max(1, diffDays(minDate, maxDate)); + + const pct = (iso: string): number => { + const clamped = Math.max(0, Math.min(totalSpan, diffDays(minDate, iso))); + return (clamped / totalSpan) * 100; + }; + + const startYear = parseISO(minDate).getUTCFullYear(); + const endYear = parseISO(maxDate).getUTCFullYear(); + const ticks: Array<{iso: string; label: string; left: number}> = []; + for (let y = startYear; y <= endYear + 1; y++) { + for (const m of [1, 4, 7, 10]) { + const iso = `${y}-${String(m).padStart(2, '0')}-01`; + if (iso >= minDate && iso <= maxDate) { + ticks.push({ + iso, + label: + m === 1 ? String(y) : `Q${Math.ceil(m / 3)} '${String(y).slice(2)}`, + left: pct(iso), + }); + } + } + } + + const todayLeft = pct(today); + const showToday = today >= minDate && today <= maxDate; + + return ( +
+
+ + + RC Stabilization (Branch Cut → .0) + + + + Active Support (latest 2 minor series) + + + + End of Cycle (3rd minor series) + +
+ +
+
+
+
Series
+
+ {ticks.map(t => ( + + {t.label} + + ))} + {showToday ? ( + + Today · {formatPrettyDate(today, locale)} + + ) : null} +
+
+ + {[...rows].reverse().map(r => { + const rcStart = pct(r.branchCut); + const relStart = pct(r.releaseDate); + const eocStart = r.eocDate ? pct(r.eocDate) : null; + const eolStart = r.eolDate ? pct(r.eolDate) : null; + + const rcW = Math.max(0.8, relStart - rcStart); + const activeEnd = eocStart ?? 100; + const activeW = Math.max(0.8, activeEnd - relStart); + const eocEnd = eolStart ?? 100; + const eocW = + eocStart !== null ? Math.max(0.8, eocEnd - eocStart) : 0; + + return ( +
+
{r.version}.x
+
+
+ RC +
+
+ Active +
+ {eocStart !== null ? ( +
+ EoC +
+ ) : null} + {showToday ? ( +
+ ) : null} +
+
+ ); + })} +
+
+
+ ); +} diff --git a/website/src/components/releases/ReleasesTable.tsx b/website/src/components/releases/ReleasesTable.tsx index d1022b3d822..ef7f8b028fd 100644 --- a/website/src/components/releases/ReleasesTable.tsx +++ b/website/src/components/releases/ReleasesTable.tsx @@ -1,5 +1,53 @@ -import ReleasesTableMD from './_releases-table.md'; +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ -export default function ReleasesTable() { - return ; +import Link from '@docusaurus/Link'; +import type {ReactNode} from 'react'; + +import {RELEASES, getSupportStatusForRank} from './releasesData'; + +export default function ReleasesTable(): ReactNode { + let releasedRank = 0; + + return ( +
+ + + + + + + + + + + + {RELEASES.map(release => { + const support = getSupportStatusForRank( + release.released, + releasedRank + ); + if (release.released) { + releasedRank += 1; + } + return ( + + + + + + + + ); + })} + +
VersionBranch cut dateRelease dateSupportBlog post
{release.version}.x{release.branchCut}{release.releaseDate}{support} + {release.blog ? Details : null} +
+
+ ); } diff --git a/website/src/components/releases/_releases-table.md b/website/src/components/releases/_releases-table.md deleted file mode 100644 index 9a323d1d7f1..00000000000 --- a/website/src/components/releases/_releases-table.md +++ /dev/null @@ -1,16 +0,0 @@ -| Version | Branch cut date | Release date | Support | Blog post | -| ------- | --------------- | ------------ | ------------ | --------------------------------------------- | -| 0.90.x | 2027-01-04 | 2027-02-08 | Future | | -| 0.89.x | 2026-11-02 | 2026-12-07 | Future | | -| 0.88.x | 2026-09-07 | 2026-10-15 | Active | [Details](/blog/2026/10/19/react-native-0.88) | -| 0.87.x | 2026-07-06 | 2026-08-11 | Active | [Details](/blog/2026/08/11/react-native-0.87) | -| 0.86.x | 2026-05-04 | 2026-06-09 | End of Cycle | [Details](/blog/2026/06/11/react-native-0.86) | -| 0.85.x | 2026-03-02 | 2026-04-06 | Unsupported | [Details](/blog/2026/04/07/react-native-0.85) | -| 0.84.x | 2026-01-05 | 2026-02-09 | Unsupported | [Details](/blog/2026/02/11/react-native-0.84) | -| 0.83.x | 2025-11-03 | 2025-12-10 | Unsupported | [Details](/blog/2025/12/10/react-native-0.83) | -| 0.82.x | 2025-09-01 | 2025-10-06 | Unsupported | [Details](/blog/2025/10/08/react-native-0.82) | -| 0.81.x | 2025-07-10 | 2025-08-12 | Unsupported | [Details](/blog/2025/08/12/react-native-0.81) | -| 0.80.x | 2025-05-07 | 2025-06-12 | Unsupported | [Details](/blog/2025/06/12/react-native-0.80) | -| 0.79.x | 2025-03-04 | 2025-04-08 | Unsupported | [Details](/blog/2025/04/08/react-native-0.79) | -| 0.78.x | 2025-01-15 | 2025-02-19 | Unsupported | [Details](/blog/2025/02/19/react-native-0.78) | -| 0.77.x | 2024-11-26 | 2025-01-21 | Unsupported | [Details](/blog/2025/01/21/version-0.77) | diff --git a/website/src/components/releases/releaseSchedule.ts b/website/src/components/releases/releaseSchedule.ts new file mode 100644 index 00000000000..88e99a4107a --- /dev/null +++ b/website/src/components/releases/releaseSchedule.ts @@ -0,0 +1,680 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +import { + RELEASES, + getSupportStatusForRank, + type ReleaseRecord, + type ReleaseType, + type SupportStatus, +} from './releasesData'; + +export type {ReleaseType, SupportStatus}; + +export type MilestoneKind = 'cut' | 'rc' | 'golden' | 'stable' | 'patch'; + +export interface ReleaseMilestone { + kind: MilestoneKind; + code: string; + label: string; + date: string; + manualTest: boolean; + /** Direct GitHub Releases URL when this tag has been published. */ + url?: string; + /** True when the date comes from an actual published GitHub release. */ + isActual?: boolean; +} + +export interface GitHubReleaseApiItem { + tag_name: string; + published_at?: string | null; + created_at?: string | null; + html_url: string; + prerelease?: boolean; + draft?: boolean; +} + +export interface GitHubTagInfo { + tag: string; + code: string; + date: string; + url: string; + rcNumber?: number; + patchNumber?: number; +} + +export interface GitHubSeriesData { + rcs: GitHubTagInfo[]; + stable: GitHubTagInfo | null; + patches: GitHubTagInfo[]; +} + +export interface ScheduledRelease { + version: string; + branchCut: string; + goldenDate: string; + releaseDate: string; + eocDate: string | null; + eolDate: string | null; + blog: string; + githubSearchUrl: string; + latestRc: GitHubTagInfo | null; + stableReleaseUrl: string | null; + releaseType: ReleaseType; + released: boolean; + support: SupportStatus; + inRC: boolean; + isLatestStable: boolean; + milestones: ReleaseMilestone[]; +} + +export interface IcsOptions { + cut: boolean; + rc: boolean; + golden: boolean; + stable: boolean; + patch: boolean; + upcomingOnly: boolean; +} + +export interface ScheduleResult { + allAsc: ScheduledRelease[]; + visibleAsc: ScheduledRelease[]; + visibleDesc: ScheduledRelease[]; + upcomingAsc: ScheduledRelease[]; +} + +export const GITHUB_RELEASES_API_URL = + 'https://api.github.com/repos/react/react-native/releases?per_page=100'; + +export const GITHUB_RELEASES_PAGE_URL = + 'https://github.com/react/react-native/releases'; + +/** + * Deterministic SSR baseline date; updated to the visitor's local date on + * client mount to avoid React hydration mismatches. + */ +export const SSR_DEFAULT_TODAY = '2026-12-03'; + +export const MONTH_NAMES = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', +] as const; + +export const DOW_SHORT = [ + 'Sun', + 'Mon', + 'Tue', + 'Wed', + 'Thu', + 'Fri', + 'Sat', +] as const; + +export function parseISO(iso: string): Date { + const [year, month, day] = iso.split('-').map(Number); + return new Date(Date.UTC(year, month - 1, day)); +} + +export function toISO(date: Date): string { + const y = date.getUTCFullYear(); + const m = String(date.getUTCMonth() + 1).padStart(2, '0'); + const d = String(date.getUTCDate()).padStart(2, '0'); + return `${y}-${m}-${d}`; +} + +export function addDays(iso: string, days: number): string { + const dt = parseISO(iso); + dt.setUTCDate(dt.getUTCDate() + days); + return toISO(dt); +} + +export function diffDays(isoA: string, isoB: string): number { + return Math.round( + (parseISO(isoB).getTime() - parseISO(isoA).getTime()) / 86400000 + ); +} + +export function formatPrettyDate( + iso: string | null, + locale: string | undefined = 'en-US' +): string { + if (!iso) { + return '—'; + } + const dt = parseISO(iso); + return new Intl.DateTimeFormat(locale, { + year: 'numeric', + month: 'short', + day: 'numeric', + timeZone: 'UTC', + }).format(dt); +} + +export function formatShortDate( + iso: string | null, + locale: string | undefined = 'en-US' +): string { + if (!iso) { + return '—'; + } + const dt = parseISO(iso); + return new Intl.DateTimeFormat(locale, { + month: 'short', + day: 'numeric', + timeZone: 'UTC', + }).format(dt); +} + +export function getLocalTodayISO(): string { + const now = new Date(); + const y = now.getFullYear(); + const m = String(now.getMonth() + 1).padStart(2, '0'); + const d = String(now.getDate()).padStart(2, '0'); + return `${y}-${m}-${d}`; +} + +/** + * Converts the build-time release dates (tag -> ISO date, provided by the + * `release-dates` Docusaurus plugin) into GitHub API rows so they can be + * merged with a live fetch. + */ +export function releaseDatesToGitHubReleases( + dates: Readonly> +): GitHubReleaseApiItem[] { + return Object.entries(dates).map(([tag, date]) => ({ + tag_name: tag, + created_at: date, + html_url: `${GITHUB_RELEASES_PAGE_URL}/tag/${tag}`, + })); +} + +/** + * Merges build-time rows with live API rows; live rows win for the same tag. + */ +export function mergeGitHubReleases( + buildTime: readonly GitHubReleaseApiItem[], + live: readonly GitHubReleaseApiItem[] +): GitHubReleaseApiItem[] { + const byTag = new Map(); + for (const item of buildTime) { + byTag.set(item.tag_name, item); + } + for (const item of live) { + byTag.set(item.tag_name, item); + } + return Array.from(byTag.values()); +} + +/** + * Parses GitHub Releases API rows from `react/react-native` into per-series + * RC, stable, and patch records sorted ascending by version number. + */ +export function parseGitHubReleases( + items: readonly GitHubReleaseApiItem[] +): Map { + const map = new Map(); + + const getOrCreate = (series: string): GitHubSeriesData => { + let entry = map.get(series); + if (!entry) { + entry = {rcs: [], stable: null, patches: []}; + map.set(series, entry); + } + return entry; + }; + + for (const item of items) { + if (item.draft || !item.tag_name) { + continue; + } + // `created_at` is the release commit date; `published_at` (when the GitHub + // release page went public) can lag the actual release by days. + const rawDate = item.created_at ?? item.published_at; + if (!rawDate || rawDate.length < 10) { + continue; + } + const date = rawDate.slice(0, 10); + const url = + item.html_url || `${GITHUB_RELEASES_PAGE_URL}/tag/${item.tag_name}`; + + const rcMatch = /^v(\d+\.\d+)\.0-rc\.(\d+)$/.exec(item.tag_name); + if (rcMatch) { + const series = rcMatch[1]; + const rcNumber = Number(rcMatch[2]); + const entry = getOrCreate(series); + entry.rcs.push({ + tag: item.tag_name, + code: `${series}.0-rc.${rcNumber}`, + date, + url, + rcNumber, + }); + continue; + } + + const stableMatch = /^v(\d+\.\d+)\.(\d+)$/.exec(item.tag_name); + if (stableMatch) { + const series = stableMatch[1]; + const patchNumber = Number(stableMatch[2]); + const entry = getOrCreate(series); + const info: GitHubTagInfo = { + tag: item.tag_name, + code: `${series}.${patchNumber}`, + date, + url, + patchNumber, + }; + if (patchNumber === 0) { + entry.stable = info; + } else { + entry.patches.push(info); + } + } + } + + for (const entry of map.values()) { + entry.rcs.sort((a, b) => (a.rcNumber ?? 0) - (b.rcNumber ?? 0)); + entry.patches.sort((a, b) => (a.patchNumber ?? 0) - (b.patchNumber ?? 0)); + } + + return map; +} + +function buildUpcomingMilestones( + record: ReleaseRecord, + ghSeries?: GitHubSeriesData +): ReleaseMilestone[] { + const actualRcByIndex = new Map(); + if (ghSeries) { + for (const rc of ghSeries.rcs) { + if (rc.rcNumber !== undefined) { + actualRcByIndex.set(rc.rcNumber, rc); + } + } + } + + const weeksBetween = Math.max( + 1, + Math.round(diffDays(record.branchCut, record.releaseDate) / 7) + ); + const maxActualRc = + ghSeries && ghSeries.rcs.length > 0 + ? Math.max(...ghSeries.rcs.map(r => r.rcNumber ?? 0)) + : -1; + const rcCount = Math.max(weeksBetween, maxActualRc + 1); + const goldenIdx = weeksBetween - 1; + + const milestones: ReleaseMilestone[] = []; + for (let w = 0; w < rcCount; w++) { + const actual = actualRcByIndex.get(w); + const dt = actual ? actual.date : addDays(record.branchCut, w * 7); + const isCut = w === 0; + const isGolden = w === goldenIdx; + const manualTest = w === 0 || w === 1 || isGolden; + const label = isCut + ? 'RC0 (Branch Cut)' + : isGolden + ? `RC${w} (Golden RC)` + : `RC${w}`; + milestones.push({ + kind: isCut ? 'cut' : isGolden ? 'golden' : 'rc', + code: `${record.version}.0-rc.${w}`, + label, + date: dt, + manualTest, + url: actual?.url, + isActual: Boolean(actual), + }); + } + + const actualStable = ghSeries?.stable ?? null; + milestones.push({ + kind: 'stable', + code: `${record.version}.0`, + label: `${record.version}.0 (Stable)`, + date: actualStable ? actualStable.date : record.releaseDate, + manualTest: false, + url: actualStable?.url, + isActual: Boolean(actualStable), + }); + + if (ghSeries) { + for (const patch of ghSeries.patches) { + milestones.push({ + kind: 'patch', + code: patch.code, + label: `${patch.code} (Patch)`, + date: patch.date, + manualTest: false, + url: patch.url, + isActual: true, + }); + } + } + + return milestones; +} + +function buildPublishedMilestones( + record: ReleaseRecord, + ghSeries?: GitHubSeriesData +): ReleaseMilestone[] { + const defaultStableUrl = `${GITHUB_RELEASES_PAGE_URL}/tag/v${record.version}.0`; + + if (!ghSeries || (ghSeries.rcs.length === 0 && !ghSeries.stable)) { + return [ + { + kind: 'cut', + code: `${record.version}.0-rc.0`, + label: 'RC0 (Branch Cut)', + date: record.branchCut, + manualTest: true, + url: `${GITHUB_RELEASES_PAGE_URL}/tag/v${record.version}.0-rc.0`, + isActual: true, + }, + { + kind: 'stable', + code: `${record.version}.0`, + label: `${record.version}.0 (Stable)`, + date: record.releaseDate, + manualTest: false, + url: defaultStableUrl, + isActual: true, + }, + ]; + } + + const milestones: ReleaseMilestone[] = []; + const lastRcNumber = + ghSeries.rcs.length > 0 + ? ghSeries.rcs[ghSeries.rcs.length - 1].rcNumber + : undefined; + + for (const rc of ghSeries.rcs) { + const n = rc.rcNumber ?? 0; + const isCut = n === 0; + const isGolden = !isCut && n === lastRcNumber; + milestones.push({ + kind: isCut ? 'cut' : isGolden ? 'golden' : 'rc', + code: rc.code, + label: isCut + ? 'RC0 (Branch Cut)' + : isGolden + ? `RC${n} (Final RC)` + : `RC${n}`, + date: rc.date, + manualTest: n === 0 || n === 1 || isGolden, + url: rc.url, + isActual: true, + }); + } + + milestones.push({ + kind: 'stable', + code: `${record.version}.0`, + label: `${record.version}.0 (Stable)`, + date: ghSeries.stable?.date ?? record.releaseDate, + manualTest: false, + url: ghSeries.stable?.url ?? defaultStableUrl, + isActual: true, + }); + + for (const patch of ghSeries.patches) { + milestones.push({ + kind: 'patch', + code: patch.code, + label: `${patch.code} (Patch)`, + date: patch.date, + manualTest: false, + url: patch.url, + isActual: true, + }); + } + + return milestones; +} + +export function buildReleaseSchedule( + todayIso: string, + githubBySeries?: Map, + showUnsupported = true +): ScheduleResult { + let releasedRank = 0; + + const allDesc: ScheduledRelease[] = RELEASES.map(record => { + const released = Boolean(record.released); + const support = getSupportStatusForRank(released, releasedRank); + const isLatestStable = released && releasedRank === 0; + if (released) { + releasedRank += 1; + } + + const ghSeries = githubBySeries?.get(record.version); + const latestRc = + ghSeries && ghSeries.rcs.length > 0 + ? ghSeries.rcs[ghSeries.rcs.length - 1] + : null; + const milestones = released + ? buildPublishedMilestones(record, ghSeries) + : buildUpcomingMilestones(record, ghSeries); + + const goldenMilestone = milestones.find(m => m.kind === 'golden'); + const effectiveReleaseDate = released + ? record.releaseDate + : (ghSeries?.stable?.date ?? record.releaseDate); + + return { + version: record.version, + branchCut: record.branchCut, + goldenDate: goldenMilestone?.date ?? addDays(effectiveReleaseDate, -7), + releaseDate: effectiveReleaseDate, + eocDate: null, + eolDate: null, + blog: record.blog ?? '', + githubSearchUrl: `${GITHUB_RELEASES_PAGE_URL}?q=v${record.version}`, + latestRc, + stableReleaseUrl: released + ? (ghSeries?.stable?.url ?? + `${GITHUB_RELEASES_PAGE_URL}/tag/v${record.version}.0`) + : (ghSeries?.stable?.url ?? null), + releaseType: record.releaseType, + released, + support, + inRC: !released && (record.branchCut <= todayIso || latestRc !== null), + isLatestStable, + milestones, + }; + }); + + const allAsc = [...allDesc].reverse(); + + // Derive known EoC (2 releases later) and EOL (3 releases later) from + // scheduled entries in RELEASES without extrapolating beyond the table. + for (let i = 0; i < allAsc.length; i++) { + allAsc[i].eocDate = allAsc[i + 2]?.releaseDate ?? null; + allAsc[i].eolDate = allAsc[i + 3]?.releaseDate ?? null; + } + + const visibleAsc = showUnsupported + ? allAsc + : allAsc.filter(r => r.support !== 'Unsupported'); + const visibleDesc = [...visibleAsc].reverse(); + const upcomingAsc = allAsc.filter(r => !r.released); + + return { + allAsc, + visibleAsc, + visibleDesc, + upcomingAsc, + }; +} + +export function buildOverviewMarkdown(data: ScheduleResult): string { + const lines = [ + '| Version | Branch cut date | Release date | Support | Blog post |', + '| --- | --- | --- | --- | --- |', + ]; + for (const r of data.visibleDesc) { + const blog = r.blog ? `[Details](${r.blog})` : ''; + lines.push( + `| ${r.version}.x | ${r.branchCut} | ${r.releaseDate} | ${r.support} | ${blog} |` + ); + } + return lines.join('\n'); +} + +export function buildRcMarkdown( + data: ScheduleResult, + upcomingOnly: boolean +): string { + const rows = upcomingOnly ? data.upcomingAsc : data.visibleAsc; + const lines = [ + '| Release Series | Type | Date | Event | Notes |', + '| --- | --- | --- | --- | --- |', + ]; + for (const r of rows) { + r.milestones.forEach((m, idx) => { + const seriesCell = idx === 0 ? `**${r.version}.x**` : ''; + const typeCell = idx === 0 ? r.releaseType : ''; + const eventCell = m.url ? `[${m.label}](${m.url})` : m.label; + const notes: string[] = []; + if (m.isActual) { + notes.push('Published'); + } + if (m.manualTest) { + notes.push('Release Crew QA'); + } + lines.push( + `| ${seriesCell} | ${typeCell} | ${m.date} | ${eventCell} | ${notes.join('; ')} |` + ); + }); + } + return lines.join('\n'); +} + +export function buildICS( + data: ScheduleResult, + todayIso: string, + icsOptions: IcsOptions +): string { + const rows = icsOptions.upcomingOnly ? data.upcomingAsc : data.visibleAsc; + const stamp = `${todayIso.replace(/-/g, '')}T000000Z`; + const lines = [ + 'BEGIN:VCALENDAR', + 'VERSION:2.0', + 'PRODID:-//React Native//Release Schedule Calendar//EN', + 'CALSCALE:GREGORIAN', + 'METHOD:PUBLISH', + 'X-WR-CALNAME:React Native Release Schedule', + ]; + + for (const r of rows) { + for (const m of r.milestones) { + if (!icsOptions[m.kind]) { + continue; + } + const dtStart = m.date.replace(/-/g, ''); + const dtEnd = addDays(m.date, 1).replace(/-/g, ''); + const uid = `rn-${m.code.replace(/[^a-zA-Z0-9.-]/g, '')}-${dtStart}@reactnative.dev`; + const summary = `React Native ${r.version} — ${m.label}`; + const descParts = [ + `Series: ${r.version}.x`, + `Type: ${r.releaseType}`, + `Version: ${m.code}`, + m.url ? `GitHub Release: ${m.url}` : '', + m.manualTest ? 'Release Crew manual QA milestone.' : '', + 'Schedule reference: https://reactnative.dev/releases/overview', + ].filter(Boolean); + + lines.push('BEGIN:VEVENT'); + lines.push(`UID:${uid}`); + lines.push(`DTSTAMP:${stamp}`); + lines.push(`DTSTART;VALUE=DATE:${dtStart}`); + lines.push(`DTEND;VALUE=DATE:${dtEnd}`); + lines.push(`SUMMARY:${summary}`); + lines.push(`DESCRIPTION:${descParts.join('\\n')}`); + if (m.url) { + lines.push(`URL:${m.url}`); + } + lines.push('END:VEVENT'); + } + } + + lines.push('END:VCALENDAR'); + return lines.join('\r\n'); +} + +export function buildCSV(data: ScheduleResult): string { + const header = [ + 'version', + 'release_type', + 'branch_cut', + 'latest_or_golden_rc', + 'release_date', + 'end_of_cycle', + 'unsupported', + 'support_status', + 'latest_rc_tag', + ]; + const lines = [header.join(',')]; + for (const r of data.visibleDesc) { + const cells = [ + `${r.version}.x`, + r.releaseType, + r.branchCut, + r.latestRc?.date ?? (r.released ? '' : r.goldenDate), + r.releaseDate, + r.eocDate ?? '', + r.eolDate ?? '', + r.support, + r.latestRc?.tag ?? '', + ].map(value => + value.includes(',') ? `"${value.replace(/"/g, '""')}"` : value + ); + lines.push(cells.join(',')); + } + return lines.join('\n'); +} + +export function buildJSON(data: ScheduleResult): string { + const payload = { + source: 'https://reactnative.dev/releases/overview', + githubReleases: GITHUB_RELEASES_PAGE_URL, + releases: data.visibleDesc.map(r => ({ + version: `${r.version}.x`, + releaseType: r.releaseType, + branchCut: r.branchCut, + releaseDate: r.releaseDate, + endOfCycle: r.eocDate, + unsupported: r.eolDate, + support: r.support, + latestRc: r.latestRc + ? {tag: r.latestRc.tag, date: r.latestRc.date, url: r.latestRc.url} + : undefined, + milestones: r.milestones.map(m => ({ + code: m.code, + label: m.label, + date: m.date, + manualTest: m.manualTest, + isActual: Boolean(m.isActual), + url: m.url, + })), + })), + }; + return JSON.stringify(payload, null, 2); +} diff --git a/website/src/components/releases/releasesData.ts b/website/src/components/releases/releasesData.ts new file mode 100644 index 00000000000..14d62552bdb --- /dev/null +++ b/website/src/components/releases/releasesData.ts @@ -0,0 +1,163 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +export type ReleaseType = 'Breaking' | 'Non-breaking'; + +export type SupportStatus = + 'Future' | 'Active' | 'End of Cycle' | 'Unsupported'; + +export interface ReleaseRecord { + /** Minor series version, e.g. '0.89' (rendered as '0.89.x'). */ + version: string; + /** ISO date (YYYY-MM-DD) when the release branch was or will be cut. */ + branchCut: string; + /** ISO date (YYYY-MM-DD) when the .0 release was or will be published. */ + releaseDate: string; + /** True once .0 has shipped; omit or false for upcoming Future releases. */ + released?: boolean; + /** Path to the release announcement blog post once published. */ + blog?: string; + /** Breaking vs. non-breaking classification for the release cadence. */ + releaseType: ReleaseType; +} + +/** + * Single source of truth for React Native release dates used by both + * `/releases/overview` (`ReleasesTable`) and `/releases/schedule` + * (`ReleaseScheduleCalendar`). + * + * Keep entries ordered newest-first. Support status (`Future`, `Active`, + * `End of Cycle`, `Unsupported`) is derived automatically from `released` + * (the latest 2 released series are Active, the 3rd is End of Cycle, and + * older series are Unsupported). + */ +export const RELEASES: readonly ReleaseRecord[] = [ + { + version: '0.90', + branchCut: '2027-01-04', + releaseDate: '2027-02-08', + releaseType: 'Non-breaking', + }, + { + version: '0.89', + branchCut: '2026-11-02', + releaseDate: '2026-12-07', + releaseType: 'Breaking', + }, + { + version: '0.88', + branchCut: '2026-09-07', + releaseDate: '2026-10-15', + released: true, + blog: '/blog/2026/10/19/react-native-0.88', + releaseType: 'Non-breaking', + }, + { + version: '0.87', + branchCut: '2026-07-06', + releaseDate: '2026-08-11', + released: true, + blog: '/blog/2026/08/11/react-native-0.87', + releaseType: 'Breaking', + }, + { + version: '0.86', + branchCut: '2026-05-04', + releaseDate: '2026-06-09', + released: true, + blog: '/blog/2026/06/11/react-native-0.86', + releaseType: 'Non-breaking', + }, + { + version: '0.85', + branchCut: '2026-03-02', + releaseDate: '2026-04-06', + released: true, + blog: '/blog/2026/04/07/react-native-0.85', + releaseType: 'Breaking', + }, + { + version: '0.84', + branchCut: '2026-01-05', + releaseDate: '2026-02-09', + released: true, + blog: '/blog/2026/02/11/react-native-0.84', + releaseType: 'Breaking', + }, + { + version: '0.83', + branchCut: '2025-11-03', + releaseDate: '2025-12-10', + released: true, + blog: '/blog/2025/12/10/react-native-0.83', + releaseType: 'Non-breaking', + }, + { + version: '0.82', + branchCut: '2025-09-01', + releaseDate: '2025-10-06', + released: true, + blog: '/blog/2025/10/08/react-native-0.82', + releaseType: 'Breaking', + }, + { + version: '0.81', + branchCut: '2025-07-10', + releaseDate: '2025-08-12', + released: true, + blog: '/blog/2025/08/12/react-native-0.81', + releaseType: 'Breaking', + }, + { + version: '0.80', + branchCut: '2025-05-07', + releaseDate: '2025-06-12', + released: true, + blog: '/blog/2025/06/12/react-native-0.80', + releaseType: 'Breaking', + }, + { + version: '0.79', + branchCut: '2025-03-04', + releaseDate: '2025-04-08', + released: true, + blog: '/blog/2025/04/08/react-native-0.79', + releaseType: 'Breaking', + }, + { + version: '0.78', + branchCut: '2025-01-15', + releaseDate: '2025-02-19', + released: true, + blog: '/blog/2025/02/19/react-native-0.78', + releaseType: 'Breaking', + }, + { + version: '0.77', + branchCut: '2024-11-26', + releaseDate: '2025-01-21', + released: true, + blog: '/blog/2025/01/21/version-0.77', + releaseType: 'Breaking', + }, +]; + +export function getSupportStatusForRank( + released: boolean | undefined, + releasedRank: number +): SupportStatus { + if (!released) { + return 'Future'; + } + if (releasedRank === 0 || releasedRank === 1) { + return 'Active'; + } + if (releasedRank === 2) { + return 'End of Cycle'; + } + return 'Unsupported'; +} diff --git a/website/src/pages/versions.tsx b/website/src/pages/versions.tsx index 0c889b7f0eb..dd9dbc3ee8b 100644 --- a/website/src/pages/versions.tsx +++ b/website/src/pages/versions.tsx @@ -63,6 +63,7 @@ const VersionItem = ({ // (a standalone React page, not a doc) renders the same sidebar. Keep in sync. const releasesSidebar: PropSidebar = [ {type: 'link', href: '/releases/overview', label: 'Overview'}, + {type: 'link', href: '/releases/schedule', label: 'Release Calendar'}, {type: 'link', href: '/releases/branches', label: 'Branches'}, { type: 'link',