mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-05 03:25:10 +08:00
build: allow node package depends on workspace packages (#11963)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added a unified CLI entry point for server operations and introduced a new CLI executable alias. - Centralized and simplified server startup, allowing selection between CLI and server modes. - Added static migration module aggregation for easier migration management. - **Bug Fixes** - Improved platform-specific native module loading for better compatibility and reliability. - **Refactor** - Streamlined server build, startup, and artifact management processes. - Reorganized and simplified workflow and configuration files for backend services. - Transitioned export styles and import mechanisms for native modules to enhance maintainability. - **Chores** - Removed unused dependencies and configuration files. - Updated test cases to reflect refined server flavor logic. - Adjusted package and build configurations for consistency and clarity. - **Revert** - Removed legacy scripts and loaders no longer needed after refactor. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
+16
-3
@@ -10,12 +10,16 @@ import WebpackDevServer, {
|
||||
} from 'webpack-dev-server';
|
||||
|
||||
import { Option, PackageCommand } from './command';
|
||||
import { createHTMLTargetConfig, createWorkerTargetConfig } from './webpack';
|
||||
import {
|
||||
createHTMLTargetConfig,
|
||||
createNodeTargetConfig,
|
||||
createWorkerTargetConfig,
|
||||
} from './webpack';
|
||||
|
||||
function getBundleConfigs(pkg: Package) {
|
||||
function getBaseWorkerConfigs(pkg: Package) {
|
||||
const core = new Package('@affine/core');
|
||||
|
||||
const workerConfigs = [
|
||||
return [
|
||||
createWorkerTargetConfig(
|
||||
pkg,
|
||||
core.srcPath.join(
|
||||
@@ -31,7 +35,9 @@ function getBundleConfigs(pkg: Package) {
|
||||
core.srcPath.join('blocksuite/extensions/turbo-painter.worker.ts').value
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
function getBundleConfigs(pkg: Package) {
|
||||
switch (pkg.name) {
|
||||
case '@affine/admin': {
|
||||
return [createHTMLTargetConfig(pkg, pkg.srcPath.join('index.tsx').value)];
|
||||
@@ -40,6 +46,7 @@ function getBundleConfigs(pkg: Package) {
|
||||
case '@affine/mobile':
|
||||
case '@affine/ios':
|
||||
case '@affine/android': {
|
||||
const workerConfigs = getBaseWorkerConfigs(pkg);
|
||||
workerConfigs.push(
|
||||
createWorkerTargetConfig(
|
||||
pkg,
|
||||
@@ -58,6 +65,8 @@ function getBundleConfigs(pkg: Package) {
|
||||
];
|
||||
}
|
||||
case '@affine/electron-renderer': {
|
||||
const workerConfigs = getBaseWorkerConfigs(pkg);
|
||||
|
||||
return [
|
||||
createHTMLTargetConfig(
|
||||
pkg,
|
||||
@@ -78,10 +87,14 @@ function getBundleConfigs(pkg: Package) {
|
||||
...workerConfigs,
|
||||
];
|
||||
}
|
||||
case '@affine/server': {
|
||||
return [createNodeTargetConfig(pkg, pkg.srcPath.join('index.ts').value)];
|
||||
}
|
||||
}
|
||||
|
||||
throw new Error(`Unsupported package: ${pkg.name}`);
|
||||
}
|
||||
|
||||
const IN_CI = !!process.env.CI;
|
||||
const httpProxyMiddlewareLogLevel = IN_CI ? 'silent' : 'error';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user