chore: add monorepo tools (#9196)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 ??
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user