Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33,989 changes: 19,244 additions & 14,745 deletions assets/data.json

Large diffs are not rendered by default.

323 changes: 118 additions & 205 deletions bun.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
borderRadius: 4,
// @ts-ignore
outlineOffset: 1,
},
});
27 changes: 9 additions & 18 deletions components/PageMeta.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import getShareImage from '@jlengstorf/get-share-image';
import Head from 'next/head';

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

const BASE_OG_URL = 'https://og.expo.dev/?theme=rnd';

type PageMetaProps = {
title?: string;
description?: string;
Expand All @@ -16,38 +17,28 @@ type PageMetaProps = {
const PageMeta = ({ title, query, path, description = site.description }: PageMetaProps) => {
const pageTitle = `${title ? title + ' • ' : ''}${site.title}`;
const parsedQuery = Array.isArray(query) ? query[0] : query;
const finalDescription = parsedQuery
? `Search results for keyword: '${parsedQuery}'`
: description;

const socialImage = getShareImage({
title: site.title,
tagline: parsedQuery ? `Search results for keyword:\n"${parsedQuery}"` : description,
cloudName: 'react-native-directory',
imagePublicID: 'share-bg',
titleColor: 'fff',
titleFont: 'roboto',
titleFontSize: 66,
taglineFont: 'roboto',
taglineColor: 'aeb1bc',
titleBottomOffset: 372,
taglineTopOffset: 324,
});
const socialImage = `${BASE_OG_URL}&title=${encodeURIComponent(pageTitle)}&description=${encodeURIComponent(finalDescription)}`;

return (
<Head>
<title>{pageTitle}</title>
<meta name="description" content={description} />

<meta property="og:title" content={pageTitle} />
<meta
property="og:description"
content={parsedQuery ? `Search results for keyword: '${parsedQuery}'` : description}
/>
<meta property="og:description" content={finalDescription} />
<meta property="og:site_name" content={site.title} />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://reactnative.directory" />
<meta property="og:image" content={socialImage} />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="669" />

<meta name="twitter:title" content={pageTitle} />
<meta name="twitter:description" content={finalDescription} />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:image" content={socialImage} />

Expand Down
1 change: 0 additions & 1 deletion components/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ const styles = StyleSheet.create({
fontSize: 20,
color: colors.white,
fontFamily: 'inherit',
// @ts-ignore
outlineOffset: -2,
},
searchIcon: {
Expand Down
19 changes: 9 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,31 @@
"dependencies": {
"@expo/html-elements": "^0.12.1",
"@expo/match-media": "^0.4.0",
"@jlengstorf/get-share-image": "^1.0.2",
"@radix-ui/react-hover-card": "^1.1.6",
"@radix-ui/react-tooltip": "^1.1.8",
"@radix-ui/react-hover-card": "^1.1.7",
"@radix-ui/react-tooltip": "^1.2.0",
"@react-native-async-storage/async-storage": "^2.1.2",
"@react-native-picker/picker": "^2.11.0",
"@sentry/react": "^8.46.0",
"@vercel/blob": "^0.27.3",
"expo": "^53.0.0-preview.3",
"expo-font": "~13.1.1",
"expo": "^53.0.0-preview.9",
"expo-font": "~13.2.1",
"lodash": "^4.17.21",
"next": "^15.2.4",
"next": "^15.3.1",
"node-emoji": "^2.2.0",
"react": "^18.3.1",
"react-content-loader": "^7.0.2",
"react-dom": "^18.3.1",
"react-easy-linkify": "^1.0.8",
"react-native": "0.79.0",
"react-native-safe-area-context": "^5.3.0",
"react-native": "0.79.1",
"react-native-safe-area-context": "^5.4.0",
"react-native-svg": "^15.11.2",
"react-native-web": "^0.20.0",
"react-native-web-hooks": "^3.0.2",
"use-debounce": "^10.0.4"
},
"devDependencies": {
"@expo/next-adapter": "^6.0.0",
"@next/bundle-analyzer": "^15.2.4",
"@next/bundle-analyzer": "^15.3.1",
"@types/bun": "^1.2.9",
"@types/lodash": "^4.17.16",
"@types/react": "^18.3.12",
Expand All @@ -54,7 +53,7 @@
"cross-fetch": "^4.1.0",
"dotenv": "^16.4.7",
"eslint": "^8.57.0",
"eslint-config-next": "^15.2.4",
"eslint-config-next": "^15.3.1",
"eslint-config-universe": "^14.2.0",
"lint-staged": "^15.5.0",
"next-compose-plugins": "^2.2.1",
Expand Down
6 changes: 4 additions & 2 deletions react-native-libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -12548,7 +12548,9 @@
"images": [
"https://raw.githubusercontent.com/tamagui/tamagui/master/code/tamagui.dev/public/social.png"
],
"android": true
"android": true,
"ios": true,
"web": true
},
{
"githubUrl": "https://github.com/EdgarJMesquita/react-native-webp-converter",
Expand Down Expand Up @@ -14252,7 +14254,7 @@
"ios": true,
"android": true
},
{
{
"githubUrl": "https://github.com/i18next/i18next",
"npmPkg": "i18next",
"examples": ["https://github.com/i18next/i18next/tree/master/examples/typescript"],
Expand Down
22 changes: 14 additions & 8 deletions scripts/build-and-score-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ import chunk from 'lodash/chunk';
import fs from 'node:fs';
import path from 'node:path';

import debugGithubRepos from '~/debug-github-repos.json';
import githubRepos from '~/react-native-libraries.json';
import { Library } from '~/types';
import { isLaterThan, TimeRange } from '~/util/datetime';
import { isEmptyOrNull } from '~/util/strings';

import { calculateDirectoryScore, calculatePopularityScore } from './calculate-score';
import { fetchGithubData, fetchGithubRateLimit, loadGitHubLicenses } from './fetch-github-data';
import { fetchNpmData, fetchNpmDataBulk } from './fetch-npm-data';
import fetchReadmeImages from './fetch-readme-images';
import { fillNpmName, hasMismatchedPackageData, sleep } from './helpers';
import debugGithubRepos from '../debug-github-repos.json';
import githubRepos from '../react-native-libraries.json';
import { Library } from '../types';
import { isLaterThan, TimeRange } from '../util/datetime';
import { isEmptyOrNull } from '../util/strings';

// Uses debug-github-repos.json instead, so we have less repositories to crunch
// each time we run the script
Expand Down Expand Up @@ -91,7 +92,7 @@ async function buildAndScoreData() {
data.map(async project => {
if (!project.template) {
if (project.npmPkg.startsWith('@')) {
await sleep(Math.max(Math.random() * 2500));
await sleep(Math.random() * 10000);
return fetchNpmData(project);
} else {
bulkList.push(project.npmPkg);
Expand Down Expand Up @@ -214,7 +215,11 @@ async function buildAndScoreData() {
const existingData = libraries.map(lib => lib.npmPkg);
const newData = data.map(lib => lib.npmPkg);
const missingData = existingData.filter(npmPkg => !newData.includes(npmPkg));
const currentData = [...libraries.filter(lib => missingData.includes(lib.npmPkg)), ...data];

const existingPackages = DATASET.map(fillNpmName).map(lib => lib.npmPkg);
const dataToFill = missingData.filter(npmPkg => !existingPackages.includes(npmPkg));

const currentData = [...libraries.filter(lib => dataToFill.includes(lib.npmPkg)), ...data];

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

fileContent = JSON.stringify(
{
libraries: dataWithFallback,
libraries: finalData,
topics: topicCounts,
topicsList: Object.keys(topicCounts).sort(),
},
Expand Down