Skip to content
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

Add "deprecated" field and deprecate header navigation #5721

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

domoscargin
Copy link
Contributor

@domoscargin domoscargin commented Feb 12, 2025

Adds deprecated field to macro options YAML schema to flag options which have been deprecated. It takes either a boolean or a string matching a semver version (eg: '1.0.1').

Updates macro options test to account for optional fields.

Copy link

github-actions bot commented Feb 12, 2025

📋 Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 118.42 KiB
dist/govuk-frontend-development.min.js 42.59 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 92.42 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 86.71 KiB
packages/govuk-frontend/dist/govuk/all.mjs 1.21 KiB
packages/govuk-frontend/dist/govuk/component.mjs 1.67 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 118.41 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 42.58 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB
packages/govuk-frontend/dist/govuk/init.mjs 6.64 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 82.32 KiB 40.4 KiB
accordion.mjs 26.58 KiB 13.41 KiB
button.mjs 9.09 KiB 3.79 KiB
character-count.mjs 25.37 KiB 10.91 KiB
checkboxes.mjs 7.76 KiB 3.42 KiB
error-summary.mjs 10.99 KiB 4.55 KiB
exit-this-page.mjs 20.2 KiB 10.34 KiB
header.mjs 6.41 KiB 3.22 KiB
notification-banner.mjs 9.35 KiB 3.71 KiB
password-input.mjs 18.16 KiB 8.34 KiB
radios.mjs 6.76 KiB 2.98 KiB
service-navigation.mjs 6.39 KiB 3.26 KiB
skip-link.mjs 6.34 KiB 2.76 KiB
tabs.mjs 11.99 KiB 6.67 KiB

View stats and visualisations on the review app


Action run for e3ed188

Copy link

github-actions bot commented Feb 12, 2025

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/components/button/macro-options.json b/packages/govuk-frontend/dist/govuk/components/button/macro-options.json
index d922bbaa1..7ae5d2975 100644
--- a/packages/govuk-frontend/dist/govuk/components/button/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/button/macro-options.json
@@ -3,7 +3,8 @@
         "name": "element",
         "type": "string",
         "required": false,
-        "description": "HTML element for the button component – `input`, `button` or `a`. In most cases you will not need to set this as it will be configured automatically if `href` is provided. This parameter will be removed in the next major version."
+        "description": "HTML element for the button component – `input`, `button` or `a`. In most cases you will not need to set this as it will be configured automatically if `href` is provided.",
+        "deprecated": "5.1.0"
     },
     {
         "name": "text",
diff --git a/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json b/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
index a9eff4d8c..a7902cd24 100644
--- a/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/file-upload/macro-options.json
@@ -15,7 +15,8 @@
         "name": "value",
         "type": "string",
         "required": false,
-        "description": "Deprecated. Optional initial value of the input."
+        "description": "Optional initial value of the input.",
+        "deprecated": "5.7.1"
     },
     {
         "name": "disabled",
diff --git a/packages/govuk-frontend/dist/govuk/components/header/macro-options.json b/packages/govuk-frontend/dist/govuk/components/header/macro-options.json
index d7fc417b5..5edced572 100644
--- a/packages/govuk-frontend/dist/govuk/components/header/macro-options.json
+++ b/packages/govuk-frontend/dist/govuk/components/header/macro-options.json
@@ -15,49 +15,57 @@
         "name": "serviceName",
         "type": "string",
         "required": false,
-        "description": "The name of your service, included in the header."
+        "description": "The name of your service, included in the header.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "serviceUrl",
         "type": "string",
         "required": false,
-        "description": "URL for the service name anchor."
+        "description": "URL for the service name anchor.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "navigation",
         "type": "array",
         "required": false,
         "description": "Can be used to add navigation to the header component.",
+        "deprecated": "5.9.0",
         "params": [
             {
                 "name": "text",
                 "type": "string",
                 "required": true,
-                "description": "Text for the navigation item. If `html` is provided, the `text` option will be ignored."
+                "description": "Text for the navigation item. If `html` is provided, the `text` option will be ignored.",
+                "deprecated": "5.9.0"
             },
             {
                 "name": "html",
                 "type": "string",
                 "required": true,
-                "description": "HTML for the navigation item. If `html` is provided, the `text` option will be ignored."
+                "description": "HTML for the navigation item. If `html` is provided, the `text` option will be ignored.",
+                "deprecated": "5.9.0"
             },
             {
                 "name": "href",
                 "type": "string",
                 "required": false,
-                "description": "URL of the navigation item anchor."
+                "description": "URL of the navigation item anchor.",
+                "deprecated": "5.9.0"
             },
             {
                 "name": "active",
                 "type": "boolean",
                 "required": false,
-                "description": "Flag to mark the navigation item as active or not."
+                "description": "Flag to mark the navigation item as active or not.",
+                "deprecated": "5.9.0"
             },
             {
                 "name": "attributes",
                 "type": "object",
                 "required": false,
-                "description": "HTML attributes (for example data attributes) to add to the navigation item anchor."
+                "description": "HTML attributes (for example data attributes) to add to the navigation item anchor.",
+                "deprecated": "5.9.0"
             }
         ]
     },
