Skip to content

Conversation

@luwes
Copy link
Collaborator

@luwes luwes commented Nov 12, 2025

fix #102

SCR-20251111-osct

This pull request introduces a new utility for displaying a styled console banner with version information and usage warnings, and integrates it into both the HTML and React video provider components. The changes improve developer awareness of the library version and pre-release status when using the components.

Console Banner Integration

  • Added a new yieldConsoleBanner utility function in packages/utils/src/shared/console.ts that prints a styled banner with the current version, pre-release warnings, and helpful links to the browser console.
  • Exported yieldConsoleBanner from the main utils index in packages/utils/src/index.ts to make it available across the codebase.

Provider Component Updates

  • Integrated the yieldConsoleBanner(version) call at the top of both packages/html/src/media/video-provider.ts and packages/react/src/store/video-provider.tsx, ensuring the banner appears whenever the video provider components are loaded. [1] [2]

@luwes luwes requested a review from Copilot November 12, 2025 00:41
@luwes luwes self-assigned this Nov 12, 2025
@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
vjs-10-demo-html Ready Ready Preview Comment Nov 12, 2025 0:41am
vjs-10-demo-next Ready Ready Preview Comment Nov 12, 2025 0:41am
vjs-10-demo-react Ready Ready Preview Comment Nov 12, 2025 0:41am
vjs-10-website Ready Ready Preview Comment Nov 12, 2025 0:41am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a styled console banner to display library version information and usage warnings. The banner appears when video provider components are loaded, helping developers identify the version in use and warning them about pre-release builds.

Key changes:

  • Created yieldConsoleBanner utility function to display styled console output with version, pre-release warnings, and support links
  • Integrated the banner into both HTML and React video provider components at module load time

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
packages/utils/src/shared/console.ts Implements the banner utility with styled console output and pre-release detection
packages/utils/src/index.ts Exports the console banner utility for use across packages
packages/react/src/store/video-provider.tsx Calls banner function at module level to display version on component load
packages/html/src/media/video-provider.ts Calls banner function at module level to display version on component load

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

);

const prereleaseType = version.includes('preview') ? 'preview' : version.includes('alpha') ? 'alpha' : null;
if (prereleaseType) {
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
if (prereleaseType) {
if (prereleaseType) {
// eslint-disable-next-line no-console

Copilot uses AI. Check for mistakes.
`font: 1em monospace;`,
);

const prereleaseType = version.includes('preview') ? 'preview' : version.includes('alpha') ? 'alpha' : null;
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The nested ternary operator is difficult to read. Consider refactoring to an if-else statement or extracting to a separate function for better clarity.

Suggested change
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 uses AI. Check for mistakes.
import { version } from '../../package.json';
import { MediaContext } from './context';

yieldConsoleBanner(version);
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
yieldConsoleBanner(version);
if (!(globalThis as any).__videojs_banner_displayed) {
yieldConsoleBanner(version);
(globalThis as any).__videojs_banner_displayed = true;
}

Copilot uses AI. Check for mistakes.
import { yieldConsoleBanner } from '@videojs/utils';
import { version } from '../../package.json';

yieldConsoleBanner(version);
Copy link

Copilot AI Nov 12, 2025

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.

Suggested change
yieldConsoleBanner(version);
if (typeof window !== 'undefined' && !(window as any).__videojs_banner_displayed) {
yieldConsoleBanner(version);
(window as any).__videojs_banner_displayed = true;
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

console.warn("⚠️ This is a Technical Preview: proceed with caution")

2 participants