Skip to content

Commit

Permalink
Chore: [AEA-0000] - refactor to use redocly and use common packages (#…
Browse files Browse the repository at this point in the history
…475)

## Summary

- Routine Change

### Details

- refactor to have common testing module
- refactor to have common middy error handler
- switch to use redocly instead of swagger-cil

Co-authored-by: MatthewPopat-NHS <[email protected]>
  • Loading branch information
anthony-nhs and MatthewPopat-NHS authored Jul 3, 2024
1 parent a9c7c10 commit 33381c3
Show file tree
Hide file tree
Showing 38 changed files with 2,424 additions and 1,316 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/run_package_code_and_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
cp .tool-versions ~/
rm -rf .aws-sam
export PATH=$PATH:$PWD/node_modules/.bin
make build-specification
make compile-specification
make sam-build
cp Makefile .aws-sam/build/
cp samconfig_package_and_deploy.toml .aws-sam/build/
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
cp .tool-versions ~/
rm -rf .aws-sam
export PATH=$PATH:$PWD/node_modules/.bin
make build-specification
make compile-specification
make sam-build-sandbox
cp Makefile .aws-sam/build/
cp samconfig_package_and_deploy.toml .aws-sam/build/
Expand Down
27 changes: 27 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,33 @@ repos:
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-capabilityStatement
name: Lint capabilityStatement
entry: npm
args: ["run", "--prefix=packages/capabilityStatement", "lint"]
language: system
files: ^packages\/capabilityStatement
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-commonTesting
name: Lint common/testing
entry: npm
args: ["run", "--prefix=packages/common/testing", "lint"]
language: system
files: ^packages\/common/testing
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-commonMiddyErrorHandler
name: Lint common/middyErrorHandler
entry: npm
args: ["run", "--prefix=packages/common/middyErrorHandler", "lint"]
language: system
files: ^packages\/common/middyErrorHandler
types_or: [ts, tsx, javascript, jsx, json]
pass_filenames: false

- id: lint-samtemplates
name: Lint sam templates
entry: make
Expand Down
14 changes: 13 additions & 1 deletion .vscode/eps-prescription-status-update-api.code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,22 @@
{
"name": "packages/capabilityStatement",
"path": "../packages/capabilityStatement"
},
{
"name": "packages/common/testing",
"path": "../packages/common/testing"
},
{
"name": "packages/common/middyErrorHandler",
"path": "../packages/common/middyErrorHandler"
}
],
"settings": {
"jest.disabledWorkspaceFolders": ["eps-prescription-status-update-monorepo"],
"jest.disabledWorkspaceFolders": [
"eps-prescription-status-update-monorepo",
"packages/common/testing",
"packages/specification"
],
"files.exclude": {
"packages/": true
},
Expand Down
20 changes: 14 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,24 @@ sam-deploy-package: guard-artifact_bucket guard-artifact_bucket_prefix guard-sta
compile-node:
npx tsc --build tsconfig.build.json

compile: compile-node
compile-specification:
npm run resolve --workspace packages/specification/
npm run resolve-cpsu --workspace packages/specification/

compile: compile-node compile-specification

lint-node: compile-node
npm run lint --workspace packages/updatePrescriptionStatus
npm run lint --workspace packages/gsul
npm run lint --workspace packages/sandbox
npm run lint --workspace packages/specification
npm run lint --workspace packages/statusLambda
npm run lint --workspace packages/capabilityStatement
npm run lint --workspace packages/cpsuLambda
npm run lint --workspace packages/common/testing
npm run lint --workspace packages/common/middyErrorHandler

lint-specification: compile-specification
npm run lint --workspace packages/specification

lint-samtemplates:
poetry run cfn-lint -I "SAMtemplates/**/*.yaml" 2>&1 | grep "Run scan"
Expand All @@ -117,7 +125,7 @@ lint-githubactions:
lint-githubaction-scripts:
shellcheck .github/scripts/*.sh

lint: lint-node lint-samtemplates lint-python lint-githubactions lint-githubaction-scripts
lint: lint-node lint-samtemplates lint-python lint-githubactions lint-githubaction-scripts lint-specification

test: compile
npm run test --workspace packages/updatePrescriptionStatus
Expand All @@ -126,6 +134,7 @@ test: compile
npm run test --workspace packages/statusLambda
npm run test --workspace packages/capabilityStatement
npm run test --workspace packages/cpsuLambda
npm run test --workspace packages/common/middyErrorHandler

clean:
rm -rf packages/updatePrescriptionStatus/coverage
Expand All @@ -140,16 +149,15 @@ clean:
rm -rf packages/capabilityStatement/lib
rm -rf packages/cpsuLambda/coverage
rm -rf packages/cpsuLambda/lib
rm -rf packages/common/testing/lib
rm -rf packages/common/middyErrorHandler/lib
rm -rf .aws-sam

deep-clean: clean
rm -rf venv
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
poetry env remove --all

build-specification:
$(MAKE) --directory=packages/specification build

check-licenses: check-licenses-node check-licenses-python

check-licenses-node:
Expand Down
Loading

0 comments on commit 33381c3

Please sign in to comment.