mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 00:41:50 +03:00
feat: improve scripts
This commit is contained in:
parent
f99bf74499
commit
462e86b9a0
@ -6,7 +6,8 @@
|
||||
"license": "MPL-2.0",
|
||||
"scripts": {
|
||||
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
|
||||
"dev:ac": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev:ac",
|
||||
"dev:ac": "pnpm --filter=!@affine/app build && NODE_API_SERVER=ac pnpm --filter @affine/app dev",
|
||||
"dev:local": "pnpm --filter=!@affine/app build && NODE_API_SERVER=local pnpm --filter @affine/app dev",
|
||||
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
|
||||
"export": "pnpm --filter @affine/app export",
|
||||
"start": "pnpm --filter @affine/app start",
|
||||
|
@ -9,6 +9,27 @@ const EDITOR_VERSION = enableDebugLocal
|
||||
? 'local-version'
|
||||
: dependencies['@blocksuite/editor'];
|
||||
|
||||
const profileTarget = {
|
||||
ac: '100.85.73.88:12001',
|
||||
dev: '100.85.73.88:12001',
|
||||
local: '127.0.0.1:3000',
|
||||
};
|
||||
|
||||
const getRedirectConfig = profile => {
|
||||
const target = profileTarget[profile || 'dev'] || profileTarget['dev'];
|
||||
|
||||
return [
|
||||
[
|
||||
{ source: '/api/:path*', destination: `http://${target}/api/:path*` },
|
||||
{
|
||||
source: '/collaboration/:path*',
|
||||
destination: `http://${target}/collaboration/:path*`,
|
||||
},
|
||||
],
|
||||
target,
|
||||
];
|
||||
};
|
||||
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
productionBrowserSourceMaps: true,
|
||||
@ -36,38 +57,12 @@ const nextConfig = {
|
||||
images: {
|
||||
unoptimized: true,
|
||||
},
|
||||
// XXX not test yet
|
||||
rewrites: async () => {
|
||||
if (process.env.NODE_API_SERVER === 'ac') {
|
||||
let destinationAC = 'http://100.85.73.88:12001/api/:path*';
|
||||
printer.info('API request proxy to [AC Server] ' + destinationAC);
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: destinationAC,
|
||||
},
|
||||
{
|
||||
source: '/collaboration/:path*',
|
||||
destination: 'http://localhost:3000/collaboration/:path*',
|
||||
},
|
||||
];
|
||||
} else {
|
||||
let destinationStandard = 'http://100.77.180.48:11001/api/:path*';
|
||||
printer.info(
|
||||
'API request proxy to [Standard Server] ' + destinationStandard
|
||||
);
|
||||
|
||||
return [
|
||||
{
|
||||
source: '/api/:path*',
|
||||
destination: destinationStandard,
|
||||
},
|
||||
{
|
||||
source: '/collaboration/:path*',
|
||||
destination: 'http://localhost:3000/collaboration/:path*',
|
||||
},
|
||||
];
|
||||
}
|
||||
const [profile, desc] = getRedirectConfig(process.env.NODE_API_SERVER);
|
||||
printer.info(
|
||||
`API request proxy to [${process.env.NODE_API_SERVER} Server]: ` + desc
|
||||
);
|
||||
return profile;
|
||||
},
|
||||
basePath: process.env.BASE_PATH,
|
||||
};
|
||||
|
@ -3,7 +3,6 @@
|
||||
"version": "0.3.1",
|
||||
"scripts": {
|
||||
"dev": "next dev -p 8080",
|
||||
"dev:ac": "NODE_API_SERVER=ac next dev -p 8080",
|
||||
"build": "next build",
|
||||
"export": "next export",
|
||||
"start": "next start",
|
||||
|
Loading…
Reference in New Issue
Block a user