- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 6.4k
 
feat: add eol page #7990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
  
     Merged
                    feat: add eol page #7990
Changes from 18 commits
      Commits
    
    
            Show all changes
          
          
            69 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      02db91b
              
                feat: add eol page
              
              
                bmuenzenmeyer 113334f
              
                Update Modal.tsx
              
              
                ovflowd 6bc1393
              
                expand and do not reuse i18n keys
              
              
                bmuenzenmeyer 967676d
              
                add one more i18n key
              
              
                bmuenzenmeyer 5cd1b33
              
                add footer to article layout
              
              
                bmuenzenmeyer d2b7826
              
                Update apps/site/components/EOL/Table.tsx
              
              
                bmuenzenmeyer b294b44
              
                cleanup unused classnames
              
              
                bmuenzenmeyer 4204159
              
                simplify Table
              
              
                bmuenzenmeyer 2cadb0c
              
                normalize endOfLife vs eol
              
              
                bmuenzenmeyer 55abd69
              
                Apply suggestions from code review
              
              
                bmuenzenmeyer 1a4a53a
              
                add back in the release schedule link
              
              
                bmuenzenmeyer 51c5fb0
              
                small grammar / tense / capitalization changes
              
              
                bmuenzenmeyer ea43096
              
                Update apps/site/pages/en/eol.mdx
              
              
                ovflowd d94d5ce
              
                increase gap between vulnerability chips
              
              
                bmuenzenmeyer 1dccbd5
              
                Merge branch 'main' into eol
              
              
                ovflowd 21014bd
              
                make all translation strings long-form
              
              
                bmuenzenmeyer ff6ddec
              
                document translation key retrieval
              
              
                bmuenzenmeyer 9c68dd0
              
                rename variable
              
              
                bmuenzenmeyer f8cab5e
              
                move CTAs up
              
              
                bmuenzenmeyer 2fbd30a
              
                Merge branch 'main' into eol
              
              
                ovflowd 7babcc8
              
                chore: button variants, and updated eol page; removed translated prev…
              
              
                ovflowd 07befbb
              
                rename EOLModal/index per standard
              
              
                bmuenzenmeyer 594531f
              
                rename components per docs and patterns
              
              
                bmuenzenmeyer c4abb0e
              
                chore: design improvements
              
              
                ovflowd e471cb0
              
                chore: tiny mobile improvement
              
              
                ovflowd 6b7bde7
              
                chore: apply suggestions
              
              
                ovflowd 2a748fd
              
                chore: apply text suggestions
              
              
                ovflowd e0f7c44
              
                chore: balance the buttons
              
              
                ovflowd 5ab2cbb
              
                fix a11y issue on mdx rendering
              
              
                bmuenzenmeyer 26f5b81
              
                chore: make it rain tm
              
              
                ovflowd 16f5992
              
                Update vulnerabilities.mjs
              
              
                avivkeller ccbba0f
              
                apply aviv"s suggestions - manually added as the redirect also needed…
              
              
                bmuenzenmeyer 40df1ab
              
                types and constants cleanup
              
              
                bmuenzenmeyer f424d53
              
                fix import
              
              
                bmuenzenmeyer 7724afb
              
                more types cleanup
              
              
                bmuenzenmeyer 669d21d
              
                one final type lint
              
              
                bmuenzenmeyer 04e4f5c
              
                Merge branch 'main' into eol
              
              
                bmuenzenmeyer 89e5c92
              
                move link below buttons
              
              
                bmuenzenmeyer 748e116
              
                move URL to constants
              
              
                bmuenzenmeyer 9fe21cc
              
                rename variable
              
              
                bmuenzenmeyer 4836bef
              
                tighten up UnknownSeverity types
              
              
                bmuenzenmeyer c147efc
              
                format after refactor
              
              
                bmuenzenmeyer 847897b
              
                memoize calls
              
              
                bmuenzenmeyer d61bd30
              
                simplify translation call
              
              
                bmuenzenmeyer 1a522c8
              
                apply suggestion
              
              
                bmuenzenmeyer dd10604
              
                apply linter
              
              
                bmuenzenmeyer fb31b90
              
                refator vulnerability grouping, add unit tests
              
              
                bmuenzenmeyer 6957f21
              
                avoid passing modal via frontmatter
              
              
                avivkeller 1c499dd
              
                generify modal props
              
              
                avivkeller 1a7a80a
              
                move checks into children components
              
              
                avivkeller 029ee7d
              
                pass all vulns to children
              
              
                avivkeller 54fe024
              
                fixup!
              
              
                avivkeller 9a8c6c7
              
                no modal provider
              
              
                avivkeller 92cdd9a
              
                rename ref to url
              
              
                avivkeller f579c6f
              
                fix type
              
              
                avivkeller f376739
              
                use proper import specifier
              
              
                bmuenzenmeyer 37df55b
              
                tweak memo per review
              
              
                bmuenzenmeyer ef51f5c
              
                destructure and cleanup.
              
              
                bmuenzenmeyer ec44c25
              
                Merge branch 'main' into eol
              
              
                bmuenzenmeyer cfc2828
              
                move key after fragment introduced
              
              
                bmuenzenmeyer f63e6b6
              
                change herodevs link to be a direct anchor, with no event listener fr…
              
              
                bmuenzenmeyer 947ea35
              
                use rich translation for EOLAlertBox
              
              
                bmuenzenmeyer 3a1ae8f
              
                chore: recommendation under
              
              
                ovflowd 784e7e1
              
                Update apps/site/components/EOL/VulnerabilityChips/Chip/index.tsx
              
              
                bmuenzenmeyer 5167bf1
              
                use filtered vulnerabilities
              
              
                bmuenzenmeyer c4e0b56
              
                add space
              
              
                bmuenzenmeyer 60ff118
              
                use consistent modern looping
              
              
                bmuenzenmeyer dca3e9c
              
                chore: cleanup, refactor + fixes
              
              
                ovflowd 97ac623
              
                fix: tests
              
              
                ovflowd File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import AlertBox from '@node-core/ui-components/Common/AlertBox'; | ||
