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

Bump govuk-frontend from 4.8.0 to 5.5.0 #740

Merged
merged 6 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/assets/sass/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ $govuk-global-styles: true;

// We can't mount GOV.UK Frontend's assets at root as it's done automatically by the extensions framework.
$app-assets-path: '/public/';
$govuk-assets-path: '/govuk/assets/';
$govuk-assets-path: '/dist/govuk/assets/';

// Import GOV.UK Frontend and any extension styles if extensions have been configured
@import "lib/extensions/extensions";
Expand Down
6 changes: 0 additions & 6 deletions app/assets/sass/components/_all-records-search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@ $large-input-size: 50px;
// Also, `outline` cannot be utilised
// here as it is already used for the yellow focus state.
box-shadow: inset 0 0 0 $govuk-border-width-form-element * 2 govuk-colour("black");

@include govuk-if-ie8 {
// IE8 doesn't support `box-shadow` so double the border with
// `border-width`.
border-width: $govuk-border-width-form-element * 2;
}
}

&::-moz-focus-inner {
Expand Down
4 changes: 0 additions & 4 deletions app/assets/sass/components/_autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
outline: $govuk-focus-width solid $govuk-focus-colour;
outline-offset: 0;
box-shadow: inset 0 0 0 $govuk-border-width-form-element;

@include govuk-if-ie8 {
border-width: $govuk-border-width-form-element * 2;
}
}

.autocomplete__input--show-all-values {
Expand Down
7 changes: 0 additions & 7 deletions app/assets/sass/components/_sub-navigation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@
box-shadow: inset 0 -1px 0 $govuk-border-colour;
width: 100%;
}

// IE8 does not support box shadow, so use a standard border.
@include govuk-if-ie8 {
border-bottom: 1px solid $govuk-border-colour;
}

}


Expand Down Expand Up @@ -109,4 +103,3 @@
}

}

6 changes: 0 additions & 6 deletions app/assets/sass/components/_timeline.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,4 @@
&:focus {
color: govuk-colour("black"); // Focus colour on yellow should really be black.
}

// IE8 does not support box shadow, so use a standard border.
@include govuk-if-ie8 {
// background-image: url(#{$app-images-path}icon-document.png);
}

}
4 changes: 0 additions & 4 deletions app/assets/sass/helpers/_width-container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
// Limit the width of the container to the page width
max-width: $width;

@include govuk-if-ie8 {
width: $width;
}

// On mobile, add half width gutters
margin: 0 $govuk-gutter-half;

Expand Down
26 changes: 13 additions & 13 deletions app/assets/sass/overrides/_simplify.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Import settings first so we can override them before importing all of GOV.UK Frontend
// If you need to enable compatibility mode or the legacy palette, do that *before* this import.
// @import "node_modules/govuk-frontend/govuk/settings/all";
// @import "node_modules/govuk-frontend/govuk/settings/index";
// #unbranded.scss
// Override the default GOV.UK Frontend font stack
// $govuk-font-family: "HelveticaNeue", "Helvetica Neue", "Arial", "Helvetica", sans-serif;
Expand All @@ -10,22 +10,22 @@

