From cbd3732cff9da6878a51ef964043579ec64d830d Mon Sep 17 00:00:00 2001 From: Gavin Barron Date: Thu, 27 Aug 2026 15:43:33 -0700 Subject: [PATCH] Emit runtime deprecation warning from mgt-element base components Add a guarded, one-time console.warn announcing that MGT was retired on August 28, 2026. The warning is invoked from the MgtBaseComponent and MgtBaseTaskComponent constructors so any component usage surfaces it, and is wrapped in try/catch so logging can never break a host application. This provides a code change to include in the final shipped version. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6df6f5e4-b73e-41c2-a6a6-60f2621c293b --- .../src/components/baseComponent.ts | 2 ++ .../src/components/baseTaskComponent.ts | 2 ++ .../src/utils/deprecationWarning.ts | 33 +++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 packages/mgt-element/src/utils/deprecationWarning.ts diff --git a/packages/mgt-element/src/components/baseComponent.ts b/packages/mgt-element/src/components/baseComponent.ts index 19a4d5544c..c27bfa804e 100644 --- a/packages/mgt-element/src/components/baseComponent.ts +++ b/packages/mgt-element/src/components/baseComponent.ts @@ -11,6 +11,7 @@ import { ProviderState } from '../providers/IProvider'; import { Providers } from '../providers/Providers'; import { LocalizationHelper } from '../utils/LocalizationHelper'; import { PACKAGE_VERSION } from '../utils/version'; +import { emitDeprecationWarning } from '../utils/deprecationWarning'; /** * Defines media query based on component width @@ -128,6 +129,7 @@ export abstract class MgtBaseComponent extends LitElement { constructor() { super(); + emitDeprecationWarning(); this.handleDirectionChanged(); this.handleLocalizationChanged(); } diff --git a/packages/mgt-element/src/components/baseTaskComponent.ts b/packages/mgt-element/src/components/baseTaskComponent.ts index ae25c97bfa..428d8c1269 100644 --- a/packages/mgt-element/src/components/baseTaskComponent.ts +++ b/packages/mgt-element/src/components/baseTaskComponent.ts @@ -13,6 +13,7 @@ import { ProviderState } from '../providers/IProvider'; import { Providers } from '../providers/Providers'; import { LocalizationHelper } from '../utils/LocalizationHelper'; import { PACKAGE_VERSION } from '../utils/version'; +import { emitDeprecationWarning } from '../utils/deprecationWarning'; import { ComponentMediaQuery } from './baseComponent'; /** @@ -96,6 +97,7 @@ export abstract class MgtBaseTaskComponent extends LitElement { constructor() { super(); + emitDeprecationWarning(); this.handleDirectionChanged(); this.handleLocalizationChanged(); } diff --git a/packages/mgt-element/src/utils/deprecationWarning.ts b/packages/mgt-element/src/utils/deprecationWarning.ts new file mode 100644 index 0000000000..e181543178 --- /dev/null +++ b/packages/mgt-element/src/utils/deprecationWarning.ts @@ -0,0 +1,33 @@ +/** + * ------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. + * See License in the project root for license information. + * ------------------------------------------------------------------------------------------- + */ + +let hasWarned = false; + +/** + * Emits a one-time console warning informing consumers that the + * Microsoft Graph Toolkit has been retired. + * + * The warning is emitted at most once per runtime, and any failure to + * write to the console is swallowed so this can never break a host app. + */ +export const emitDeprecationWarning = (): void => { + if (hasWarned) { + return; + } + hasWarned = true; + + try { + console.warn( + '🦒: The Microsoft Graph Toolkit was retired on August 28, 2026 and is no longer maintained. ' + + 'This package will receive no further updates. ' + + 'If you would like to continue using or maintaining MGT, you are welcome to fork the repository: ' + + 'https://github.com/microsoftgraph/microsoft-graph-toolkit' + ); + } catch { + // Never allow logging to break a host application. + } +};