在 Makelore 构建并预检静态发布产物

This commit is contained in:
2026-08-12 21:19:39 +08:00
parent 3a80625fe2
commit 5b44864265
26 changed files with 1275 additions and 217 deletions

View File

@@ -1,5 +1,5 @@
const { execFileSync } = require('child_process');
const { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } = require('fs');
const { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } = require('fs');
const { join } = require('path');
const MEOWA_RELEASE_CREDENTIAL_FILE_NAME = 'meowa-game-assets-credential.json';
@@ -9,6 +9,7 @@ exports.default = async function afterPack(context) {
console.log(`[after-pack] Target: ${platform}/${context.arch}`);
writeMeowaReleaseCredential(context);
copyPublishRuntime(context);
assertNoPersistedUserData(context.appOutDir);
if (platform !== 'win32') {
@@ -19,6 +20,18 @@ exports.default = async function afterPack(context) {
patchNsisExtractionMacro();
};
function copyPublishRuntime(context) {
const source = join(__dirname, '..', 'build', 'publish-runtime');
const resourcesDir = context.packager.getResourcesDir(context.appOutDir);
const destination = join(resourcesDir, 'publish-runtime');
if (!existsSync(join(source, 'node_modules', 'proc-log', 'package.json'))) {
throw new Error(`Prepared publish runtime is incomplete: ${source}`);
}
rmSync(destination, { recursive: true, force: true });
cpSync(source, destination, { recursive: true });
console.log('[after-pack] Copied self-contained npm publish runtime.');
}
function writeMeowaReleaseCredential(context) {
const apiKey = process.env.MEOWART_API_KEY?.trim();
if (!apiKey) {