mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-23 00:20:45 +00:00
feat: rebuild plugin UI with host rendering and standard settings (#4053)
* feat: rebuild plugin pages with host rendering and native settings * fix(plugins): contain host-view errors, isolate editing, and migrate fixtures * fix(plugins): migrate remaining permission fixture hosts
This commit is contained in:
227 files changed
+8298
-4172
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { build } from 'esbuild';
|
||||
import { mkdir, readFile, rm, copyFile, cp, stat } from 'node:fs/promises';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import path from 'node:path';
|
||||
export async function buildHostViewExample(directory) {
|
||||
const root = fileURLToPath(directory);
|
||||
await build({ entryPoints: [path.join(root, 'host.js')], outfile: path.join(root, 'dist/host.js'), bundle: true, platform: 'browser', format: 'esm', loader: { '.html': 'text', '.css': 'text' }, minify: true });
|
||||
const staging = path.join(root, '.package');
|
||||
await rm(staging, { recursive: true, force: true });
|
||||
await mkdir(path.join(staging, 'dist'), { recursive: true });
|
||||
for (const file of ['netcatty.plugin.json', 'dist/host.js']) await copyFile(path.join(root, file), path.join(staging, file));
|
||||
if (await stat(path.join(root, 'assets')).then((info) => info.isDirectory(), () => false)) await cp(path.join(root, 'assets'), path.join(staging, 'assets'), { recursive: true });
|
||||
// Parse at build time so a forgotten view declaration fails before packaging.
|
||||
const manifest = JSON.parse(await readFile(path.join(root, 'netcatty.plugin.json'), 'utf8'));
|
||||
if (!manifest.contributes?.views?.length) throw new Error('Example has no declared view');
|
||||
}
|
||||
Reference in new issue
Block a user