mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat(electron): support WOA native (#8741)
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
ROOT,
|
||||
} from './make-env.js';
|
||||
|
||||
const log = debug('make-nsis');
|
||||
const log = debug('affine:make-nsis');
|
||||
|
||||
async function make() {
|
||||
const appName = productName;
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
ROOT,
|
||||
} from './make-env.js';
|
||||
|
||||
const log = debug('make-squirrel');
|
||||
const log = debug('affine:make-squirrel');
|
||||
|
||||
// taking from https://github.com/electron/forge/blob/main/packages/maker/squirrel/src/MakerSquirrel.ts
|
||||
// it was for forge's maker, but can be used standalone as well
|
||||
@@ -29,6 +29,7 @@ async function make() {
|
||||
buildType,
|
||||
`${appName}-${platform}-${arch}`
|
||||
);
|
||||
log('making squirrel.windows: appDirectory', appDirectory);
|
||||
await fs.ensureDir(outPath);
|
||||
|
||||
const packageJSON = await fs.readJson(path.resolve(ROOT, 'package.json'));
|
||||
@@ -40,7 +41,7 @@ async function make() {
|
||||
exe: `${appName}.exe`,
|
||||
setupExe: `${appName}-${packageJSON.version} Setup.exe`,
|
||||
version: packageJSON.version,
|
||||
appDirectory: appDirectory,
|
||||
appDirectory,
|
||||
outputDirectory: outPath,
|
||||
iconUrl: iconUrl,
|
||||
setupIcon: icoPath,
|
||||
|
||||
Reference in New Issue
Block a user