| import { useTranslations } from 'next-intl'; | ||
| 
     | 
||
| import Link from '#site/components/Link'; | ||
| 
     | 
||
| const EOLAlert = () => { | ||
| const t = useTranslations(); | ||
| return ( | ||
| <AlertBox level="warning"> | ||
| {t('components.eolAlert.intro')}{' '} | ||
| <Link href="/eol"> | ||
| OpenJS Ecosystem Sustainability Program{' '} | ||
| {t('components.eolAlert.partner')} HeroDevs | ||
| </Link> | ||
| </AlertBox> | ||
| ); | ||
| }; | ||
| 
     | 
||
| export default EOLAlert; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| import { Modal, Title, Content } from '@node-core/ui-components/Common/Modal'; | ||
| import classNames from 'classnames'; | ||
| import { useTranslations } from 'next-intl'; | ||
| import type { FC } from 'react'; | ||
| 
     | 
||
| import VulnerabilityChip from '#site/components/EOL/VulnerabilityChips/Chip'; | ||
| import LinkWithArrow from '#site/components/LinkWithArrow'; | ||
| import type { ModalProps } from '#site/providers/modalProvider'; | ||
| import type { NodeRelease } from '#site/types'; | ||
| import type { Vulnerability } from '#site/types/vulnerabilities'; | ||
| 
     | 
||
| import { SEVERITY_ORDER } from './VulnerabilityChips'; | ||
| 
     | 
||
| type EOLModalData = { | ||
| release: NodeRelease; | ||
| vulnerabilities: Array<Vulnerability>; | ||
| }; | ||
| 
     | 
||
| type KnownVulnerability = Vulnerability & { | ||
| severity: (typeof SEVERITY_ORDER)[number]; | ||
| }; | ||
| 
     | 
