chore(server): hoist deps (#12145)

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **Chores**
  - Updated workflow to move the node_modules directory during the build process.
  - Adjusted Prisma client output directory for improved file organization.
  - Removed unused properties from backend server package configuration.

- **Refactor**
  - Simplified type annotations for improved code clarity in test utilities.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
forehalo
2025-05-06 11:36:30 +00:00
parent 8940151ffe
commit 0ffa6fbe89
4 changed files with 6 additions and 11 deletions

View File

@@ -253,6 +253,9 @@ jobs:
- name: Generate Prisma client - name: Generate Prisma client
run: yarn workspace @affine/server prisma generate run: yarn workspace @affine/server prisma generate
- name: Mv node_modules
run: mv ./node_modules ./packages/backend/server
- name: Setup Version - name: Setup Version
id: version id: version
uses: ./.github/actions/setup-version uses: ./.github/actions/setup-version

View File

@@ -177,9 +177,5 @@
"**/*.spec.ts", "**/*.spec.ts",
"**/*.e2e.ts" "**/*.e2e.ts"
] ]
},
"stableVersion": "0.5.3",
"installConfig": {
"hoistingLimits": "workspaces"
} }
} }

View File

@@ -1,6 +1,6 @@
generator client { generator client {
provider = "prisma-client-js" provider = "prisma-client-js"
output = "./node_modules/.prisma/client" output = "../../../node_modules/.prisma/client"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"] binaryTargets = ["native", "debian-openssl-3.0.x", "linux-arm64-openssl-3.0.x"]
previewFeatures = ["metrics", "relationJoins", "nativeDistinct", "postgresqlExtensions"] previewFeatures = ["metrics", "relationJoins", "nativeDistinct", "postgresqlExtensions"]
} }

View File

@@ -12,6 +12,7 @@ import { faker } from '@faker-js/faker';
import { hash } from '@node-rs/argon2'; import { hash } from '@node-rs/argon2';
import type { BrowserContext, Cookie, Page } from '@playwright/test'; import type { BrowserContext, Cookie, Page } from '@playwright/test';
import { expect } from '@playwright/test'; import { expect } from '@playwright/test';
import { type PrismaClient } from '@prisma/client';
import type { Assertions } from 'ava'; import type { Assertions } from 'ava';
import { z } from 'zod'; import { z } from 'zod';
@@ -57,12 +58,7 @@ const server = new Package('@affine/server');
const require = createRequire(server.srcPath.join('index.ts').toFileUrl()); const require = createRequire(server.srcPath.join('index.ts').toFileUrl());
export const runPrisma = async <T>( export const runPrisma = async <T>(
cb: ( cb: (prisma: PrismaClient) => Promise<T>
prisma: InstanceType<
// oxlint-disable-next-line @typescript-eslint/consistent-type-imports
typeof import('../../../../packages/backend/server/node_modules/@prisma/client').PrismaClient
>
) => Promise<T>
): Promise<T> => { ): Promise<T> => {
const { PrismaClient } = require('@prisma/client'); const { PrismaClient } = require('@prisma/client');
const client = new PrismaClient({ const client = new PrismaClient({