@@ -65,25 +73,29 @@
         "name": "navigationClasses",
         "type": "string",
         "required": false,
-        "description": "Classes for the navigation section of the header."
+        "description": "Classes for the navigation section of the header.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "navigationLabel",
         "type": "string",
         "required": false,
-        "description": "Text for the `aria-label` attribute of the navigation. Defaults to the same value as `menuButtonText`."
+        "description": "Text for the `aria-label` attribute of the navigation. Defaults to the same value as `menuButtonText`.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "menuButtonLabel",
         "type": "string",
         "required": false,
-        "description": "Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu."
+        "description": "Text for the `aria-label` attribute of the button that opens the mobile navigation, if there is a mobile navigation menu.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "menuButtonText",
         "type": "string",
         "required": false,
-        "description": "Text of the button that opens the mobile navigation menu, if there is a mobile navigation menu. There is no enforced character limit, but there is a limited display space so keep text as short as possible. By default, this is set to 'Menu'."
+        "description": "Text of the button that opens the mobile navigation menu, if there is a mobile navigation menu. There is no enforced character limit, but there is a limited display space so keep text as short as possible. By default, this is set to 'Menu'.",
+        "deprecated": "5.9.0"
     },
     {
         "name": "containerClasses",
@@ -107,6 +119,7 @@
         "name": "useTudorCrown",
         "type": "boolean",
         "required": false,
-        "description": "Deprecated. If `true`, uses the Tudor crown from King Charles III's royal cypher. Otherwise, uses the St. Edward's crown. Default is `true`."
+        "description": "If `true`, uses the Tudor crown from King Charles III's royal cypher. Otherwise, uses the St. Edward's crown. Default is `true`.",
+        "deprecated": "5.2.0"
     }
 ]

Action run for e3ed188

@@ -10,7 +10,9 @@ params:
- name: value
type: string
required: false
description: Deprecated. Optional initial value of the input.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially we could JUST have one field, something like: deprecated: '5.7.1'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just trying to think of a case where something isn't specifically deprecated in a version. Struggling though!

Copy link
Member

Choose a reason for hiding this comment

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

Could it accept either a string or a boolean, and alter the output depending on whether a string is present or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only thing about that is that we don't seem to define a macro option schema, and this would actually only affect output on the DS website, so not very clear here what the field accepts.

I guess the answer is: Well then, define a macro option schema, doofus.

@domoscargin domoscargin changed the title Add deprecation field and deprecate header navigation Add "deprecated" field and deprecate header navigation Feb 13, 2025
@romaricpascal
Copy link
Member

@domoscargin Looks like there's another deprecation that slipped through: the element option of the Button has been deprecated since 5.1.0 😊

Currently we have the following keys: 'name', 'type', 'required', 'description', 'isComponent' and 'params'. Add a 'deprecated' key which takes either a boolean, or the string version number it was deprecated in.

This will allow us to check the option's status and display appropriate documentation
@domoscargin
Copy link
Contributor Author

Ah, sneaky one @romaricpascal - ducked under my search for "deprecated" in the option descriptions 😂

Nice catch, thanks!

@domoscargin domoscargin requested a review from a team February 24, 2025 09:34
@domoscargin domoscargin added documentation User requests new documentation or improvements to existing documentation tooling labels Feb 24, 2025
@domoscargin domoscargin added this to the v5.9.0 milestone Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation User requests new documentation or improvements to existing documentation tooling
Projects
Status: Needs review 🔍
Development

Successfully merging this pull request may close these issues.

4 participants