From 64281e95c007b2a61dd015e2130efa2f38b6e938 Mon Sep 17 00:00:00 2001 From: Rudy Fraser Date: Tue, 10 Nov 2026 17:07:45 -0500 Subject: [PATCH] fix(web): build and serve the fork under Metro Emits the fork's splash fonts from the post-build step, reports Sentry releases under the fork's bundle identifier and uploads source maps to the fork's Sentry project, and gives the storybook sample images the fork ships. --- Dockerfile | 2 +- __e2e__/flows/following-restore.yml | 4 +- public/index.html | 6 +- scripts/post-web-build.js | 135 +++++++++++++------- src/components/Gallery/Storybook.tsx | 30 +++-- src/env/common.ts | 2 +- src/view/screens/Storybook/NewPostsPill.tsx | 5 +- 7 files changed, 117 insertions(+), 67 deletions(-) diff --git a/Dockerfile b/Dockerfile index 19f368e4e..07e72a304 100644 --- a/Dockerfile +++ b/Dockerfile @@ -92,7 +92,7 @@ RUN pnpm intl:build 2>&1 | tee i18n.log && \ if grep -q "invalid syntax" "i18n.log"; then echo "\n\nFound compilation errors!\n\n" && exit 1; else echo "\n\nNo compile errors!\n\n"; fi RUN SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN \ - SENTRY_RELEASE="xyz.blueskyweb.app@${EXPO_PUBLIC_RELEASE_VERSION:-unset}" \ + SENTRY_RELEASE="community.blacksky.app@${EXPO_PUBLIC_RELEASE_VERSION:-unset}" \ SENTRY_DIST=$EXPO_PUBLIC_BUNDLE_IDENTIFIER \ pnpm build-web diff --git a/__e2e__/flows/following-restore.yml b/__e2e__/flows/following-restore.yml index 818f12530..828865039 100644 --- a/__e2e__/flows/following-restore.yml +++ b/__e2e__/flows/following-restore.yml @@ -1,4 +1,4 @@ -appId: xyz.blueskyweb.app +appId: community.blacksky.app --- # Following v2 restores Home Following across a restart, from the snapshot # its query persister wrote, then puts posts made meanwhile above the restored @@ -43,7 +43,7 @@ appId: xyz.blueskyweb.app env: SERVER_PATH: ?newposts=5&text=Newer%20post - launchApp: - appId: "xyz.blueskyweb.app" + appId: "community.blacksky.app" # The feed comes back as it was, and the posts bob made go above it once the # list is at rest, out of view. Only a restore prepend shows the pill. diff --git a/public/index.html b/public/index.html index 38e94197f..9cd34e40d 100644 --- a/public/index.html +++ b/public/index.html @@ -46,21 +46,21 @@ } @font-face { font-family: 'BasteB'; - src: url(/static/media/BasteB-Regular.a4daf98712b66c088d13.woff2) format('woff2'); + src: url(/assets/assets/fonts/baste_b/BasteB-Regular.woff2) format('woff2'); font-weight: normal; font-style: normal; font-display: swap; } @font-face { font-family: 'AzeretMonoVariable'; - src: url(/static/media/AzeretMono-VariableFont_wght.bdaf772c43385c3dde88.ttf) format('truetype'); + src: url(/assets/assets/fonts/azeret_mono/AzeretMono-VariableFont_wght.ttf) format('truetype'); font-weight: 100 900; font-style: normal; font-display: swap; } @font-face { font-family: 'RubikVariable'; - src: url(/static/media/Rubik-VariableFont_wght.d3c04283940221abf09a.ttf) format('truetype'); + src: url(/assets/assets/fonts/rubik/Rubik-VariableFont_wght.ttf) format('truetype'); font-weight: 100 900; font-style: normal; font-display: swap; diff --git a/scripts/post-web-build.js b/scripts/post-web-build.js index 493578b1d..ed24b9190 100644 --- a/scripts/post-web-build.js +++ b/scripts/post-web-build.js @@ -68,62 +68,109 @@ fs.writeFileSync(templateFile, outputLines.join('\n')) // Generate fonts.html — preload + @font-face for the splash, using the same // content-hashed paths Metro emits for the bundle. Avoids shipping a duplicate // font copy under /static/media/ and ensures the preload is actually used. -const fontsDir = path.join(distDir, 'assets', 'assets', 'fonts', 'inter') -function findFontHash(prefix) { - if (!fs.existsSync(fontsDir)) return null - const match = fs - .readdirSync(fontsDir) - .find(name => name.startsWith(prefix) && name.endsWith('.woff2')) - return match || null -} -const interRegular = findFontHash('InterVariable.') -const interItalic = findFontHash('InterVariable-Italic.') -if (!interRegular || !interItalic) { - throw new Error( - `Could not find Inter font files in ${fontsDir}. ` + - 'Update post-web-build.js if the font emit path changed.', +const fontsRoot = '/assets/assets/fonts/' +const splashFonts = [ + { + family: 'InterVariable', + file: 'inter/InterVariable.woff2', + format: 'woff2', + weight: '300 1000', + style: 'normal', + preload: true, + }, + { + family: 'InterVariableItalic', + file: 'inter/InterVariable-Italic.woff2', + format: 'woff2', + weight: '300 1000', + style: 'italic', + }, + { + family: 'BasteB', + file: 'baste_b/BasteB-Regular.woff2', + format: 'woff2', + weight: 'normal', + style: 'normal', + }, + { + family: 'AzeretMonoVariable', + file: 'azeret_mono/AzeretMono-VariableFont_wght.ttf', + format: 'truetype', + weight: '100 900', + style: 'normal', + }, + { + family: 'RubikVariable', + file: 'rubik/Rubik-VariableFont_wght.ttf', + format: 'truetype', + weight: '100 900', + style: 'normal', + }, +] + +function findHashedFont(file) { + const dir = path.join( + distDir, + 'assets', + 'assets', + 'fonts', + path.dirname(file), ) + const ext = path.extname(file) + const prefix = `${path.basename(file, ext)}.` + const hashed = + fs.existsSync(dir) && + fs + .readdirSync(dir) + .find(name => name.startsWith(prefix) && name.endsWith(ext)) + if (!hashed) { + throw new Error( + `Could not find ${file} in ${dir}. ` + + 'Update post-web-build.js if the font emit path changed.', + ) + } + return `${fontsRoot}${path.dirname(file)}/${hashed}` +} + +for (const font of splashFonts) { + font.hashedPath = findHashedFont(font.file) } -const interFontPath = '/assets/assets/fonts/inter/' /* * The static index.html references the fonts by their unhashed names, but * Metro emits them content-hashed. Rewrite dist/index.html in place so the * font preload and @font-face URLs resolve when serving dist/ directly. */ -const fixedIndexHtml = indexHtml - .replaceAll( - '/assets/assets/fonts/inter/InterVariable.woff2', - `${interFontPath}${interRegular}`, - ) - .replaceAll( - '/assets/assets/fonts/inter/InterVariable-Italic.woff2', - `${interFontPath}${interItalic}`, - ) +const fixedIndexHtml = splashFonts.reduce( + (html, font) => html.replaceAll(`${fontsRoot}${font.file}`, font.hashedPath), + indexHtml, +) if (fixedIndexHtml !== indexHtml) { console.log('Rewriting font paths in dist/index.html to hashed filenames') fs.writeFileSync(path.join(distDir, 'index.html'), fixedIndexHtml) } -const interRegularPath = `{{ staticCDNHost }}/static${interFontPath}${interRegular}` -const interItalicPath = `{{ staticCDNHost }}/static${interFontPath}${interItalic}` +const cdnFontPath = font => `{{ staticCDNHost }}/static${font.hashedPath}` -const fontsHtml = ` +const fontsHtml = `${splashFonts + .filter(font => font.preload) + .map( + font => + ``, + ) + .join('\n')} ` console.log(`Writing ${fontsTemplateFile}`) @@ -172,12 +219,12 @@ if ( process.env.SENTRY_AUTH_TOKEN && process.env.SENTRY_AUTH_TOKEN != 'unknown' ) { - const releasePackage = 'xyz.blueskyweb.app' + const releasePackage = 'community.blacksky.app' const release = process.env.SENTRY_RELEASE || `${releasePackage}@${require(path.join(projectRoot, 'package.json')).version}` /* - * The runtime reports `xyz.blueskyweb.app@` + (EXPO_PUBLIC_RELEASE_VERSION + * The runtime reports `community.blacksky.app@` + (EXPO_PUBLIC_RELEASE_VERSION * || package.json version) (SENTRY_RELEASE in src/env/common.ts), so maps * uploaded under a bogus release never match incoming events. "null" and * "undefined" catch `jq -r '.version'` stringifying a missing package.json @@ -201,9 +248,9 @@ if ( 'sourcemaps', 'upload', '--org', - 'blueskyweb', + 'blacksky-algorithms', '--project', - 'app', + 'social-app', '--release', release, ...(dist ? ['--dist', dist] : []), diff --git a/src/components/Gallery/Storybook.tsx b/src/components/Gallery/Storybook.tsx index 27757b476..7175b8b7b 100644 --- a/src/components/Gallery/Storybook.tsx +++ b/src/components/Gallery/Storybook.tsx @@ -24,10 +24,12 @@ function asUri(value: string) { return value as `${string}:${string}` } -const kawaii = Asset.fromModule(require('../../../assets/kawaii.png')).uri // 1920x1080 -const kawaiiSmol = Asset.fromModule( - require('../../../assets/kawaii_smol.png'), -).uri // 246x138 +const landscape = Asset.fromModule( + require('../../../assets/images/bookmarks_announcement_nux.png'), +).uri // 2986x1256 +const landscapeSmall = Asset.fromModule( + require('../../../assets/images/initial_verification_announcement_1.png'), +).uri // 706x320 const welcome = Asset.fromModule( require('../../../assets/images/welcome-modal-bg.jpg'), ).uri // 1432x1025 @@ -163,10 +165,10 @@ function ImageContent() { - + - + 120×160, 140×140, 220×124 @@ -184,11 +186,11 @@ function ImageAdapter() { const adapterImages: app.bsky.embed.images.ViewImage[] = [ { - thumb: asUri(kawaii), - fullsize: asUri(kawaii), - alt: l`A kawaii scene`, + thumb: asUri(landscape), + fullsize: asUri(landscape), + alt: l`A wide illustration`, // Landscape wider than the carousel allows, so it's cropped - aspectRatio: {width: 1920, height: 1080}, + aspectRatio: {width: 2986, height: 1256}, }, { thumb: asUri(welcome), @@ -197,9 +199,9 @@ function ImageAdapter() { aspectRatio: {width: 1432, height: 1025}, }, { - thumb: asUri(kawaiiSmol), - fullsize: asUri(kawaiiSmol), - alt: l`A small kawaii scene with no ratio on record`, + thumb: asUri(landscapeSmall), + fullsize: asUri(landscapeSmall), + alt: l`A small illustration with no ratio on record`, // No ratio: starts square, then learns it from the loaded thumbnail aspectRatio: undefined, }, @@ -290,7 +292,7 @@ function MixedContent() { - +