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