feat(plugins): move game resources behind marketplace
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
const { execFileSync } = require('child_process');
|
||||
const { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } = require('fs');
|
||||
const { cpSync, existsSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } = require('fs');
|
||||
const { join } = require('path');
|
||||
|
||||
const MEOWA_RELEASE_CREDENTIAL_FILE_NAME = 'meowa-game-assets-credential.json';
|
||||
|
||||
exports.default = async function afterPack(context) {
|
||||
const platform = context.electronPlatformName;
|
||||
console.log(`[after-pack] Target: ${platform}/${context.arch}`);
|
||||
|
||||
writeMeowaReleaseCredential(context);
|
||||
copyPublishRuntime(context);
|
||||
assertNoPersistedUserData(context.appOutDir);
|
||||
|
||||
@@ -32,25 +29,6 @@ function copyPublishRuntime(context) {
|
||||
console.log('[after-pack] Copied self-contained npm publish runtime.');
|
||||
}
|
||||
|
||||
function writeMeowaReleaseCredential(context) {
|
||||
const apiKey = process.env.MEOWART_API_KEY?.trim();
|
||||
if (!apiKey) {
|
||||
console.log('[after-pack] Meowa release credential not included; MEOWART_API_KEY is unset.');
|
||||
return false;
|
||||
}
|
||||
|
||||
const resourcesDir = context.packager.getResourcesDir(context.appOutDir);
|
||||
const target = join(resourcesDir, 'resources', MEOWA_RELEASE_CREDENTIAL_FILE_NAME);
|
||||
mkdirSync(join(resourcesDir, 'resources'), { recursive: true });
|
||||
writeFileSync(
|
||||
target,
|
||||
`${JSON.stringify({ schemaVersion: 1, apiKey })}\n`,
|
||||
{ encoding: 'utf8', mode: 0o600 },
|
||||
);
|
||||
console.log('[after-pack] Meowa release credential included in packaged Main resources.');
|
||||
return true;
|
||||
}
|
||||
|
||||
const PERSISTED_USER_DATA_FILES = new Set([
|
||||
'gateway-prelaunch-maintenance-cache.json',
|
||||
'niancode-device-identity.json',
|
||||
@@ -227,4 +205,3 @@ function patchNsisExtractionMacro() {
|
||||
}
|
||||
|
||||
exports.assertNoPersistedUserData = assertNoPersistedUserData;
|
||||
exports.writeMeowaReleaseCredential = writeMeowaReleaseCredential;
|
||||
|
||||
Reference in New Issue
Block a user