From 7e30229d4553d9c5eb73e49713387868773a077d Mon Sep 17 00:00:00 2001 From: tnagorra Date: Mon, 15 Apr 2024 13:42:35 +0545 Subject: [PATCH] Fix import for prisma client - use pnpm in github actions --- .github/workflows/test-backend-api.yml | 9 ++++++--- .github/workflows/test-e2e.yml | 6 +++--- .github/workflows/test-frontend.yml | 2 +- lib/prisma.ts | 2 +- lib/xml/helpers.ts | 2 +- lib/xml/sign.ts | 2 +- pages/api/user/alertingAuthorities.ts | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-backend-api.yml b/.github/workflows/test-backend-api.yml index eb4d4a0..43b3ffb 100644 --- a/.github/workflows/test-backend-api.yml +++ b/.github/workflows/test-backend-api.yml @@ -13,9 +13,12 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - uses: bahmutov/npm-install@v1 + - uses: pnpm/action-setup@v3 with: - useLockFile: false + version: 8 + run_install: | + - recursive: true + args: [--frozen-lockfile, --strict-peer-dependencies] - name: Create test private key for signing alerts run: ssh-keygen -m PKCS8 -t ecdsa -f $(pwd)/test-key @@ -24,7 +27,7 @@ jobs: run: docker-compose -f docker-compose-test-api.yml up -d - name: Run backend API tests - run: npm run test:api + run: pnpm run test:api env: BASE_URL: http://example.com VERIFIER_EMAIL: ifrc@example.com diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index 5d9e3c4..fdf4a90 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -34,15 +34,15 @@ jobs: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}- - name: Build frontend - run: npm run build + run: pnpm run build env: NODE_ENV: test - name: Run end-to-end tests run: | # Run Next.js frontend in background - npm run start & - npm run test:e2e + pnpm run start & + pnpm run test:e2e env: NODE_ENV: test PRIVATE_KEY_FILENAME: test-key diff --git a/.github/workflows/test-frontend.yml b/.github/workflows/test-frontend.yml index fdbaefa..9e37f56 100644 --- a/.github/workflows/test-frontend.yml +++ b/.github/workflows/test-frontend.yml @@ -21,7 +21,7 @@ jobs: args: [--frozen-lockfile, --strict-peer-dependencies] - name: Run frontend component tests - run: npm run test:frontend + run: pnpm run test:frontend - uses: actions/upload-artifact@v4 with: diff --git a/lib/prisma.ts b/lib/prisma.ts index 38de33f..54afb94 100644 --- a/lib/prisma.ts +++ b/lib/prisma.ts @@ -1,4 +1,4 @@ -import { PrismaClient } from ".prisma/client"; +import { PrismaClient } from "@prisma/client"; declare global { var prisma: PrismaClient | undefined; diff --git a/lib/xml/helpers.ts b/lib/xml/helpers.ts index 6ca76a2..6e42f21 100644 --- a/lib/xml/helpers.ts +++ b/lib/xml/helpers.ts @@ -1,4 +1,4 @@ -import { Alert } from ".prisma/client"; +import { Alert } from "@prisma/client"; import { Capgen } from "capgen"; import { XMLBuilder } from "fast-xml-parser"; diff --git a/lib/xml/sign.ts b/lib/xml/sign.ts index f0753ca..c596824 100644 --- a/lib/xml/sign.ts +++ b/lib/xml/sign.ts @@ -1,7 +1,7 @@ import { webcrypto } from "node:crypto"; import { Application, Parse, SignedXml } from "xmldsigjs"; -import { Alert } from ".prisma/client"; +import { Alert } from "@prisma/client"; import { getPrivateKey } from "../crypto"; import { formatAlertAsXML } from "./helpers"; import { CAPV12JSONSchema } from "../types/cap.schema"; diff --git a/pages/api/user/alertingAuthorities.ts b/pages/api/user/alertingAuthorities.ts index 38c9d38..7741aad 100644 --- a/pages/api/user/alertingAuthorities.ts +++ b/pages/api/user/alertingAuthorities.ts @@ -1,4 +1,4 @@ -import { AlertingAuthority } from ".prisma/client"; +import { AlertingAuthority } from "@prisma/client"; import { randomBytes, randomUUID } from "crypto"; import type { NextApiRequest, NextApiResponse } from "next"; import { getServerSession } from "next-auth";