-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add console banner #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,9 +3,14 @@ import type { ReactNode } from 'react'; | |||||||||||
|
|
||||||||||||
| import { createMediaStore } from '@videojs/core/store'; | ||||||||||||
|
|
||||||||||||
| import { yieldConsoleBanner } from '@videojs/utils'; | ||||||||||||
| import { useMemo } from 'react'; | ||||||||||||
|
|
||||||||||||
| import { version } from '../../package.json'; | ||||||||||||
| import { MediaContext } from './context'; | ||||||||||||
|
|
||||||||||||
| yieldConsoleBanner(version); | ||||||||||||
|
||||||||||||
| yieldConsoleBanner(version); | |
| if (!(globalThis as any).__videojs_banner_displayed) { | |
| yieldConsoleBanner(version); | |
| (globalThis as any).__videojs_banner_displayed = true; | |
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||||||||||||
| export function yieldConsoleBanner(version: string): void { | ||||||||||||||||
| // eslint-disable-next-line no-console | ||||||||||||||||
| console.info( | ||||||||||||||||
| `%c Video.js %c v${version}`, | ||||||||||||||||
| `border-radius: 9999px; | ||||||||||||||||
| background: #393836; | ||||||||||||||||
| font: bold 1.5em/1.5em monospace; | ||||||||||||||||
| color: #ebe4c1; | ||||||||||||||||
| text-shadow: 1px 1px 0 #fcb116, | ||||||||||||||||
| 2px 2px 0 #f26222, | ||||||||||||||||
| 3px 3px 0 #ea3837, | ||||||||||||||||
| 4px 4px 0 #a83b71`, | ||||||||||||||||
| `font: 1em monospace;`, | ||||||||||||||||
| ); | ||||||||||||||||
|
|
||||||||||||||||
| const prereleaseType = version.includes('preview') ? 'preview' : version.includes('alpha') ? 'alpha' : null; | ||||||||||||||||
|
||||||||||||||||
| const prereleaseType = version.includes('preview') ? 'preview' : version.includes('alpha') ? 'alpha' : null; | |
| let prereleaseType: string | null = null; | |
| if (version.includes('preview')) { | |
| prereleaseType = 'preview'; | |
| } else if (version.includes('alpha')) { | |
| prereleaseType = 'alpha'; | |
| } |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing eslint-disable-next-line comment for console.warn, while console.info calls have them. Apply the same pattern for consistency with the existing eslint suppressions.
| if (prereleaseType) { | |
| if (prereleaseType) { | |
| // eslint-disable-next-line no-console |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The banner is displayed at module initialization, which means it will execute every time this module is imported, potentially multiple times in an application. Consider adding a guard to ensure the banner is only displayed once per page load.