||
| const VulnerabilitiesTable: FC<{ | ||
                
      
                  bmuenzenmeyer marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| vulnerabilities: Array<Vulnerability>; | ||
| maxWidth?: string; | ||
| }> = ({ vulnerabilities, maxWidth = 'max-w-2xs' }) => { | ||
| const t = useTranslations(); | ||
| 
     | 
||
| return ( | ||
| <table className="w-full"> | ||
| <thead> | ||
| <tr> | ||
| <th>{t('components.eolModal.table.cves')}</th> | ||
| <th>{t('components.eolModal.table.severity')}</th> | ||
| <th>{t('components.eolModal.table.overview')}</th> | ||
| <th>{t('components.eolModal.table.details')}</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {vulnerabilities.map((vuln, i) => ( | ||
| <tr key={i}> | ||
| <td> | ||
| {vuln.cve.length | ||
| ? vuln.cve.map(cveId => ( | ||
                
      
                  ovflowd marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| <div key={cveId}> | ||
| <LinkWithArrow | ||
| href={`https://www.cve.org/CVERecord?id=${cveId}`} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {cveId} | ||
| </LinkWithArrow> | ||
| </div> | ||
| )) | ||
| : '-'} | ||
| </td> | ||
| <td> | ||
| <VulnerabilityChip severity={vuln.severity} /> | ||
| </td> | ||
| <td className={classNames(maxWidth, 'truncate')}> | ||
| {vuln.description || vuln.overview || '-'} | ||
| </td> | ||
| <td> | ||
| {vuln.ref ? ( | ||
| <LinkWithArrow | ||
| href={vuln.ref} | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| {t('components.eolModal.blogLinkText')} | ||
| </LinkWithArrow> | ||
| ) : ( | ||
| '—' | ||
| )} | ||
| </td> | ||
| </tr> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| ); | ||
| }; | ||
| 
     | 
||
| const UnknownSeveritySection: FC<{ | ||
| vulnerabilities: Array<Vulnerability>; | ||
                
      
                  ovflowd marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| hasKnownVulns: boolean; | ||
| }> = ({ vulnerabilities, hasKnownVulns }) => { | ||
| const t = useTranslations(); | ||
| 
     | 
||
| if (!vulnerabilities.length) { | ||
| return null; | ||
| } | ||
| 
     | 
||
| return ( | ||
| <details open={!hasKnownVulns}> | ||
| <summary className="cursor-pointer font-semibold"> | ||
| {t('components.eolModal.showUnknownSeverities')} ( | ||
| {vulnerabilities.length}) | ||
| </summary> | ||
| <div className="mt-4"> | ||
| <VulnerabilitiesTable | ||
| vulnerabilities={vulnerabilities} | ||
| maxWidth={'max-w-3xs'} | ||
| /> | ||
| </div> | ||
| </details> | ||
| ); | ||
| }; | ||
| 
     | 
||
| const EOLModal: FC<ModalProps> = ({ open, closeModal, data }) => { | ||
| const { release, vulnerabilities } = data as EOLModalData; | ||
| const t = useTranslations(); | ||
| 
     | 
||
| const modalHeading = t( | ||
| release.codename | ||
| ? 'components.eolModal.title' | ||
| : 'components.eolModal.titleWithoutCodename', | ||
| { | ||
| version: release.major, | ||
| codename: release.codename ?? '', | ||
| } | ||
| ); | ||
| 
     | 
||
| const [knownVulns, unknownVulns] = vulnerabilities.reduce( | ||
                
      
                  ovflowd marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| (acc, vuln) => { | ||
| acc[vuln.severity === 'unknown' ? 1 : 0].push(vuln as KnownVulnerability); | ||
| return acc; | ||
| }, | ||
| [[], []] as [Array<KnownVulnerability>, Array<Vulnerability>] | ||
| ); | ||
| 
     | 
||
| knownVulns.sort( | ||
                
      
                  ovflowd marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
| (a, b) => | ||
| SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity) | ||
| ); | ||
| 
     | 
||
| const hasKnownVulns = knownVulns.length > 0; | ||
| const hasAnyVulns = hasKnownVulns || unknownVulns.length > 0; | ||
| 
     | 
||
| return ( | ||
| <Modal open={open} onOpenChange={closeModal}> | ||
| <Title>{modalHeading}</Title> | ||
| <Content> | ||
| {vulnerabilities.length > 0 && ( | ||
| <p className="m-1"> | ||
| {t('components.eolModal.vulnerabilitiesMessage', { | ||
| count: vulnerabilities.length, | ||
| })} | ||
| </p> | ||
| )} | ||
| 
     | 
||
| {hasKnownVulns && <VulnerabilitiesTable vulnerabilities={knownVulns} />} | ||
| 
     | 
||
| <UnknownSeveritySection | ||
| vulnerabilities={unknownVulns} | ||
| hasKnownVulns={hasKnownVulns} | ||
| /> | ||
| 
     | 
||
| {!hasAnyVulns && ( | ||
| <p className="m-1"> | ||
| {t('components.eolModal.noVulnerabilitiesMessage')} | ||
| </p> | ||
| )} | ||
| </Content> | ||
| </Modal> | ||
| ); | ||
| }; | ||
| 
     | 
||
| export default EOLModal; | ||
                
      
                  bmuenzenmeyer marked this conversation as resolved.
               
              
                Outdated
          
            Show resolved
            Hide resolved
         | 
||
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.