'use strict'; const { packageHotUpdate } = require('../lib/packager'); const PACKAGE_NAME = 'hot-update-builder'; // 让构建钩子的异常直接终止构建,避免发布一个 Manifest 或资源不完整的版本。 exports.throwError = true; exports.onAfterBuild = async function onAfterBuild(options, result) { const config = options?.packages?.[PACKAGE_NAME] || {}; if (!config.enabled) { return; } const summary = await packageHotUpdate({ buildOptions: options, buildResult: result, remoteUrl: config.remoteUrl, version: config.version, projectPath: globalThis.Editor?.Project?.path || process.cwd(), }); console.info(`[热更新打包] 完成:${summary.version}`); console.info(`[热更新打包] 本地 Manifest:${summary.localManifestPath}`); console.info(`[热更新打包] 远端资源目录:${summary.remotePackagePath}`); console.info(`[热更新打包] 文件数:${summary.fileCount},总大小:${summary.totalBytes} bytes`); };