在 Makelore 构建并预检静态发布产物
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user