chore(server): local data migration env (#9080)
This commit is contained in:
@@ -16,9 +16,8 @@
|
|||||||
"test:coverage": "c8 ava --concurrency 1 --serial",
|
"test:coverage": "c8 ava --concurrency 1 --serial",
|
||||||
"test:copilot:coverage": "c8 ava --timeout=5m \"tests/**/copilot-*.spec.ts\"",
|
"test:copilot:coverage": "c8 ava --timeout=5m \"tests/**/copilot-*.spec.ts\"",
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
"data-migration": "node --loader ts-node/esm/transpile-only.mjs ./src/data/index.ts",
|
"data-migration": "NODE_ENV=script node --loader ts-node/esm/transpile-only.mjs ./src/data/index.ts",
|
||||||
"predeploy": "yarn prisma migrate deploy && node --import ./scripts/register.js ./dist/data/index.js run",
|
"predeploy": "yarn prisma migrate deploy && node --import ./scripts/register.js ./dist/data/index.js run"
|
||||||
"predeploy:ts": "yarn prisma migrate deploy && node --loader ts-node/esm/transpile-only.mjs ./src/data/index.ts run"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apollo/server": "^4.10.2",
|
"@apollo/server": "^4.10.2",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { AppStartupConfig } from './types';
|
|||||||
export type EnvConfigType = 'string' | 'int' | 'float' | 'boolean';
|
export type EnvConfigType = 'string' | 'int' | 'float' | 'boolean';
|
||||||
export type ServerFlavor = 'allinone' | 'graphql' | 'sync' | 'renderer';
|
export type ServerFlavor = 'allinone' | 'graphql' | 'sync' | 'renderer';
|
||||||
export type AFFINE_ENV = 'dev' | 'beta' | 'production';
|
export type AFFINE_ENV = 'dev' | 'beta' | 'production';
|
||||||
export type NODE_ENV = 'development' | 'test' | 'production';
|
export type NODE_ENV = 'development' | 'test' | 'production' | 'script';
|
||||||
|
|
||||||
export enum DeploymentType {
|
export enum DeploymentType {
|
||||||
Affine = 'affine',
|
Affine = 'affine',
|
||||||
@@ -25,7 +25,12 @@ export interface PreDefinedAFFiNEConfig {
|
|||||||
readonly isSelfhosted: boolean;
|
readonly isSelfhosted: boolean;
|
||||||
readonly flavor: { type: string } & { [key in ServerFlavor]: boolean };
|
readonly flavor: { type: string } & { [key in ServerFlavor]: boolean };
|
||||||
readonly affine: { canary: boolean; beta: boolean; stable: boolean };
|
readonly affine: { canary: boolean; beta: boolean; stable: boolean };
|
||||||
readonly node: { prod: boolean; dev: boolean; test: boolean };
|
readonly node: {
|
||||||
|
prod: boolean;
|
||||||
|
dev: boolean;
|
||||||
|
test: boolean;
|
||||||
|
script: boolean;
|
||||||
|
};
|
||||||
readonly deploy: boolean;
|
readonly deploy: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ function getPredefinedAFFiNEConfig(): PreDefinedAFFiNEConfig {
|
|||||||
'development',
|
'development',
|
||||||
'test',
|
'test',
|
||||||
'production',
|
'production',
|
||||||
|
'script',
|
||||||
]);
|
]);
|
||||||
const AFFINE_ENV = readEnv<AFFINE_ENV>('AFFINE_ENV', 'dev', [
|
const AFFINE_ENV = readEnv<AFFINE_ENV>('AFFINE_ENV', 'dev', [
|
||||||
'dev',
|
'dev',
|
||||||
@@ -47,6 +48,7 @@ function getPredefinedAFFiNEConfig(): PreDefinedAFFiNEConfig {
|
|||||||
prod: NODE_ENV === 'production',
|
prod: NODE_ENV === 'production',
|
||||||
dev: NODE_ENV === 'development',
|
dev: NODE_ENV === 'development',
|
||||||
test: NODE_ENV === 'test',
|
test: NODE_ENV === 'test',
|
||||||
|
script: NODE_ENV === 'script',
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export type GraphqlContext = {
|
|||||||
},
|
},
|
||||||
autoSchemaFile: join(
|
autoSchemaFile: join(
|
||||||
fileURLToPath(import.meta.url),
|
fileURLToPath(import.meta.url),
|
||||||
config.node.test
|
config.node.dev
|
||||||
? '../../../../node_modules/.cache/schema.gql'
|
? '../../../schema.gql'
|
||||||
: '../../../schema.gql'
|
: '../../../../node_modules/.cache/schema.gql'
|
||||||
),
|
),
|
||||||
sortSchema: true,
|
sortSchema: true,
|
||||||
context: ({
|
context: ({
|
||||||
|
|||||||
Reference in New Issue
Block a user