mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-17 02:32:09 +03:00
85ee22329c
1. the icon is fixed in `/Applications`: 128b8c22f9 (diff-a694a3e854f53b066e34ec310e05bd18b4944c016455f6963f54a351784d5fa6L91)
2. the App's icon MUST be 64x64 png and set via `setIcon`
![image](https://github.com/toeverything/AFFiNE/assets/584378/bbce0007-066b-413f-a85a-193acbbe5c13)
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { z } from 'zod';
|
|
|
|
const ReleaseTypeSchema = z.enum(['stable', 'beta', 'canary', 'internal']);
|
|
|
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
|
|
|
const ROOT = path.resolve(__dirname, '..');
|
|
|
|
const envBuildType = (process.env.BUILD_TYPE || 'canary').trim().toLowerCase();
|
|
const buildType = ReleaseTypeSchema.parse(envBuildType);
|
|
const stableBuild = buildType === 'stable';
|
|
const productName = !stableBuild ? `AFFiNE-${buildType}` : 'AFFiNE';
|
|
const icoPath = path.join(
|
|
ROOT,
|
|
!stableBuild
|
|
? `./resources/icons/icon_${buildType}.ico`
|
|
: './resources/icons/icon.ico'
|
|
);
|
|
|
|
const iconX64PngPath = path.join(
|
|
ROOT,
|
|
`./resources/icons/icon_${buildType}_64x64.png`
|
|
);
|
|
|
|
const icnsPath = path.join(
|
|
ROOT,
|
|
!stableBuild
|
|
? `./resources/icons/icon_${buildType}.icns`
|
|
: './resources/icons/icon.icns'
|
|
);
|
|
|
|
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;
|
|
|
|
export {
|
|
arch,
|
|
buildType,
|
|
icnsPath,
|
|
iconPngPath,
|
|
iconUrl,
|
|
iconX64PngPath,
|
|
icoPath,
|
|
platform,
|
|
productName,
|
|
ROOT,
|
|
stableBuild,
|
|
};
|