Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

mobile-showcase.config.ts

235 lines7.3 KB

1import {
2 MOBILE_DEFAULT_THEME_ID,
3 MOBILE_THEME_IDS,
4 type MobileThemeId,
5} from "@t3tools/shared/themePalettes";
6​
7import { SHOWCASE_SCENES, type ShowcaseScene } from "./mobile-showcase-environment.ts";
8​
9export { SHOWCASE_SCENES };
10export type { ShowcaseScene };
11​
12export type ShowcaseAppearance = "light" | "dark";
13​
14export const SHOWCASE_THEMES = MOBILE_THEME_IDS;
15const DEFAULT_SHOWCASE_THEME = MOBILE_DEFAULT_THEME_ID;
16export type ShowcaseTheme = MobileThemeId;
17​
18export interface ShowcaseStoreAssetSpec {
19 readonly store: "apple" | "google-play";
20 readonly directory: string;
21 readonly width: number;
22 readonly height: number;
23 readonly minimumUploadCount: number;
24 readonly maximumUploadCount: number;
25 readonly maximumFileSizeBytes?: number;
27​
28export interface ShowcaseIosDevice {
29 readonly id: string;
30 readonly platform: "ios";
31 readonly simulator: string;
32 readonly simulatorDeviceType?: string;
33 readonly appearance: ShowcaseAppearance;
34 readonly theme: ShowcaseTheme;
35 readonly orientation?: "portrait" | "landscape";
36 readonly fold?: "closed" | "open";
37 readonly scenes: ReadonlyArray<ShowcaseScene>;
38 readonly storeAsset: ShowcaseStoreAssetSpec;
40​
41export interface ShowcaseAndroidDevice {
42 readonly id: string;
43 readonly platform: "android";
44 readonly avd: string;
45 readonly appearance: ShowcaseAppearance;
46 readonly theme: ShowcaseTheme;
47 readonly abi?: "arm64-v8a" | "x86_64" | "x86" | "armeabi-v7a";
48 readonly scenes: ReadonlyArray<ShowcaseScene>;
49 readonly viewport?: {
50 readonly width: number;
51 readonly height: number;
52 readonly density?: number;
53 };
54 readonly storeAsset: ShowcaseStoreAssetSpec;
56​
57export type ShowcaseDevice = ShowcaseIosDevice | ShowcaseAndroidDevice;
58​
59export interface ShowcaseConfig {
60 readonly outputDirectory: string;
61 readonly metroPort: number;
62 readonly settleDelayMs: number;
63 readonly devices: ReadonlyArray<ShowcaseDevice>;
65​
66const ANDROID_ABIS = ["arm64-v8a", "x86_64", "x86", "armeabi-v7a"] as const;
67​
68export function resolveShowcaseAndroidAbi(
69 value: string | undefined,
70): NonNullable<ShowcaseAndroidDevice["abi"]> {
71 if (!value) return "arm64-v8a";
72 if (ANDROID_ABIS.some((abi) => abi === value)) {
73 return value as NonNullable<ShowcaseAndroidDevice["abi"]>;
74 }
75 throw new Error(
76 `Unsupported T3_SHOWCASE_ANDROID_ABI '${value}'. Use ${ANDROID_ABIS.join(", ")}.`,
77 );
79​
80const config: ShowcaseConfig = {
81 outputDirectory: "artifacts/app-store/screenshots",
82 // Dedicated port so the harness cannot attach to a normal mobile dev server
83 // (or a second worktree) and capture the wrong bundle.
84 metroPort: 8199,
85 settleDelayMs: 2_500,
86 devices: [
87 {
88 id: "iphone-6.9",
89 platform: "ios",
90 simulator: "T3 Showcase iPhone 17 Pro Max",
91 simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro-Max",
92 appearance: "dark",
93 theme: DEFAULT_SHOWCASE_THEME,
94 scenes: ["thread", "terminal", "review", "threads", "environments", "agent-activity"],
95 storeAsset: {
96 store: "apple",
97 directory: "apple/iphone-6.9",
98 width: 1320,
99 height: 2868,
100 minimumUploadCount: 1,
101 maximumUploadCount: 10,
102 },
103 },
104 {
105 id: "iphone-6.5",
106 platform: "ios",
107 simulator: "T3 Showcase iPhone 14 Plus",
108 simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPhone-14-Plus",
109 appearance: "dark",
110 theme: DEFAULT_SHOWCASE_THEME,
111 scenes: ["thread", "terminal", "review", "threads", "environments", "agent-activity"],
112 storeAsset: {
113 store: "apple",
114 directory: "apple/iphone-6.5",
115 width: 1284,
116 height: 2778,
117 minimumUploadCount: 1,
118 maximumUploadCount: 10,
119 },
120 },
121 ...(["closed", "open"] as const).map((fold): ShowcaseIosDevice => ({
122 id: `iphone-duo-${fold}`,
123 platform: "ios",
124 simulator: `T3 Showcase iPhone Duo ${fold}`,
125 simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPhone-Duo",
126 appearance: "dark",
127 theme: DEFAULT_SHOWCASE_THEME,
128 orientation: fold === "closed" ? "portrait" : "landscape",
129 fold,
130 // Both poses share one ten-image App Store slot.
131 scenes: ["thread", "terminal", "review", "threads", "environments"],
132 storeAsset: {
133 store: "apple",
134 directory: `apple/iphone-duo-${fold}`,
135 width: fold === "closed" ? 1398 : 2853,
136 height: fold === "closed" ? 2034 : 2007,
137 minimumUploadCount: 1,
138 maximumUploadCount: 5,
139 },
140 })),
141 {
142 id: "ipad-13",
143 platform: "ios",
144 simulator: "iPad Pro 13-inch (M5)",
145 simulatorDeviceType: "com.apple.CoreSimulator.SimDeviceType.iPad-Pro-13-inch-M5-16GB",
146 appearance: "dark",
147 theme: DEFAULT_SHOWCASE_THEME,
148 orientation: "landscape",
149 // The lock screen does not follow the app's self-rotation, so a
150 // headless landscape capture of it would come out sideways.
151 scenes: ["thread", "terminal", "review", "threads", "environments"],
152 storeAsset: {
153 store: "apple",
154 directory: "apple/ipad-13",
155 width: 2752,
156 height: 2064,
157 minimumUploadCount: 1,
158 maximumUploadCount: 10,
159 },
160 },
161 {
162 id: "pixel",
163 platform: "android",
164 avd: "Pixel_10_Pro",
165 // Apple Silicon uses ARM64 locally; CI overrides this with x86_64 so its
166 // Blacksmith Linux runner can use KVM acceleration.
167 abi: resolveShowcaseAndroidAbi(process.env.T3_SHOWCASE_ANDROID_ABI),
168 appearance: "dark",
169 theme: DEFAULT_SHOWCASE_THEME,
170 viewport: {
171 width: 1080,
172 height: 1920,
173 density: 420,
174 },
175 scenes: ["thread", "terminal", "review", "threads", "environments", "agent-activity"],
176 storeAsset: {
177 store: "google-play",
178 directory: "google-play/phone",
179 width: 1080,
180 height: 1920,
181 minimumUploadCount: 2,
182 maximumUploadCount: 8,
183 maximumFileSizeBytes: 8 * 1024 * 1024,
184 },
185 },
186 {
187 id: "android-tablet-7",
188 platform: "android",
189 avd: "Pixel_10_Pro",
190 abi: resolveShowcaseAndroidAbi(process.env.T3_SHOWCASE_ANDROID_ABI),
191 appearance: "dark",
192 theme: DEFAULT_SHOWCASE_THEME,
193 viewport: {
194 width: 1080,
195 height: 1920,
196 density: 288,
197 },
198 scenes: ["thread", "terminal", "review", "threads", "environments", "agent-activity"],
199 storeAsset: {
200 store: "google-play",
201 directory: "google-play/tablet-7",
202 width: 1080,
203 height: 1920,
204 minimumUploadCount: 4,
205 maximumUploadCount: 8,
206 maximumFileSizeBytes: 8 * 1024 * 1024,
207 },
208 },
209 {
210 id: "android-tablet-10",
211 platform: "android",
212 avd: "Pixel_10_Pro",
213 abi: resolveShowcaseAndroidAbi(process.env.T3_SHOWCASE_ANDROID_ABI),
214 appearance: "dark",
215 theme: DEFAULT_SHOWCASE_THEME,
216 viewport: {
217 width: 1440,
218 height: 2560,
219 density: 288,
220 },
221 scenes: ["thread", "terminal", "review", "threads", "environments", "agent-activity"],
222 storeAsset: {
223 store: "google-play",
224 directory: "google-play/tablet-10",
225 width: 1440,
226 height: 2560,
227 minimumUploadCount: 4,
228 maximumUploadCount: 8,
229 maximumFileSizeBytes: 8 * 1024 * 1024,
230 },
231 },
232 ],
233};
234​
235export default config;