删除 android/、ios/ 两个 Capacitor 原生工程与 capacitor.config.ts、 ionic.config.json,以及 scripts/android、scripts/ios.sh 构建脚本; 根与 apps/web 的 @capacitor/* 依赖和相关 npm scripts 一并移除。 Web 侧去掉原生分支:登录只走云乐坊容器授权面板或顶层重定向, 暗色模式不再改原生状态栏,移除 Android 物理返回键处理。 保留 @nuxtjs/ionic(Web UI 框架)、云乐坊 window.ylf 桥接与 PWA。 决策记录见 docs/decisions/0004-web-only.md。
43 lines
1.7 KiB
TypeScript
43 lines
1.7 KiB
TypeScript
import { Buffer } from 'node:buffer'
|
|
import { readFileSync } from 'node:fs'
|
|
import { resolve } from 'node:path'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const root = resolve(import.meta.dirname, '..')
|
|
|
|
function readPngMetadata(path: string) {
|
|
const data = readFileSync(resolve(root, path))
|
|
|
|
expect(data.subarray(0, 8)).toEqual(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]))
|
|
|
|
return {
|
|
colorType: data[25],
|
|
height: data.readUInt32BE(20),
|
|
width: data.readUInt32BE(16),
|
|
}
|
|
}
|
|
|
|
describe('web app metadata', () => {
|
|
it('uses 食用手册 as the app name', () => {
|
|
const constants = readFileSync(resolve(root, 'apps/web/app/constants/index.ts'), 'utf8')
|
|
|
|
expect(constants).toContain('export const appName = \'食用手册\'')
|
|
})
|
|
|
|
it('ships the selected Cook icon across web surfaces', () => {
|
|
const appIcon = readFileSync(resolve(root, 'apps/web/public/brand/cook-app-icon.svg'), 'utf8')
|
|
const mark = readFileSync(resolve(root, 'apps/web/public/brand/cook-mark.svg'), 'utf8')
|
|
|
|
expect(appIcon).toContain('viewBox="0 0 1254 1254"')
|
|
expect(appIcon).toContain('<path fill="#07855F" d="M0 0h1254v1254H0z"/>')
|
|
expect(appIcon).toContain('<g transform="translate(0 16)">')
|
|
expect(mark).not.toContain('M0 0h1254v1254H0z')
|
|
expect(mark).toContain('<g transform="translate(0 16)">')
|
|
|
|
expect(readPngMetadata('apps/web/public/pwa-192x192.png')).toMatchObject({ width: 192, height: 192, colorType: 2 })
|
|
expect(readPngMetadata('apps/web/public/pwa-512x512.png')).toMatchObject({ width: 512, height: 512, colorType: 2 })
|
|
expect(readPngMetadata('apps/web/public/apple-touch-icon.png')).toMatchObject({ width: 180, height: 180, colorType: 2 })
|
|
})
|
|
})
|