div[class^="govuk-grid-column-"] {
outline: 1px solid rgba(0,0,0,0.5);
background: linear-gradient(to top left, rgba(0,0,0,0) 0%,
rgba(0,0,0,0) calc(50% - 0.8px),
rgba(0,0,0,0.5) 50%,
rgba(0,0,0,0) calc(50% + 0.8px),
rgba(0,0,0,0) 100%),
linear-gradient(to top right,
rgba(0,0,0,0) 0%,
rgba(0,0,0,0) calc(50% - 0.8px),
rgba(0,0,0,0.5) 50%,
rgba(0,0,0,0) calc(50% + 0.8px),
background: linear-gradient(to top left, rgba(0,0,0,0) 0%,
rgba(0,0,0,0) calc(50% - 0.8px),
rgba(0,0,0,0.5) 50%,
rgba(0,0,0,0) calc(50% + 0.8px),
rgba(0,0,0,0) 100%),
linear-gradient(to top right,
rgba(0,0,0,0) 0%,
rgba(0,0,0,0) calc(50% - 0.8px),
rgba(0,0,0,0.5) 50%,
rgba(0,0,0,0) calc(50% + 0.8px),
rgba(0,0,0,0) 100%);
}


body {
filter: grayscale(1);
body {
filter: grayscale(1);
// text-transform: uppercase;
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/sass/unbranded.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

// Import settings first so we can override them before importing all of GOV.UK Frontend
// If you need to enable compatibility mode or the legacy palette, do that *before* this import.
@import "node_modules/govuk-frontend/govuk/settings/all";
@import "node_modules/govuk-frontend/dist/govuk/settings/index";

// Override the default GOV.UK Frontend font stack
$govuk-font-family: "HelveticaNeue", "Helvetica Neue", "Arial", "Helvetica", sans-serif;
Expand Down
2 changes: 1 addition & 1 deletion app/views/layout.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{#- We can't mount GOV.UK Frontend's assets at root as it's done automatically by the extensions framework. -#}
{%- set assetPath = '/govuk/assets' -%}
{%- set assetPath = '/dist/govuk/assets' -%}

{% extends "govuk/template.njk" %}

Expand Down
26 changes: 21 additions & 5 deletions lib/extensions/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,37 @@ setExtensionsByType()
// The hard-coded reference to govuk-frontend allows us to soft launch without a breaking change. After a hard launch
// govuk-frontend assets will be served on /extension-assets/govuk-frontend
const getPublicUrl = config => {
if (config.item.endsWith('assets') && config.packageName === 'govuk-frontend') {
return '/govuk/assets'

let configItem
if (typeof config.item === 'object') {
configItem = config.item.path
} else {
configItem = config.item
}

if (configItem.endsWith('assets') && config.packageName === 'govuk-frontend') {
return '/dist/govuk/assets'
} else {
return ['', 'extension-assets', config.packageName]
.concat(config.item.split('/').filter(filterOutParentAndEmpty))
.concat(configItem.split('/').filter(filterOutParentAndEmpty))
.map(encodeURIComponent)
.join('/')
}
}

const getFileSystemPath = config => {
throwIfBadFilepath(config)
// throwIfBadFilepath(config)

let configItem
if (typeof config.item === 'object') {
configItem = config.item.path.split('/').filter(filterOutParentAndEmpty).join(path.sep)
} else {
configItem = config.item.split('/').filter(filterOutParentAndEmpty).join(path.sep)
}

return getPathFromProjectRoot('node_modules',
config.packageName,
config.item.split('/').filter(filterOutParentAndEmpty).join(path.sep))
configItem)
}

const getPublicUrlAndFileSystemPath = config => ({
Expand Down
20 changes: 10 additions & 10 deletions lib/extensions/extensions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('extensions', () => {
fileSystem: {}
}
addFileToMockFileSystem(['package.json'], fs.readFileSync('package.json', 'utf8'))
addFileToMockFileSystem(['node_modules', 'govuk-frontend', 'govuk-prototype-kit.config.json'], '{"nunjucksPaths": ["/"],"scripts": ["/govuk/all.js"],"assets": ["/govuk/assets"],"sass": ["/govuk/all.scss"]}')
addFileToMockFileSystem(['node_modules', 'govuk-frontend', 'govuk-prototype-kit.config.json'], '{"nunjucksPaths": ["/"],"scripts": ["/dist/govuk/all.js"],"assets": ["/dist/govuk/assets"],"sass": ["/dist/govuk/all.scss"]}')
setupFakeFilesystem()
extensions.setExtensionsByType()
})
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('extensions', () => {
})
it('should lookup scripts paths as file system paths', () => {
expect(extensions.getFileSystemPaths('scripts')).toEqual(joinPaths([
'node_modules/govuk-frontend/govuk/all.js'
'node_modules/govuk-frontend/dist/govuk/all.js'
]))
})
it('should not break when asking for an extension key which isn\'t used', function () {
Expand All @@ -124,7 +124,7 @@ describe('extensions', () => {
assets: ['/ghi', '/jkl']
})
expect(extensions.getPublicUrls('assets')).toEqual([
'/govuk/assets',
'/dist/govuk/assets',
'/extension-assets/another-frontend/abc',
'/extension-assets/another-frontend/def',
'/extension-assets/hmrc-frontend/ghi',
Expand All @@ -142,7 +142,7 @@ describe('extensions', () => {
expect(extensions.getPublicUrls('assets')).toEqual([
'/extension-assets/another-frontend/abc',
'/extension-assets/another-frontend/def',
'/govuk/assets',
'/dist/govuk/assets',
'/extension-assets/hmrc-frontend/ghi',
'/extension-assets/hmrc-frontend/jkl'
])
Expand All @@ -158,7 +158,7 @@ describe('extensions', () => {
expect(extensions.getPublicUrls('assets')).toEqual([
'/extension-assets/hmrc-frontend/ghi',
'/extension-assets/hmrc-frontend/jkl',
'/govuk/assets',
'/dist/govuk/assets',
'/extension-assets/another-frontend/abc',
'/extension-assets/another-frontend/def'
])
Expand All @@ -182,7 +182,7 @@ describe('extensions', () => {
})
expect(extensions.getPublicUrlAndFileSystemPaths('assets')).toEqual([
{
publicUrl: '/govuk/assets',
publicUrl: '/dist/govuk/assets',
fileSystemPath: path.join(rootPath, 'node_modules', 'govuk-frontend', 'govuk', 'assets')
},
{
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('extensions', () => {
fileSystemPath: path.join(rootPath, 'node_modules', 'another-frontend', 'def')
},
{
publicUrl: '/govuk/assets',
publicUrl: '/dist/govuk/assets',
fileSystemPath: path.join(rootPath, 'node_modules', 'govuk-frontend', 'govuk', 'assets')
},
{
Expand Down Expand Up @@ -252,7 +252,7 @@ describe('extensions', () => {
fileSystemPath: path.join(rootPath, 'node_modules', 'hmrc-frontend', 'jkl')
},
{
publicUrl: '/govuk/assets',
publicUrl: '/dist/govuk/assets',
fileSystemPath: path.join(rootPath, 'node_modules', 'govuk-frontend', 'govuk', 'assets')
},
{
Expand Down Expand Up @@ -340,7 +340,7 @@ describe('extensions', () => {

it('should return a list of public urls for the scripts', () => {
expect(extensions.getAppConfig().scripts).toEqual([
'/extension-assets/govuk-frontend/govuk/all.js'
'/extension-assets/govuk-frontend/dist/govuk/all.js'
])
})

Expand All @@ -351,7 +351,7 @@ describe('extensions', () => {
it('should include installed extensions', () => {
mockExtensionConfig('my-extension', { scripts: ['/abc/def/ghi.js'] })
expect(extensions.getAppConfig().scripts).toEqual([
'/extension-assets/govuk-frontend/govuk/all.js',
'/extension-assets/govuk-frontend/dist/govuk/all.js',
'/extension-assets/my-extension/abc/def/ghi.js'
])
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"@faker-js/faker": "^8.4.1",
"@ministryofjustice/frontend": "^1.6.6",
"@ministryofjustice/frontend": "^2.2.0",
"acorn": "^8.12.1",
"ansi-colors": "^4.1.1",
"basic-auth": "^2.0.0",
Expand All @@ -32,7 +32,7 @@
"express-session": "^1.17.2",
"express-writer": "0.0.4",
"fancy-log": "^2.0.0",
"govuk-frontend": "^4.6.0",
"govuk-frontend": "^5.5.0",
"govuk-markdown": "^0.7.0",
"gulp": "^5.0.0",
"gulp-nodemon": "^2.5.0",
Expand Down
Loading