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

Tech debt/civ 2752 #481

Merged
merged 7 commits into from
Jun 14, 2022
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hmcts/nodejs-logging": "^4.0.2",
"@hmcts/os-places-client": "^1.1.7",
"@hmcts/properties-volume": "^0.0.13",
"@ministryofjustice/frontend": "^1.3.0",
"@ministryofjustice/frontend": "^1.4.2",
"@types/config": "^0.0.41",
"@types/cookie-parser": "^1.4.3",
"@types/cookie-session": "^2.0.44",
Expand Down Expand Up @@ -60,7 +60,7 @@
"express-nunjucks": "^2.2.5",
"express-session": "^1.17.2",
"glob": "^8.0.1",
"govuk-frontend": "4.0.1",
"govuk-frontend": "4.1.0",
"helmet": "^5.1.0",
"i18next": "^21.6.16",
"i18next-fs-backend": "^1.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/main/assets/scss/main.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '~govuk-frontend';
@import 'node_modules/govuk-frontend/govuk/all';
@import './task-list';
@import './citizen-ui-colours';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ describe('Payment date', () => {
.expect((res) => {
expect(res.status).toBe(200);
expect(res.text).toContain('What date will you pay on?');
expect(res.text).toContain('name="year" type="text" pattern="[0-9]*"');
expect(res.text).toContain('name="month" type="text" pattern="[0-9]*"');
expect(res.text).toContain('name="day" type="text" pattern="[0-9]*"');
expect(res.text).toContain('name="year" type="text"');
expect(res.text).toContain('name="month" type="text"');
expect(res.text).toContain('name="day" type="text"');
});
});
test('should return payment date page with payment date loaded from Redis', async () => {
Expand All @@ -85,9 +85,9 @@ describe('Payment date', () => {
.expect((res) => {
expect(res.status).toBe(200);
expect(res.text).toContain('What date will you pay on?');
expect(res.text).toContain('name="year" type="text" value="2025" pattern="[0-9]*');
expect(res.text).toContain('name="month" type="text" value="6" pattern="[0-9]*');
expect(res.text).toContain('name="day" type="text" value="1" pattern="[0-9]*');
expect(res.text).toContain('name="year" type="text" value="2025"');
expect(res.text).toContain('name="month" type="text" value="6"');
expect(res.text).toContain('name="day" type="text" value="1"');
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ describe('How Much Have You Paid', () => {
expect(res.status).toBe(200);
expect(res.text).toContain('How much have you paid the claimant?');
expect(res.text).toContain('name="amount" type="number" spellcheck="false" value="20"');
expect(res.text).toContain('name="year" type="text" value="2022" pattern="[0-9]*');
expect(res.text).toContain('name="month" type="text" value="1" pattern="[0-9]*');
expect(res.text).toContain('name="day" type="text" value="1" pattern="[0-9]*');
expect(res.text).toContain('name="year" type="text" value="2022"');
expect(res.text).toContain('name="month" type="text" value="1"');
expect(res.text).toContain('name="day" type="text" value="1"');
});
});
});
Expand Down
11 changes: 9 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const path = require('path');

const sourcePath = path.resolve(__dirname, 'src/main/');
const govukFrontend = require(path.resolve(__dirname, 'webpack/govukFrontend'));
const scss = require(path.resolve(__dirname, 'webpack/scss'));
const HtmlWebpack = require(path.resolve(__dirname, 'webpack/htmlWebpack'));
const govukFrontend = require(path.resolve(__dirname, 'webpack/govukFrontend'));

const devMode = process.env.NODE_ENV !== 'production';
const fileNameSuffix = devMode ? '-dev' : '.[contenthash]';
Expand All @@ -22,10 +22,17 @@ module.exports = {
use: 'ts-loader',
exclude: /node_modules/,
},
{
test: /\.mjs$/,
type: 'javascript/auto',
resolve: {
fullySpecified: false,
},
},
],
},
resolve: {
extensions: ['.ts', '.js'],
extensions: ['.ts', '.js', '.mjs'],
},
output: {
path: path.resolve(__dirname, 'src/main/public/'),
Expand Down
14 changes: 2 additions & 12 deletions webpack/govukFrontend.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');

const packageJson = require.resolve('govuk-frontend/package.json');
const root = path.resolve(packageJson, '..', 'govuk');
const sass = path.resolve(root, 'all.scss');
const javascript = path.resolve(root, 'all.js');
const components = path.resolve(root, 'components');
const assets = path.resolve(root, 'assets');
const images = path.resolve(assets, 'images');
const fonts = path.resolve(assets, 'fonts');

const copyGovukTemplateAssets = new CopyWebpackPlugin({
patterns: [
{ from: images, to: 'assets/images' },
{ from: fonts, to: 'assets/fonts' },
{ from: path.join(__dirname, '../node_modules/govuk-frontend/govuk/assets/images'), to: 'assets/images' },
{ from: path.join(__dirname, '../node_modules/govuk-frontend/govuk/assets/fonts'), to: 'assets/fonts' },
],
});

module.exports = {
paths: { template: root, components, sass, javascript, assets },
plugins: [copyGovukTemplateAssets],
};
33 changes: 14 additions & 19 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1380,10 +1380,10 @@
"@jridgewell/resolve-uri" "^3.0.3"
"@jridgewell/sourcemap-codec" "^1.4.10"

"@ministryofjustice/frontend@^1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@ministryofjustice/frontend/-/frontend-1.3.0.tgz#f1982225927024565b5365adc7d8515c8af3f065"
integrity sha512-YE8xbuGkX8goM0jkV4tHhnzl3A0DD+eoX01XQDzfchRXQf2yQrCfoSdCJf3Xf5oBaknhtBSq3D0eKVt+vRu6OA==
"@ministryofjustice/frontend@^1.4.2":
version "1.4.2"
resolved "https://registry.yarnpkg.com/@ministryofjustice/frontend/-/frontend-1.4.2.tgz#d105ada3bb7abf5977dcb742213178a7820a3959"
integrity sha512-vkJFncllNqVoogLEjsk2k1Fn1EtOV9IJS0XB1htw0x1nhq/fX1Edac3mY04IfQyzIiA9RNwIbV/5qQ83z+Akgg==
dependencies:
govuk-frontend "^3.0.0 || ^4.0.0"
moment "^2.27.0"
Expand Down Expand Up @@ -5912,12 +5912,7 @@ got@^9.6.0:
to-readable-stream "^1.0.0"
url-parse-lax "^3.0.0"

[email protected]:
version "4.0.1"
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-4.0.1.tgz#bceff58ecb399272cba32bd2b357fe16198e3249"
integrity sha512-X+B88mqYHoxAz0ID87Uxo3oHqdKBRnNHd3Cz8+u8nvQUAsrEzROFLK+t7sAu7e+fKqCCrJyIgx6Cmr6dIGnohQ==

"govuk-frontend@^3.0.0 || ^4.0.0":
[email protected], "govuk-frontend@^3.0.0 || ^4.0.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/govuk-frontend/-/govuk-frontend-4.1.0.tgz#d3bc3af09baba539adee31f980ac0322b9eeb949"
integrity sha512-xBUUarxinGWSccmXPmwa7ovg3xabEQ0+Dcv7pdq9X3F69892OFMqP2g8jvlDUrVsDVdasXLk4Jq4w8dPiaEVqQ==
Expand Down Expand Up @@ -8246,10 +8241,10 @@ [email protected]:
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=

nanoid@^3.2.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.0.tgz#5906f776fd886c66c24f3653e0c46fcb1d4ad6b0"
integrity sha512-JzxqqT5u/x+/KOFSd7JP15DOo9nOoHpx6DYatqIHUW2+flybkm+mdcraotSQR5WcnZr+qhGVh8Ted0KdfSMxlg==
nanoid@^3.3.4:
version "3.3.4"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab"
integrity sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==

nanomatch@^1.2.9:
version "1.2.13"
Expand Down Expand Up @@ -9034,12 +9029,12 @@ postcss-value-parser@^4.1.0, postcss-value-parser@^4.2.0:
resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514"
integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==

postcss@^8.2.13, postcss@^8.4.7:
version "8.4.6"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.6.tgz#c5ff3c3c457a23864f32cb45ac9b741498a09ae1"
integrity sha512-OovjwIzs9Te46vlEx7+uXB0PLijpwjXGKXjVGGPIGubGpq7uh5Xgf6D6FiJ/SzJMBosHDp6a2hiXOS97iBXcaA==
postcss@^8.4.7:
version "8.4.14"
resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.14.tgz#ee9274d5622b4858c1007a74d76e42e56fd21caf"
integrity sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==
dependencies:
nanoid "^3.2.0"
nanoid "^3.3.4"
picocolors "^1.0.0"
source-map-js "^1.0.2"

Expand Down