( pkg: Package, buildFlags: BuildFlags )
| 8 | } |
| 9 | |
| 10 | export function getBuildConfig( |
| 11 | pkg: Package, |
| 12 | buildFlags: BuildFlags |
| 13 | ): BUILD_CONFIG_TYPE { |
| 14 | const distribution = PackageToDistribution.get(pkg.name); |
| 15 | |
| 16 | if (!distribution) { |
| 17 | throw new Error(`Distribution for ${pkg.name} is not found`); |
| 18 | } |
| 19 | |
| 20 | const buildPreset: Record<BuildFlags['channel'], BUILD_CONFIG_TYPE> = { |
| 21 | get stable() { |
| 22 | return { |
| 23 | debug: buildFlags.mode === 'development', |
| 24 | distribution, |
| 25 | isDesktopEdition: ( |
| 26 | ['web', 'desktop', 'admin'] as BUILD_CONFIG_TYPE['distribution'][] |
| 27 | ).includes(distribution), |
| 28 | isMobileEdition: ( |
| 29 | ['mobile', 'ios', 'android'] as BUILD_CONFIG_TYPE['distribution'][] |
| 30 | ).includes(distribution), |
| 31 | isElectron: distribution === 'desktop', |
| 32 | isWeb: distribution === 'web', |
| 33 | isMobileWeb: distribution === 'mobile', |
| 34 | isIOS: distribution === 'ios', |
| 35 | isAndroid: distribution === 'android', |
| 36 | isNative: |
| 37 | distribution === 'desktop' || |
| 38 | distribution === 'ios' || |
| 39 | distribution === 'android', |
| 40 | isAdmin: distribution === 'admin', |
| 41 | |
| 42 | appBuildType: 'stable' as const, |
| 43 | appVersion: pkg.version, |
| 44 | // editorVersion: pkg.dependencies['@blocksuite/affine'], |
| 45 | editorVersion: pkg.version, |
| 46 | githubUrl: 'https://github.com/toeverything/AFFiNE', |
| 47 | changelogUrl: 'https://affine.pro/what-is-new', |
| 48 | downloadUrl: 'https://affine.pro/download', |
| 49 | pricingUrl: 'https://affine.pro/pricing', |
| 50 | discordUrl: 'https://affine.pro/redirect/discord', |
| 51 | requestLicenseUrl: 'https://affine.pro/redirect/license', |
| 52 | imageProxyUrl: '/api/worker/image-proxy', |
| 53 | linkPreviewUrl: '/api/worker/link-preview', |
| 54 | CAPTCHA_SITE_KEY: process.env.CAPTCHA_SITE_KEY ?? '', |
| 55 | SENTRY_DSN: process.env.SENTRY_DSN ?? '', |
| 56 | }; |
| 57 | }, |
| 58 | get beta() { |
| 59 | return { |
| 60 | ...this.stable, |
| 61 | appBuildType: 'beta' as const, |
| 62 | changelogUrl: 'https://github.com/toeverything/AFFiNE/releases', |
| 63 | }; |
| 64 | }, |
| 65 | get internal() { |
| 66 | return { |
| 67 | ...this.stable, |
no test coverage detected