diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 284605d..3773e11 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -6,11 +6,11 @@ -- ๐Ÿ› Bug fix -- ๐Ÿš€ New feature development -- ๐Ÿงน Tech debt (refactoring, code cleanup, dependency upgrades, etc.) -- ๐Ÿค– Build/deploy pipeline (DevOps) -- ๐ŸŽ‚ Other +- [ ] ๐Ÿ› Bug fix +- [ ] ๐Ÿš€ New feature development +- [ ] ๐Ÿงน Tech debt (refactoring, code cleanup, dependency upgrades, etc.) +- [ ] ๐Ÿค– Build/deploy pipeline (DevOps) +- [ ] ๐ŸŽ‚ Other ## ๐Ÿ“” Objective @@ -21,7 +21,7 @@ -- **file.ext:** Description of what was changed and why. +- **file.ext:** Description of what was changed and why. ## ๐Ÿ“ธ Screenshots @@ -29,23 +29,10 @@ ## โฐ Reminders before review -- Contributor guidelines followed -- All formatters and local linters executed and passed -- Written new unit and / or integration tests where applicable -- Used internationalization (i18n) for all UI strings -- CI builds passed -- Communicated to DevOps any deployment requirements -- Updated any necessary documentation or informed the documentation team - -## ๐Ÿฆฎ Reviewer guidelines - - - -- ๐Ÿ‘ (`:+1:`) or similar for great changes -- ๐Ÿ“ (`:memo:`) or โ„น๏ธ (`:information_source:`) for notes or general info -- โ“ (`:question:`) for questions -- ๐Ÿค” (`:thinking:`) or ๐Ÿ’ญ (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion -- ๐ŸŽจ (`:art:`) for suggestions / improvements -- โŒ (`:x:`) or โš ๏ธ (`:warning:`) for more significant problems or concerns needing attention -- ๐ŸŒฑ (`:seedling:`) or โ™ป๏ธ (`:recycle:`) for future improvements or indications of technical debt -- โ› (`:pick:`) for minor or nitpick changes +- Contributor guidelines followed +- All formatters and local linters executed and passed +- Written new unit and / or integration tests where applicable +- Used internationalization (i18n) for all UI strings +- CI builds passed +- Communicated to DevOps any deployment requirements +- Updated any necessary documentation or informed the documentation team diff --git a/.github/renovate.json b/.github/renovate.json index b49b561..238cbf9 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -11,13 +11,8 @@ "schedule:weekends", ":separateMajorReleases" ], - "enabledManagers": ["cargo", "github-actions", "npm", "nuget"], + "enabledManagers": ["github-actions", "npm"], "packageRules": [ - { - "groupName": "cargo minor", - "matchManagers": ["cargo"], - "matchUpdateTypes": ["minor", "patch"] - }, { "groupName": "gh minor", "matchManagers": ["github-actions"], @@ -27,11 +22,6 @@ "groupName": "npm minor", "matchManagers": ["npm"], "matchUpdateTypes": ["minor", "patch"] - }, - { - "groupName": "nuget minor", - "matchManagers": ["nuget"], - "matchUpdateTypes": ["minor", "patch"] } ] } diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..04d89c7 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,46 @@ +--- +name: Build API/client files + +on: + workflow_dispatch: + pull_request: + branches: [ "main" ] + paths-ignore: + - ".github/workflows/**" + push: + branches: [ "main" ] + paths-ignore: + - ".github/workflows/**" + +defaults: + run: + shell: bash + +jobs: + build: + name: Build + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Set up Node + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + with: + cache: "npm" + cache-dependency-path: "**/package-lock.json" + node-version: "18" + + - name: Clean install dependencies and build + run: | + npm ci + npm run build + + - name: Upload build as artifact + uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 + if: always() + with: + name: build-files + path: | + ./api/build + ./client/build diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..8f0ae25 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,19 @@ +--- +name: Docker Image + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Build the Docker image + run: docker build . -f Dockerfile -t test-the-web:$(date +%s) diff --git a/Dockerfile b/Dockerfile index cba3d6a..2afc161 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,5 +11,5 @@ WORKDIR /usr/app COPY --from=build /usr/app/client/build ./client/build COPY --from=build /usr/app/api/build ./api/build COPY --from=build /usr/app/api/node_modules ./api/node_modules -COPY --from=build /usr/app/api/.env ./.env +COPY --from=build /usr/app/api/.en[v] ./ CMD ["node", "api/build/app.js"] diff --git a/Dockerfile.dev b/Dockerfile.dev index b2b2d66..21530e4 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -5,14 +5,13 @@ WORKDIR /usr/app COPY . . RUN npm ci RUN npm run build -# CMD ["sh", "scripts/generate-certs.sh"] FROM node:${NODE_VERSION}-alpine WORKDIR /usr/app COPY --from=build /usr/app/client/build ./client/build COPY --from=build /usr/app/api/build ./api/build COPY --from=build /usr/app/api/node_modules ./api/node_modules -COPY --from=build /usr/app/api/ssl.crt ./api/ssl.crt -COPY --from=build /usr/app/api/ssl.key ./api/ssl.key -COPY --from=build /usr/app/api/.env ./.env +COPY --from=build /usr/app/api/ssl.cr[t] ./api/ +COPY --from=build /usr/app/api/ssl.ke[y] ./api/ +COPY --from=build /usr/app/api/.en[v] ./ CMD ["node", "api/build/app.js"] diff --git a/api/app.ts b/api/app.ts index 6799da4..2d91acc 100644 --- a/api/app.ts +++ b/api/app.ts @@ -13,7 +13,7 @@ const staticFilesPath = process.env.STATIC_FILES_DIR || "client/build"; const app = express(); if (staticFilesPath) { - app.use(express.static(`${__dirname}/../../${process.env.STATIC_FILES_DIR}`)); + app.use(express.static(`${__dirname}/../../${staticFilesPath}`)); } else { console.warn("The static files folder could not be found."); } @@ -35,12 +35,15 @@ app.use( }, ); -function handlePost(request: Request, response: Response, route: string) { - console.log("POST received for:", route); +function handleRequest(request: Request, response: Response, route: string) { + console.log(`${request.method} received for:`, route); + const referrerURL = request.get("Referrer") || ""; let referrerQueryParams = ""; const isLogin = route === ROUTES.LOGIN; + + // @TODO enable fail case const responsePath = `/forms/response/${ isLogin ? "login-success" : "request-success" }`; @@ -62,21 +65,21 @@ function handlePost(request: Request, response: Response, route: string) { } app - .route(ROUTES.LOGIN) + .route(ROUTES.IDENTITY) .post((request: Request, response: Response) => - handlePost(request, response, ROUTES.LOGIN), + handleRequest(request, response, ROUTES.IDENTITY), ); app - .route(ROUTES.PAYMENT) + .route(ROUTES.LOGIN) .post((request: Request, response: Response) => - handlePost(request, response, ROUTES.PAYMENT), + handleRequest(request, response, ROUTES.LOGIN), ); app - .route(ROUTES.IDENTITY) + .route(ROUTES.PAYMENT) .post((request: Request, response: Response) => - handlePost(request, response, ROUTES.IDENTITY), + handleRequest(request, response, ROUTES.PAYMENT), ); try {