validate / validate (push) Canceled after 0s
本仓只服务桌面宿主 image-workbench-desktop,与网页端无限画布工具无关。 14 个测试/工具脚本里共 15 处仍把 image-workbench-web 当 playwright/esbuild 的依赖后备目录(含 path.resolve、报错文案、album viewer-e2e 的多余候选), 全部改为 image-workbench-desktop;album 里重复的 web 仓候选直接删掉。 这些常量只用于找 node_modules,不参与任何插件逻辑,行为零变化。 桌面仓已确认有 playwright 1.64.1 / esbuild 0.28.2,改后依赖解析有效。 本轮不动 6 处 test.image-workbench-web.pages.dev 网址(属于网页端 e2e 脚本的废弃处理,另案);插件源码与版本未动,不需要发市场。
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
// 引擎单文件打包(开发用):把 plugin/engine.js + potrace 打成 IIFE 全局 VZEngine,便于在
|
||
// 浏览器里直接跑参数实验(tools/trace-cli.mjs 用它)。发布不走这里 —— 发布走根目录
|
||
// scripts/build-plugin.mjs(esbuild → 单文件 IIFE 插件)。
|
||
import path from 'node:path'
|
||
import { fileURLToPath } from 'node:url'
|
||
import { createRequire } from 'node:module'
|
||
|
||
const HERE = path.dirname(fileURLToPath(import.meta.url))
|
||
const PLUGIN = path.resolve(HERE, '../plugin')
|
||
const HOST_REPO = '/Users/qiqi/open/github/image-workbench-desktop'
|
||
const REPO = path.resolve(HERE, '../..')
|
||
|
||
export function esbuildModule() {
|
||
for (const base of [HOST_REPO, REPO, process.cwd()]) {
|
||
try {
|
||
return createRequire(path.join(base, 'package.json'))('esbuild')
|
||
} catch {
|
||
/* 试下一个 */
|
||
}
|
||
}
|
||
throw new Error('找不到 esbuild(宿主仓 node_modules 里应该有)')
|
||
}
|
||
|
||
export function bundleEngine(outfile = '/tmp/vz-engine.bundle.js') {
|
||
const esbuild = esbuildModule()
|
||
esbuild.buildSync({
|
||
entryPoints: [path.join(PLUGIN, 'engine.js')],
|
||
bundle: true,
|
||
format: 'iife',
|
||
globalName: 'VZEngine',
|
||
platform: 'browser',
|
||
target: ['chrome110'],
|
||
outfile,
|
||
logLevel: 'error',
|
||
})
|
||
return outfile
|
||
}
|