mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
refactor: use esbuild instead of vite (#2672)
This commit is contained in:
29
apps/electron/scripts/plugins/utils.mjs
Normal file
29
apps/electron/scripts/plugins/utils.mjs
Normal file
@@ -0,0 +1,29 @@
|
||||
import { resolve } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
export const rootDir = fileURLToPath(new URL('../../../..', import.meta.url));
|
||||
export const electronOutputDir = resolve(
|
||||
rootDir,
|
||||
'apps',
|
||||
'electron',
|
||||
'dist',
|
||||
'plugins'
|
||||
);
|
||||
export const pluginDir = resolve(rootDir, 'plugins');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pluginDirName {string}
|
||||
* @return {import('esbuild').BuildOptions}
|
||||
*/
|
||||
export function definePluginServerConfig(pluginDirName) {
|
||||
const pluginRootDir = resolve(pluginDir, pluginDirName);
|
||||
const serverEntryFile = resolve(pluginRootDir, 'src/server.ts');
|
||||
const serverOutputDir = resolve(electronOutputDir, pluginDirName);
|
||||
return {
|
||||
entryPoints: [serverEntryFile],
|
||||
platform: 'node',
|
||||
outdir: serverOutputDir,
|
||||
bundle: true,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user