alphagov / govuk-frontend

GOV.UK Frontend contains the code you need to start building a user interface for government platforms and services.
https://frontend.design-system.service.gov.uk/
MIT License
1.18k stars 325 forks source link

Rename `all` files to `index` for our Sass entrypoints #4955

Closed 36degrees closed 6 months ago

36degrees commented 6 months ago

Use index as the entrypoint for each layer as it:

Keep the existing all files as aliases, but add deprecation warnings when importing via them so we can remove those files in the next major release.

Fixes #4960

github-actions[bot] commented 6 months ago

:clipboard: Stats

File sizes

File Size
dist/govuk-frontend-development.min.css 113.24 KiB
dist/govuk-frontend-development.min.js 42.21 KiB
packages/govuk-frontend/dist/govuk/all.bundle.js 87.21 KiB
packages/govuk-frontend/dist/govuk/all.bundle.mjs 81.95 KiB
packages/govuk-frontend/dist/govuk/all.mjs 4.17 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend-component.mjs 359 B
packages/govuk-frontend/dist/govuk/govuk-frontend.min.css 113.23 KiB
packages/govuk-frontend/dist/govuk/govuk-frontend.min.js 42.2 KiB
packages/govuk-frontend/dist/govuk/i18n.mjs 5.55 KiB

Modules

File Size (bundled) Size (minified)
all.mjs 77.67 KiB 40.19 KiB
accordion.mjs 22.71 KiB 12.85 KiB
button.mjs 5.98 KiB 2.69 KiB
character-count.mjs 22.4 KiB 9.92 KiB
checkboxes.mjs 5.83 KiB 2.83 KiB
error-summary.mjs 7.89 KiB 3.46 KiB
exit-this-page.mjs 17.1 KiB 9.26 KiB
header.mjs 4.46 KiB 2.6 KiB
notification-banner.mjs 6.26 KiB 2.62 KiB
password-input.mjs 15.15 KiB 7.25 KiB
radios.mjs 4.83 KiB 2.38 KiB
skip-link.mjs 4.39 KiB 2.18 KiB
tabs.mjs 10.13 KiB 6.11 KiB

View stats and visualisations on the review app


Action run for 85e7fe4780263e34a946749e417b8559937e5527

github-actions[bot] commented 6 months ago

Other changes to npm package

