Skip to content

Commit 069597e

Browse files
authored
fix OG share image, bump dependencies, other tweaks (#1596)
1 parent 6ac11bf commit 069597e

File tree

8 files changed

+19398
-14990
lines changed

8 files changed

+19398
-14990
lines changed

assets/data.json

Lines changed: 19244 additions & 14745 deletions
Large diffs are not rendered by default.

bun.lock

Lines changed: 118 additions & 205 deletions
Large diffs are not rendered by default.

components/Button.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const styles = StyleSheet.create({
5252
justifyContent: 'center',
5353
alignItems: 'center',
5454
borderRadius: 4,
55-
// @ts-ignore
5655
outlineOffset: 1,
5756
},
5857
});

components/PageMeta.tsx

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import getShareImage from '@jlengstorf/get-share-image';
21
import Head from 'next/head';
32

43
const site = {
54
title: 'React Native Directory',
65
description: 'An interactive directory to find packages for your React Native apps.',
76
};
87

8+
const BASE_OG_URL = 'https://og.expo.dev/?theme=rnd';
9+
910
type PageMetaProps = {
1011
title?: string;
1112
description?: string;
@@ -16,38 +17,28 @@ type PageMetaProps = {
1617
const PageMeta = ({ title, query, path, description = site.description }: PageMetaProps) => {
1718
const pageTitle = `${title ? title + ' • ' : ''}${site.title}`;
1819
const parsedQuery = Array.isArray(query) ? query[0] : query;
20+
const finalDescription = parsedQuery
21+
? `Search results for keyword: '${parsedQuery}'`
22+
: description;
1923

20-
const socialImage = getShareImage({
21-
title: site.title,
22-
tagline: parsedQuery ? `Search results for keyword:\n"${parsedQuery}"` : description,
23-
cloudName: 'react-native-directory',
24-
imagePublicID: 'share-bg',
25-
titleColor: 'fff',
26-
titleFont: 'roboto',
27-
titleFontSize: 66,
28-
taglineFont: 'roboto',
29-
taglineColor: 'aeb1bc',
30-
titleBottomOffset: 372,
31-
taglineTopOffset: 324,
32-
});
24+
const socialImage = `${BASE_OG_URL}&title=${encodeURIComponent(pageTitle)}&description=${encodeURIComponent(finalDescription)}`;
3325

3426
return (
3527
<Head>
3628
<title>{pageTitle}</title>
3729
<meta name="description" content={description} />
3830

3931
<meta property="og:title" content={pageTitle} />
40-
<meta
41-
property="og:description"
42-
content={parsedQuery ? `Search results for keyword: '${parsedQuery}'` : description}
43-
/>
32+
<meta property="og:description" content={finalDescription} />
4433
<meta property="og:site_name" content={site.title} />
4534
<meta property="og:type" content="website" />
4635
<meta property="og:url" content="https://reactnative.directory" />
4736
<meta property="og:image" content={socialImage} />
4837
<meta property="og:image:width" content="1280" />
4938
<meta property="og:image:height" content="669" />
5039

40+
<meta name="twitter:title" content={pageTitle} />
41+
<meta name="twitter:description" content={finalDescription} />
5142
<meta name="twitter:card" content="summary_large_image" />
5243
<meta name="twitter:image" content={socialImage} />
5344

components/Search.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ const styles = StyleSheet.create({
203203
fontSize: 20,
204204
color: colors.white,
205205
fontFamily: 'inherit',
206-
// @ts-ignore
207206
outlineOffset: -2,
208207
},
209208
searchIcon: {

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,31 @@
1919
"dependencies": {
2020
"@expo/html-elements": "^0.12.1",
2121
"@expo/match-media": "^0.4.0",
22-
"@jlengstorf/get-share-image": "^1.0.2",
23-
"@radix-ui/react-hover-card": "^1.1.6",
24-
"@radix-ui/react-tooltip": "^1.1.8",
22+
"@radix-ui/react-hover-card": "^1.1.7",
23+
"@radix-ui/react-tooltip": "^1.2.0",
2524
"@react-native-async-storage/async-storage": "^2.1.2",
2625
"@react-native-picker/picker": "^2.11.0",
2726
"@sentry/react": "^8.46.0",
2827
"@vercel/blob": "^0.27.3",
29-
"expo": "^53.0.0-preview.3",
30-
"expo-font": "~13.1.1",
28+
"expo": "^53.0.0-preview.9",
29+
"expo-font": "~13.2.1",
3130
"lodash": "^4.17.21",
32-
"next": "^15.2.4",
31+
"next": "^15.3.1",
3332
"node-emoji": "^2.2.0",
3433
"react": "^18.3.1",
3534
"react-content-loader": "^7.0.2",
3635
"react-dom": "^18.3.1",
3736
"react-easy-linkify": "^1.0.8",
38-
"react-native": "0.79.0",
39-
"react-native-safe-area-context": "^5.3.0",
37+
"react-native": "0.79.1",
38+
"react-native-safe-area-context": "^5.4.0",
4039
"react-native-svg": "^15.11.2",
4140
"react-native-web": "^0.20.0",
4241
"react-native-web-hooks": "^3.0.2",
4342
"use-debounce": "^10.0.4"
4443
},
4544
"devDependencies": {
4645
"@expo/next-adapter": "^6.0.0",
47-
"@next/bundle-analyzer": "^15.2.4",
46+
"@next/bundle-analyzer": "^15.3.1",
4847
"@types/bun": "^1.2.9",
4948
"@types/lodash": "^4.17.16",
5049
"@types/react": "^18.3.12",
@@ -54,7 +53,7 @@
5453
"cross-fetch": "^4.1.0",
5554
"dotenv": "^16.4.7",
5655
"eslint": "^8.57.0",
57-
"eslint-config-next": "^15.2.4",
56+
"eslint-config-next": "^15.3.1",
5857
"eslint-config-universe": "^14.2.0",
5958
"lint-staged": "^15.5.0",
6059
"next-compose-plugins": "^2.2.1",

react-native-libraries.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12548,7 +12548,9 @@
1254812548
"images": [
1254912549
"https://raw.githubusercontent.com/tamagui/tamagui/master/code/tamagui.dev/public/social.png"
1255012550
],
12551-
"android": true
12551+
"android": true,
12552+
"ios": true,
12553+
"web": true
1255212554
},
1255312555
{
1255412556
"githubUrl": "https://github.com/EdgarJMesquita/react-native-webp-converter",
@@ -14252,7 +14254,7 @@
1425214254
"ios": true,
1425314255
"android": true
1425414256
},
14255-
{
14257+
{
1425614258
"githubUrl": "https://github.com/i18next/i18next",
1425714259
"npmPkg": "i18next",
1425814260
"examples": ["https://github.com/i18next/i18next/tree/master/examples/typescript"],

scripts/build-and-score-data.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ import chunk from 'lodash/chunk';
44
import fs from 'node:fs';
55
import path from 'node:path';
66

7+
import debugGithubRepos from '~/debug-github-repos.json';
8+
import githubRepos from '~/react-native-libraries.json';
9+
import { Library } from '~/types';
10+
import { isLaterThan, TimeRange } from '~/util/datetime';
11+
import { isEmptyOrNull } from '~/util/strings';
12+
713
import { calculateDirectoryScore, calculatePopularityScore } from './calculate-score';
814
import { fetchGithubData, fetchGithubRateLimit, loadGitHubLicenses } from './fetch-github-data';
915
import { fetchNpmData, fetchNpmDataBulk } from './fetch-npm-data';
1016
import fetchReadmeImages from './fetch-readme-images';
1117
import { fillNpmName, hasMismatchedPackageData, sleep } from './helpers';
12-
import debugGithubRepos from '../debug-github-repos.json';
13-
import githubRepos from '../react-native-libraries.json';
14-
import { Library } from '../types';
15-
import { isLaterThan, TimeRange } from '../util/datetime';
16-
import { isEmptyOrNull } from '../util/strings';
1718

1819
// Uses debug-github-repos.json instead, so we have less repositories to crunch
1920
// each time we run the script
@@ -91,7 +92,7 @@ async function buildAndScoreData() {
9192
data.map(async project => {
9293
if (!project.template) {
9394
if (project.npmPkg.startsWith('@')) {
94-
await sleep(Math.max(Math.random() * 2500));
95+
await sleep(Math.random() * 10000);
9596
return fetchNpmData(project);
9697
} else {
9798
bulkList.push(project.npmPkg);
@@ -214,7 +215,11 @@ async function buildAndScoreData() {
214215
const existingData = libraries.map(lib => lib.npmPkg);
215216
const newData = data.map(lib => lib.npmPkg);
216217
const missingData = existingData.filter(npmPkg => !newData.includes(npmPkg));
217-
const currentData = [...libraries.filter(lib => missingData.includes(lib.npmPkg)), ...data];
218+
219+
const existingPackages = DATASET.map(fillNpmName).map(lib => lib.npmPkg);
220+
const dataToFill = missingData.filter(npmPkg => !existingPackages.includes(npmPkg));
221+
222+
const currentData = [...libraries.filter(lib => dataToFill.includes(lib.npmPkg)), ...data];
218223

219224
const dataWithFallback = currentData.map(entry =>
220225
Object.keys(entry.npm).length > 0
@@ -225,10 +230,11 @@ async function buildAndScoreData() {
225230
latestData.libraries.find(prevEntry => entry.npmPkg === prevEntry.npmPkg)?.npm ?? {},
226231
}
227232
);
233+
const finalData = dataWithFallback.filter(npmPkg => !existingPackages.includes(npmPkg));
228234

229235
fileContent = JSON.stringify(
230236
{
231-
libraries: dataWithFallback,
237+
libraries: finalData,
232238
topics: topicCounts,
233239
topicsList: Object.keys(topicCounts).sort(),
234240
},

0 commit comments

Comments
 (0)