Skip to content

Commit 9cf682d

Browse files
committed
Merge branch main into bugfix/CCM-8074_accessibility-issue-fix
2 parents 65b7c78 + 17eed32 commit 9cf682d

File tree

119 files changed

+42113
-37844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+42113
-37844
lines changed

.eslintrc.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,21 @@
4040
"error",
4141
{
4242
"case": "kebabCase",
43-
"ignore": [".tsx"]
43+
"ignore": [
44+
".tsx"
45+
]
4446
}
4547
],
4648
"react/react-in-jsx-scope": "off",
4749
"react/jsx-filename-extension": "off",
4850
"react/jsx-props-no-spreading": "off",
4951
"react/function-component-definition": "off",
50-
"react/jsx-no-useless-fragment": ["error", { "allowExpressions": true }],
52+
"react/jsx-no-useless-fragment": [
53+
"error",
54+
{
55+
"allowExpressions": true
56+
}
57+
],
5158
"import/prefer-default-export": "off",
5259
"import/extensions": "off",
5360
"no-shadow": "off",
@@ -72,21 +79,23 @@
7279
"prefer-regex-literals": "off",
7380
"class-methods-use-this": "off",
7481
"no-underscore-dangle": "off",
75-
"import/no-extraneous-dependencies":[
82+
"import/no-extraneous-dependencies": [
7683
"error",
7784
{
78-
"devDependencies":[
79-
"jest.config.ts",
80-
"jest.setup.ts",
81-
"src/__tests__/**"
85+
"devDependencies": [
86+
"jest.config.ts",
87+
"jest.setup.ts",
88+
"src/__tests__/**"
8289
]
8390
}
8491
],
8592
"no-empty-function": "off"
8693
},
8794
"overrides": [
8895
{
89-
"files": ["*.js"],
96+
"files": [
97+
"*.js"
98+
],
9099
"rules": {
91100
"@typescript-eslint/no-var-requires": "off",
92101
"@typescript-eslint/no-require-imports": "off",
@@ -95,7 +104,9 @@
95104
}
96105
},
97106
{
98-
"files": ["*.test.{ts,tsx}"],
107+
"files": [
108+
"*.test.{ts,tsx}"
109+
],
99110
"rules": {
100111
"unicorn/no-useless-undefined": "off",
101112
"unicorn/consistent-function-scoping": "off",
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: PR Destroy Environment
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
jobs:
12+
create-dynamic-environment:
13+
name: Destroy Dynamic Environment
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Trigger nhs-notify-internal dynamic environment destruction
18+
shell: bash
19+
run: |
20+
set -x
21+
this_repo_name=$(echo ${{ github.repository }} | cut -d'/' -f2)
22+
23+
DISPATCH_EVENT=$(jq -ncM \
24+
--arg infraRepoName "${this_repo_name}" \
25+
--arg releaseVersion "main" \
26+
--arg targetEnvironment "pr${{ github.event.number }}" \
27+
--arg targetAccountGroup "nhs-notify-template-management-dev" \
28+
--arg targetComponent "branch" \
29+
--arg terraformAction "destroy" \
30+
'{ "ref": "main",
31+
"inputs": {
32+
"infraRepoName": $infraRepoName,
33+
"releaseVersion", $releaseVersion,
34+
"targetEnvironment", $targetEnvironment,
35+
"targetAccountGroup", $targetAccountGroup,
36+
"targetComponent", $targetComponent,
37+
"terraformAction", $terraformAction,
38+
"overrides", $overrides,
39+
}
40+
}')
41+
42+
curl --fail -L \
43+
-X POST \
44+
-H "Accept: application/vnd.github+json" \
45+
-H "Authorization: Bearer ${{ secrets.PR_TRIGGER_PAT }}" \
46+
-H "X-GitHub-Api-Version: 2022-11-28" \
47+
https://api.github.com/repos/NHSDigital/nhs-notify-internal/actions/workflows/dispatch-deploy-dynamic-env.yaml/dispatches \
48+
-d "${DISPATCH_EVENT}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ tests/test-team/playwright/.cache/
8181
sandbox_cognito_auth_token.json
8282

8383
frontend/public/testing
84+
.vscode/launch.json

frontend/amplify/package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
"private": true,
55
"main": "index.ts",
66
"type": "module",
7+
"scripts": {
8+
"generate-dependencies": "tsx functions/send-email/generate-dependencies.ts",
9+
"lint": "eslint . -c .eslintrc.json",
10+
"lint:fix": "eslint . --fix",
11+
"test:unit": "jest",
12+
"typecheck": "tsc --noEmit"
13+
},
714
"dependencies": {
815
"@aws-amplify/backend": "^1.8.0",
916
"@aws-sdk/client-ses": "^3.637.0",
@@ -15,17 +22,11 @@
1522
"mimetext": "^3.0.24",
1623
"winston": "^3.17.0"
1724
},
18-
"scripts": {
19-
"generate-dependencies": "tsx functions/send-email/generate-dependencies.ts",
20-
"lint": "eslint . -c .eslintrc.json",
21-
"lint:fix": "eslint . --fix",
22-
"test:unit": "jest",
23-
"typecheck": "tsc --noEmit",
24-
"typescript": "^5.5.4"
25-
},
2625
"devDependencies": {
2726
"@types/jest": "^29.5.14",
2827
"@types/node": "^22.10.1",
29-
"nhs-notify-web-template-management-utils": "*"
28+
"nhs-notify-web-template-management-utils": "*",
29+
"tsx": "^4.19.2",
30+
"typescript": "^5.5.4"
3031
}
3132
}

frontend/jest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const config: Config = {
3030
'backend.ts',
3131
'generate-dependencies.ts',
3232
'jest.config.ts',
33+
'.dev.tsx',
3334
],
3435

3536
testPathIgnorePatterns: [

frontend/next.config.js

Lines changed: 50 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,60 @@
11
/** @type {import('next').NextConfig} */
2+
3+
const { PHASE_DEVELOPMENT_SERVER } = require('next/constants');
4+
25
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '/templates';
36
const domain = process.env.NOTIFY_DOMAIN_NAME ?? 'localhost:3000';
47

5-
const nextConfig = {
6-
basePath,
7-
env: {
8-
basePath,
9-
},
8+
const nextConfig = (phase) => {
9+
const isDevServer = phase === PHASE_DEVELOPMENT_SERVER;
1010

11-
experimental: {
12-
serverActions: {
13-
allowedOrigins: [domain, domain.replace('templates', 'web-gateway')],
11+
return {
12+
basePath,
13+
env: {
14+
basePath,
1415
},
15-
},
16-
17-
async redirects() {
18-
return [
19-
{
20-
source: '/',
21-
destination: basePath,
22-
basePath: false,
23-
permanent: false,
16+
17+
experimental: {
18+
serverActions: {
19+
allowedOrigins: [domain, domain.replace('templates', 'web-gateway')],
2420
},
25-
];
26-
},
21+
},
22+
23+
async redirects() {
24+
return [
25+
{
26+
source: '/',
27+
destination: basePath,
28+
basePath: false,
29+
permanent: false,
30+
},
31+
];
32+
},
33+
34+
async rewrites() {
35+
if (isDevServer) {
36+
return [
37+
{
38+
source: '/auth/signout',
39+
destination: `http://${domain}${basePath}/auth/signout`,
40+
basePath: false,
41+
},
42+
{
43+
source: '/auth',
44+
destination: `http://${domain}${basePath}/auth`,
45+
basePath: false,
46+
},
47+
];
48+
}
49+
50+
return [];
51+
},
52+
53+
// pages with e.g. .dev.tsx extension are only included when running locally
54+
pageExtensions: ['ts', 'tsx', 'js', 'jsx'].flatMap((extension) => {
55+
return isDevServer ? [`dev.${extension}`, extension] : [extension];
56+
}),
57+
};
2758
};
2859

2960
module.exports = nextConfig;

frontend/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@
1212
"app:start": "pm2 start npm -- start",
1313
"app:wait": "wait-on -l http://localhost:3000/templates/create-and-submit-templates",
1414
"app:stop": "pm2 kill",
15-
"typecheck": "tsc --noEmit",
15+
"typecheck": "npm run mock-amplify-outputs && tsc --noEmit",
1616
"create-sandbox": "pm2 start npx -- ampx sandbox",
17-
"destroy-sandbox": "npx ampx sandbox delete --y"
17+
"destroy-sandbox": "npx ampx sandbox delete --y",
18+
"mock-amplify-outputs": "if [ ! -f ./amplify_outputs.json ]; then echo \"{}\" > ./amplify_outputs.json ; fi"
1819
},
1920
"dependencies": {
2021
"@aws-amplify/adapter-nextjs": "^1.2.23",
2122
"@aws-amplify/backend": "^1.2.0",
23+
"@aws-amplify/ui-react": "^6.3.1",
2224
"@aws-sdk/client-ses": "^3.637.0",
25+
"aws-amplify": "^6.6.0",
2326
"date-fns": "^4.1.0",
2427
"markdown-it": "^13.0.1",
2528
"mimetext": "^3.0.24",
@@ -28,6 +31,7 @@
2831
"nhs-notify-web-template-management-utils": "*",
2932
"nhsuk-frontend": "^8.3.0",
3033
"nhsuk-react-components": "^4.1.1",
34+
"path": "^0.12.7",
3135
"react": "^18",
3236
"react-dom": "^18",
3337
"zod": "^3.23.8"

frontend/src/__tests__/app/manage-templates/page.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { render, screen } from '@testing-library/react';
33
import ManageTemplatesPage from '@app/manage-templates/page';
44
import content from '@content/content';
55
import { getTemplates } from '@utils/form-actions';
6-
import { Template } from 'nhs-notify-web-template-management-utils/src/types';
76
import {
7+
Template,
88
TemplateStatus,
99
TemplateType,
10-
} from 'nhs-notify-web-template-management-utils/src/enum';
10+
} from 'nhs-notify-web-template-management-utils';
1111

1212
const manageTemplatesContent = content.pages.manageTemplates;
1313

0 commit comments

Comments
 (0)