chore: add monorepo tools (#9196)

This commit is contained in:
liuyi
2024-12-24 15:29:48 +08:00
committed by GitHub
parent e3a8b63e38
commit 2443935830
116 changed files with 9390 additions and 1466 deletions

View File

@@ -26,9 +26,8 @@ const config: PlaywrightTestConfig = {
retries: 3,
reporter: process.env.CI ? 'github' : 'list',
webServer: [
// Intentionally not building the web, reminds you to run it by yourself.
{
command: 'yarn -T run start:web-static',
command: 'yarn run -T affine dev -p @affine/web',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
@@ -37,7 +36,7 @@ const config: PlaywrightTestConfig = {
},
},
{
command: 'yarn workspace @affine/server start',
command: 'yarn run -T affine dev -p @affine/server',
port: 3010,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -26,9 +26,12 @@ const config: PlaywrightTestConfig = {
retries: process.env.COPILOT ? 1 : 3,
reporter: process.env.CI ? 'github' : 'list',
webServer: [
// Intentionally not building the web, reminds you to run it by yourself.
{
command: 'yarn -T run start:web-static',
// TODO(@forehalo):
// in ci, all the target will be built,
// we could download the builds from archives
// and then run the web with simple http serve, it's will be faster
command: 'yarn run -T affine dev -p @affine/web',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
@@ -37,12 +40,10 @@ const config: PlaywrightTestConfig = {
},
},
{
command: 'yarn workspace @affine/server start',
command: 'yarn run -T affine dev -p @affine/server',
port: 3010,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
stdout: 'pipe',
stderr: 'pipe',
env: {
DATABASE_URL:
process.env.DATABASE_URL ??

View File

@@ -23,7 +23,7 @@ const config: PlaywrightTestConfig = {
webServer: [
// Intentionally not building the web, reminds you to run it by yourself.
{
command: 'yarn -T run start:web-static',
command: 'yarn run -T affine bundle -p @affine/electron --dev',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
@@ -34,7 +34,7 @@ const config: PlaywrightTestConfig = {
},
},
{
command: 'yarn workspace @affine/server start',
command: 'yarn run -T affine dev -p @affine/server',
port: 3010,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -41,7 +41,7 @@ if (process.env.DEV_SERVER_URL) {
);
config.webServer = [
{
command: 'yarn run start:web-static',
command: 'yarn run -T affine bundle -p @affine/electron --dev',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -46,7 +46,7 @@ const config: PlaywrightTestConfig = {
webServer: [
// Intentionally not building the web, reminds you to run it by yourself.
{
command: 'yarn run start:web-static',
command: 'yarn run -T affine dev -p @affine/web',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -49,7 +49,7 @@ const config: PlaywrightTestConfig = {
webServer: [
// Intentionally not building the web, reminds you to run it by yourself.
{
command: 'yarn workspace @affine/mobile static-server',
command: 'yarn run -T affine dev -p @affine/mobile',
port: 8080,
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,

View File

@@ -53,16 +53,22 @@ const cloudUserSchema = z.object({
export const runPrisma = async <T>(
cb: (
prisma: InstanceType<
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
// oxlint-disable-next-line @typescript-eslint/consistent-type-imports
typeof import('../../../packages/backend/server/node_modules/@prisma/client').PrismaClient
>
) => Promise<T>
): Promise<T> => {
const {
PrismaClient,
// eslint-disable-next-line @typescript-eslint/no-var-requires
} = require('../../../packages/backend/server/node_modules/@prisma/client');
const client = new PrismaClient();
// oxlint-disable-next-line @typescript-eslint/consistent-type-imports
} = await import(
'../../../packages/backend/server/node_modules/@prisma/client'
);
const client = new PrismaClient({
datasourceUrl:
process.env.DATABASE_URL ||
'postgresql://affine:affine@localhost:5432/affine',
});
await client.$connect();
try {
return await cb(client);