feat: refine plugin branding and settings layout

This commit is contained in:
xmanrui 2026-08-17 18:20:07 +08:00
parent 396c83d7f2
commit 6f81bcb813
8 changed files with 69 additions and 30 deletions

View file

@ -1,4 +1,4 @@
import { mkdir, writeFile } from 'node:fs/promises';
import { mkdir, readFile, writeFile } from 'node:fs/promises';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@ -8,6 +8,8 @@ const sourceDirectory = dirname(fileURLToPath(import.meta.url));
const packageRoot = resolve(sourceDirectory, '../..');
const outputPath = resolve(packageRoot, 'lib/client.js');
const loaderId = process.env.DSH_IM_CLIENT_ID ?? '@xmanrui/dsh-im';
const logoPath = resolve(packageRoot, 'assets/logo-icon.png');
const logoDataUrl = `data:image/png;base64,${(await readFile(logoPath)).toString('base64')}`;
const result = await build({
entryPoints: [resolve(sourceDirectory, 'index.js')],
@ -16,6 +18,9 @@ const result = await build({
platform: 'browser',
target: ['chrome100'],
external: ['react'],
define: {
'globalThis.__DSH_IM_LOGO_DATA_URL__': JSON.stringify(logoDataUrl),
},
write: false,
minify: process.env.NODE_ENV === 'production',
legalComments: 'none',