feat(electron): support WOA native (#8741)

This commit is contained in:
Brooooooklyn
2024-11-11 11:33:58 +00:00
parent 5605185a00
commit 64674a539f
4 changed files with 92 additions and 37 deletions
@@ -1,8 +1,12 @@
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { parseArgs } from 'node:util';
import debug from 'debug';
import { z } from 'zod';
const log = debug('affine:make-env');
const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
const __dirname = fileURLToPath(new URL('.', import.meta.url));
@@ -36,15 +40,27 @@ const icnsPath = path.join(
const iconPngPath = path.join(ROOT, './resources/icons/icon.png');
const iconUrl = `https://cdn.affine.pro/app-icons/icon_${buildType}.ico`;
const arch =
process.argv.indexOf('--arch') > 0
? process.argv[process.argv.indexOf('--arch') + 1]
: process.arch;
const platform =
process.argv.indexOf('--platform') > 0
? process.argv[process.argv.indexOf('--platform') + 1]
: process.platform;
log(`buildType=${buildType}, productName=${productName}, icoPath=${icoPath}`);
const {
values: { arch, platform },
} = parseArgs({
options: {
arch: {
type: 'string',
description: 'The architecture to build for',
default: process.arch,
},
platform: {
type: 'string',
description: 'The platform to build for',
default: process.platform,
},
},
});
log(`parsed args: arch=${arch}, platform=${platform}`);
const appIdMap = {
internal: 'pro.affine.internal',