From 9c26c4ebd4da1660af47d7ed0dc461f9c558743c Mon Sep 17 00:00:00 2001 From: Rajdeep Chandra Date: Thu, 14 Mar 2024 19:56:05 +0530 Subject: [PATCH 1/2] chore: deprecation warning for color lightest and darkest --- .../_includes/partials/deprecation.njk | 7 ++++-- .../scripts/copy-component-docs.js | 22 +++++++++---------- tools/theme/package.json | 1 + tools/theme/src/Theme.ts | 8 +++++++ 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/projects/documentation/content/_includes/partials/deprecation.njk b/projects/documentation/content/_includes/partials/deprecation.njk index 8edaef392c..9ab944ef5c 100644 --- a/projects/documentation/content/_includes/partials/deprecation.njk +++ b/projects/documentation/content/_includes/partials/deprecation.njk @@ -3,11 +3,14 @@ >
- Deprecated component + Deprecation Warning
- This component has been deprecated.

+ {% if isComponent %} + This component will be deprecated. +

+ {% endif %} {{ deprecationNotice | safe }}
diff --git a/projects/documentation/scripts/copy-component-docs.js b/projects/documentation/scripts/copy-component-docs.js index 94fc9cf3a5..714cae69d9 100644 --- a/projects/documentation/scripts/copy-component-docs.js +++ b/projects/documentation/scripts/copy-component-docs.js @@ -58,12 +58,14 @@ const findDeclaration = (customElements, test) => { }; const findDeprecationNotice = async function (filePath) { - const hasDeprecation = fs.existsSync(filePath); - if (hasDeprecation) { - const packageJSON = await import(filePath, { - assert: { type: 'json' }, - }).then((packageDefault) => packageDefault.default); - return packageJSON.deprecationNotice; + for await (const mdPath of globby.stream(filePath)) { + const hasDeprecation = fs.existsSync(mdPath); + if (hasDeprecation) { + const packageJSON = await import(mdPath, { + assert: { type: 'json' }, + }).then((packageDefault) => packageDefault.default); + return packageJSON.deprecationNotice; + } } }; @@ -184,12 +186,7 @@ export async function processREADME(mdPath) { ) ); const deprecationNotice = await findDeprecationNotice( - path.resolve( - __dirname, - '../../../packages', - packageName, - 'package.json' - ) + `${projectDir}/(packages|tools)/${packageName}/package.json` ); const hasTemplate = fs.existsSync( path.resolve( @@ -211,6 +208,7 @@ export async function processREADME(mdPath) { hasDemoControls: ${hasArgs}, hasDemoTemplate: ${hasTemplate}, deprecationNotice: ${JSON.stringify(deprecationNotice)}, + isComponent: ${isComponent}, ${hasArgs ? 'demoControls: Object.values(argTypes),' : ''} }; `; diff --git a/tools/theme/package.json b/tools/theme/package.json index b9728ba2ab..948bd11c93 100644 --- a/tools/theme/package.json +++ b/tools/theme/package.json @@ -138,6 +138,7 @@ }, "types": "./src/index.d.ts", "customElements": "custom-elements.json", + "deprecationNotice": "Color Lightest and Darkest are deprecated and will be removed in a future release", "sideEffects": [ "./sp-*.js", "./**/*.dev.js", diff --git a/tools/theme/src/Theme.ts b/tools/theme/src/Theme.ts index f3d773b0d3..1afebaa1c9 100644 --- a/tools/theme/src/Theme.ts +++ b/tools/theme/src/Theme.ts @@ -342,6 +342,14 @@ export class Theme extends HTMLElement implements ThemeKindProvider { } ); } + if (['lightest', 'darkest'].includes(this.color)) { + window.__swc.warn( + this, + `Color lightest and darkest are deprecated and will be removed in a future release`, + 'https://opensource.adobe.com/spectrum-web-components/tools/themes/#deprecation', + { level: 'deprecation' } + ); + } } return [...styles]; } From cb5a79d8302481595cc3d98e1a6d1286fa45b759 Mon Sep 17 00:00:00 2001 From: Rajdeep Chandra Date: Fri, 15 Mar 2024 12:12:08 +0530 Subject: [PATCH 2/2] chore: updated deprecationNotice to include package name instead of component --- packages/banner/package.json | 2 +- packages/quick-actions/package.json | 2 +- packages/split-button/package.json | 2 +- .../documentation/content/_includes/partials/deprecation.njk | 4 ---- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/banner/package.json b/packages/banner/package.json index 708493fd3f..12d5f62026 100644 --- a/packages/banner/package.json +++ b/packages/banner/package.json @@ -64,7 +64,7 @@ }, "types": "./src/index.d.ts", "customElements": "custom-elements.json", - "deprecationNotice": "Banner is deprecated and it will be removed in the future release.", + "deprecationNotice": "@spectrum-web-components/banner is deprecated and it will be removed in the future release.", "sideEffects": [ "./sp-*.js", "./**/*.dev.js" diff --git a/packages/quick-actions/package.json b/packages/quick-actions/package.json index c5f64d6233..6eea1fdf5c 100644 --- a/packages/quick-actions/package.json +++ b/packages/quick-actions/package.json @@ -64,7 +64,7 @@ }, "types": "./src/index.d.ts", "customElements": "custom-elements.json", - "deprecationNotice": "Quick Actions is deprecated. Use an Action bar to allow users to perform actions on either a single or multiple items at the same time, instead.", + "deprecationNotice": "@spectrum-web-components/quick-actions is deprecated. Use an Action bar to allow users to perform actions on either a single or multiple items at the same time, instead.", "sideEffects": [ "./sp-*.js", "./**/*.dev.js" diff --git a/packages/split-button/package.json b/packages/split-button/package.json index b1ef92c3ea..341e9db612 100644 --- a/packages/split-button/package.json +++ b/packages/split-button/package.json @@ -76,7 +76,7 @@ }, "types": "./src/index.d.ts", "customElements": "custom-elements.json", - "deprecationNotice": "Split Button is deprecated. Use a button group to show any additional actions related to the most critical action. Reference Spectrum documentation for more information.", + "deprecationNotice": "@spectrum-web-components/split-button is deprecated. Use a button group to show any additional actions related to the most critical action. Refer Spectrum documentation for more information.", "sideEffects": [ "./sp-*.js", "./**/*.dev.js", diff --git a/projects/documentation/content/_includes/partials/deprecation.njk b/projects/documentation/content/_includes/partials/deprecation.njk index 9ab944ef5c..8a01055463 100644 --- a/projects/documentation/content/_includes/partials/deprecation.njk +++ b/projects/documentation/content/_includes/partials/deprecation.njk @@ -7,10 +7,6 @@
- {% if isComponent %} - This component will be deprecated. -

- {% endif %} {{ deprecationNotice | safe }}