Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #617 +/- ##
==========================================
- Coverage 78.62% 72.44% -6.19%
==========================================
Files 128 144 +16
Lines 12461 12613 +152
Branches 902 872 -30
==========================================
- Hits 9798 9137 -661
- Misses 2658 3471 +813
Partials 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
| File | Base | Head | Diff |
|---|---|---|---|
orama-db.json |
8.03 MB | 8.03 MB | +2.00 B (+0.00%) |
web Generator
| File | Base | Head | Diff |
|---|---|---|---|
webcrypto.js |
464.93 KB | 428.55 KB | -36.38 KB (-7.83%) |
webcrypto.html |
528.45 KB | 500.52 KB | -27.93 KB (-5.29%) |
crypto.js |
1.24 MB | 1.23 MB | -6.21 KB (-0.49%) |
crypto.html |
987.57 KB | 982.80 KB | -4.77 KB (-0.48%) |
styles.css |
128.14 KB | 129.94 KB | +1.80 KB (+1.40%) |
addons.js |
299.72 KB | 299.85 KB | +138.00 B (+0.04%) |
debugger.js |
31.09 KB | 31.22 KB | +138.00 B (+0.43%) |
report.js |
188.53 KB | 188.67 KB | +138.00 B (+0.07%) |
typescript.js |
25.81 KB | 25.94 KB | +138.00 B (+0.52%) |
cli.js |
325.51 KB | 325.64 KB | +133.00 B (+0.04%) |
deprecations.js |
313.52 KB | 313.65 KB | +133.00 B (+0.04%) |
environment_variables.js |
15.13 KB | 15.26 KB | +133.00 B (+0.86%) |
errors.js |
413.89 KB | 414.02 KB | +133.00 B (+0.03%) |
esm.js |
139.78 KB | 139.91 KB | +133.00 B (+0.09%) |
globals.js |
141.34 KB | 141.47 KB | +133.00 B (+0.09%) |
module.js |
351.50 KB | 351.63 KB | +133.00 B (+0.04%) |
modules.js |
158.24 KB | 158.37 KB | +133.00 B (+0.08%) |
n-api.js |
721.30 KB | 721.43 KB | +133.00 B (+0.02%) |
packages.js |
126.22 KB | 126.35 KB | +133.00 B (+0.10%) |
permissions.js |
28.46 KB | 28.58 KB | +133.00 B (+0.46%) |
webstreams.js |
320.81 KB | 320.94 KB | +133.00 B (+0.04%) |
assert.js |
467.59 KB | 467.71 KB | +128.00 B (+0.03%) |
async_context.js |
194.17 KB | 194.30 KB | +128.00 B (+0.06%) |
async_hooks.js |
201.30 KB | 201.42 KB | +128.00 B (+0.06%) |
buffer.js |
1.13 MB | 1.13 MB | +128.00 B (+0.01%) |
child_process.js |
489.11 KB | 489.24 KB | +128.00 B (+0.03%) |
cluster.js |
206.89 KB | 207.01 KB | +128.00 B (+0.06%) |
console.js |
114.73 KB | 114.85 KB | +128.00 B (+0.11%) |
dgram.js |
185.12 KB | 185.25 KB | +128.00 B (+0.07%) |
diagnostics_channel.js |
252.87 KB | 253.00 KB | +128.00 B (+0.05%) |
dns.js |
292.44 KB | 292.56 KB | +128.00 B (+0.04%) |
domain.js |
93.08 KB | 93.20 KB | +128.00 B (+0.13%) |
embedding.js |
37.28 KB | 37.40 KB | +128.00 B (+0.34%) |
events.js |
575.74 KB | 575.87 KB | +128.00 B (+0.02%) |
fs.js |
1.33 MB | 1.33 MB | +128.00 B (+0.01%) |
http.js |
742.92 KB | 743.04 KB | +128.00 B (+0.02%) |
http2.js |
861.83 KB | 861.96 KB | +128.00 B (+0.01%) |
https.js |
166.44 KB | 166.57 KB | +128.00 B (+0.08%) |
inspector.js |
132.83 KB | 132.95 KB | +128.00 B (+0.09%) |
intl.js |
37.06 KB | 37.19 KB | +128.00 B (+0.34%) |
net.js |
321.67 KB | 321.79 KB | +128.00 B (+0.04%) |
os.js |
116.34 KB | 116.47 KB | +128.00 B (+0.11%) |
path.js |
105.32 KB | 105.44 KB | +128.00 B (+0.12%) |
perf_hooks.js |
406.03 KB | 406.15 KB | +128.00 B (+0.03%) |
process.js |
747.57 KB | 747.69 KB | +128.00 B (+0.02%) |
punycode.js |
30.23 KB | 30.36 KB | +128.00 B (+0.41%) |
querystring.js |
33.02 KB | 33.15 KB | +128.00 B (+0.38%) |
quic.js |
220.25 KB | 220.37 KB | +128.00 B (+0.06%) |
readline.js |
238.88 KB | 239.00 KB | +128.00 B (+0.05%) |
repl.js |
215.40 KB | 215.52 KB | +128.00 B (+0.06%) |
single-executable-applications.js |
83.41 KB | 83.54 KB | +128.00 B (+0.15%) |
sqlite.js |
241.73 KB | 241.86 KB | +128.00 B (+0.05%) |
stream.js |
909.92 KB | 910.04 KB | +128.00 B (+0.01%) |
string_decoder.js |
32.32 KB | 32.45 KB | +128.00 B (+0.39%) |
synopsis.js |
15.70 KB | 15.83 KB | +128.00 B (+0.80%) |
test.js |
885.03 KB | 885.16 KB | +128.00 B (+0.01%) |
timers.js |
107.82 KB | 107.95 KB | +128.00 B (+0.12%) |
tls.js |
349.38 KB | 349.51 KB | +128.00 B (+0.04%) |
tracing.js |
78.84 KB | 78.97 KB | +128.00 B (+0.16%) |
tty.js |
54.21 KB | 54.34 KB | +128.00 B (+0.23%) |
url.js |
354.43 KB | 354.55 KB | +128.00 B (+0.04%) |
util.js |
797.10 KB | 797.22 KB | +128.00 B (+0.02%) |
v8.js |
355.28 KB | 355.40 KB | +128.00 B (+0.04%) |
vm.js |
380.39 KB | 380.51 KB | +128.00 B (+0.03%) |
wasi.js |
44.80 KB | 44.92 KB | +128.00 B (+0.28%) |
worker_threads.js |
420.88 KB | 421.00 KB | +128.00 B (+0.03%) |
zlib.js |
334.44 KB | 334.56 KB | +128.00 B (+0.04%) |
documentation.js |
9.72 KB | 9.84 KB | +123.00 B (+1.24%) |
index.js |
9.51 KB | 9.63 KB | +123.00 B (+1.26%) |
There was a problem hiding this comment.
Pull request overview
This PR implements an announcement banner component that fetches configuration from a remote JSON endpoint to display global and version-specific banners on the API documentation pages. The banners support date-based activation/deactivation and can include links to relevant resources.
Changes:
- Added
AnnouncementBannercomponent that asynchronously fetches and displays banners from a remote config - Implemented
isBannerActiveutility function to filter banners based on date ranges - Added
versionMajorandremoteConfigfields to static data passed from server to client
Reviewed changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/generators/web/index.mjs |
Adds remote config URL to web generator default configuration |
src/generators/web/types.d.ts |
Adds remoteConfig type definition for the web generator |
src/generators/web/utils/data.mjs |
Extracts version major and remote config URL from server config to client static data |
src/generators/web/constants.mjs |
Registers AnnouncementBanner component in JSX imports map |
src/generators/jsx-ast/utils/buildContent.mjs |
Adds AnnouncementBanner to document layout above navigation bar |
src/generators/web/ui/utils/banner.mjs |
Implements date range checking logic for banner activation |
src/generators/web/ui/utils/__tests__/banner.test.mjs |
Comprehensive tests for banner date range logic |
src/generators/web/ui/components/AnnouncementBanner/types.d.ts |
Type definitions for banner entries and remote config structure |
src/generators/web/ui/components/AnnouncementBanner/index.jsx |
Main component that fetches config and renders active banners |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div> | ||
| {banners.map(banner => ( | ||
| <Banner key={banner.link} type={banner.type}> | ||
| {banner.link ? <a href={banner.link}>{banner.text}</a> : banner.text} |
There was a problem hiding this comment.
External URLs from the remote config are used directly in href attributes without validation. While React/Preact provides some protection against javascript: protocol URLs, there's still a potential security risk if the remote config source is compromised. Consider validating that banner.link uses an approved protocol (https://) or implementing an allowlist of acceptable domains to ensure only trusted URLs are rendered. This is especially important since the config is fetched from an external source.
There was a problem hiding this comment.
@avivkeller @ovflowd what do you think? is this necessary? We don't do this on nodejs website
|
@araujogui please be aware this must 100% be a client-side only component. Since the value of this comes from being able to fetch this at page load, as docs are built only once for each version. |
|
(this also means that this spec cannot ever change or needs to be forever retroactively compatible) |
It is |
uh, that also means we can't change the config url, so we should already create the config file on nodejs/node? |
Yeah... So we need to be very careful here 😓 |
We already have a |
We can use site.json, but note that it is not publicly available, the link would either need to be through raw.githubusercontent.com or we'd need to move the file to be publicly available. |
Description
Create announcements banner component
Validation
Related Issues
Fixes #327
Check List
node --run testand all tests passed.node --run format&node --run lint.