diff --git a/packages/govuk-frontend/dist/govuk/_base.scss b/packages/govuk-frontend/dist/govuk/_base.scss
index 58c825543..adc899c85 100644
--- a/packages/govuk-frontend/dist/govuk/_base.scss
+++ b/packages/govuk-frontend/dist/govuk/_base.scss
@@ -1,5 +1,5 @@
-@import "settings/all";
-@import "tools/all";
-@import "helpers/all";
+@import "settings/index";
+@import "tools/index";
+@import "helpers/index";

 /*# sourceMappingURL=_base.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/all.scss b/packages/govuk-frontend/dist/govuk/all.scss
index f3125cbb0..d906d5093 100644
--- a/packages/govuk-frontend/dist/govuk/all.scss
+++ b/packages/govuk-frontend/dist/govuk/all.scss
@@ -1,11 +1,11 @@
 @import "base";

-@import "core/all";
-@import "objects/all";
+@import "core/index";
+@import "objects/index";

-@import "components/all";
+@import "components/index";

-@import "utilities/all";
-@import "overrides/all";
+@import "utilities/index";
+@import "overrides/index";

 /*# sourceMappingURL=all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/components/_all.scss b/packages/govuk-frontend/dist/govuk/components/_all.scss
index e0f702951..b8fd480b8 100644
--- a/packages/govuk-frontend/dist/govuk/components/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/components/_all.scss
@@ -1,39 +1,10 @@
-@import "../base";
+@import "../settings/warnings";
+@import "index";

-@import "accordion/index";
-@import "back-link/index";
-@import "breadcrumbs/index";
-@import "button/index";
-@import "character-count/index";
-@import "checkboxes/index";
-@import "cookie-banner/index";
-@import "date-input/index";
-@import "details/index";
-@import "error-message/index";
-@import "error-summary/index";
-@import "exit-this-page/index";
-@import "fieldset/index";
-@import "file-upload/index";
-@import "footer/index";
-@import "header/index";
-@import "hint/index";
-@import "input/index";
-@import "inset-text/index";
-@import "label/index";
-@import "notification-banner/index";
-@import "pagination/index";
-@import "panel/index";
-@import "password-input/index";
-@import "phase-banner/index";
-@import "radios/index";
-@import "select/index";
-@import "skip-link/index";
-@import "summary-list/index";
-@import "table/index";
-@import "tabs/index";
-@import "tag/index";
-@import "task-list/index";
-@import "textarea/index";
-@import "warning-text/index";
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/components/all' is deprecated. Update your import statement to import 'govuk/components/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/components/_index.scss b/packages/govuk-frontend/dist/govuk/components/_index.scss
new file mode 100644
index 000000000..c0c34dca3
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/components/_index.scss
@@ -0,0 +1,39 @@
+@import "../base";
+
+@import "accordion/index";
+@import "back-link/index";
+@import "breadcrumbs/index";
+@import "button/index";
+@import "character-count/index";
+@import "checkboxes/index";
+@import "cookie-banner/index";
+@import "date-input/index";
+@import "details/index";
+@import "error-message/index";
+@import "error-summary/index";
+@import "exit-this-page/index";
+@import "fieldset/index";
+@import "file-upload/index";
+@import "footer/index";
+@import "header/index";
+@import "hint/index";
+@import "input/index";
+@import "inset-text/index";
+@import "label/index";
+@import "notification-banner/index";
+@import "pagination/index";
+@import "panel/index";
+@import "password-input/index";
+@import "phase-banner/index";
+@import "radios/index";
+@import "select/index";
+@import "skip-link/index";
+@import "summary-list/index";
+@import "table/index";
+@import "tabs/index";
+@import "tag/index";
+@import "task-list/index";
+@import "textarea/index";
+@import "warning-text/index";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/core/_all.scss b/packages/govuk-frontend/dist/govuk/core/_all.scss
index a9c87c554..919b9ac03 100644
--- a/packages/govuk-frontend/dist/govuk/core/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/core/_all.scss
@@ -1,8 +1,10 @@
-@import "govuk-frontend-properties";
-@import "links";
-@import "lists";
-@import "typography";
-@import "section-break";
-@import "global-styles";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/core/all' is deprecated. Update your import statement to import 'govuk/core/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/core/_index.scss b/packages/govuk-frontend/dist/govuk/core/_index.scss
new file mode 100644
index 000000000..b0b59758e
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/core/_index.scss
@@ -0,0 +1,8 @@
+@import "govuk-frontend-properties";
+@import "links";
+@import "lists";
+@import "typography";
+@import "section-break";
+@import "global-styles";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/helpers/_all.scss b/packages/govuk-frontend/dist/govuk/helpers/_all.scss
index d79faf6ac..b6850afda 100644
--- a/packages/govuk-frontend/dist/govuk/helpers/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/helpers/_all.scss
@@ -1,14 +1,10 @@
-@import "clearfix";
-@import "colour";
-@import "device-pixels";
-@import "focused";
-@import "font-faces";
-@import "grid";
-@import "links";
-@import "media-queries";
-@import "shape-arrow";
-@import "spacing";
-@import "typography";
-@import "visually-hidden";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/helpers/all' is deprecated. Update your import statement to import 'govuk/helpers/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/helpers/_index.scss b/packages/govuk-frontend/dist/govuk/helpers/_index.scss
new file mode 100644
index 000000000..7a039bdd1
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/helpers/_index.scss
@@ -0,0 +1,14 @@
+@import "clearfix";
+@import "colour";
+@import "device-pixels";
+@import "focused";
+@import "font-faces";
+@import "grid";
+@import "links";
+@import "media-queries";
+@import "shape-arrow";
+@import "spacing";
+@import "typography";
+@import "visually-hidden";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/index.scss b/packages/govuk-frontend/dist/govuk/index.scss
new file mode 100644
index 000000000..393a85f39
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/index.scss
@@ -0,0 +1,11 @@
+@import "base";
+
+@import "core/index";
+@import "objects/index";
+
+@import "components/index";
+
+@import "utilities/index";
+@import "overrides/index";
+
+/*# sourceMappingURL=index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/objects/_all.scss b/packages/govuk-frontend/dist/govuk/objects/_all.scss
index 50c692a7a..a393b2724 100644
--- a/packages/govuk-frontend/dist/govuk/objects/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/objects/_all.scss
@@ -1,8 +1,10 @@
-@import "button-group";
-@import "form-group";
-@import "grid";
-@import "main-wrapper";
-@import "template";
-@import "width-container";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/objects/all' is deprecated. Update your import statement to import 'govuk/objects/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/objects/_index.scss b/packages/govuk-frontend/dist/govuk/objects/_index.scss
new file mode 100644
index 000000000..9a9ec28cd
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/objects/_index.scss
@@ -0,0 +1,8 @@
+@import "button-group";
+@import "form-group";
+@import "grid";
+@import "main-wrapper";
+@import "template";
+@import "width-container";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/overrides/_all.scss b/packages/govuk-frontend/dist/govuk/overrides/_all.scss
index 0e9a9fb14..d28d0e7a9 100644
--- a/packages/govuk-frontend/dist/govuk/overrides/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/overrides/_all.scss
@@ -1,7 +1,9 @@
-@import "display";
-@import "spacing";
-@import "text-align";
-@import "typography";
-@import "width";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/overrides/all' is deprecated. Update your import statement to import 'govuk/overrides/index'."
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/overrides/_index.scss b/packages/govuk-frontend/dist/govuk/overrides/_index.scss
new file mode 100644
index 000000000..27886c3b1
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/overrides/_index.scss
@@ -0,0 +1,7 @@
+@import "display";
+@import "spacing";
+@import "text-align";
+@import "typography";
+@import "width";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_all.scss b/packages/govuk-frontend/dist/govuk/settings/_all.scss
index b28454af9..7fc16e9b4 100644
--- a/packages/govuk-frontend/dist/govuk/settings/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/settings/_all.scss
@@ -1,23 +1,10 @@
-// The order we import settings in is important, as some settings files rely on
-// others
-
-@import "assets";
-
-@import "warnings";
-@import "global-styles";
-
-@import "media-queries";
-
-@import "colours-palette";
-@import "colours-organisations";
-@import "colours-applied";
-
-@import "spacing";
-@import "measurements";
-
-@import "typography-font";
-@import "typography-responsive";
-
-@import "links";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/settings/all' is deprecated. Update your import statement to import 'govuk/settings/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_index.scss b/packages/govuk-frontend/dist/govuk/settings/_index.scss
new file mode 100644
index 000000000..e46fb4637
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/settings/_index.scss
@@ -0,0 +1,23 @@
+// The order we import settings in is important, as some settings files rely on
+// others
+
+@import "assets";
+
+@import "warnings";
+@import "global-styles";
+
+@import "media-queries";
+
+@import "colours-palette";
+@import "colours-organisations";
+@import "colours-applied";
+
+@import "spacing";
+@import "measurements";
+
+@import "typography-font";
+@import "typography-responsive";
+
+@import "links";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/settings/_warnings.scss b/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
index af64de8c0..e9fe535dc 100644
--- a/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
+++ b/packages/govuk-frontend/dist/govuk/settings/_warnings.scss
@@ -37,17 +37,22 @@ $govuk-suppressed-warnings: () !default;
 /// - To format the passed warning `$message` with the warning key at the end
 /// - To prevent duplicate warnings by adding the passed `$key` to
 /// `$govuk-suppressed-warnings` after `@warn` is called to ensure it only runs
-/// once per sass compilation
+/// once per sass compilation (unless $silence-further-warnings is false)
 ///
 /// @param {String} $key - The key to be checked against `$govuk-suppressed-warnings`
 /// and then passed to it to prevent multiple of the same warning.
 /// @param {String} $message - The message to use when calling `@warn`
+/// @param {Boolean} $silence-further-warnings - Whether to silence future
+/// warnings that use the same $key
 /// @access private

-@mixin _warning($key, $message) {
+@mixin _warning($key, $message, $silence-further-warnings: true) {
   @if _should-warn($key) {
     @warn _warning-text($key, $message);
-    $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
+
+    @if $silence-further-warnings {
+      $govuk-suppressed-warnings: append($govuk-suppressed-warnings, $key) !global;
+    }
   }
 }

diff --git a/packages/govuk-frontend/dist/govuk/tools/_all.scss b/packages/govuk-frontend/dist/govuk/tools/_all.scss
index 8c5556175..857712d6b 100644
--- a/packages/govuk-frontend/dist/govuk/tools/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/tools/_all.scss
@@ -1,7 +1,10 @@
-@import "exports";
-@import "font-url";
-@import "image-url";
-@import "px-to-em";
-@import "px-to-rem";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/tools/all' is deprecated. Update your import statement to import 'govuk/tools/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/tools/_index.scss b/packages/govuk-frontend/dist/govuk/tools/_index.scss
new file mode 100644
index 000000000..df0739053
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/tools/_index.scss
@@ -0,0 +1,7 @@
+@import "exports";
+@import "font-url";
+@import "image-url";
+@import "px-to-em";
+@import "px-to-rem";
+
+/*# sourceMappingURL=_index.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/utilities/_all.scss b/packages/govuk-frontend/dist/govuk/utilities/_all.scss
index 77dbb46ba..cc1da2ab0 100644
--- a/packages/govuk-frontend/dist/govuk/utilities/_all.scss
+++ b/packages/govuk-frontend/dist/govuk/utilities/_all.scss
@@ -1,4 +1,10 @@
-@import "clearfix";
-@import "visually-hidden";
+@import "../settings/warnings";
+@import "index";
+
+@include _warning(
+  "import-using-all",
+  "Importing using 'govuk/utilities/all' is deprecated. Update your import statement to import 'govuk/utilities/index'.",
+  $silence-further-warnings: false
+);

 /*# sourceMappingURL=_all.scss.map */
diff --git a/packages/govuk-frontend/dist/govuk/utilities/_index.scss b/packages/govuk-frontend/dist/govuk/utilities/_index.scss
new file mode 100644
index 000000000..7adb7f6c5
--- /dev/null
+++ b/packages/govuk-frontend/dist/govuk/utilities/_index.scss
@@ -0,0 +1,4 @@
+@import "clearfix";
+@import "visually-hidden";
+
+/*# sourceMappingURL=_index.scss.map */

Action run for 85e7fe4780263e34a946749e417b8559937e5527

36degrees commented 6 months ago

If we're happy with this change we should create an issue to clean up the all files in v6.

We'll also need to add a changelog entry and update any documentation that has examples that import the all files.